Skip to main content
A network error can hide the reply to a request that Wave did receive. If your code then sends the request again, it can do the same thing twice — for example, place a second call to the same person. To prevent this, send an Idempotency-Key header on a request that changes data (POST, PUT, PATCH or DELETE).
Use a new random value (for example, a UUID) for each new request, and the same value for each retry of that request.

What Wave does with the key

Two requests are the same when they use the same method, the same endpoint and the same JSON body. The order of the fields in the body does not matter.

Which replies Wave keeps

  • Wave keeps a successful reply (2xx) for 24 hours.
  • Wave also keeps one failure: 502 CALL_FAILED from POST /v1/calls or POST /v1/callback when the telephony engine did not answer clearly. The call may have started, so a retry with the same key gets the same 502 and does not place a call. Check your webhooks or the person before you try again, and send a new key to place a new call.
  • Wave does not keep any other error. After a 4xx (for example a validation error) or another 5xx, you can correct the request and retry with the same key.
  • Wave does not keep a reply that contains a secret (for example a new webhook signing secret or web-calling credentials), or a reply larger than 64 KB. The key still stops a duplicate request while the first one runs (409) and a different request (422). But after the first reply, a retry with the same key runs again. Before you retry such a request, check if the first one was done.

Scope

A key belongs to one project and one key environment. Two production keys of the same project share their idempotency keys, so a retry still works after you rotate a key. A sandbox key and a production key never share an idempotency key. The key works only on a request that has an API key (or a signed-in portal user). On a request with neither, Wave ignores the header. The key is optional, but we recommend it on every call request.