> ## Documentation Index
> Fetch the complete documentation index at: https://docs.finalsay-hitl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency and retries

> Use request_id so a retry never asks twice, and correlation_id to group approvals by run.

Networks fail and workflows retry. `request_id` makes that safe: the same id with the same body always returns the same
approval.

## `request_id` vs `correlation_id`

| | `request_id` | `correlation_id` |
| - | - | - |
| What it identifies | One approval | The run, ticket or job it belongs to |
| Unique? | Yes, per agent | No: many approvals can share one |
| If you leave it out | The server generates a UUID | No correlation id |
| Used for | Idempotency and reading the result | Your own bookkeeping; returned in the result |
| Limits | 1–120 characters after trimming | 1–120 characters after trimming |

## How retries work

* **Same `request_id`, same body** → `200` with the existing approval and `"idempotent": true`. No second approval, and
  it doesn't count toward your plan again. `status` is the existing approval's, so it may already be answered.
* **Same `request_id`, different body** → `409 idempotency_conflict` with `existing_approval_id`. The comparison covers
  `question`, `context_markdown`, `notification_summary`, `options`, the merged `timeout`, and `callback` (URL and
  headers).
* **Same `request_id` and body, different `correlation_id`** → still the existing approval. `correlation_id` is a label,
  not part of the question, so it isn't compared; the approval keeps the `correlation_id` it was created with.
* **No `request_id`** → every call creates a new approval. A blind retry after a timeout can ask twice.

> [!WARNING]
>
> If you retry without a `request_id`, a create that succeeded but whose response you never got becomes a duplicate.
> Always send one when anything might retry.

## Choosing a `request_id`

Make it deterministic from what you're asking about, so a retry computes the same id:

* `deploy-${commit_sha}-production`
* `refund-${order_id}`
* `${workflow_run_id}-${step}-${attempt_item}`

Don't reuse an id for a genuinely new question. If the same action needs approving again later (say, a re-deploy), add
something that changes, such as a timestamp or run number.

Integrations do this for you:

* **n8n** defaults to `{execution id}-{node}-r{run}-i{item}`, unique per approval and stable across n8n retries of the
  same node run, and sets `correlation_id` to the execution id.
* **CLI** `--request-id`; **MCP** and **Zapier** have a `request_id` field.

## Retrying errors

| Error | Retry? |
| - | - |
| Network error, timeout, `500` | Yes, with the same `request_id` and body. |
| `429 rate_limited` | Yes, after backing off with jitter. Every attempt counts toward the limit. |
| `400`, `401`, `404`, `409` | No. Fix the request. |
| `403 USAGE_APPROVAL_LIMIT` | Not in a loop. Wait for the next period or an upgrade. |

Reading a result (`GET …/result`) is always safe to repeat.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.