Spans

List span groups with filters

Changed on

Group spans using the same query parameters as GET and optional standard Respan filters in the request body.

post/api/request-logs/groups/

Request

  • Base URL
    https://api.respan.ai
  • URL
    https://api.respan.ai/api/request-logs/groups/
  • Auth
    • HTTP bearer
    • or HTTP bearer

Query parameters

group_by'model' | 'provider_id' | 'organization_key_id' | 'prompt_id' | 'deployment_id' | 'deployment_name' | 'custom_identifier' | 'customer_identifier' | 'trace' | 'thread'

Grouping dimension. trace and thread use entity rollups.

sort_bystring
start_timestring date-time
end_timestring date-time
environmentstring
pageinteger
page_sizeinteger

Request body

filtersobject

Narrows what's grouped.

Each key is a field to filter on, and each value is a condition: {"<field>": {"operator": "<operator>", "value": [...]}}. Each span, trace or thread 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 depend on group_by:

  • trace: trace fields such as total_cost, error_count, span_count, customer_identifier and metadata__<key>, plus span fields such as model, which match a trace when any of its spans matches.
  • thread: thread fields such as thread_identifier, customer_identifier, number_of_requests, total_cost and total_tokens.
  • Any other value: span columns, such as model, provider_id, deployment_name, customer_identifier, custom_identifier, organization_key_id, prompt_id, log_type, status_code, cost, latency, prompt_tokens, completion_tokens and total_request_tokens, plus metadata__<key> (values are strings). Aliases such as total_tokens don't work.

Example:

{
  "status_code": {"operator": "not", "value": [200]},
  "metadata__plan": {"operator": "", "value": ["pro"]}
}

Response

Paginated groups and aggregate metrics.

countinteger required

Number of results on this page, not the total. Request pages until next is null to get every result.

nextstring nullable
previousstring nullable
current_filtersobject
filters_dataobject

Changes

    • breaking

      the response property became nullable for the status

    • breaking

      the response property became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • breaking

      the // response's property type changed from number null to number, and format from double to no format for status

    • info

      api operation id spans_request_logs_groups_filter removed and replaced with request_logs_groups_filter

    • info

      the endpoint scheme security DashboardJwt was added to the API

    • info

      api tag Spans added

    • info

      api tag spans removed

    • warning

      removed the optional property from the response with the status

    • info

      removed the non-success response with the status

    • info

      the response property became required for the status