Skip to Content
Idempotency

Idempotency

Networks fail. When a POST times out, you cannot know whether Skoup received it. Retrying blindly could create the same task twice.

Send an Idempotency-Key header on every POST and retries become safe:

curl https://api.skoup.ai/v1/brands/br_2xKq8Fh3LmN9pQrT4vWy6Z/tasks \ -H "Authorization: Bearer skoup_test_4eC39HqLyjWDarjtT1zdp7dc" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 5b0e2c7a-9f1d-4f5e-8a2b-1c3d4e5f6a7b" \ -d '{"title": "Add GTIN to the Gravel 500 product page", "kind": "technical"}'

How it works

  • The first request with a given key is executed normally and its response — status code and body, errors included — is stored for 24 hours.
  • Any retry with the same key and the same body returns the stored response, without running the request again. The replayed response carries the header Idempotent-Replayed: true.
  • A retry with the same key but a different body fails with 422 idempotency_key_reused: a key identifies one operation.

Keys are scoped to the API key that sent them. Use a random UUID v4 per operation, generated before the first attempt and reused for its retries.

GET, PATCH and DELETE are idempotent by nature and ignore the header.

Last updated on