> This page is for version v4.0.
> For other versions, use one of these documentation indexes:
> - v5.0 (default): https://humanloop.com/docs/v5/llms.txt
> - v4.0: https://humanloop.com/docs/v4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/docs/_mcp/server.

# List For Project

GET https://api.humanloop.com/v4/projects/{project_id}/datasets

Get all datasets for a project.

Reference: https://humanloop.com/docs/v4/api/projects/list-datasets

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `project_id` (string, required)

## Response

### 200

Successful Response

- `list of DatasetResponse`

## Errors

### 422 Projects List Datasets Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### DatasetResponse

- `id` (string, required)
- `name` (string, required)
- `datapoint_count` (integer, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `project_id` (string, required, deprecated) — Datasets are now files and do not belong to projects. If this dataset was created before that change, the legacy project ID will be provided here, otherwise an empty string will be returned.
- `description` (string, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**Response**

```json
[
  {
    "id": "id",
    "name": "name",
    "datapoint_count": 1,
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "project_id": "project_id",
    "description": "description"
  }
]
```

**SDK Code**

```python
import requests

url = "https://api.humanloop.com/v4/projects/project_id/datasets"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.humanloop.com/v4/projects/project_id/datasets';
const options = {method: 'GET', headers: {'X-API-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.humanloop.com/v4/projects/project_id/datasets"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.humanloop.com/v4/projects/project_id/datasets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.humanloop.com/v4/projects/project_id/datasets")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.humanloop.com/v4/projects/project_id/datasets', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v4/projects/project_id/datasets");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v4/projects/project_id/datasets")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```