Idempotency
Accounting writes must happen exactly once. Give every create, update, delete, and void a stable Idempotency-Key, and reconcile when the outcome is unknown.
When a key is required
Live-project writes without an Idempotency-Key header fail with 409 IDEMPOTENCY_KEY_REQUIRED. Test projects accept writes without one, but use keys there too so your code is ready for production. Keys are ignored on reads.
curl -X POST "https://crossblade.dev/v1/quickbooks-desktop/invoices" \
-H "Authorization: Bearer $CROSSBLADE_SECRET_KEY" \
-H "Conductor-End-User-Id: $CROSSBLADE_END_USER_ID" \
-H "Idempotency-Key: invoice:ord_1042:v1" \
-H "Content-Type: application/json" \
-d '{"customerId":"80000001-1234567890","transactionDate":"2026-09-23","lines":[{"itemId":"80000002-1234567890","quantity":2,"rate":"125.00"}]}'
Designing keys
- Use
<operation>:<your record id>:v<n>, for exampleinvoice:ord_1042:v1orvoid:invoice:ord_1042:v1. Keys are 1–255 characters. - Derive the key from your own data, and save it before sending. A key generated in memory is lost if your process crashes mid-request.
- Keys are scoped to one company file (end-user). The same key on two end-users refers to two separate operations.
- Put your record ID somewhere visible in QuickBooks too, such as the memo or reference number, so a person can find the record while reconciling.
Replay semantics
| You send | Previous state of that key | Result |
|---|---|---|
| Same key, same payload | Succeeded; response retained | The original result. Nothing is written again. |
| Same key, same payload | Succeeded; response unavailable | 409 QBD_RESULT_UNAVAILABLE. The original outcome stays succeeded; nothing is written again. Read the original request status using Location or error.requestId. |
| Same key, same payload | Queued, processing, or unknown | Attaches to the original durable request (same Conductor-Request-Id). |
| Same key, same payload | QBD_REQUEST_EXPIRED (never dispatched) | The original request is queued again with its original ID. |
| Same key, same payload | Failed in QuickBooks (502 with integrationCode) | The same failure. Fix the cause, then send the corrected write with the next version, such as :v2. |
| Same key, different payload | Any | 409 IDEMPOTENCY_KEY_CONFLICT. Nothing is queued. |
| New key | — | A new, independent write. Only do this when you know the previous attempt did not happen. |
Validation errors (422) happen before anything is recorded, so you can fix the request and reuse the same key.
Request status separates the recorded outcome from response availability. A successful request can return status: "succeeded", hasResult: false and result: null after its payload is removed; payloadPurgedAt records that removal. Keep the successful outcome. Do not repeat the write with a new key to recover expired response data.
Unknown outcomes and reconciliation
If a write reached QuickBooks but no verifiable response came back, Crossblade returns HTTP 202 with status: "unknown_outcome" and code QBD_WRITE_OUTCOME_UNKNOWN. The write may or may not exist in QuickBooks. Until it is resolved, later requests for that company file wait behind it.
- Poll
GET /v1/requests/{id}(thestatusUrl). A late QuickBooks response resolves it automatically;resultis available only after verified success and while the response bytes are retained. - If it stays unknown, check QuickBooks for the record, for example by reference number or memo.
- Record what you found, in the dashboard request log or with
requests.resolve. Evidence must be at least 12 characters and should say what you checked. - If QuickBooks later reports a different outcome, the request moves to
resolution_conflict(409QBD_RESOLUTION_CONFLICT). Review it before writing again.
const state = await client.requests.retrieve(requestId);
if (state.status === "unknown_outcome") {
// Only after checking QuickBooks:
await client.requests.resolve(requestId, {
outcome: "succeeded",
evidence: "Invoice 1042 found in QuickBooks, entered 2026-09-23 10:14 by the connection user",
});
}
A manual resolution records your decision; it does not create a QuickBooks object or invent an ID. Keep your integration on hold for that record until you have its real QuickBooks ID.