Sora 2 API

Build on top of the Sora 2 API

Ship text-to-video experiences backed by OpenAI Sora 2 and Sora Pro. Authenticate with API keys, poll task status, and deliver final videos in minutes.

Why teams rely on the Sora 2 API

Deliver resilient video generation workflows with predictable polling, 20 concurrent requests, and automatic storage uploads.

Sora 2 + Sora Pro

Pick the model string that matches your quality and cost needs: sora-2 or sora-2-pro.

Predictable polling

Create a task, then poll the check-result endpoint to keep status and progress in sync without SSE.

20 concurrent requests

Process up to 20 video generation tasks simultaneously. Contact us for higher limits.

Authentication & Base URL

All endpoints live under https://freesoragenerator.com/api. Supply the API key created in the console via the Authorization header.

  • Send the header Authorization: Bearer YOUR_API_KEY with every request.
  • Use Content-Type: application/json when posting payloads.
  • Each generation request deducts 20 credits (sora-2) or 30 credits (sora-2-pro); failed jobs are refunded automatically.

Core endpoints

Start by creating a generation task, then poll or listen for the result.

Create Sora 2 video

Kick off a Sora 2 or Sora Pro generation job with text-to-video or optional image-to-video prompts.

Method: POSTPath: /api/v1/video/sora-video

Payload parameters

  • Required. Use "sora-2" or "sora-2-pro" to target the model variant you need.
  • Required. Natural language description of the scene you want Sora to create.
  • Optional (recommended). Base64 data URL with prefix "data:image/*;base64," for image-to-video mode.
  • Optional. Legacy reference image URL; still supported but lower priority than imageData.
  • Optional. Supported values: "9:16" (default) or "16:9".
  • Optional. Whether to display the video publicly; default is true.
  • Optional (VIP only). Target video pid for continuation/remix features.
  • Optional (VIP only). Character control array; each item includes url and timestamps.
  • Optional. HTTPS endpoint that receives the final result payload when the task succeeds.

Notes

  • Responses return immediately with a taskId; poll check-result until status is succeeded or failed.
  • Provide webHook to receive the final payload asynchronously without running a polling loop.

Sample request

curl -X POST https://freesoragenerator.com/api/v1/video/sora-video \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2-pro",
    "prompt": "A cinematic shot of a futuristic city at sunset, captured in 4K.",
    "imageData": "data:image/png;base64,iVBORw0KGgoAAA...",
    "aspectRatio": "9:16",
    "isPublic": true
  }'

Sample response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "task_1234567890"
  }
}

Check generation result

Poll the latest status for a generation task to track progress and retrieve results.

Method: POSTPath: /api/video-generations/check-result

Payload parameters

  • Required. The identifier returned when you created the generation task.

Notes

  • The endpoint verifies the task belongs to your account before returning data.
  • Failed jobs return credits automatically and expose refund metadata in the response.

Sample request

curl -X POST https://freesoragenerator.com/api/video-generations/check-result \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "task_1234567890"
  }'

Sample response

{
  "code": 0,
  "message": "Success",
  "data": {
    "status": "running",
    "progress": 35,
    "result_url": "https://your-domain.com/storage/videos/xxx.mp4",
    "result_urls": [
      "https://your-domain.com/storage/videos/xxx.mp4"
    ],
    "failure_reason": "",
    "error_message": null,
    "credits_refunded": false,
    "refund_trans_no": null,
    "result_pid": "s_xxx",
    "result_pids": [
      "s_xxx"
    ],
    "metadata": {
      "remixTargetId": "s_prev",
      "characters": [
        {
          "url": "https://.../hero.mp4",
          "timestamps": "0,3"
        }
      ]
    }
  }
}

Get user credits and VIP status

Query current user's available credits and VIP membership status.

Method: POSTPath: /api/get-user-credits

Notes

  • Requires valid login session or API token to access user information.
  • Returns left_credits, is_recharged, is_pro, and is_vip status fields.

Sample request

curl -X POST https://freesoragenerator.com/api/get-user-credits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Sample response

{
  "code": 0,
  "message": "ok",
  "data": {
    "left_credits": 120,
    "is_recharged": true,
    "is_pro": true,
    "is_vip": false
  }
}

1. Create the task

Send the Sora2 API request with your prompt, then store the returned taskId.

2. Track progress

Call the check-result endpoint until the status becomes succeeded or failed.

3. Deliver the video

Use the storage-backed URLs in result_url/result_urls to serve or download the generated video.

Frequently asked questions

How do I authenticate my requests?

Create an API key in the console, then include it as Authorization: Bearer YOUR_API_KEY. Keys can be rotated at any time.

How should I poll for results?

After calling create, store the taskId. Call /api/video-generations/check-result every 3-5 seconds until status is succeeded or failed, then use result_url/result_urls.

How are credits handled for failures?

We automatically refund credits when a task fails and return refund_trans_no plus credits_refunded=true in the check-result payload for audit trails.

Helpful resources

Launch with Sora2 API today

Create your API key and start generating cinematic AI videos in minutes.