Idempotency
The Idempotency-Key header for safe POST retries.
The Idempotency-Key header is required on POST /v1/admin/orders, POST /v1/storefront/orders and POST /v1/storefront/payment-sessions. Use a UUID that is unique per operation.
curl -X POST https://api.bazzario.app/v1/admin/orders \
-H "Authorization: Bearer bzk_YOUR_KEY" \
-H "Idempotency-Key: 6f1d3c2e-8a0b-4c55-9d7e-2f4a1b9c0e11" \
-H "Content-Type: application/json" \
-d @order.json| Situation | Result |
|---|---|
| Retry with the same key and body | The stored response of the first request is returned; no new order |
| Same key, different body | 422 IDEMPOTENCY_KEY_REUSED |
| First request still running | 409 IDEMPOTENCY_IN_PROGRESS: retry in a second |
| Request failed before it was stored | The key is released and the retry runs as new |
- Keys are unique per API key and kept for 24 hours.
- For buyer requests the buyer token is part of the request fingerprint.
- Stored responses cover successful (2xx) and client-error (4xx) results.
POST /v1/admin/orders is also idempotent by externalOrderId: re-posting the same external number returns the existing order with 200, a new one returns 201. The lookup runs before the stock check.