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

# Create a dataset

`POST /api/datasets/`

Create a new dataset from existing logs, create an empty dataset, or duplicate an existing dataset.

## Headers

- `Authorization` string, required

## Request body

- object
  - `name` string — Dataset name. Required unless `source_dataset_id` is provided.
  - `description` string — Dataset description.
  - `sampling` integer — Percent of matching logs to add (1-100).
  - `start_time` string, date-time — Start of the time range to sample logs from.
  - `end_time` string, date-time — End of the time range to sample logs from.
  - `is_empty` boolean — Create an empty dataset without importing logs.
  - `initial_log_filters` object — Platform-standard filters keyed by field name.
  - `source_dataset_id` string — Existing dataset ID to duplicate. Copies logs asynchronously.
  - `granularity` 'logs' | 'traces' — Evaluation unit. Immutable after dataset creation.

## Response `201`

Dataset created.

- DatasetsCreateDatasetResponse201
  - `id` string
  - `name` string
  - `description` string
  - `type` string
  - `status` 'initializing' | 'ready' | 'failed' | 'loading'
  - `initial_log_filters` object — Platform-standard filters keyed by field name.
  - `created_at` string, date-time
  - `updated_at` string, date-time
  - `granularity` 'logs' | 'traces' — Evaluation unit. Immutable after dataset creation.

## Other responses

- `400` — Invalid dataset request, time range, sampling, or processing limit.
- `401` — Unauthorized - Missing/invalid authentication
- `402` — The organization has reached its dataset plan limit.
- `404` — Source dataset not found.

## Changes

> 6 revisions in range; 3 could not be searched.

- **2026-07-31** `c26d550029f8` — 2 breaking, 5 warning, 14 info
  - added the new required request property `organization`
  - the request property `name` became required
  - added the new `dataset` enum value to the `type` response property for the response status `201`
  - added the new `human` enum value to the `type` response property for the response status `201`
  - …17 more

[Change history](https://skmtc.dev/keywordsai/apis/api-reference/changes/api/datasets/post.md)

---

[API](https://skmtc.dev/keywordsai/apis/api-reference.md) · [All operations](https://skmtc.dev/keywordsai/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/keywordsai/api-reference/revisions/c61efaf24756/schema)
