Skip to Content

List span groups

GEThttps://api.respan.ai/api/request-logs/groups/

Group spans by a supported dimension and return one aggregate row per group. trace and thread roll spans up through their dedicated entity views.

Servers

https://api.respan.ai: Respan API Server

Authentication

RespanApiKey

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.

HTTP scheme: bearer; format: Respan API key.

HTTP
Authorization: Bearer $RESPAN_API_KEY

Or:

DashboardJwt

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

HTTP scheme: bearer; format: Dashboard JWT.

HTTP
Authorization: Bearer $RESPAN_DASHBOARD_JWT

Query parameters

Parameter Type Required Description and constraints
group_by string Optional
Grouping dimension. trace and thread use entity rollups.
Allowed: "model", "provider_id", "organization_key_id", "prompt_id", "deployment_id", "deployment_name", "custom_identifier", "customer_identifier", "trace", "thread"
Default: model
sort_by string Optional
Default: number_of_requests
start_time string Optional
Format: date-time
end_time string Optional
Format: date-time
environment string Optional
-
page integer Optional
Minimum: 1
page_size integer Optional
Minimum: 1
Maximum: 1000

Responses

200

Paginated groups and aggregate metrics.

application/json

Field Type Requirement Description and constraints
$ object Body
-
count integer Required in parent
Number of results on this page, not the total. Request pages until next is null to get every result.
next string or null Optional
-
previous string or null Optional
-
current_filters object Optional
Additional properties are allowed
filters_data object Optional
Additional properties are allowed
results array<object> Required in parent
-
results[] object Array item
Aggregated metrics plus the selected group key. Trace and thread groups include their richer entity fields.
Additional properties are allowed
results[].date_group string Optional
Format: date-time
results[].model string Optional
-
results[].provider_id string Optional
-
results[].organization_key_id string Optional
-
results[].prompt_id string Optional
-
results[].deployment_id string Optional
-
results[].deployment_name string Optional
-
results[].custom_identifier string Optional
-
results[].customer_identifier string Optional
-
results[].trace_unique_id string Optional
-
results[].thread_identifier string Optional
-
results[].number_of_requests integer or null Optional
-
results[].span_count integer or null Optional
-
results[].total_cost number or null Optional
-
results[].total_tokens integer or null Optional
-
results[].error_count integer or null Optional
-
results[].error_percentage number or null Optional
-
results[].average_cost number or null Optional
-
results[].average_tokens integer or null Optional
-
results[].average_latency number or null Optional
-
results[].average_ttft number or null Optional
-
results[].average_tps number or null Optional
-
results[].cache_hit_percentage number or null Optional
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "count",
    "results"
  ],
  "properties": {
    "count": {
      "type": "integer",
      "description": "Number of results on this page, not the total. Request pages until `next` is null to get every result."
    },
    "next": {
      "type": "string",
      "nullable": true
    },
    "previous": {
      "type": "string",
      "nullable": true
    },
    "current_filters": {
      "type": "object",
      "additionalProperties": true
    },
    "filters_data": {
      "type": "object",
      "additionalProperties": true
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Aggregated metrics plus the selected group key. Trace and thread groups include their richer entity fields.",
        "properties": {
          "date_group": {
            "type": "string",
            "format": "date-time"
          },
          "model": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "organization_key_id": {
            "type": "string"
          },
          "prompt_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "deployment_name": {
            "type": "string"
          },
          "custom_identifier": {
            "type": "string"
          },
          "customer_identifier": {
            "type": "string"
          },
          "trace_unique_id": {
            "type": "string"
          },
          "thread_identifier": {
            "type": "string"
          },
          "number_of_requests": {
            "type": "integer",
            "nullable": true
          },
          "span_count": {
            "type": "integer",
            "nullable": true
          },
          "total_cost": {
            "type": "number",
            "nullable": true
          },
          "total_tokens": {
            "type": "integer",
            "nullable": true
          },
          "error_count": {
            "type": "integer",
            "nullable": true
          },
          "error_percentage": {
            "type": "number",
            "nullable": true
          },
          "average_cost": {
            "type": "number",
            "nullable": true
          },
          "average_tokens": {
            "type": "integer",
            "nullable": true
          },
          "average_latency": {
            "type": "number",
            "nullable": true
          },
          "average_ttft": {
            "type": "number",
            "nullable": true
          },
          "average_tps": {
            "type": "number",
            "nullable": true
          },
          "cache_hit_percentage": {
            "type": "number",
            "nullable": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}

400

Unsupported group_by value. Invalid sort_by falls back to number_of_requests.

application/json

Field Type Requirement Description and constraints
$ object Body
-
error string Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
Example
JSON
{ "error": "Not supported group_by value" }

403

The API key is missing, invalid or expired, or it doesn’t grant analytics read access.

application/json

Field Type Requirement Description and constraints
$ object Body
-
detail string Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
JSON
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "tags": [
    "Spans"
  ],
  "parameters": [
    {
      "name": "group_by",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "enum": [
          "model",
          "provider_id",
          "organization_key_id",
          "prompt_id",
          "deployment_id",
          "deployment_name",
          "custom_identifier",
          "customer_identifier",
          "trace",
          "thread"
        ],
        "default": "model"
      },
      "description": "Grouping dimension. `trace` and `thread` use entity rollups."
    },
    {
      "name": "sort_by",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "default": "number_of_requests"
      }
    },
    {
      "name": "start_time",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date-time"
      }
    },
    {
      "name": "end_time",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "date-time"
      }
    },
    {
      "name": "environment",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      }
    },
    {
      "name": "page_size",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 1000
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Paginated groups and aggregate metrics.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "count",
              "results"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "description": "Number of results on this page, not the total. Request pages until `next` is null to get every result."
              },
              "next": {
                "type": "string",
                "nullable": true
              },
              "previous": {
                "type": "string",
                "nullable": true
              },
              "current_filters": {
                "type": "object",
                "additionalProperties": true
              },
              "filters_data": {
                "type": "object",
                "additionalProperties": true
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Aggregated metrics plus the selected group key. Trace and thread groups include their richer entity fields.",
                  "properties": {
                    "date_group": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "model": {
                      "type": "string"
                    },
                    "provider_id": {
                      "type": "string"
                    },
                    "organization_key_id": {
                      "type": "string"
                    },
                    "prompt_id": {
                      "type": "string"
                    },
                    "deployment_id": {
                      "type": "string"
                    },
                    "deployment_name": {
                      "type": "string"
                    },
                    "custom_identifier": {
                      "type": "string"
                    },
                    "customer_identifier": {
                      "type": "string"
                    },
                    "trace_unique_id": {
                      "type": "string"
                    },
                    "thread_identifier": {
                      "type": "string"
                    },
                    "number_of_requests": {
                      "type": "integer",
                      "nullable": true
                    },
                    "span_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "total_cost": {
                      "type": "number",
                      "nullable": true
                    },
                    "total_tokens": {
                      "type": "integer",
                      "nullable": true
                    },
                    "error_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "error_percentage": {
                      "type": "number",
                      "nullable": true
                    },
                    "average_cost": {
                      "type": "number",
                      "nullable": true
                    },
                    "average_tokens": {
                      "type": "integer",
                      "nullable": true
                    },
                    "average_latency": {
                      "type": "number",
                      "nullable": true
                    },
                    "average_ttft": {
                      "type": "number",
                      "nullable": true
                    },
                    "average_tps": {
                      "type": "number",
                      "nullable": true
                    },
                    "cache_hit_percentage": {
                      "type": "number",
                      "nullable": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Unsupported group_by value. Invalid sort_by falls back to number_of_requests.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "error"
            ],
            "properties": {
              "error": {
                "type": "string"
              }
            }
          },
          "example": {
            "error": "Not supported group_by value"
          }
        }
      }
    },
    "403": {
      "description": "The API key is missing, invalid or expired, or it doesn't grant analytics read access.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ],
  "summary": "List span groups",
  "operationId": "request_logs_groups_list",
  "description": "Group spans by a supported dimension and return one aggregate row per group. `trace` and `thread` roll spans up through their dedicated entity views."
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "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.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}