Price a transfer between the client's own accounts
curl --request POST \
--url https://api.example.com/swaps/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.example.com/swaps/preview"
payload = {}
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({})
};
fetch('https://api.example.com/swaps/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"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"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Swaps
Price a transfer between the client's own accounts
Compare every route that can serve this pair of accounts and return the best price. Nothing is booked with a provider and nothing is signed.
POST
/
swaps
/
preview
Price a transfer between the client's own accounts
curl --request POST \
--url https://api.example.com/swaps/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.example.com/swaps/preview"
payload = {}
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({})
};
fetch('https://api.example.com/swaps/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"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"
}
}{
"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.
Example:
"cl_9f2c1ab84d7e4f1fa3c65b0e7d9a2c41"
Body
application/json
Account the money leaves.
Available options:
USDC, EURC, FDIC_USD Account the money lands on.
Available options:
USDC, EURC, FDIC_USD Exact amount to debit from the source account.
Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Example:
"500.00"
Exact amount the destination account should receive.
Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Example:
"500.00"
Response
Successful Response
Account the money would leave.
Available options:
USDC, EURC, FDIC_USD Account the money would land on.
Available options:
USDC, EURC, FDIC_USD Best price available for this move right now.
Show child attributes
Show child attributes
Was this page helpful?