Skip to content

Why does reusing an Idempotency-Key return a conflict?

A 409 idempotency conflict means that identifier was already used for a different normalized request. Keep the original identifier for retries of the original task. If the user deliberately changes the prompt, model, size, reference or spending ceiling, review a new quote and create a new task with a new identifier.

RECOVER AND DELIVER API JOBSAISwapLab team · Editorial methodUpdated 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Compare saved and current bodies; Classify the user action; Assign a new task only deliberately.
Workflow diagram: Compare saved and current bodies → Classify the user action → Assign a new task only deliberately. Read the article for evidence and limits.

One identifier represents one approved request

The idempotency record is not a reusable session name or a permanent user ID. Reusing a string such as image-request for every submission will collide. Conversely, silently changing the identifier to suppress a conflict can spend again when your app accidentally altered the saved task during recovery. Compare normalized values, including omitted versus defaulted settings and the approved ceiling, while keeping credentials out of diagnostics.

What to do next

  1. 01

    Compare saved and current bodies

    Inspect the approved payload fields, including max_credits, after your application's normalization. Remove secrets from diagnostics, but retain enough data to identify which field changed.

  2. 02

    Classify the user action

    A timeout retry should restore the saved original body. An intentional revision should receive a fresh quote and approval rather than altering the durable record behind an existing identifier.

  3. 03

    Assign a new task only deliberately

    Create a new internal record and unique identifier for a new generation. Keep a link to the previous attempt so the user can distinguish revision spending from technical recovery.

A concrete example

Illustrative conflict: a client retries an image job with the same identifier but changes size from 1K to 4K. The service refuses the mismatch instead of silently upgrading the existing task. Quote and approve the 4K request separately.

409 conflict decision

Difference foundInterpretationAction
Retry body accidentally changedRecovery bug, not user-approved new workRestore the saved original and original identifier
User intentionally revised size, prompt or other inputA distinct intended taskObtain the new quote/approval and assign a new identity
No understood differenceUnresolved conflictRetain safe request evidence; stop random-suffix retries

Before you call it ready

  • Each identifier has one immutable request body.
  • Creative revision and network recovery use different paths.
  • Conflicts are investigated before another charge.

When to stop or choose another method

Do not append random suffixes automatically whenever a 409 appears. Determine whether the original request should be recovered or the user truly approved a new attempt.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation