> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# Can resubmitting a timed-out image start create two tasks?

> Sending the same Idempotency-Key, path, and request body to POST /v1/images/tasks within 24 hours replays the original 201 response instead of creating a duplicate task.

Resubmitting a timed-out `POST /v1/images/tasks` request does not create a second task when the retry reuses the original `Idempotency-Key`, request path, and exact JSON body within 24 hours. The gateway replays the stored `201` response with the `Idempotent-Replayed: true` header rather than queuing another render.

## Safe recovery steps after a timeout

1. Check local storage for a saved `task_id` (`data.id`). When a `task_id` already exists, query `GET /v1/tasks/{task_id}` instead of calling `POST /v1/images/tasks` again.
2. When no `task_id` reached the client and the original request included an `Idempotency-Key` (at most 255 characters), resend the identical path, header, and JSON body within 24 hours.
3. Persist the `Idempotency-Key`, request body, and returned `task_id` together on the order or asset record so later retries stay traceable.

```bash
curl -sS -X POST 'https://api.beatapi.io/v1/images/tasks' \
  -H "Authorization: Bearer $BEATAPI_API_KEY" \
  -H "Idempotency-Key: bg-edit-sku-1042-v1" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-2.5-flare-std","prompt":"Replace the background with light gray studio paper.","images":["https://example.com/product.jpg"]}'
```

## Conflict and new-key boundaries

* **In-flight or mismatched requests (`409 idempotency_conflict`)**: Reusing a key while the first request is still running, or pairing the key with a changed body or path, returns `409 idempotency_conflict`. Wait for the original request to finish before retrying an identical payload.
* **Failed validation or balance checks**: BeatAPI stores idempotency records only for `2xx` responses. After a `400` or `402` refusal, fix the request or balance and submit again.
* **Distinct tasks**: Generate a fresh `Idempotency-Key` whenever the prompt, reference image, or parameters change for a new asset.

[Image reference](/api-reference/image-api/gpt-image-2-5-flare-std)

## Contracts and related questions

Before sending a paid request, inspect the model contracts for free: `model:gpt-6-luna`, `model:gpt-image-2.5-flare-std`.

[Back to AI Models questions](/faq/models).