List batches

Retrieve a list of all batch jobs for your organization. Use this to monitor the status of multiple batches or find specific batch IDs. <Note> **Customer credentials required**: This endpoint requires your own OpenAI API key configured in Respan dashboard (Settings → Providers). </Note> ## Respan parameters You can pass Respan tracking parameters via the `X-Data-Respan-Params` header: ```bash -H "X-Data-Respan-Params: {\"customer_identifier\": \"user123\"}" ``` ## Query parameters - `limit` *integer*: Maximum number of batches to return. **Example** ``` ?limit=10 ``` - `after` *string*: Cursor for pagination. Use the `last_id` from a previous response to get the next page. **Example** ``` ?after=batch_def456 ``` ## Response Returns a list object containing batch metadata. ```json 200 OK { "object": "list", "data": [ { "id": "batch_abc123", "object": "batch", "endpoint": "/v1/chat/completions", "status": "completed", "created_at": 1711471533, "completed_at": 1711493163, "request_counts": { "total": 100, "completed": 95, "failed": 5 } }, { "id": "batch_def456", "object": "batch", "endpoint": "/v1/chat/completions", "status": "in_progress", "created_at": 1711475163, "request_counts": { "total": 50, "completed": 23, "failed": 0 } } ], "first_id": "batch_abc123", "last_id": "batch_def456", "has_more": false } ``` ```json 401 Unauthorized { "error": "Authentication credentials were not provided." } ``` ```python Python url = "https://api.respan.ai/api/v1/batches/" headers = { "Authorization": "Bearer YOUR_API_KEY", "X-Data-Respan-Params": json.dumps({ "customer_identifier": "user123" }) } params = {"limit": 10} response = requests.get(url, headers=headers, params=params) print(response.json()) ``` ```typescript TypeScript const url = 'https://api.respan.ai/api/v1/batches/?limit=10'; const headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'X-Data-Respan-Params': JSON.stringify({ customer_identifier: 'user123' }) }; const response = await fetch(url, { method: 'GET', headers: headers }); const data = await response.json(); console.log(data); ``` ```bash cURL curl "https://api.respan.ai/api/v1/batches/?limit=10" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "X-Data-Respan-Params: {\"customer_identifier\": \"user123\"}" ```

Authentication

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

Query parameters

limitintegerOptionalDefaults to 20
Maximum number of batches to return.
afterstringOptional

Cursor for pagination. Use the last_id from a previous response to get the next page.

Response

Successful response for List batches

Errors

401
Unauthorized Error