Idempotency key

Also called: Idempotency-Key header

A unique value you send with a request so that repeating it is safe.

What it means

An operation is idempotent if doing it twice has the same effect as doing it once. A client that times out does not know whether the first request went through. If it sends a unique key with each distinct request, the server can recognise the repeat and return the first answer instead of doing the work, or charging, again.

How Onekey handles it

Send a UUID in the Idempotency-Key header on any billed data call. The first success is stored for 24 hours; a repeat with the same key and request returns the stored body with credits_charged: 0 and idempotent_replay: true. The same key on a different request is 422 IDEMPOTENCY_KEY_REUSED. A failed first attempt releases the key.

Read more

Related terms

← All terms