> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aigenstudio.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency

> Safely retry create requests without creating duplicate jobs.

Every create endpoint requires an `Idempotency-Key` header.

```bash theme={"theme":{"light":"github-light","dark":"github-light"}}
-H "Idempotency-Key: campaign-1001-square"
```

Idempotency is scoped to the API key. The same API key, key value, endpoint, and request body return the same job.

## Same key, same body

Returns the existing job:

```json theme={"theme":{"light":"github-light","dark":"github-light"}}
{
  "job": {
    "id": "f693e677-51e0-4ebe-80a0-ad06acbc4443",
    "api": "ad_creative",
    "status": "queued"
  }
}
```

## Same key, different body

Returns:

```json theme={"theme":{"light":"github-light","dark":"github-light"}}
{
  "error": {
    "code": "idempotency_conflict",
    "message": "This Idempotency-Key was already used with a different request body."
  },
  "request_id": "req_abc123"
}
```

## Recommended keys

Use stable business identifiers:

```txt theme={"theme":{"light":"github-light","dark":"github-light"}}
catalog-sync-2026-06-28-page-4
shopify-product-8172-main-image-cleanup
ad-campaign-456-beverage-square-v1
```

Do not reuse the same key for unrelated work.
