The Idempotency-Key
Travomatrix supports theIdempotency-Key header for the following endpoints:
POST /booking/createPOST /booking/cancel/confirm
Example Workflow
- Generate Key: Your system generates
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000. - Send Request: You call
POST /booking/create. - Timeout: Your connection drops before you receive a response.
- Retry: You send the exact same request with the same
Idempotency-Key. - Safe Response: Travomatrix sees the key, finds the existing (or currently processing) booking, and returns the successful PNR. No second debit occurs.
Retry Strategy
For non-idempotent endpoints (like Search), use a standard exponential backoff strategy. For idempotent endpoints:| Status Code | Action |
|---|---|
2xx | Success. No retry needed. |
4xx | Client error (Validation, Insufficient Funds). Do not retry without fixing the payload. |
409 | Conflict. The same idempotency key is being used for a different payload. |
5xx / Timeout | Retry with the same Idempotency-Key. |
Best Practices
- Persistence: Store your idempotency keys in your database alongside your local order record.
- Uniqueness: Never reuse an idempotency key for a different passenger set or different flight.
- Expiration: Idempotency keys are typically cached for 24 hours.