Add spans to dataset

Add existing spans from your span history to a dataset based on filter criteria. **Note:** This endpoint also supports the legacy endpoint `POST /evaluations/datasets/{dataset_id}/logs/` for backward compatibility. ## Authentication - API key: `Authorization: Bearer ` Request body: - start_time (string, required, ISO 8601) - end_time (string, required, ISO 8601) - filters (object, optional; key name is `filters`) - sampling_percentage (integer, optional, default 100) Request example: ```json { "start_time": "2025-07-01T00:00:00Z", "end_time": "2025-07-31T23:59:59Z", "filters": { "status_code": { "operator": "eq", "value": 200 } }, "sampling_percentage": 40 } ``` Response (200 OK): ```json { "message": "Logs are being added to dataset in the background" } ``` Errors: - 400 Bad Request — invalid/missing `start_time`/`end_time`, or exceeds plan limit - 404 Not Found — dataset not found or not in your organization

Authentication

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

Path parameters

dataset_idstringRequired
Dataset Id

Request

This endpoint expects an object.

Response

Successful response for Add spans to dataset
start_timestring
end_timestring
filtersobject
sampling_percentageinteger

Errors

401
Unauthorized Error