The custody gateway routes live under / in the custodyOps operation group of the Platform API. This guide covers add-on setup, then walks through deposit and withdrawal flows in order. See Deposit and withdrawal stages for every stage and transition rule, and Custody gateway for the conceptual model.
Before you call
- Licensed module: These routes belong to the “Self-custody” licensed module, controlled by
features.custodyOps(on by default). If disabled for the deployment, the routes return404. If disabled for an organisation, reads continue and writes return403platform.module.DISABLED(DALP-20531). - Authentication and step-up: Writes authenticated with a Console session include
walletVerificationwhen a wallet factor is set. Programmatic writes authenticated withX-Api-KeyomitwalletVerification. Clearing a client flag and setting up or rotating signer wallets send no on-chain transaction but still require wallet verification on session calls. Adding an operator note requires neither. - Async settlement and idempotency: On-chain writes return
202with a status URL to poll, or200whenPrefer: wait=Nsettles in time. SendIdempotency-Keyso retries never duplicate writes. See Idempotency and async settlement. - Roles: The deposit, withdrawal and unsupported-transfer routes and the pause, unpause and close route admit a caller whose wallets hold a gateway role (Manager, Screener or Keeper) or are registered to the gateway's client identity. An organisation owner or platform administrator who holds no gateway role gets
404. Each transition checks the wallet that signs it for the role its contract call requires and otherwise returns403 GATEWAY_naming that role. On a gateway with a screener override, only the override wallet counts as screener. The client signs with any wallet registered to its identity. The bound client wallet only drivesROLE_ REQUIRED GET /gateways/.mine
Set up the add-on
The write routes below need the gateway Manager role on the wallet that signs the write, not an organisation role. The signer routes are the exception, and Set up the keeper and screener lists their roles. Two writes admit one more caller: a Screener removes a gateway's approved source (on a gateway with a screener override, only the override wallet), and the gateway's client binds its client wallet from a wallet registered to its identity. Any other caller, an organisation owner or platform administrator included, gets 403 GATEWAY_ naming the roles the write accepts, and nothing is queued. The reads depend on the roles your wallets hold on chain, not on your organisation role:
- Factory, coins, profiles and settings: Any wallet of yours that holds a system role, a token role, a gateway role or the add-on's permission role can read them, including the settings of a gateway that the next bullet hides. Other callers, investors included, get
403 ADMIN_(ACCESS_ REQUIRED DALP-0032). The factory response lists the gateway roles of all your wallets incallerRolesand the roles of the wallet you act with inexecutorRoles, which is the wallet every write signs with. Each field is left out when its role lookup fails. A role incallerRolesbut not inexecutorRolessits on another wallet of yours: the Console keeps the write buttons off and asks you to act with the wallet that holds it. - Gateways: A wallet with the manager or keeper role can read every gateway of your organisation's system. A wallet with only the screener role reads every gateway without a screener override. Other callers see only the gateways where one of their identities is the client, or where one of their wallets is the screener override. The list returns an empty page and a single gateway returns
404for anything else.
In the Console, use Set up the custody gateway. Reads come from indexed chain data and can lag briefly after a write. If no custody gateway add-on is deployed on the network, routes return 404 GATEWAY_.
Before queueing any write, the platform simulates the call from the signing wallet. If the add-on checker requires multi-manager approval, the route returns 422 GATEWAY_ with the calls to propose and their hashes, queueing nothing. The route checks wallet verification after that simulation, so a write the checker holds returns GATEWAY_ even with no walletVerification. Send the code only when you propose the held calls or when the route answers WALLET_. The signer set-up and rotate routes check wallet verification first.
After the required gateway managers approve those calls on Approvals, the proposer resends the original request. See Approvals through the add-on checker. A contract revert returns 422 GATEWAY_ with data.revert, and enabling wait-for-custody on an incompatible receipt returns 422 GATEWAY_.
Bind the client wallet
A newly created gateway has no bound client wallet because a client identity can hold several wallets. Until one is bound, client routes return 404. A gateway manager can bind it from the gateway's Overview tab in the Console (Create a client gateway), or through this route. Bind a wallet owned by the gateway's client identity:
curl -sS -X PATCH "$DALP_API_URL/api/v2/addons/custody-gateways/gateways/$GATEWAY/client-wallet" \
-H "X-Api-Key: $DALP_API_KEY" \
-H "Idempotency-Key: bind-wallet-001" \
-H "Content-Type: application/json" \
-d '{
"clientWallet": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"
}'The response returns {"client. Once bound, GET /api/ returns the gateway and its deposit address to the client. Its paused is true while the gateway or the whole add-on is paused. Every mint verifies again that the bound wallet belongs to the client identity.
Walk a deposit
- The client calls
GET /api/and transfers coins to the gateway address, or records a deposit withv2/ addons/ custody- gateways/ gateways/ mine POST /api/usingv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits {"token": "0x.... An unsupported coin returns", "amount": "1000000"} 422 GATEWAY_withWRITE_ REFUSED data.revertset toCustody.Gateway Token Not Enabled - List deposits with
GET /api/or read one withv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits GET /api/. New deposits start atv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits/ {deposit Id} Quarantined. - The screener transitions the deposit with
POST /api/:v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits/ {deposit Id}/ transitions
curl -sS -X POST "$DALP_API_URL/api/v2/addons/custody-gateways/gateways/$GATEWAY/deposits/$DEPOSIT_ID/transitions" \
-H "X-Api-Key: $DALP_API_KEY" \
-H "Idempotency-Key: deposit-clear-001" \
-H "Content-Type: application/json" \
-d '{
"transition": "clear"
}'- A Screener sends
confirm-sender,clearandrefuse. A Manager or Screener sendsflagandunfreeze. A Manager sendsrenew-freeze,report,return,custody-returnedandrecover(which also takes"to"). A Keeper sendsretry. The client sendspull-backandexit. - Read
GET /api/for screening details, and post operator notes tov2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits/ {deposit Id}/ screening POST /api/.v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ deposits/ {deposit Id}/ notes
Walk a withdrawal
- The client reads the fee with
GET /api/, then creates a withdrawal withv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawal- fee- quotes POST /api/usingv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawals {"receipt. TheToken": "0x... ", "shares": "1000000", "payout": "0x... "} payoutaddress must be on the approved payout list. An unknown receipt token returns422 GATEWAY_.RECEIPT_ TOKEN_ NOT_ ENABLED - List and read withdrawals with
GET /api/andv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawals GET /api/. Read screening results atv2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawals/ {request Id} GET /api/.v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawals/ {request Id}/ screening - Transition the request with
POST /api/:v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ withdrawals/ {request Id}/ transitions
curl -sS -X POST "$DALP_API_URL/api/v2/addons/custody-gateways/gateways/$GATEWAY/withdrawals/$REQUEST_ID/transitions" \
-H "X-Api-Key: $DALP_API_KEY" \
-H "Idempotency-Key: withdrawal-collect-001" \
-H "Content-Type: application/json" \
-d '{
"transition": "collect"
}'- A Screener sends
clear. A Manager or Screener sendsreject,flagandunfreeze. A Manager sendsapprove,renew-freeze,report,returnandunfulfil. The client sendscancel,exitandset-payout(which also takes"payout"), and the client or a Keeper sendscollect. If the client's organisation account status blocks withdrawals,clear,approve,collect, andexiton a claimable request return422 custody, while unwinding transitions still work.Ops. withdrawal. PARTICIPANT_ RESTRICTED - Clients configure payout preferences with
PATCH /api/(v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ auto- claim {"enabled": true}) andPATCH /api/(v2/ addons/ custody- gateways/ gateways/ {gateway Address}/ default- payout {"payout": "0x...)."}
Reinstate a payout address
A client flag suspends the gateway's approved payout addresses, and clearing the flag does not reinstate them. After review, a gateway manager reinstates an address via its transitions route:
curl -sS -X POST "$DALP_API_URL/api/v2/addons/custody-gateways/gateways/$GATEWAY/approved-payouts/$ADDRESS/transitions" \
-H "X-Api-Key: $DALP_API_KEY" \
-H "Idempotency-Key: payout-reinstate-001" \
-H "Content-Type: application/json" \
-d '{
"transition": "reinstate"
}'The other transitions on this route are remove and suspend. List addresses with GET /api/ and add one with POST /api/.
Set up the keeper and screener
The keeper and screener sign automatic gateway calls from wallets provisioned through your custody provider. POST /api/ provisions a role's wallet and grants its role in one write:
curl -sS -X POST "$DALP_API_URL/api/v2/addons/custody-gateways/signers" \
-H "Cookie: $DALP_SESSION_COOKIE" \
-H "Idempotency-Key: signer-keeper-001" \
-H "Content-Type: application/json" \
-d '{
"role": "keeper",
"providerConfigurationId": "019c4d2e-7a10-7b3c-9e21-5f8a6b4c3d2e",
"walletVerification": {
"verificationType": "PINCODE",
"secretVerificationCode": "482913"
}
}'- Console session only: Signer setup and rotation require a Console-issued session and reject API keys with
403 WALLET_(ROLE_ ADMINISTRATION_ NEEDS_ CONSOLE_ SIGN_ IN DALP-200384). - Role grant response: The response includes
grant. Whengrant.statusis"queued", followgrant.statusUrl. When"settled",grant.transactionHashholds the transaction hash.nullmeans the wallet already exists past pending and nothing was sent. - Rotation:
POST /api/withv2/ addons/ custody- gateways/ signers/ {role}/ transitions {"transition": "rotate"}mints and grants the next wallet. The previous wallet keeps its role until revoked viaPOST /api/.v2/ addons/ custody- gateways/ role- members/ {role}/ {account}/ transitions - Required roles:
GET /api/requires the gateway permission manager role on the system or the add-on manager role. Setup and rotation require the gateway permission manager role (checked before key minting).v2/ addons/ custody- gateways/ signers PATCH /api/requires the add-on manager role. Other callers receivev2/ addons/ custody- gateways/ signers/ {role} 403 ADMIN_(ACCESS_ REQUIRED DALP-0032) withdata.reasonset tocustody-,gateway- signers- read custody-, orgateway- signer- provision custody-.gateway- signer- threshold - Access manager refusal: If the access manager still refuses the role grant, setup and rotation return
422 GATEWAY_(PERMISSION_ MANAGER_ REQUIRED DALP-9830).
Grant and revoke gateway roles
GET /api/ lists who holds the manager, keeper and screener roles on the add-on's access manager. A row's blocked is true when the system's role block list blocks the wallet: it keeps the role but cannot use it until it is unblocked. POST /api/ grants one role to a wallet, and POST …/ with {"transition": "revoke"} revokes it. Both writes need a Console-issued session and a wallet step-up.
Access comes from the indexed roles of your wallets, not your organisation role:
- List: answers when one of your wallets holds the add-on's permission role or a gateway role. Other callers, an owner or platform administrator included, get
403 ADMIN_(ACCESS_ REQUIRED DALP-0032). - Grant and revoke: the wallet you act with must hold the add-on's permission role, the same wallet the access manager checks. Otherwise the write returns
422 GATEWAY_(PERMISSION_ MANAGER_ REQUIRED DALP-9830) and queues nothing. - Before the first grant: a new add-on has no access manager. A caller whose wallet holds Gateway permission manager (
custody) on the system gets an empty list, and its first grant creates the access manager in the same write. Every other caller's list, and every revoke, returnsGateway Permission Manager 404 GATEWAY_.ADDON_ NOT_ DEPLOYED
Read review work and lists
Access to these reads comes from the indexed gateway roles of your wallets, not your organisation role.
- Review queue, screening, client flag and notes:
GET …/,gateways/ {gateway Address}/ review- queue …/,deposits/ {deposit Id}/ screening …/andwithdrawals/ {request Id}/ screening …/client-flaganswer a wallet with the gateway manager, keeper or screener role, and the gateway's screener override. The gateway's client gets an empty review queue and404on the others.POST …/needs the manager or screener role and returnsdeposits/ {deposit Id}/ notes 403 GATEWAY_otherwise. On a gateway with a screener override, only the override wallet counts as its screener, though a manager still qualifies.ROLE_ REQUIRED - Lists:
GET …/,approved- sources …/approved-payouts,…/whitelist-entriesand…/answer the same role holders and the gateway's client wallet.tokens/ {token Address}/ funding- sources - Everyone else: An owner or platform administrator without a gateway role gets
404 GATEWAY_, the same as for a gateway that is not indexed.NOT_ FOUND