Bulk create spans

Creates multiple span entries in a single request. Useful for batch imports and CSV upload workflows. - Up to **500** spans per request - Per-row error handling (partial failures do not abort the batch) - `logs` *array* **required**: Array of span objects (max 500). Each follows the same schema as the [Create span](/api-reference/observe/logs/create-span) endpoint. ```Python Python import requests url = "https://api.respan.ai/api/request-logs/bulk/" api_key = "YOUR_RESPAN_API_KEY" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "logs": [ { "model": "gpt-4o", "prompt_messages": [{"role": "user", "content": "What is 2+2?"}], "completion_message": {"role": "assistant", "content": "4"}, "usage": {"prompt_tokens": 10, "completion_tokens": 1} }, { "model": "gpt-4o", "prompt_messages": [{"role": "user", "content": "Summarize this."}], "completion_message": {"role": "assistant", "content": "The document discusses..."}, "usage": {"prompt_tokens": 150, "completion_tokens": 50} } ] } response = requests.post(url, headers=headers, json=data) print(response.json()) ``` ```TypeScript TypeScript fetch('https://api.respan.ai/api/request-logs/bulk/', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_RESPAN_API_KEY' }, body: JSON.stringify({ logs: [ { model: "gpt-4o", prompt_messages: [{role: "user", content: "What is 2+2?"}], completion_message: {role: "assistant", content: "4"}, usage: {prompt_tokens: 10, completion_tokens: 1} }, { model: "gpt-4o", prompt_messages: [{role: "user", content: "Summarize this."}], completion_message: {role: "assistant", content: "The document discusses..."}, usage: {prompt_tokens: 150, completion_tokens: 50} } ] }) }) .then(response => response.json()) .then(data => console.log(data)); ```

Authentication

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

Request

This endpoint expects an object.
logslist of objectsRequired

Array of span objects (max 500). Each follows the same schema as the Create span endpoint.

Response

Spans created (may include partial failures)

success_countinteger
Number of successfully created spans
error_countinteger
Number of failed spans
errorslist of objects

Error details: [{index, error}]

Errors

401
Unauthorized Error
422
Unprocessable Entity Error