n8n integration
Configure credentials, stable retries and asynchronous polling.
1. Store credentials
Create an n8n Header Auth Credential: name Authorization, value Bearer YOUR_API_KEY. Select it in each API HTTP Request node. Keep keys out of node fields and exported workflow JSON.
2. Quote and create
Use a POST HTTP Request to https://seedance2-5.com/api/v1/quotes with a JSON generation body. Review cost_credits, then POST the body to /videos or /images with a maximum credit cap.
Idempotency-Key: seedance-{{$execution.id}}-shot-001This execution ID example is stable only within one execution. If a business operation can resume in another execution, persist the original idempotency key and body outside the workflow. Do not use a new execution ID for an uncertain retry.
3. Wait and poll
Trigger → Quote → Create → Save generation id → Wait 20–30s → Get status → Switch
↑ │
└── pending/processing┘
success → Download outputs
failed/canceled/expired → Stop and reportPersist the ID returned by Create. GET /generations/{id} with the original Credential. Wait 20–30 seconds while pending or processing, and respect any longer Retry-After. Use a timeout/error branch that retains the original request instead of recreating it.
4. Save outputs
{{$json.outputs[0].url}}Read this expression only in the success branch after confirming a nonempty outputs array. For multiple images iterate over outputs. Download signed URLs before expires_at; do not attach your API Bearer key to storage downloads. Image inputs require the upload/PUT/complete sequence in the image input guide.