Logocowtic
Public API

Idempotency

Use Idempotency-Key for safe retries on order create, ticket issue and event cancellation

Required on mutating checkout paths

Idempotency-Key is required for:

  • POST /orders (create order / checkout)
  • POST /tickets/issue (manual ticket issue)
  • POST /events/{eventId}/cancel (cancel an event, optionally with refunds)
  • POST /events/{eventId}/refunds/retry (retry an event's failed refunds)

Missing the header returns 400.

Why it matters

Network timeouts and client retries can otherwise create duplicate orders, tickets or refunds. With the same key and the same request body, the API returns the stored successful response instead of running the operation again.

Behavior

  1. Send a unique Idempotency-Key per logical operation (UUID recommended).
  2. The API hashes the request body and stores successful 2xx responses for that organization, method, path, and key.
  3. Replay with the same key and same body → original status and body, plus header Idempotency-Replayed: true.
  4. Reuse the same key with a different body → 409 idempotency conflict.

Failed non-success responses are not stored for replay; you may retry with the same key after fixing transient errors, as long as the body stays identical.

Example

curl -X POST https://api.cowtic.com/api/v1/orders \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json" \
  -d '{
    "eventId": "evt_…",
    "customer": { "email": "guest@example.com", "name": "Ada Guest" },
    "items": [{ "ticketId": "tt_…", "quantity": 2 }]
  }'

Client guidance

  • Generate the key before the first attempt and reuse it on retries.
  • Do not rotate the key when only retrying the same payload.
  • Use a new key for a new logical purchase, issue or cancellation request.
  • Cancelling an event is also safe to repeat with a new key — see Event cancellation.

On this page