Use idempotency keys to safely retry failed requests without accidentally creating duplicate orders.
Network failures, timeouts, and unexpected errors can leave you uncertain whether a request succeeded. Without idempotency, a naive retry might create a duplicate order and charge your balance twice.
By including an idempotencyKey field in the body of every order
creation request (UUID v4 recommended), Giftronaut guarantees that the same key
can never create more than one order. The first request with a given key
creates the order and returns 201 Created. Any subsequent request
that reuses the same key — regardless of whether the body is identical — is
rejected with 409 DUPLICATE_IDEMPOTENCY_KEY; the original order is
not replayed in the response.
curl -X POST "https://api.giftronaut.com/api/v1/orders/branded-cards" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000",
"productId": "10042",
"sendTiming": { "type": "IMMEDIATE" },
"emailSetting": { "senderName": "Giftronaut Rewards", "subject": "Your gift has arrived!" },
"recipients": [
{ "email": "alice@giftronaut.com", "firstName": "Alice", "amount": 50 }
]
}'
| Scenario | HTTP status | Body |
|---|---|---|
| First request with a new key | 201 | New order object |
| Any retry with the same key (identical or different body) | 409 | Error: DUPLICATE_IDEMPOTENCY_KEY |
409 DUPLICATE_IDEMPOTENCY_KEY means an order with that key already
exists — it does not mean your order failed. If a network failure
left you unsure whether the first request succeeded, do not blindly change the key
and retry. Instead, confirm the outcome by looking up the order with your key:
GET /api/v1/orders?clientOrderId={key}. If a matching order is
returned, the original request succeeded.
GET /api/v1/orders?clientOrderId={key}idempotencyKey in the body of every order creation request (POST)GET and DELETE requests are inherently safe to retryStart typing to search...
Select the APIs you want to integrate. A ready-to-use Markdown file with full API specs and a project context template will be generated and downloaded. Paste it into your AI assistant to get started instantly.