# Idempotency

Use `X-Idempotency-Key` on `POST /v1/jobs` to safely retry job creation without duplicates.

## Why it matters

Network interruptions can leave clients unsure whether a job was created.

With idempotency keys, retries return the original result instead of creating duplicate jobs.

## Header

- `X-Idempotency-Key: <unique-key-per-business-operation>`

## Key design recommendations

- Build keys from your internal identifiers when possible.
- Keep keys stable across retries.
- Do not reuse the same key for different source files or business events.

Example patterns:

- `tenant-17:invoice-2026-03-001`
- `sync-run-90210:file-abc123`

## cURL example

```bash
curl -sS -X POST "https://api.redactpdf.ai/v1/jobs" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Idempotency-Key: tenant-17:invoice-2026-03-001" \
  -F 'files=@/absolute/path/invoice.pdf;type=application/pdf'
```

## Operational practice

Store idempotency keys and resulting `job_id` in your own DB for auditability and incident recovery.
