Idempotency
Retry safely: the same Idempotency-Key never does the same thing twice.
Send an Idempotency-Key header with every call that creates something or moves money; creating a booking requires one. Use a new random value per action and reuse it only to retry that action.
KEY=$(uuidgen)
curl -X POST "https://api.opentourbase.com/api/supplier/v1/bookings" \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: $KEY" \
-H "Content-Type: application/json" \
-d @hold.json
# A retry with the same $KEY and body answers the first result, with Idempotent-Replayed: true.- A retry with the same key and body answers the first result again, with Idempotent-Replayed: true.
- The same key with a different body is refused with 422 idempotency_key_reused.
- While the first call is still running, a retry gets 409 idempotency_in_progress; wait a second and retry.
- Keys are remembered for 24 hours. A booking remembers its key for good, so a late retry still returns the same booking.