Export experiment spans

Exports experiment spans to CSV/Excel format. The export is processed asynchronously and a download link is sent to your email. ## Authentication - API key: `Authorization: Bearer ` ## Path Parameters - `experiment_id` *string* **required**: The ID of the experiment to export spans from. ## Query Parameters - `export` *string* **required**: Set to `1` or `true` to trigger export. - `page` *integer* **required**: Page number (default: 1). - `page_size` *integer* **required**: Number of results per page (default: 100). - `sort_by` *string* **required**: Sort field (e.g., "-cost", "-start_time", "name"). - `start_time` *string* **required**: Filter start time (ISO format). - `end_time` *string* **required**: Filter end time (ISO format). ## POST Request Body (Optional) For advanced filtering, you can send a POST request with filters in the body: ```json Request { "filters": [ { "field": "status", "operator": "=", "value": "completed" }, { "field": "comparison_key", "operator": "in", "value": ["key1", "key2"] } ] } ``` ## Examples ```python Python experiment_id = "experiment_id_123" url = f"https://api.respan.ai/api/v2/experiments/{experiment_id}/logs/" headers = { "Authorization": "Bearer YOUR_API_KEY" } # GET request with export parameter params = { "export": "1", "start_time": "2025-01-01T00:00:00Z", "end_time": "2025-01-31T23:59:59Z" } response = requests.get(url, headers=headers, params=params) print(response.json()) ``` ```bash cURL curl -X GET "https://api.respan.ai/api/v2/experiments/{experiment_id}/logs/?export=1&start_time=2025-01-01T00:00:00Z&end_time=2025-01-31T23:59:59Z" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ## Response ```json 202 Accepted { "message": "Exporting experiment logs. Check your email for the download link." } ``` **Export Features:** - Supports all filtering options (query params and POST body filters) - Includes all trace data: input, output, metrics, metadata - Async processing for large datasets - Email notification with download link - CSV and Excel format options **Notes:** - Export is processed asynchronously - You will receive an email with the download link when the export is ready - Large datasets may take several minutes to process - All standard filtering parameters are supported

Authentication

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

Path parameters

experiment_idstringRequired
The ID of the experiment to export spans from.

Query parameters

exportstringRequired
Set to 1 or true to trigger export.
pageintegerRequired

Page number (default: 1).

page_sizeintegerRequired

Number of results per page (default: 100).

sort_bystringRequired

Sort field (e.g., “-cost”, “-start_time”, “name”).

start_timestringRequired

Filter start time (ISO format).

end_timestringRequired

Filter end time (ISO format).

Response

Successful response for Export experiment spans
countinteger
Total number of results
resultslist of objects
Array of results for the current page
nextstring or null
URL for the next page of results
previousstring or null
URL for the previous page of results

Errors

401
Unauthorized Error