Idempotency keys
Networks fail. An idempotency key lets you retry a send without risking a duplicate.
Send any unique string up to 256 characters in the Idempotency-Key header. Postwick remembers it for 24 hours; a second request with the same key returns the first response instead of sending again.
- Node.js
- cURL
await postwick.emails.send(payload, { idempotencyKey: `welcome/${user.id}` });curl https://api.postwick.dev/emails \
-H "Idempotency-Key: welcome/8812" \
-H "Authorization: Bearer $POSTWICK_API_KEY" \
-d @payload.jsonReusing a key with a different body is a 409 idempotency_conflict, not a silent success.
Updated
Was this page helpful?