Skip to navigation

Get span summary

Returns aggregate span statistics for a time range. Send start_time, end_time, and environment as query parameters, and additional filters in the JSON body. Fields such as log_type are not read from query parameters. Empty or omitted filters may use pre-aggregated data; non-empty filters query individual spans using the List spans filter format.

Authentication

AuthorizationBearer

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

OR
AuthorizationBearer

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

Query parameters

start_timedatetimeOptional

Start of time range (ISO 8601).

end_timedatetimeOptional

End of time range (ISO 8601).

environmentenumOptional

Filter by environment (prod or test).

Allowed values:

Request

This endpoint expects an object.
filtersobjectOptional

Each key is a field to filter on, and each value is a condition: {"<field>": {"operator": "<operator>", "value": [...]}}. A span must match every condition. To set two conditions on one field, such as a range, pass a list of conditions.

Operators: "" (equals, the default), not, in, not_in, lt, lte, gt, gte, contains, not_contains, icontains (ignores case), startswith, not_startswith, endswith, not_endswith, empty, not_empty. Put values in a list: "" and in match any of the listed values, and not and not_in match none of them. Other operators take one value; for empty and not_empty, send [""].

Fields:

  • unique_id, trace_unique_id, span_unique_id, span_parent_id, span_name, span_workflow_name, thread_identifier, customer_identifier, customer_email, custom_identifier, group_identifier, evaluation_identifier, organization_key_id, prompt_id, prompt_name, prompt_version_number, model, provider_id, deployment_name, log_type, log_method, status, status_code, environment, error_class, error_code, error_message, error_fingerprint, cache_key, note
  • True or false: stream, has_tool_calls, cache_bit, used_custom_credential, positive_feedback
  • Numbers: cost, latency, time_to_first_token, tokens_per_second, routing_time, prompt_tokens, completion_tokens, total_request_tokens, prompt_cache_hit_tokens, prompt_cache_creation_tokens. The aliases total_cost, input_tokens, output_tokens and total_tokens also work, and so does trace_id for trace_unique_id.
  • metadata__<key>: a custom metadata value. Values are strings, and spans without the key never match, even with not.
  • scores__<evaluator_id>: an evaluator's numeric score, with "", not, in, not_in, lt, lte, gt or gte.
  • is_root_span ([true] or [false]), fault_domain (user, respan or provider), and behaviors (spans where the named behaviors fired, when span behaviors are on).

Unsupported fields return a 400 error.

Example:

{
  "customer_identifier": {"operator": "", "value": ["alex@acme.dev"]},
  "status_code": {"operator": "not", "value": [200]}
}

Response

Summary statistics for matching spans.
number_of_requestsinteger

Total number of matching spans/log rows.

total_costdouble

Total cost in USD for all matching spans/log rows.

total_tokensinteger

Total tokens across all matching spans/log rows.

total_prompt_tokensinteger

Total prompt/input tokens.

total_completion_tokensinteger

Total completion/output tokens.

avg_latencydouble
Average latency in seconds.
avg_tpsdouble
Average tokens per second.
avg_ttftdouble
Average time to first token in seconds.
scoresmap from strings to any
Aggregated score summaries grouped by evaluator ID.

Errors

400
Bad Request Error
403
Forbidden Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error