Guides
Idempotency
A request can time out after the service has accepted it. To retry without creating a second sweep, give every
sweep an external_id: your own id for it, such as the id of the deposit in your system.
{ "external_id": "dep-7f3a91", "chain_id": 11155111, "hot_wallet": "0x…", "account": "0x…", "token": "USDT" }- The first request with an
external_idcreates the sweep and responds with202 Accepted. - Any later request with the same
external_idcreates nothing and responds with200 OKand the sweep created the first time, whatever its status now. The SDKs return it withcreated: false. external_idis up to 128 characters, unique among all your sweeps. Revocations have their ownexternal_ids, separate from the sweeps’.
A request is validated before the external_id is looked up: a retry with an invalid body gets its error, not the
original sweep.
Sweep lists
Section titled “Sweep lists”A sweep list needs an external_id on every item. A request with the same chain_id
and the same set of them, in any order, is a repeat: it answers 200 OK with the list as it is now and sends nothing.
Unlike a single sweep’s, a repeated list is answered before the rest of the request is checked; the rate limit
counts it too. Ids of other sweeps, or the same ids on another chain or with other items, get
409 external_id_conflict, and nothing is created. An item rejected before sending uses up its external_id.
Without external_id
Section titled “Without external_id”Each request creates a new sweep. A retry after a timeout can then queue the same sweep twice. Without amount, the
second one usually finds nothing left and is rejected; with an amount, it can move more than you meant if the
address received new funds in between. Always set external_id.
Retrying safely
Section titled “Retrying safely”- Network errors, timeouts and
5xx: retry with the sameexternal_id, with a growing pause. 4xx: do not retry the same request: fix what the error says. See Errors and retries.- A sweep that ended
rejectedorfailed: it is final. To try again, for example with a new authorization, send a new request with a newexternal_id.
Idempotent by nature
Section titled “Idempotent by nature”| Request | Repeating it |
|---|---|
POST /v1/hot-wallets | Returns the same hot wallet for the same chain and address. After failed it restarts the deployment. |
POST /v1/tokens/check | Checks the token again and changes nothing. |
POST /v1/tokens | Responds with 200 and the same token; a token of your own is checked again. A token turned off after 5 failed sweeps gets 409 token_needs_support. |
DELETE /v1/tokens/{chain_id}/{address} | A base token stays off: 204 again. A token of your own is gone already: 404 not_found, and nothing changes. |
PUT /v1/webhook | Sets the same settings again; the secret stays. |
PATCH /v1/settings | Sets the same values again. |
DELETE /v1/webhook | Responds with 404 not_found and changes nothing. |
GET requests | Change nothing. |
POST /v1/webhook/test is not idempotent: each call queues another test event.