Idempotency
Use a stable Idempotency-Key for writes that create durable request receipts, and follow each endpoint's documented retry behavior.
POST /notes, POST /contacts, POST /customers, POST /suppliers, parent-scoped customer location/address and document creates, supplier ship-from creates, product creates, product-family creates, Cost Book updates, Cost Book corrections and batches, and Price Book updates require Idempotency-Key. Repeating the same route plus the same key and same request body returns the original record or ordered batch result. Reusing the same key with a different intended update returns a conflict.
Tag vocabulary and assignment changes use the requested state itself for safe repeats. POST /tags, PATCH /tags/{id}, and POST or DELETE /tag-assignments require neither Idempotency-Key nor If-Match; their changed fields show whether a repeat altered the saved grouping.
Tax setup and template cost retries
Tax-type, tax-rate, and rate-period creates use stable Idempotency-Key values and return the current resource on an identical retry. Tax PATCH and archive use the type/rate's current updatedAt in If-Match; rate-period DELETE instead uses that period's own updatedAt. Ship-to tax PUT and batch use neither header: repeat the same desired assignments to converge, and inspect each independent batch result. Keep all imported Formula/Repack cost fields and allocation positions unchanged on an identical template-create retry. See Tax setup for complete examples and version rules.
Certificate and COA retries
Structured COA import on POST /lots/{id}/coas has its own behavior: it accepts neither Idempotency-Key nor dry run, and every accepted request creates another certificate. Save the returned ID and reconcile the lot's certificates after an uncertain response before resubmitting. The current-file COA PUT below continues to use saved-document matching.
Certificate filing and lot COA assignment use the saved dates and document for safe repeats. POST /certification-records, PATCH /certification-records/{recordId}, and PUT /lots/{id}/coa do not require Idempotency-Key; an identical request returns unchanged. Changed certificate PATCH requests use the record's current updatedAt as If-Match; a COA replacement uses the returned COA version. See Certification Intelligence and Lots for the complete retry rules.
Key format
Build the key from stable source facts.
<source-system>:<source-event-id>:<target-type>:<target-id>:<action>
Examples:
gmail:thread-18f0:customer:customer-id:create-note
gmail:thread-18f0:customer:customer-id:create-contact:jane@example.com
call:recording-77:supplier:supplier-id:create-note
crm:lead-1842:customer:create-profile
crm:site-742:customer:customer-id:create-location
intake:doc-913:create-product
intake:doc-913:create-product-family
intake:file-482:purchase-order:purchase-order-id:attach
quote:2026-0819-line-2:price-book:customer-id:update
cost-review:2026-0901:cost-book:entry-id:correct
cost-review:2026-0901:cost-book:approved-batch-4
Do not use timestamps or random ids unless the source event is genuinely unique. A random key per retry disables replay protection.
Note replay
curl "$SHELFCYCLE_API_BASE_URL/notes" \
-X POST \
-H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: gmail:thread-18f0:customer:customer-id:create-note" \
-d '{ "primarySubject": { "type": "customer", "id": "customer-id" }, "noteType": "EMAIL", "title": "Inbound thread", "body": "Approved summary." }'
First successful request:
{
"data": {
"id": "note-id",
"type": "note",
"idempotencyStatus": "created"
}
}
Same key and same body:
{
"data": {
"id": "note-id",
"type": "note",
"idempotencyStatus": "replayed"
}
}
Same key and different body:
{
"error": {
"type": "conflict_error",
"code": "idempotency_key_reused",
"message": "The Idempotency-Key was reused with a different request body.",
"requestId": "request-id"
}
}
Contact, profile, child-record, and product replay
POST /contacts, POST /customers, POST /suppliers, parent-scoped child creates, POST /products, and POST /product-families follow the same rule. A duplicate created through a matching idempotency key replays. A different key whose identity fields match an existing record can return 409 duplicate_contact, 409 duplicate_customer, 409 duplicate_supplier, 409 duplicate_customer_location, 409 duplicate_customer_address, 409 duplicate_supplier_ship_from_location, 409 duplicate_product, or 409 duplicate_family.
Price Book review and replay
Price Book uses the same stable key from POST /price-book-entries?dryRun=true through the reviewed execution. Add the preview's expectedAffectedEntryIds and expectedPlanToken to the execution body. If the execution response is lost, replay that exact execute request with the same key and body to recover the original saved entry.
If ShelfCycle reports that the reviewed plan is no longer current, run a new preview and review its affected entries before applying it. Keep the original key only for an identical replay of the original intended update.
Price Entry management replay
Price Entry management on PATCH or DELETE /price-book-entries/{id} uses Idempotency-Key and the selected entry's updatedAt as If-Match on both preview and execution. Execute with the approved review values: reviewedTargets, selectedClientItemIds, and expectedPlanToken. The batch route uses the same review object and requires a stable key for execution; preview may omit the key.
For an uncertain management response, replay the identical method, route, body, key, and scalar If-Match. The saved receipt remains replayable after deletion or review expiry, with current access checked. Do not refresh an exact committed replay's proof or timestamp. A revised selection or intended change needs a fresh preview. See Price Book for the two-phase examples and all-or-nothing batch behavior.
Cost Book corrections and batch replay
Cost Book POST, PATCH, and batch requests use a stable Idempotency-Key. Keep the key and body unchanged from preview through execution. PATCH corrects the selected entry in place and sends its latest updatedAt as If-Match; batch editCost items send that value as payload.expectedUpdatedAt. A correction replay retains the same entry identity. A completed batch replay returns the same ordered item results.
If a batch is interrupted, repeat the identical request with the same key. Completed items are returned from the saved receipt and only pending items continue. Each item also needs a stable, unique clientItemId so the ordered results remain tied to the caller's source rows.
Product and work-order import retries
POST /products/batch and POST /work-orders/batch require a stable Idempotency-Key for execution. Keep the body, item order, and unique clientItemId values identical to replay saved outcomes and continue pending items. Previews need no key and save nothing. Corrected failed rows go in a new request with a new key.
Product import recognizes an exact existing code and returns it only with current product-detail access, without updating its fields or packaging profile. Work-order import recognizes the source ticket's externalId within the organization, across request keys, and returns the existing work order unchanged; a repeat does not change its status. A different body with the same request key still conflicts. See Product setup and Work-order imports.
Warehouse-location import retries
Execute POST /warehouse-locations/batch with a stable Idempotency-Key; repeat the identical body, item order, and IDs to replay recorded results or resume pending items. Preview needs no key and saves nothing. An existing warehouse/location externalId returns unchanged only when supplied fields match; differing fields fail without updating it. Location source IDs preserve outer spaces. Preview does not retain a parent created by an earlier item, so load parents before previewing children. See Warehouses.
Formula import replay
Execute POST /formulas/batch with a stable Idempotency-Key. Retrying the identical body, item order, and clientItemId values returns recorded outcomes and continues only pending items. A completed retry reports idempotencyStatus: "replayed". Preview with dryRun=true does not save formulas or request results and does not require the key. Corrected failed items belong in a new request with a new key, without already successful formulas. See Formula imports.
Repack template import replay
Repack template imports use the same independent-item retry pattern as formulas on POST /repack-templates/batch, with repack-templates:write. Retain the exact body, item order, IDs, and key to replay recorded results and continue pending items. These independent imports differ from Price Entry batches, whose approved changes apply together. See Repack template imports.
Attribute and certification setup
Attribute definition/value creates and certification-type creates require a stable Idempotency-Key. Repeat the same route, key, and intended body after an uncertain response; do not use duplicate labels or titles as proof of an earlier create. Certification-type replay returns the type's current settings, and an unavailable target returns idempotency_target_unavailable rather than creating a replacement. Read the relevant resource again before changing it.
Definition rename, vocabulary deletion, certification-type PATCH/DELETE, and certification-record DELETE use the current record's updatedAt as If-Match. Attribute reorder instead sends every current collection member once in orderedIds, without a key or version header. Certificate record POST/PATCH still use saved-record matching rather than Idempotency-Key; keep recordedStatus identical on retries because omission defaults to ACTIVE. See Attribute vocabulary and Certification Intelligence.
Attached-document replay
Product, customer, supplier, purchase-order, sales-order, and bill document routes use the same replay rule. A newly uploaded file attachment returns data.integrity with the verified checksum, size, content type, and verification time. Replaying the exact route, key, and body returns the same stored integrity receipt without depending on a new file check. Sales-order and bill replays retain that receipt even if the URL later becomes a lot COA; current record visibility and access still apply. The matching document read scope separately controls uploaded-file links in the response.
Keep that receipt with the source event so a workflow can reconcile a lost response without creating another attachment. See Attached documents for the complete response.
Retry rule
On network failure or 429 rate_limited, retry the same idempotent request with the same key and same body. Price Book execute retries must also keep the reviewed plan fields unchanged. Cost Book batch retries must keep item order and every clientItemId unchanged. If a caller changes the intended update, treat it as a new source event and choose a new stable key.