---
title: "Create a dataset"
method: POST
path: "/v2/datasets"
tags: ["Datasets"]
---

# Create a dataset

`POST /v2/datasets`

Create a new dataset with JSON examples. Empty datasets are not allowed.

**Payload Requirements**
- The dataset name must be unique within the given space.
- Each item in `examples[]` may contain **any user-defined fields**.
- Do not include system-managed fields on input: `id`, `created_at`, `updated_at`.
Requests that contain these fields in any example **will be rejected**.
- Each example **must contain at least one property** (i.e., `{}` is invalid).

**Valid example** (create)
```json
{
  "name": "my-dataset",
  "space_id": "spc_123",
  "examples": [
    {
      "question": "What is 2+2?",
      "answer": "4",
      "topic": "math"
    },
    {
      "question": "What is the capital of Spain?",
      "answer": "Madrid",
      "topic": "geography"
    },
  ]
}
```

**Invalid example** ('id' not allowed on create)
```json
{
  "name": "my-dataset",
  "space_id": "spc_123",
  "examples": [
    {
      "id": "ex_1",
      "input": "Hello"
    }
  ]
}
```

<Note>This endpoint is in beta, read more [here](https://arize.com/docs/ax/rest-reference#api-version-stages).</Note>

## Request body

- CreateDatasetRequest — Dataset creation parameters.
  - `name` string, required — Name of the new dataset. Must be unique within the space.
  - `space_id` string, required — ID of the space the dataset will belong to
  - `examples` CreateDatasetExampleInput[], required — Array of examples for the new dataset

## Response `201`

A dataset object

- Dataset — A dataset is a structured collection of examples used to test and evaluate LLM applications. Datasets allow you to test models consistently across any real-world scenarios and edge cases, quickly identify regressions, and track measurable improvements.
  - `id` string, required — Unique identifier for the dataset
  - `name` string, required — Name of the dataset
  - `space_id` string, required — Unique identifier for the space this dataset belongs to
  - `created_at` string, date-time, required — Timestamp for when the dataset was created
  - `updated_at` string, date-time, required — Timestamp for the last update of the dataset
  - `versions` DatasetVersion[] — List of versions associated with this dataset
    - `id` string, required — Unique identifier for the dataset version
    - `name` string, required — Name of the dataset version
    - `dataset_id` string, required — Unique identifier for the dataset this version belongs to
    - `created_at` string, date-time, required — Timestamp for when the dataset version was created
    - `updated_at` string, date-time, required — Timestamp for the last update of the dataset version

## Other responses

- `400` — Invalid request
- `401` — Authentication is required
- `403` — Insufficient permissions to access this resource
- `404` — Not found
- `409` — Resource conflict
- `422` — Unprocessable entity

---

[API](https://skmtc.net/arize-ai/apis/arize-rest-api.md) · [All operations](https://skmtc.net/arize-ai/apis/arize-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/arize-ai/arize-rest-api/versions/1e87d8a4cf69/schema)
