Retrieve span

The Get Span endpoint allows you to retrieve complete information about a specific span by its unique ID, including: - Full input/output content (`input` and `output` fields) - Type-specific fields extracted based on `log_type` - Credit and budget check results (`limit_info`) - Evaluation scores - Complete request/response metadata ## Response fields Each span in the response includes: ### Universal fields (All Span Types) - **`input`** (string): JSON-serialized representation of the span's input data - **`output`** (string): JSON-serialized representation of the span's output data - **`log_type`** (string): Type of span (`"chat"`, `"embedding"`, `"workflow"`, etc.) <Note> ### Legacy compatibility For `log_type="chat"`, `"completion"`, `"text"`, or `"response"`: - **`prompt_messages`** (array): Full input messages array (extracted from `input`) - **`completion_message`** (object): Full output message object (extracted from `output`) For other span types (embedding, workflow, etc.), type-specific fields are extracted based on the `log_type`. See [span types](/documentation/resources/reference/data-model#log-types) for details. </Note> <Note> You should first get the span list, and based on the unique_id in the list, retrieve the specific span. Learn more about the [span list endpoint](/api-reference/observe/logs/list-spans). </Note> ## Credit and Budget Information Every span includes credit and budget check information in the `respan_params.limit_info` field (available in the detail endpoint only). ### What is `limit_info`? When you make an LLM request, Respan checks: 1. **Organization Credits**: Your organization's remaining credit balance 2. **Customer Budgets**: Per-customer spending limits (if configured) The `limit_info` object shows the results of these checks. ### Structure ```json { "limit_info": { "is_allowed": true, "limits": [ { "name": "org_credits", "current_value": 29.99, "new_value": 29.98, "limit_value": 0.0, "is_within_limit": true }, { "name": "customer_budget", "current_value": 8.50, "new_value": 8.49, "limit_value": 10.0, "is_within_limit": true } ] } } ``` ### Fields Explained - **`is_allowed`**: Whether the request was allowed to proceed (all limits passed) - **`limits`**: Array of individual limit check results - **`name`**: Type of limit - `"org_credits"` or `"customer_budget"` - **`current_value`**: Balance before this request (USD) - **`new_value`**: Balance after this request (USD) - **`limit_value`**: Minimum required balance (USD) - **`is_within_limit`**: Whether this specific check passed ### Use Cases - **Monitor spending**: Track credit usage per request - **Debug rejections**: Understand why a request was blocked - **Customer analytics**: Analyze per-customer spending patterns - **Budget alerts**: Build custom alerts when approaching limits **Example: Request Allowed** ```json { "is_allowed": true, "limits": [ { "name": "org_credits", "current_value": 50.00, "new_value": 49.98, "limit_value": 0.0, "is_within_limit": true } ] } ``` *Request succeeded. Organization had $50 in credits, now has $49.98 after this $0.02 request.* **Example: Request Blocked** ```json { "is_allowed": false, "limits": [ { "name": "customer_budget", "current_value": 9.99, "new_value": 9.99, "limit_value": 10.0, "is_within_limit": false } ] } ``` *Request blocked. Customer has used $9.99 of their $10 budget, not enough for this request.* ## Path parameters - `unique_id` *string* **required**: The unique ID of the log to get. ```python url = "https://api.respan.ai/api/request-logs/{{unique_id}}/" payload = "" headers = { 'Authorization': 'Bearer {{your_api_key}}' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) ```

Authentication

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

Path parameters

unique_idstringRequired
The unique ID of the log to get.

Response

Successful response for Retrieve span
limit_infoobject

Errors

401
Unauthorized Error