Get experiment spans summary

Retrieves aggregated summary statistics for experiment traces matching the current filters. This is useful for getting overview metrics without retrieving individual traces. ## Authentication - API key: `Authorization: Bearer ` ## Path Parameters - `experiment_id` *string* **required**: The ID of the experiment to get summary statistics for. ## Query Parameters - `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": "total_cost", "operator": ">=", "value": 0.01 } ] } ``` **Supported Filter Operators:** - `=` or `""`: Exact match - `!=` or `"not"`: Not equal - `>`, `>=`, `<`, `<=` or `"gt"`, `"gte"`, `"lt"`, `"lte"`: Numeric comparisons - `contains`: String contains (case-insensitive) - `startsWith`: String starts with - `endsWith`: String ends with - `in` or `IN`: Value in list - `not_in` or `NOT IN`: Value not in list <Note> For more filter operators and examples, see the [Filters API Reference](/api-reference/reference/filters-api-reference). </Note> ## Examples ```python Python experiment_id = "experiment_id_123" url = f"https://api.respan.ai/api/v2/experiments/{experiment_id}/logs/summary/" headers = { "Authorization": "Bearer YOUR_API_KEY" } # GET request response = requests.get(url, headers=headers) print(response.json()) # POST request with filtering data = { "filters": [ { "field": "status", "operator": "=", "value": "completed" } ] } response = requests.post(url, headers=headers, json=data) print(response.json()) ``` ```bash cURL # GET request curl -X GET "https://api.respan.ai/api/v2/experiments/{experiment_id}/logs/summary/" \ -H "Authorization: Bearer YOUR_API_KEY" # POST request with filtering curl -X POST "https://api.respan.ai/api/v2/experiments/{experiment_id}/logs/summary/" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "filters": [ { "field": "status", "operator": "=", "value": "completed" } ] }' ``` ## Response ```json 200 OK { "total_count": 150, "total_cost": 12.45, "total_tokens": 50000, "total_prompt_tokens": 30000, "total_completion_tokens": 20000, "avg_latency": 1.23 } ``` **Response Fields:** - `total_count`: Total number of traces matching filters - `total_cost`: Sum of all trace costs (in dollars) - `total_tokens`: Sum of all tokens (input + output) - `total_prompt_tokens`: Sum of all input tokens - `total_completion_tokens`: Sum of all output tokens - `avg_latency`: Average latency across all traces (in seconds) **Notes:** - Uses same filtering logic as list endpoint for consistency - Returns zeros if no traces match the filters - Supports both GET and POST methods (POST for advanced filtering) - Efficient aggregation without loading individual trace data

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 get summary statistics for.

Query parameters

start_timestringRequired

Filter start time (ISO format).

end_timestringRequired

Filter end time (ISO format).

Response

Successful response for Get experiment spans summary

Errors

401
Unauthorized Error