curl --request POST \
--url https://api.example.com/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "<string>"
}
'import requests
url = "https://api.example.com/swaps"
payload = { "publicKey": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({publicKey: '<string>'})
};
fetch('https://api.example.com/swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "swp_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41",
"status": "awaitingSignature",
"idempotencyKey": "<string>",
"sourceAccount": "USDC",
"destinationAccount": "USDC",
"quote": {
"fromAmount": "500.00",
"fromCurrency": "<string>",
"toAmount": "500.00",
"toCurrency": "<string>",
"rate": "500.00",
"feeAmount": "500.00",
"feeCurrency": "<string>",
"minimumToAmount": "500.00",
"estimated": false,
"etaHours": 123,
"expiresAt": "2023-11-07T05:31:56Z"
},
"authorization": "debit",
"approval": {
"id": "<string>",
"payload": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"debit": {
"address": "<string>",
"amount": "500.00",
"amountAtomic": "<string>",
"token": "<string>",
"chainId": 123
},
"intent": {
"digest": "<string>",
"settles": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Create a transfer between the client's own accounts
Price a move between two accounts the client owns, reserve it idempotently and return the approval to sign. authorization says what that approval covers: a debit of the client’s wallet that funds the move, or an intent its smart wallet signs so the backend can settle it.
curl --request POST \
--url https://api.example.com/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "<string>"
}
'import requests
url = "https://api.example.com/swaps"
payload = { "publicKey": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({publicKey: '<string>'})
};
fetch('https://api.example.com/swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "swp_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41",
"status": "awaitingSignature",
"idempotencyKey": "<string>",
"sourceAccount": "USDC",
"destinationAccount": "USDC",
"quote": {
"fromAmount": "500.00",
"fromCurrency": "<string>",
"toAmount": "500.00",
"toCurrency": "<string>",
"rate": "500.00",
"feeAmount": "500.00",
"feeCurrency": "<string>",
"minimumToAmount": "500.00",
"estimated": false,
"etaHours": 123,
"expiresAt": "2023-11-07T05:31:56Z"
},
"authorization": "debit",
"approval": {
"id": "<string>",
"payload": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"debit": {
"address": "<string>",
"amount": "500.00",
"amountAtomic": "<string>",
"token": "<string>",
"chainId": 123
},
"intent": {
"digest": "<string>",
"settles": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The client account to act for, as a cl_… id. Omit it to act as yourself.
"cl_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
Your own key for this write, ^[A-Za-z0-9._:-]{1,128}$. A retry with the same key replays the first answer; the same key with a different request is refused.
"po-inv-2026-114"
Body
Account the money leaves.
USDC, EURC, FDIC_USD Account the money lands on.
USDC, EURC, FDIC_USD Base64 DER SubjectPublicKeyInfo for the registered P-256 developer key.
1 - 512Exact amount to debit from the source account.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"500.00"
Exact amount the destination account should receive.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"500.00"
Response
Successful Response
Stable public identifier for this swap.
^(?:swp_)?[A-Za-z0-9._:\-]{1,216}$"swp_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
Current public lifecycle status of the swap.
awaitingSignature, submitted, settled, failed Caller-supplied key that makes an identical retry return this result.
Account the money leaves.
USDC, EURC, FDIC_USD Account the money lands on.
USDC, EURC, FDIC_USD Price, fee and conversion terms fixed for this swap.
Show child attributes
Show child attributes
Whether the approval authorizes a balance debit or a signature over the swap's terms.
debit, intent Authorization to sign with the developer key before settlement.
Show child attributes
Show child attributes
Exact on-chain debit used to fund this swap.
Show child attributes
Show child attributes
Terms authorized by the signature, when this swap is not funded by a debit.
Show child attributes
Show child attributes
Was this page helpful?