Guide
Use idempotency keys
Idempotency keys let you retry send-creating requests safely after a timeout or lost response. Use one stable key per logical send request.
Where keys are required
The public transport requires Idempotency-Key only for these send-creating operations:
| Operation | Path |
|---|---|
| createEmail | POST /v1/emails |
| createEmailBatch | POST /v1/emails/batch |
| sendEmail | POST /v1/emails/{email_id}:send |
| createSend | POST /v1/sends |
Example
curl -X POST "https://api.ctct.dev/v1/emails" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: receipt-1042" \
-d '{
"from": "noreply@constantcontact.com",
"to": ["ada@example.com"],
"subject": "Receipt AB-1042",
"html": "<p>Thanks for your order.</p>"
}'
Retry rules
- Reuse the same key when retrying the same request body after a network timeout, connection reset, or unknown response.
- Use a new key when any send intent changes, including recipient, subject, content, schedule, or tags.
- Keep keys unique enough for your own system, such as
receipt-<ORDER_ID>or a generated UUID.
Common error
400
missing_idempotency_key — The request is a send-creating operation and did not include
Idempotency-Key.