Enterprise API Documentation

Everything you need to integrate with the Sora2 Batch API.

API Overview

EndpointMethodDescription
/v1/batchesPOSTCreate a batch job
/v1/batches/:idGETGet batch status
/v1/batches/:id/itemsGETGet batch items
/v1/batches/:id/cancelPOSTCancel a batch
/v1/credits/balanceGETGet credits balance
/v1/credits/ledgerGETGet 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.