Skip to main content
Where enforcement is enabled, an idempotency key lets a repeated POST or PATCH replay its cached response. Check availability and caching limits before relying on it to prevent duplicate work.
Idempotency-Key enforcement applies to the Extended API and Main API email campaign triggers. Other Main API endpoints depend on rollout availability. For email triggers, use the same key and body when retrying the same logical send.

How it works

1

Generate a key

Generate a unique key per logical request, typically a UUID, a hash, or your own primary key.
2

Send it on the first attempt

Add an Idempotency-Key header to your POST or PATCH.
3

Retry with the same key and body

If the request times out or fails partially, retry with the exact same key and exact same body.
4

Receive the cached response

Where idempotency enforcement is enabled, Spotzee replays the cached status and body. The response header Idempotent-Replayed: true confirms a replay; do not rely on the request’s correlation header staying the same.

Scope and TTL

  • Scope: keys are scoped per API key, so distinct API keys have separate replay caches. Within one API key, use a unique idempotency key across all paths and methods; changing the URL does not create a separate replay scope.
  • Per-surface scope: the Main API and Extended API maintain independent caches. The same Idempotency-Key sent to both surfaces is treated as two distinct requests. Pick a fresh key per surface if you want isolation, or reuse it deliberately knowing each surface will replay independently.
  • TTL: cached responses normally live for 24 hours. Email campaign triggers retain their key for at least 24 hours and while processing or reconciliation remains unfinished. Do not assume that waiting 24 hours makes the same key a new send.
  • Eligible methods: POST and PATCH. GET, HEAD, and DELETE are idempotent by definition and ignore the header.

What Spotzee does on replay

Errors

Generating keys

Use a non-empty opaque string of up to 255 characters. Pick a generator that suits your platform:

When not to reuse a key

Reuse a key for the same logical operation. For example, retrying the same contact upsert after a timeout. Mint a fresh key when:
  • The user submits the form a second time after deciding to change a field.
  • You’re processing a queue and each message is a distinct operation.
  • You’re running a backfill. Each row is its own logical request.

Other endpoints’ caching rules

  • 2xx responses are cached.
  • 4xx responses are eligible for caching except 408, 425, and 429.
  • 5xx, 408, 425, and 429 responses are not cached so retries can succeed when the platform recovers.
  • Oversized or unreadable response bodies are not cached. The Main API also excludes responses carrying Retry-After.

Next steps

Rate limits

Request limits and retry headers.

Errors

Status codes and the code catalogue.