USDC to EURC. Create one with POST /dapi/v1/swaps and sign it with your developer key.
A swap moves your own money. A session acting for a client can preview a swap but cannot create one, for either integration kind.
sourceAccount and destinationAccount take an account key or the acc_… id of a sub account (Sub account moves).
Preview a swap
POST /dapi/v1/swaps/preview returns the best price among the routes that serve the pair. Preview has no side effects.
Response: 200
Create and confirm
CallPOST /dapi/v1/swaps with the preview body plus publicKey and an Idempotency-Key. It prices the swap again and returns the approval.
Response: 201, Location: /dapi/v1/swaps/swp_9f2c1ab84d
authorization is debit, compare debit.sourceAddress, debit.address, debit.amount and debit.token with the swap you meant, and check debit.operation, before you sign (Debit contents). Fields: Create a transfer between the client’s own accounts.
Sign approval.payload and post it to POST /dapi/v1/swaps/{swapId}/confirm (Signing).
Confirm returns 202 with a pollUrl. Read GET /dapi/v1/swaps/{swapId} until status is settled or failed. While the approval is open, retry as described in Retrying a confirm. Once the approval is used or expired, confirm returns 409 swap_not_confirmable, so read the swap.
Read a swap
GET /dapi/v1/swaps/{swapId} returns the status and the quote the swap was fixed at.
Response: 200
FDIC_* account has a transactionId once it is on the ledger. Between token accounts transactionId is null, so match the swap on transactionHash. Fields: Retrieve a transfer between the client’s own accounts.
To pay out of FDIC_USD without a swap, see Payouts.
Sub account moves
A move is a swap with theacc_… id of a sub account as sourceAccount or destinationAccount. It uses the same routes, the same swp_… resource and the same confirm.
The response and
GET /dapi/v1/swaps/{swapId} return the ids as sent. The exit for a token a sub account does not hold, the RD rules and the ledger rows of a move are on Sub accounts.
Statuses
Refusals
Other codes: Errors.