Skip to main content
POST
/
api
/
v1
/
sora2api
/
generate
Generate Sora2API Video
curl --request POST \
  --url https://api.sora2api.ai/api/v1/sora2api/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A cute kitten playing in a garden on a bright spring day",
  "imageUrls": [
    "https://example.com/image.jpg"
  ],
  "aspectRatio": "landscape",
  "quality": "hd",
  "watermark": "My Watermark",
  "callBackUrl": "https://api.example.com/callback"
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "sora2_task_abcdef123456"
  }
}

Usage Guide

  • This endpoint creates videos based on your text prompt
  • Supports multiple modes including text-to-video and image-to-video
  • Customizable quality, aspect ratio, and watermark

Developer Notes

  • Recommendation for First-Time Users: Start with simple prompts for best results
  • Generated files are retained for 15 days before being deleted
  • Only the prompt parameter is required, all other parameters are optional

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
prompt
string
required

Prompt for content generation. Detailed description of the desired video or image content.

  • Should be detailed and specific in describing the content
  • Can include style, composition, lighting, and other visual elements
  • Maximum length: 2000 characters
Example:

"A cute kitten playing in a garden on a bright spring day"

aspectRatio
enum<string>
required

Aspect ratio of the output video.

Supported Aspect Ratios:

OptionDescriptionCommon Use
landscapeLandscapeHD video, desktop wallpaper, horizontal viewing
portraitPortraitPhone wallpaper, short videos, vertical viewing
Available options:
landscape,
portrait
Example:

"landscape"

quality
enum<string>
required

Quality of the generated content.

  • standard: Standard quality
  • hd: High Definition
Available options:
standard,
hd
Example:

"hd"

imageUrls
string[]

Array of image URLs. Used as input images for image-to-image or image-to-video.

  • Optional parameter
  • Must be valid image URLs
  • Images must be accessible by the API server
  • Can be left empty for text-to-image
Example:
["https://example.com/image.jpg"]
watermark
string

Watermark text.

  • Optional parameter
  • If provided, watermark text will be added to the generated content
Example:

"My Watermark"

callBackUrl
string<uri>

Callback URL for receiving task completion updates.

  • Optional but recommended for production use
  • System will send task completion status to this URL via POST request
  • Alternatively, you can use the get task details endpoint to check status
Example:

"https://api.example.com/callback"

Response

Request successful

code
enum<integer>

Response status code

  • 200: Success - Request processed successfully
  • 400: Bad Request - Invalid request parameters
  • 401: Unauthorized - Authentication credentials missing or invalid
  • 402: Insufficient Credits - Account does not have enough credits to perform operation
  • 404: Not Found - Requested resource or endpoint does not exist
  • 422: Validation Error - Request parameter validation failed
  • 429: Rate Limit - Request limit exceeded for this resource
  • 455: Service Unavailable - System is undergoing maintenance
  • 500: Server Error - Unexpected error occurred while processing request
  • 501: Generation Failed - Image generation task failed
  • 505: Feature Disabled - Requested feature is currently disabled
Available options:
200,
400,
401,
402,
404,
422,
429,
455,
500,
501,
505
msg
string

Response message

Example:

"success"

data
object