Documentazione API Seedance 2.0 API
Tutto ciò di cui hai bisogno per integrare la generazione video Seedance 2.0 nella tua app.
URL base
https://api.defapi.orgAutenticazione
Tutte le richieste API richiedono una chiave API nell'intestazione Authorization.
Authorization: Bearer <your-api-key>Esempio: Bearer dk-1234567890abcdef
POST
/api/video/seedance/genGenera un video con Seedance AI. Restituisce un task_id per il polling.
Corpo della richiesta
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| model | string | No | Modello AI da usare. Default: seedance-2.0 |
| content | array | Sì | Array di elementi testo/URL immagine. Max 9 immagini. Riferimento con @image1, @image2… |
| duration | integer | No | Durata del video in secondi. Opzioni: 5, 10, 15. Default: 5 |
| ratio | string | No | Rapporto d'aspetto. Opzioni: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9. Default: 16:9 |
| callback_url | string | No | URL Webhook per ricevere notifiche di completamento attività |
Esempi
Testo in video
POST https://api.defapi.org/api/video/seedance/gen
Authorization: Bearer dk-1234567890abcdef
Content-Type: application/json
{
"model": "seedance-2.0",
"content": [
{ "type": "text", "text": "A beautiful beach scene with waves gently lapping at the shore" }
]
}Immagine in video (riferimento con @image1, @image2)
{
"model": "seedance-2.0",
"content": [
{ "type": "text", "text": "The cat in @image1 walks through a garden, then meets the dog in @image2" },
{ "type": "image_url", "image_url": { "url": "https://example.com/cat.png" } },
{ "type": "image_url", "image_url": { "url": "https://example.com/dog.png" } }
],
"duration": 5,
"callback_url": "https://example.com/webhook/video-callback"
}Risposta
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta12345678-1234-1234-1234-123456789abc"
}
}GET
/api/task/queryInterroga lo stato e il risultato di un'attività di generazione video.
Parametri di query
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| task_id | string | Sì | ID attività restituito dall'endpoint di generazione |
Esempi
GET https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071 Authorization: Bearer dk-1234567890abcdef
Risposta
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta823dfb-eaac-44fd-aec2-3e2c7ba8e071",
"status": "success",
"result": { "video": "https://example.com/generated-video.mp4" },
"consumed": "0.500000",
"status_reason": { "message": null },
"created_at": "2025-08-03T10:22:20.010Z"
}
}Codici di errore
| Stato HTTP | campo code | Significato |
|---|---|---|
| 200 | 0 | Successo |
| 400 | 1 | Richiesta non valida — parametri non validi |
| 401 | 1 | Non autorizzato — chiave API mancante o non valida |
| 404 | 1 | Attività non trovata |
| 500 | 1 | Errore interno del server |