# Tasks & idempotency

`GET /v1/tasks/{id}` reads an accepted image/video task. Authentication and account ownership are checked on every read. A different valid key in the same account may inspect the task; the original key ID remains the immutable usage attribution.

States: `submitting → running → succeeded | failed`. An uncertain outcome uses request `status: "unknown"` and `billing.status: "reconciling"`; it must not be resubmitted automatically. Successful task output and billing status are separate: a result can be available while settlement is being reconciled.

```json
{"task_id":"task_demo_01","request_id":"req_demo_async","model":"nano-banana-pro","response_mode":"async","status":"succeeded","data":[{"url":"https://assets.xxxrouter.example/demo/image.png","media_type":"image"}],"billing":{"status":"settled","currency":"USD","amount":"0.150000"}}
```

Poll with a bounded interval (start at 2 seconds and back off up to 10 seconds); respect `Retry-After`. GET retries do not create new work. A lost POST response is different: reuse the same idempotency key and identical payload. Same account + endpoint + key + request fingerprint returns the original record; a different payload returns `409 IDEMPOTENCY_CONFLICT`. Idempotency records are persisted in MySQL. Do not assume a new day makes it safe to reuse an old key or resubmit an uncertain request.

For synchronous images the replay returns the recorded direct result when available. In-progress or uncertain synchronous requests return HTTP `409` with the current request record; no second upstream submit occurs. Synchronous request IDs must not be polled through `/tasks` as if they were task IDs.

[Errors](/docs?page=errors&lang=en) · [Production](/docs?page=production&lang=en)

Successful responses return the original generated-media URL unchanged. The original host controls availability, expiry and browser cross-origin behavior. Save results before expiry; querying a completed task returns the saved URL and does not renew it. Request metadata and result URLs may be retained for recovery; generated-media bytes are never retained.
