Tai lieu tham khao API
Tong quan API
Hieu ro xac thuc, gui job, kiem tra trang thai va webhook trong Seedance 2.0 Open API.
Seedance 2.0 Open API cho phep ban gui cac job tao video bat dong bo tu san pham cua minh va lay ket qua khi qua trinh xu ly hoan tat.
Base URL
https://www.seedance2.inkAuthentication
Tat ca request Open API deu su dung Bearer token duoc tao trong dashboard Seedance.
Authorization: Bearer sd2_live_your_api_key{
"success": false,
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}Luong tich hop
- Tao API Key trong dashboard Seedance.
- Gui job bang
POST /api/open/v1/video/generations. - Luu lai
requestIdduoc tra ve. - Polling
GET /api/open/v1/video/generations/{requestId}cho den khi dat trang thai cuoi. - Neu can, hay dung webhook de nhan thong bao khi job hoan tat.
Endpoint chinh
| Method | Endpoint | Description |
|---|---|---|
GET | /api/open/v1/models | Liet ke model, thoi luong, ti le, do phan giai va thong tin gia co san. |
POST | /api/open/v1/video/generations | Tao job tao video moi. |
GET | /api/open/v1/video/generations/{requestId} | Kiem tra trang thai job va tra ve URL dau ra khi san sang. |
POST | /api/open/v1/video/generations/{requestId}/cancel | Huy job dang cho hoac dang duoc xu ly. |
Available Models
| Model | Best for | Supported durations | Resolutions |
|---|---|---|---|
seedance-2.0 | Highest quality, multimodal generation | 4-15 seconds | 480p, 720p, 1080p |
seedance-2.0-fast | Faster turnaround | 4-15 seconds | 480p, 720p, 1080p |
seedance-1.5-pro | Lower-cost fallback workloads | 5 or 10 seconds | 480p, 720p, 1080p |
Supported aspect ratios:
16:99:161:1
Trang thai
| Status | Description |
|---|---|
queued | Request da duoc chap nhan va dang cho trong hang doi. |
processing | Qua trinh tao dang duoc xu ly. |
succeeded | Job da hoan tat thanh cong va output.url da san sang. |
failed | Job that bai. Hay kiem tra error. |
cancelled | Job da bi huy truoc khi hoan tat. |
Models Endpoint Example
curl https://www.seedance2.ink/api/open/v1/models{
"success": true,
"data": [
{
"id": "seedance-2.0",
"type": "video_generation",
"mode": "image_to_video",
"durations": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
"aspectRatios": ["16:9", "9:16", "1:1"],
"resolutions": ["480p", "720p", "1080p"],
"usdPerSecond": {
"480p": 0.05,
"720p": 0.1,
"1080p": 0.2
}
}
]
}Webhook
Ban co the dat webhookUrl cho tung request hoac cau hinh URL callback mac dinh o cap API Key.
- Neu ca hai cung ton tai,
webhookUrltrong request se duoc uu tien. - Neu co cau hinh Webhook Secret, header
x-seedance-signaturese duoc gui kem. - Webhook chi duoc gui khi job dat trang thai cuoi.
x-seedance-signature: <hex_sha256_hmac>{
"success": true,
"requestId": "req_1234567890",
"status": "succeeded",
"output": {
"type": "video",
"url": "https://pub-your-bucket.r2.dev/open-api-results/req_1234567890.mp4"
},
"error": null
}Ma loi
| HTTP status | Error code | Description |
|---|---|---|
400 | invalid_request | Noi dung request khong khop schema mong doi. |
401 | unauthorized | API Key thieu hoac khong hop le. |
402 | insufficient_credits | Khong du credit de tao job. |
404 | not_found | Khong tim thay job cho API Key hien tai. |
429 | rate_limited | Vuot qua gioi han moi phut hoac quota hang thang. |
500 | internal_error | Da xay ra loi noi bo khong mong doi. |