Get started
Idempotent requests
Retry POST requests without creating duplicates: send an Idempotency-Key and Rabbitblaze runs the request once.
Networks fail in the worst moment: a request may have created the conversation even though you never saw
the response. Any POST to the REST API accepts an Idempotency-Key
header; repeats with the same key within 24 hours return the first response instead of
running again.
Sending a key
curl -X POST https://api.rabbitblaze.com/v1/conversations \ -H "Authorization: Bearer $RABBITBLAZE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: form-submission-8841" \ -d '{"email": "[email protected]", "body": "Our October invoice shows our old VAT number."}' import { randomUUID } from "node:crypto" const idempotencyKey = randomUUID() // keep it with the job, reuse it on every retry const res = await fetch("https://api.rabbitblaze.com/v1/conversations", { method: "POST", headers: { Authorization: `Bearer ${process.env.RABBITBLAZE_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey, }, body: JSON.stringify({ email: "[email protected]", body: "Our October invoice shows our old VAT number." }),})console.log(res.headers.get("Idempotent-Replayed")) // "true" when this was a replay How repeats behave
| Repeat with the same key… | Result |
|---|---|
| after the first request succeeded |
The stored response (same status and body), with Idempotent-Replayed: true.
|
| while the first is still running | 409 conflict — retry shortly.
|
| with a different method, path or body | 422 idempotency_key_reused.
|
| after the first request failed | Runs again: only successful responses are stored, so you can fix a request and reuse its key. |
Choosing keys
Use 1–255 printable ASCII characters that identify the operation, not the attempt: a
UUID stored with your job, or an id you already have such as form-submission-8841. Generate a
new key for every new operation.