What is idempotency?
An idempotent operation can be repeated multiple times without changing the result beyond the first execution. On the Arcus API, idempotency protects you from creating duplicate orders, payments, or other records when a request fails partway through (network timeout, server restart, etc.).How to use it
Include theIdempotency-Key header on any POST, PATCH, or DELETE request. The value must be unique per operation — a UUID v4 is the recommended format.
Replay behavior
| Scenario | Response |
|---|---|
| First request with a new key | Normal execution; response stored |
| Retry with the same key (within 24 hours) | Original response returned immediately, no re-execution |
| Retry with the same key (after 24 hours) | Key expired; request treated as new |
| Different request body with an existing key | 409 Conflict with code: idempotency_key_mismatch |
24-hour replay window
Arcus stores idempotency keys and their responses for 24 hours. After that window, the key is expired and a new request with the same key is treated as a fresh operation. If your retry strategy spans more than 24 hours, generate a new key.Key format
The key can be any string up to 255 characters. Best practices:SDK usage
All SDKs handle idempotency keys automatically for safe retries:When to use idempotency keys
Use them on every POST, PATCH, or DELETE that mutates data. The most critical cases:- Creating orders, invoices, or payments
- Processing refunds
- Purchasing shipping labels
- Posting journal entries
- Any financial or inventory-affecting operation
Bulk imports and async jobs
The migration cluster endpointPOST /v1/entities/{eid}/migration/{resource}/bulk accepts Idempotency-Key and gives you two distinct safety nets:
-
Request-level idempotency (this header). If your loader retries the same bulk request after a network timeout, you get the original
migration_jobrow back with the sameidand status. No duplicate jobs queued. -
Per-record provenance idempotency (
external_source+external_id). Even if you submit the same record across multiple jobs over time, the canonical handlers use the(entity_id, external_source, external_id)partial unique index to upsert. Re-runs against the same source data are safe.
Idempotency-Key, and pick up where it left off without creating duplicates.
conflict_mode semantics
The bulk endpoint takes a conflict_mode body field that controls behavior when a record already exists at the provenance key (external_source, external_id):
skip(default) - leave the existing row untouched, count it asskipped.update- PATCH the existing row with the new field values; preserves any Arcus-side fields not in the payload.replace- DELETE the existing row and INSERT the new payload as if it were a fresh record. Use with care.error- return an error envelope per-record and continue processing the rest.
Dry-run mode
Add?dry_run=true to validate a payload without writing anything. The endpoint returns a synchronous 200 with the result envelope, no migration_job row is created, and zero DB writes occur. Use this in CI to catch schema errors before the real run.

