Create dataset

Creates a new dataset, either populated with existing spans or empty for manual population. You can specify filters and sampling rate to select which spans to include, or create an empty dataset to add spans manually later. ## Authentication All endpoints require API key authentication: ```bash Authorization: Bearer YOUR_API_KEY ``` ## Parameters - `name` *string* **required**: The name of the dataset. - `description` *string*: A description of the dataset. - `sampling` *integer*: Percentage of spans to include (0-100). - `start_time` *string*: ISO 8601 timestamp for span filtering. Required when `is_empty` is false or not provided. Ignored when `is_empty` is true. - `end_time` *string*: ISO 8601 timestamp for span filtering. Required when `is_empty` is false or not provided. Ignored when `is_empty` is true. - `is_empty` *boolean*: Create empty dataset. When `true`, `start_time` and `end_time` are ignored. - `initial_log_filters` *object*: Filters to apply to select spans for the dataset. **Example** ```json { "id": { "operator": "in", "value": ["log_id_1", "log_id_2"] } } ``` ## Request Examples ```python Python - Populated Dataset url = "https://api.respan.ai/api/datasets/" payload = json.dumps({ "name": "Support Conversations - July", "description": "Sampled support chats for July", "sampling": 40, "start_time": "2025-07-01T00:00:00Z", "end_time": "2025-07-31T23:59:59Z", "initial_log_filters": { "status_code": { "operator": "eq", "value": 200 } } }) headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` ```python Python - Empty Dataset url = "https://api.respan.ai/api/datasets/" payload = json.dumps({ "name": "Custom Workflow Logs", "description": "Manually curated logs for workflow analysis", "is_empty": true }) headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` ## Response ```json 201 Created - Populated Dataset { "id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a", "name": "Support Conversations - July", "description": "Sampled support chats for July", "type": "sampling", "status": "ready", "log_count": 250, "created_at": "2025-07-26T00:00:00Z" } ``` ```json 201 Created - Empty Dataset { "id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a", "name": "Custom Workflow Logs", "description": "Manually curated logs for workflow analysis", "type": "sampling", "status": "ready", "log_count": 0, "created_at": "2025-12-09T10:00:00Z" } ```

Authentication

AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys

Request

This endpoint expects an object.
namestringRequired
The name of the dataset.
descriptionstringOptional
A description of the dataset.
samplingintegerOptionalDefaults to 100

Percentage of spans to include (0-100).

start_timestringOptional

ISO 8601 timestamp for span filtering. Required when is_empty is false or not provided. Ignored when is_empty is true.

end_timestringOptional

ISO 8601 timestamp for span filtering. Required when is_empty is false or not provided. Ignored when is_empty is true.

is_emptybooleanOptional

Create empty dataset. When true, start_time and end_time are ignored.

initial_log_filtersobjectOptional
Filters to apply to select spans for the dataset.

Response

Successful response for Create dataset
idobject

Errors

401
Unauthorized Error