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

# Create a Dataset

POST https://api.prolific.com/api/v1/data-collection/datasets
Content-Type: application/json

Create a new Task Builder dataset.

Pass an optional `schema` to create a **V4 dataset** with a structured schema. V4 datasets accept JSONL and CSV uploads, track each upload as an import job, and allow `dataset_field` items in `batch_items` to reference named schema fields. Without a `schema`, a V3 dataset is created (CSV/ZIP only, legacy flow).

V4 dataset creation requires the feature to be enabled for the workspace.

Reference: https://docs.prolific.com/api-reference/task-builder/create-task-builder-dataset

## Authentication

- `Authorization` header (required) (prefixed with ` Token  `) — The Prolific API uses API token to authenticate requests. You can create an API token directly from your settings. Your API token does not have an expiry date and carries full permission, so be sure to keep them secure. If your token is leaked, delete it and create a new one directly in the app. In your requests add `Authorization` header with the value `Token <your token>`.

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, required) — The name or identifier of the Task Builder dataset.
- `workspace_id` (string, required) — The ID of the Prolific workspace the dataset will be created in.
- `schema` (DatasetSchema, optional) — Optional schema definition. When provided, a V4 dataset is created. Omit for a V3 dataset.

## Response

### 201

Created

- `id` (string, required)
- `name` (string, required)
- `created_at` (datetime, required)
- `created_by` (string, required)
- `workspace_id` (string, required)
- `total_datapoint_count` (integer, required)
- `schema_version` (enum, required) — Internal dataset version. 3 = legacy CSV/ZIP; 4 = structured schema with JSONL/CSV import tracking.
  - Allowed values: `3`, `4`
- `status` (enum, optional) — Processing status. **V3 datasets only.** V4 datasets track status per import job via `imports`.
  - Allowed values: `ERROR`, `PROCESSING`, `READY`, `UNINITIALISED`
- `filename` (string, optional, nullable) — Filename of the uploaded data file. **V3 datasets only.**
- `has_predetermined_grouping_id` (boolean, optional, nullable) — Whether the dataset contains a `META_TASK_GROUP_ID` column. **V3 datasets only.**
- `schema` (DatasetSchema, optional, nullable) — The researcher-defined field schema for this dataset. **V4 datasets only.** `null` if no schema has been set yet.
- `imports` (list of DatasetImportJob, optional, nullable) — Import jobs for this dataset, most recent first. **V4 datasets only.** `null` for V3 datasets.

## Errors

### 400 Client Request Error

Error

- `error` (ErrorDetail, required)

## Types

### DatasetSchema

A researcher-defined schema that specifies the fields in a V4 dataset. Each field has a type that determines how it is rendered to participants and how it can be referenced in `batch_items`. Constraints: - Maximum 200 fields per schema. - Field keys: 1–128 characters. - Field labels: maximum 255 characters.

- `strict` (boolean, required) — When `true`, records that are missing any field defined in the schema are rejected during import. When `false`, missing fields are allowed and treated as absent.
- `fields` (map from string to DatasetSchemaField, required) — A map of field key to field descriptor. The key is used to reference the field in `batch_items` (`dataset_field` items) and in JSONL records.

### DatasetImportJob

Tracks the lifecycle of a single file upload to a V4 dataset. An import job is created when `GET /datasets/{dataset_id}/upload-url/{filename}` is called. It transitions through the following statuses: | Status | Meaning | | ---------------- | -------------------------------------------------------- | | `uninitialised` | Import job created; file not yet uploaded to S3 | | `queued` | File uploaded; queued for extraction | | `processing` | Extraction in progress | | `complete` | All records accepted | | `partial` | Some records accepted, some rejected — see `errors` | | `failed` | Extraction failed entirely — see `reason` | | `pending_schema` | Dataset has no schema; upload paused until schema is set | Poll `GET /datasets/{dataset_id}/imports/{import_id}` until a terminal status is reached (`complete`, `partial`, `failed`, or `pending_schema`).

- `dataset_id` (string, required) — The dataset this import job belongs to.
- `import_id` (string, required) — The unique identifier of the import job.
- `type` (enum, required) — The type of import. Currently always `file_upload`.
  - Allowed values: `file_upload`
- `created_at` (datetime, required) — When the import job was created (ISO 8601, UTC).
- `updated_at` (datetime, required) — When the import job was last updated (ISO 8601, UTC).
- `status` (enum, required) — Current status of the import job.
  - Allowed values: `uninitialised`, `queued`, `processing`, `complete`, `partial`, `failed`, `pending_schema`
- `filename` (string, optional, nullable) — The original filename supplied when the upload URL was requested.
- `accepted_count` (integer, optional) — Number of records successfully ingested. Present when status is `complete` or `partial`.
- `rejected_count` (integer, optional) — Number of records rejected. Present when status is `partial`.
- `errors` (list of ImportJobError, optional) — Record-level validation errors. Present when status is `partial`.
- `reason` (string, optional) — Human-readable reason for failure. Present when status is `failed`.

### ErrorDetail

- `status` (integer, required) — Status code as in the http standards
- `error_code` (integer, required) — Internal error code
- `title` (string, required) — Error title
- `detail` (ErrorDetailDetail, required) — Error detail
- `additional_information` (string, optional) — Optional extra information
- `traceback` (string, optional) — Optional debug information
- `interactive` (boolean, optional)

### DatasetSchemaField

Descriptor for a single field in a dataset schema.

- `type` (enum, required) — Field type: - `text` — a text value shown to participants. Can be referenced by `dataset_field` items in `batch_items`. - `image_url` — a URL pointing to an image shown to participants. Can be referenced by `dataset_field` items in `batch_items`. - `audio_url` — a URL pointing to an audio file shown to participants in Prolific's audio player. Audio must be externally hosted using a direct-file HTTPS URL. Supported formats are `.mp3`, `.wav`, `.aac`, and `.m4a`. - `video_url` — a URL pointing to a video file shown to participants in Prolific's video player. Video must be externally hosted using a direct-file HTTPS URL. Supported formats are `.mp4`, `.mov`, `.webm`, and `.m4v`. If your task could benefit from participants citing specific frame numbers, you can turn on frame controls by supplying a `frame_rate` attribute for the video (see `attributes`). - `metadata` — an internal value included in exports but not shown to participants (equivalent to the `META_` prefix in V3 CSV datasets). - `task_group_id` — groups datapoints into task groups. Rows with the same `task_group_id` value are assigned to the same participant. Equivalent to `META_TASK_GROUP_ID` in V3 CSV datasets. At most one field per schema may have this type.
  - Allowed values: `text`, `image_url`, `audio_url`, `video_url`, `metadata`, `task_group_id`
- `label` (string, optional) — Optional human-readable label for the field, used in the participant interface.
- `attributes` (map from string to string, optional) — Optional. Binds named attributes of this field to `metadata` fields in the same schema, so a value can be supplied per row. Each key is an attribute name and each value is the key of a `metadata` field in this schema that holds that attribute's value for every row. Supported attributes: - `frame_rate` (`video_url` fields only) — the frame rate of each row's video, in frames per second (1 to 480; fractional rates such as 29.97 are allowed). A video with a frame rate gets frame controls in the participant's video player. There is no layout setting for frame controls and no default frame rate: a video without one has no frame controls. A missing or blank value in a row is accepted; an invalid value rejects the row at import. An unsupported attribute name, an attribute on a field type that does not support it, or a value that is not a declared `metadata` field is rejected with `400`.

### ImportJobError

A record-level validation error from a partial import.

- `record_index` (integer, optional, nullable) — Zero-based index of the rejected record in the uploaded file.
- `field` (string, optional, nullable) — The schema field key that caused the rejection, or `null` if no specific field is implicated. The special value `_raw` indicates a whole-record parse failure (e.g. malformed JSON) rather than a field-level error.
- `reason` (string, optional, nullable) — Human-readable description of why the record was rejected.

### ErrorDetailDetail

Error detail

- string
- list of string
- ErrorDetailDetail2

### ErrorDetailDetail2

All fields with validation errors

- `any_field` (list of string, optional) — Name of the field with a validation error and as a value an array with the error descriptions

## Examples

**Request**

```json
{
  "name": "Text Dataset",
  "workspace_id": "6278acb09062db3b35bcbeb0"
}
```

**Response**

```json
{
  "id": "string",
  "name": "Text Dataset",
  "created_at": "2024-01-15T09:30:00Z",
  "created_by": "65786062db3b35bcbeb07bcc",
  "workspace_id": "6278acb09062db3b35bcbeb0",
  "total_datapoint_count": 1,
  "schema_version": 3,
  "status": "ERROR",
  "filename": "string",
  "has_predetermined_grouping_id": true,
  "schema": {
    "strict": true,
    "fields": {}
  },
  "imports": [
    {
      "dataset_id": "string",
      "import_id": "string",
      "type": "file_upload",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "status": "uninitialised",
      "filename": "string",
      "accepted_count": 1,
      "rejected_count": 1,
      "errors": [
        {
          "record_index": 1,
          "field": "string",
          "reason": "string"
        }
      ],
      "reason": "string"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.prolific.com/api/v1/data-collection/datasets"

payload = {
    "name": "Text Dataset",
    "workspace_id": "6278acb09062db3b35bcbeb0"
}
headers = {
    "Authorization": "Token <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.prolific.com/api/v1/data-collection/datasets';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Text Dataset","workspace_id":"6278acb09062db3b35bcbeb0"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.prolific.com/api/v1/data-collection/datasets"

	payload := strings.NewReader("{\n  \"name\": \"Text Dataset\",\n  \"workspace_id\": \"6278acb09062db3b35bcbeb0\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Token <token>")
	req.Header.Add("Content-Type", "application/json")

	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.prolific.com/api/v1/data-collection/datasets")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Text Dataset\",\n  \"workspace_id\": \"6278acb09062db3b35bcbeb0\"\n}"

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.post("https://api.prolific.com/api/v1/data-collection/datasets")
  .header("Authorization", "Token <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Text Dataset\",\n  \"workspace_id\": \"6278acb09062db3b35bcbeb0\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.prolific.com/api/v1/data-collection/datasets', [
  'body' => '{
  "name": "Text Dataset",
  "workspace_id": "6278acb09062db3b35bcbeb0"
}',
  'headers' => [
    'Authorization' => 'Token <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.prolific.com/api/v1/data-collection/datasets");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Text Dataset\",\n  \"workspace_id\": \"6278acb09062db3b35bcbeb0\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Token <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Text Dataset",
  "workspace_id": "6278acb09062db3b35bcbeb0"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/datasets")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```