Enterprise API Documentation
Everything you need to integrate with the Sora2 Batch API.
OpenAPI Specification
Machine-readable API spec. Import into Postman, Swagger UI, or generate client code.
Webhook Events
Event types, payload schemas, signature verification, and retry policy.
Quickstart Guide
Get your first batch running in 5 minutes with our Node.js example.
Engineering Guarantees
System invariants: idempotency, ledger integrity, billing safety.
API Overview
| Endpoint | Method | Description |
|---|---|---|
| /v1/batches | POST | Create a batch job |
| /v1/batches/:id | GET | Get batch status |
| /v1/batches/:id/items | GET | Get batch items |
| /v1/batches/:id/cancel | POST | Cancel a batch |
| /v1/credits/balance | GET | Get credits balance |
| /v1/credits/ledger | GET | Get transaction history |
Authentication
All API requests require an API key passed in the x-api-key header.
curl -X POST https://sora2aivideos.com/api/v1/batches \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items":[{"prompt":"A sunset over the ocean"}]}'Contact junpengpanchina@gmail.com to obtain an API key.
Key Concepts
Idempotency
Pass a unique request_id when creating batches. Same ID = same batch, no duplicate charges. Safe to retry on network failures.
Credits Lifecycle
Credits are reserved when a batch is created, settled for successful items, and refunded for failures. You only pay for successful generations.
reserved = settled + refunded (always)
Webhooks
Receive real-time notifications for batch lifecycle events. Webhooks are signed with HMAC-SHA256 and retried up to 5 times.
SDK & Examples
Node.js / TypeScript
A minimal TypeScript client with full type definitions.
import { Sora2Client } from './sora2-client';
const client = new Sora2Client({ apiKey: 'YOUR_API_KEY' });
const batch = await client.createBatch({
requestId: 'order-123',
items: [
{ prompt: 'A cinematic sunset over the ocean' },
{ prompt: 'An anime forest with cherry blossoms' }
]
});
const result = await client.waitForBatch(batch.batchId);
console.log(`Succeeded: ${result.succeededCount}`);
console.log(`Failed: ${result.failedCount}`);View on GitHub →Need Help?
Our engineering team is available for integration support.