Skip to article
Documentation

Search documentation

Search stays in this browser. Queries are not sent or saved. Do not paste credentials.

Loading the public search index…

Tab or arrow keys to navigate · Enter to open · Esc to close
Browse documentation

Errors, idempotency, and safe retries

Distinguish correctable errors from temporary failures, preserve one logical request across retries, and troubleshoot without exposing secrets.

Public betaAPI v1 · 1.3.0Last verified
On this page

Keep a logical operation stable

Paid create endpoints require Idempotency-Key with 8–200 characters. Generate it once, persist it with the exact request, and reuse both after a timeout or connection failure.

The same key and normalized body returns the original operation. A changed body with that key is a conflict. A request still being accepted can return a retryable in-progress conflict. Keys are retained for at least 24 hours; do not assume indefinite deduplication.

Deduplication is scoped to the account, operation, and API key identity (or OAuth client for MCP). Switching to a different API key can create a new task even with the same idempotency string. Recover a known task ID before rotating credentials during an uncertain creation.

If the create result is uncertain, first try to recover the original task. Never silently mint a new key. For a deliberate new generation or a changed request, obtain approval and use a new logical key.

Read the error envelope

json
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests",
    "param": null,
    "retryable": true,
    "request_id": "example-request-id",
    "details": {}
  }
}

This is an illustrative error, not a promise of identical message text. Branch on HTTP status and error.code, inspect retryable, and retain request_id for support. Do not log raw request headers, image bodies, prompts, or signed URLs.

Choose a response

HTTP / common code Action
400 INVALID_REQUEST, INVALID_BASE64, INVALID_IMAGE Fix input; do not retry unchanged
401 INVALID_API_KEY Check missing, expired, or revoked key
402 INSUFFICIENT_CREDITS Review balance and quote; do not auto-purchase
403 API_ACCOUNT_NOT_ELIGIBLE, API_ACCOUNT_PAUSED, INSUFFICIENT_SCOPE Resolve verification, account status, or permissions
404 NOT_FOUND Check public resource ID and ownership
409 IDEMPOTENCY_CONFLICT Stop; same key was used with different input
409 IDEMPOTENCY_IN_PROGRESS If retryable, wait and reuse the original request
413 PAYLOAD_TOO_LARGE, 415 UNSUPPORTED_MEDIA_TYPE, 422 IMAGE_DIMENSIONS_TOO_LARGE Correct image size, encoding, or type
429 RATE_LIMITED, QUEUE_LIMIT_EXCEEDED Respect Retry-After; account-wide limits apply
503 API_DISABLED, API_UNAVAILABLE, PROVIDER_UNAVAILABLE Retry only if marked retryable; otherwise stop and check availability

Resource ownership errors can intentionally look like not-found responses. Do not probe other users' IDs.

Bound every retry loop

Respect Retry-After (seconds or HTTP date); otherwise use exponential backoff with jitter. Set a maximum number of attempts and an overall deadline. A deadline stops local waiting, not a remote task already accepted.

Retry read operations after transient transport failures. Retry an uncertain paid create only with a persisted idempotency key and unchanged body. Never retry an unkeyed upload or another non-idempotent operation blindly.

When the deadline is reached, save the known task ID and resume later. For a terminal task failure, inspect partial outputs before choosing a new export or generation.

Account limits and diagnosis

PROVIDER_CONTENT_REJECTED currently identifies a confirmed Seedance content-review rejection, not a transient error to retry unchanged. Read credits.status, credits.refunded, and credits.released from the task. credits.charged is already the net charge; do not subtract the returned credits again. A confirmed rejection before output/export refunds the original one-click workflow amount. A local timeout or an export failure is not the same condition, and a return is not approval to create another paid task.

Read current limits through GET /account; response rate-limit headers can describe the current bucket. More keys do not add account capacity. Spread polling across tasks instead of synchronizing every client in a burst.

For a support request, include the public request ID, task ID if known, timestamp, error code, and a brief description. Redact secrets and private inputs. See polling and downloads for incomplete results and the Python example for bounded retries.

Was this page helpful?

No search queries, code, or free text are collected. This switch controls documentation interactions only; general site analytics follow the privacy policy. Privacy policy

Need a hand? Contact support