Skip to main content

Idempotency and async settlement

Use Idempotency-Key to deduplicate queued writes, Prefer to choose sync or async settlement, and status polling to track terminal outcomes.

Overview

Send an Idempotency-Key header on a write so a retry after a timeout attaches to the original transaction instead of moving value twice. Send Prefer: wait=N to wait for on-chain settlement inline instead of polling a status URL.

On-chain writes are asynchronous by default. DALP queues the instruction and returns 202 Accepted with a status URL, and an HTTP timeout does not cancel queued work. Money-moving v2 writes echo Idempotency-Key and are safe to replay. On any other route, inspect the original operation before retrying.

Submit a token mint with Idempotency-Key and a 30-second synchronous wait:

curl -X POST "$DALP_API_URL/api/v2/tokens/0x71C7656EC7ab88b098defB751B7401B5f6d8976F/mints" \
  -H "X-Api-Key: $DALP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a9e-4b7d-4e2a-9c3f-1a2b3c4d5e6f" \
  -H "Prefer: wait=30" \
  -d '{
    "recipients": ["0x8ba1f109551bD432803012645Ac136ddd64DBA72"],
    "amounts": ["100000000000000000000"]
  }'

When the mint settles within the wait, DALP returns 200 OK with the route's settled body and meta.transactionId. If the wait expires first, DALP returns 202 Accepted with the queue handle:

HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /api/v2/transaction-requests/0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b
Idempotency-Key: 6f1c2a9e-4b7d-4e2a-9c3f-1a2b3c4d5e6f
Preference-Applied: wait=30

{
  "transactionId": "0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b",
  "status": "QUEUED",
  "statusUrl": "/api/v2/transaction-requests/0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b"
}

Poll statusUrl (also returned in Location) until the transaction request reaches a terminal state:

curl "$DALP_API_URL/api/v2/transaction-requests/0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b" \
  -H "X-Api-Key: $DALP_API_KEY"
{
  "data": {
    "family": "evm",
    "transactionId": "0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b",
    "kind": "token.mint",
    "status": "COMPLETED",
    "subStatus": null,
    "transactionHash": "0x5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
    "blockNumber": "21458901",
    "errorMessage": null,
    "createdAt": "2026-03-11T15:58:02.000Z",
    "updatedAt": "2026-03-11T16:02:08.000Z"
  },
  "links": {
    "self": "/api/v2/transaction-requests/0198f1a2-3c4d-7e8f-9a0b-1c2d3e4f5a6b"
  }
}

Idempotency-Key

Idempotency-Key identifies one client-side instruction. The queue attaches matching submissions to the same transaction request, but a route can run checks before work reaches the queue. Treat a route as replay-safe only when its contract documents replay safety and its response echoes the effective key.

Use a fresh key for each distinct instruction and retain that key across retries. DALP reads Idempotency-Key case-insensitively and strips one pair of surrounding double quotes. An empty value, bare or quoted, counts as no key. If you omit the header, DALP generates a key, but you have nothing to retry with if the response is lost.

The money-moving v2 writes echo the key and never move value twice on an unchanged replay:

  • Token mints, burns, transfers, forced transfers, transfer acceptances, and approvals.
  • Claims, redemptions, yield, interest, dividend, and maturity claims or top-ups, and fixed-yield schedule writes.
  • XvP settlement writes, token-sale writes, airdrop writes, paymaster deposits, and bank-rail cash-out creates.

A write checks preconditions such as balance, headroom, or claimable amount before it reaches the queue. A replay sent after the original settled can therefore return that precondition refusal instead of the original result. A token-sale fund sent without an amount tops up only remaining capacity, so a replay after settlement mints nothing. Read the original operation's status before treating such a refusal as a failure.

Matching window and conflict responses

For 24 hours after the first request, the transaction queue binds Idempotency-Key to the calling user, wallet selection (accountWalletId, smartWalletAddress, forceEoa), call payload (operation, target contract, call data, and value, where omitted value equals 0), and whether Prefer: dalp-no-funding-pause was sent. Changing only Prefer: wait keeps the same write identity.

Reusing a key for a different write returns 409 Conflict with the route's conflict code, such as TRANSACTION_IDEMPOTENCY_KEY_CONFLICT (DALP-14238):

HTTP/1.1 409 Conflict
Content-Type: application/json

{
  "code": "TRANSACTION_IDEMPOTENCY_KEY_CONFLICT",
  "status": 409,
  "message": "This idempotency key already names a different write",
  "data": {
    "id": "DALP-14238",
    "why": "The idempotency key already names a different write from this sender on this chain, or its 24-hour matching window has closed.",
    "fix": "Submit this write with a new idempotency key; to retry the original write inside its 24-hour window, resend it unchanged.",
    "retryable": false,
    "category": "client"
  }
}

Two route groups report the same queue conflict with their own codes:

  • Token and token-feature writes return 400 Bad Request with TRANSACTION_QUEUE_IDEMPOTENCY_CONFLICT (DALP-14061) and data.refusal: "QueueIdempotencyConflict".
  • V2 compliance writes (installing, configuring, scoping, or removing compliance modules, holder locks, and compliance expressions, excluding system module creation) return 409 Conflict with REQUEST_STATE_CONFLICT (DALP-14262).
Situation
DALP behaviour
Same key, same write, within 24 hours
Attaches to the original instruction and returns its current transactionId, state, and result fields, whether or not processing finished. Never submits a second transaction.
Same key, different call (operation, target contract, call data, or value), within 24 hours
Rejected with the route's conflict error (retryable: false). Send a new key for the changed instruction.
Same key, different wallet selection (accountWalletId, smartWalletAddress, or forceEoa), within 24 hours
Rejected with the route's conflict error (retryable: false). Send a new key for the changed wallet selection.
Same key, reused after 24 hours
Rejected with the route's conflict error (retryable: false). Confirm the earlier instruction's outcome, then retry with a new key.
Same key, sent again after TRANSACTION_QUEUE_FUNDING_REQUIRED
Fund the paying account first. The queue enqueues a fresh attempt, or returns 400 TRANSACTION_QUEUE_DUPLICATE_SETTLED if the refused attempt still holds the key. On that 400, send the write with a new key.
Same key, sent again after TRANSACTION_QUEUE_RETRIES_EXHAUSTED
Returns the recorded 503 failure. Wait for a short backoff, then send the write with a new key. For multi-step writes, read transactionId first because an earlier step can have completed.

Token and token-feature writes report a spent retry budget as TRANSACTION_QUEUE_RETRIES_EXHAUSTED. Other queued writes (compliance module changes, governance proposals, role changes, market listings, smart-wallet mutations, forced escrow transfers, and token-sale mints) return their route's own dependency-unavailable error with retryable: true. Handle both identically: back off briefly, then resend with a new key, because the original key replays the recorded failure.

After a timeout, inspect the original operation's status before sending another write. Replay with the original Idempotency-Key only when the route documents replay safety.

Concurrent requests and changed bodies

Concurrent requests with the same write identity on the same network under the same Idempotency-Key attach to one instruction. A retry can return an in-flight state without waiting for the original request to finish.

Key comparison checks the full call data, not only wallet selection. Reusing a key with a different recipient or amount fails with the route's conflict error (for example, 400 TRANSACTION_QUEUE_IDEMPOTENCY_CONFLICT, DALP-14061 on a token mint).

One-time outcomes (bond maturity, full-balance redemption, holder yield claim, dividend reclaim, an XvP parked-leg claim or expired withdrawal, or a token-sale refund, withdrawal, or undeliverable release or payment) allow one running request at a time regardless of key. A second request under another key fails before submission with 400 Bad Request, TRANSACTION_QUEUE_OUTCOME_IN_FLIGHT (DALP-14751), data.refusal: "QueueOutcomeInFlight", and data.transactionId naming the running request when available. Read that request and resend only if it failed. A retry under the running request's own key still attaches to it.

When an earlier queued write failed before anything was signed, a matching submission under the same key enqueues a fresh attempt. The failed attempt keeps its own transactionId and no longer matches that key.

Reconcile by the original transactionId and resulting chain transaction hash. Request logs, workflow attempts, and settlement records track different stages and do not have a one-to-one row count per instruction.

Prefer: choose sync or async

Transaction routes default to asynchronous 202 Accepted. Use Prefer to wait inline on routes that declare it in the API reference. Writes that do not declare Prefer finish before responding and ignore the header.

Header
Mode
What DALP does
Omitted
Async (default)
Returns 202 Accepted immediately with transactionId, status, and statusUrl (also in Location).
Prefer: respond-async
Async
Same as the default, stated explicitly.
Prefer: wait
Sync
Waits up to 99 seconds. Returns 200 OK if settled in time, otherwise 202 Accepted.
Prefer: wait=N
Sync
Waits N seconds, clamped between 5 and 99.
Prefer: respond-async, wait=N
Sync
Same as wait=N, explicitly naming the 202 Accepted fallback.

The wait stops a few seconds before the deployment's request deadline so DALP responds before an upstream gateway times out. A synchronous wait never changes the operation's outcome. DALP echoes honoured directives in Preference-Applied per RFC 7240 (wait=N after clamping, and respond-async when sent). Sending only dalp-no-funding-pause produces no Preference-Applied header.

Resource-specific 202 Accepted writes

Several domain writes return 202 Accepted with their own resource body instead of a bare queue handle. With Prefer: wait, each holds up to the wait and returns 200 OK if every step settles in time.

Operation
202 Accepted body and Location
How to finish or settle
Wallet restrictions (POST /api/v2/restrictions, PATCH /api/v2/restrictions/{restrictionId})
Stored restriction while any token freeze or lift is queued or lift-queued, or chain.state is pending. Location is the restriction URL.
Poll Location until no token is queued and chain.state leaves pending. Each read settles queued legs. Lifting while freezes are still in flight returns 409 WALLET_RESTRICTION_FREEZE_IN_FLIGHT.
Tradable rights exercise (POST /api/v2/tokens/{assetId}/corporate-actions/{corporateActionId}/rights-exercises)
Exercise with status submitted while queued (200 settled once landed). Location is GET .../rights-exercises/{holder}.
Poll Location to settle against the queue, or retry with the same Idempotency-Key.
Fund subscription settlement (POST /api/v2/tokens/{assetId}/subscription-settlements)
Settlement body with pendingCount above 0.
Retry with the same Idempotency-Key until pendingCount reaches 0 (200). Chain-refused and unsent batches reopen, and retries recheck wallet restrictions and KYC status before sending unsent batches.
Bank rail escrow (POST /api/v2/bank-rail/connections/{connectionId}/token-links/{tokenLinkId}/escrow)
Escrow in state creating (200 once indexed). Location is the escrow read.
Poll Location until state reads ready.
Bank rail token-link transitions and decisions (.../transitions, .../decisions)
Link with mintCapReplacement while re-delegation is queued. Location is the connection's token-link list.
Poll Location to settle the replacement (restores the previous cap on failure).
Account kind switch (POST /api/v2/settings with ACCOUNT_KIND: "smart-account")
First unsent synchronisation write's transaction handle and status URL in Location.
Poll transaction requests until settled, then repeat the POST with the same Idempotency-Key. (The frozen v1 route keeps its single wait.)
Corporate actions (POST .../corporate-actions, .../confirm, .../commit)
Action in executing, or drafted without dividendId while declaration is queued. Location is the corporate action read.
Poll Location to settle queued work. Repeating confirm or a rights close resumes from the first unsent unit.
Trading venue orders (POST .../orders, PATCH .../orders/{orderId}, cancellations)
Order placement (Location is GET .../order-placements/{orderId}), or cancellation with escrowRefund: "queued" or refundsQueued above 0.
Poll order-placements/{orderId} until placed or failed. On signing_pending, repeat with the same Idempotency-Key after custody approval. Reading a cancelled order settles its refund.
Trading venue admin: POST .../trading-venues, POST or PUT .../markets, and .../transitions
New venue (status: "deploying") or instrument (status: "processing"). Location is the venue or instrument read.
Poll Location until settled. Durable workflows resume automatically, and retrying with the same Idempotency-Key attaches to the running work.
Managed participant create (POST /api/v2/participants)
Exception to default async: waits for Prefer: wait (or default wait when omitted), then returns 202 with requestId, state, and statusUrl in Location.
Poll statusUrl, or repeat with the same Idempotency-Key to attach to the same run.

Correlating meta.transactionId and replays

A settled 200 OK response names the underlying transaction request in meta.transactionId whenever the response came from a queue result (even when meta.txHashes is empty). A retry sent with Prefer: wait after settlement returns 200 OK with that same transactionId.

A retry sent without Prefer: wait returns 202 Accepted with the same transactionId and statusUrl even after settlement. Read GET /api/v2/transaction-requests/{transactionId} for the final outcome, and retry a failed request with POST /api/v2/transaction-requests/{transactionId}/transitions (action: "retry").

Treat an absent meta.transactionId as no correlation ID rather than proof that no request exists. One transaction request can submit multiple chain transactions, so meta.txHashes length does not equal request count.

Terminal states and retrying a failed transaction

Both polling GET /api/v2/transaction-requests/{transactionId} and synchronous waits end when a request reaches a terminal state.

State or error
Terminal
Immutable
What to do
QUEUED (or in-flight sub-state)
No
No
Keep polling statusUrl or follow the status stream. Do not submit a new key.
COMPLETED
Yes
Yes
Reconcile using transactionHash and blockNumber. Do not retry.
CANCELLED
Yes
Yes
Nothing landed. Submit a new write with a new Idempotency-Key if still wanted.
FAILED
Yes
No
Call did not land or reverted. Inspect errorMessage or contractError.fix. Requeue via .../transitions (action: "retry"), or send a new write with a new Idempotency-Key.
DEAD_LETTER (mayStillLand: true)
No
No
Outcome unknown and the call may still reach the chain. Do not send a new key. Wait for a later status, or escalate transactionId to an organisation owner or platform administrator.
DEAD_LETTER (mayStillLand: false)
Yes
No
Call cannot land. Requeue via .../transitions (action: "retry"), or send a new write with a new Idempotency-Key.
504 INDEXER_BARRIER_TIMEOUT (DALP-12074)
Chain landed
Yes
Transaction succeeded on chain, but indexing trailed the deadline (retryable: false). Confirm via data.transactionId and retry only the subsequent read.

Force-retry rules

An organisation owner or platform administrator can requeue a FAILED or DEAD_LETTER request back to QUEUED through POST /api/v2/transaction-requests/{transactionId}/transitions. If a requeued request stays unclaimed after dispatch failed, repeating force-retry resumes that attempt. Otherwise it starts a new attempt.

Force-retry refuses these cases, among others, with 409 Conflict:

  • TRANSACTION_FORCE_RETRY_CALL_MAY_LAND (DALP-200383): returned for DEAD_LETTER with mayStillLand: true while the call or nonce slot remains unresolved. When the chain shows neither call nor nonce reservation, send custodianStopped: true to record your confirmation that the custodian stopped the call. DALP does not verify that statement, and an incorrect override can run the call twice. A DEAD_LETTER with the sub-status MAY_BE_ON_CHAIN is refused even with custodianStopped: true, because its call may already have run at a nonce DALP holds no record of. What an operator can do says how an operator closes it.
  • TRANSACTION_WORKFLOW_OWNED (DALP-14029): returned for requests owned by a multi-step workflow (such as token creation) or a step of a role set. For a role set, send a new role set once the earlier one has ended. For any other workflow, force-retry its failed executable transaction request instead.
  • TRANSACTION_STATE_CONFLICT (DALP-14236): returned for a FAILED request whose idempotency key a workflow retired. Completing an offboard retires the key of a failed identity registry write once DALP can prove it never lands. Send a new write with a new Idempotency-Key.
  • TRANSACTION_STATE_CONFLICT (DALP-14236) is also returned for a retry that an offboard refuses. While a case is completing, DALP refuses to retry a write that concerns that person. It also refuses to retry an identity registry add or a claim for a person who is offboarded, and a claim whose holder no longer has the seat in the organisation that the claim needs. The request stays as it was. If the case is still completing, retry after it finishes or returns to started.

Failure details and indexer timeouts

FAILED and DEAD_LETTER rows carry a plain-text errorMessage (such as "Execution reverted"). When the failure maps to a catalogue error, contractError carries the id, why, and fix fields from the error envelope.

When compliance rules refuse a queued mint or transfer before it is sent, contractError.args names the reason, with the missing verification topics or the blocking module when DALP can establish them. A call that waits with Prefer: wait reads the same names in its 422 error. DALP records them only when the sending wallet holds a role that may read compliance detail: system manager, identity manager or claim issuer, and for a mint also supply management. Otherwise the request carries the catalogue error without them.

A caller who can read a transaction request only because it acted on their wallet, without being an organisation owner or platform administrator, receives errorMessage: null, no custodyApproval or amount, and activeRequirement without shortfall or recommendedTotal. For a compliance refusal, that caller's contractError names no wallet, missing topic or module.

On 504 INDEXER_BARRIER_TIMEOUT (DALP-12074), the transaction succeeded on chain, but Ledger Data did not finish indexing its block before the deadline. Because retryable is false, automatic retry loops will not duplicate the write. Confirm data.transactionId, repeat only the read, and ask an operator to check indexer errors for data.chainId at or before data.blockNumber if lag persists.

Next steps

  • Errors covers the full error envelope, including 409 Conflict structures.
  • Webhooks covers event delivery and how webhook outcomes relate to accepted writes.