Batch API
Run large async jobs across SAGEA endpoints with 50 percent discount.
POST https://api.sagea.space/v1/batch
Authentication
Send Authorization: Bearer $SAGEA_API_KEY on every request. Get a key
Parameters
Send a JSON body with the following fields.
| Parameter | Type | Required | Description |
|---|---|---|---|
endpoint | string | Yes | One of /v1/chat/completions, /v1/audio/speech, /v1/ocr/process, or /helios/kyc/v1. |
requests | array | Yes | List of individual request objects for the chosen endpoint. |
callback_url | string | No | HTTPS URL notified when the batch completes. |
metadata | object | No | Custom key value labels for tracking your job. |
idempotency_key | string | No | Unique key to safely retry batch creation. |
language | string | No | Default locale hint such as en-US, ne-NP, hi-IN, or es-ES. |
Example request
Batch Kathmandu summaries plus an Aarav Sharma NPR invoice check.
Poll the returned batch_url until status is completed, then fetch results.
Response
Creation returns IDs and polling URLs for tracking progress.
Fetch results_url after completion to download all outputs at once.
Errors
| Status | Code | Fix |
|---|---|---|
400 | invalid_request | Check endpoint is one of the four allowed paths. |
401 | unauthorized | Re-export a valid SAGEA_API_KEY value. |
404 | session_not_found | Poll the exact batch_url returned on creation. |
429 | rate_limit_exceeded | Back off and retry with exponential delay. |
500 | internal_error | Retry once, then contact support with batch ID. |
Limits
Batch creation follows the target endpoint limit, for example 120 per minute for Celer on Starter and 2000 per minute on Pro.
