Idempotency
With an idempotency key, a request is idempotent, so retrying it after a network failure doesn’t run the operation twice.
POST, PATCH and DELETE requests accept an idempotency-key header. When a key is reused, Bias returns the original response with an idempotency-replay: true header instead of running the operation again. Use a new key, such as a UUID, for each operation.
Errors are replayed too, so trying again after an error takes a new key. Rate limit and idempotency errors aren’t saved.
The SDKs send a new key with every POST and PATCH request and reuse it on retries. To retry safely across your own process restarts, set the key with the TypeScript SDK’s idempotencyKey option:
Idempotency errors
A reused key must match the first request’s endpoint, method, query parameters and body. When a key can’t be used, Bias returns an idempotency error with HTTP status 409 and one of these codes:
| Code | Meaning |
|---|---|
idempotency_key_in_use | The first request is still running. Retry once it finishes. |
idempotency_params_mismatch | The key was used for a different request. Use a new key. |
idempotency_outcome_unknown | The first request’s outcome is unknown. Check whether it happened before using a new key. |