Idempotency
Idempotency ensures that retrying a request produces the same result without duplicating the operation. This is essential for safely handling network failures and timeouts.How idempotency works
When you include anIdempotency-Key header with a request:
- The API creates a fingerprint of your request (method, path, body)
- If the same key is used again with the same fingerprint, the original response is returned
- If the key is reused with a different fingerprint, you receive a
409 Conflicterror
Idempotency keys are scoped to your account. Different accounts can use the same key without conflict.
Using idempotency keys
Add theIdempotency-Key header to any POST or DELETE request:
Key requirements
| Requirement | Details |
|---|---|
| Format | Must be a valid UUID (e.g., a1b2c3d4-e5f6-7890-abcd-ef1234567890) |
| Uniqueness | Must be unique per operation |
| Expiration | Keys expire after 24 hours |
Generating idempotency keys
Generate a new UUID for each unique operation:Handling concurrent requests
When a request is in progress and the same idempotency key is used, the API waits briefly for the original request to complete:Error responses
Conflict (different request body)
Invalid key format
a1b2c3d4-e5f6-7890-abcd-ef1234567890).
Retry patterns
Safe retry with idempotency
Handling unknown response status
When a request times out, you don’t know if it succeeded. Using idempotency keys makes retries safe:Best practices
Always use idempotency keys for mutating operations
Always use idempotency keys for mutating operations
Include
Idempotency-Key for all POST and DELETE requests, even if you don’t plan to retry. This protects against accidental double-clicks and network retries.Generate unique keys per operation
Generate unique keys per operation
Don’t reuse keys across different operations. Each logical operation should have its own unique key.
Store keys with operation context
Store keys with operation context
If you need to retry later (e.g., after a server restart), store the idempotency key alongside the operation context.
Don't rely on key expiration
Don't rely on key expiration
Keys expire after 24 hours, but you shouldn’t retry operations after such a long delay. Use fresh keys for new operations.
Endpoints supporting idempotency
| Endpoint | Method | Idempotency |
|---|---|---|
/v1/subscriptions | POST | ✅ Supported |
/v1/subscriptions/{id} | DELETE | ✅ Supported |
/v1/exports | POST | ✅ Supported |
| All GET endpoints | GET | N/A (naturally idempotent) |
Next steps
Error Handling
Handle API errors gracefully in your application
Rate Limiting
Understand rate limits and how to handle them
Pagination
Navigate large result sets efficiently
API Reference
Explore the complete API documentation