curl --request POST \
--url https://api.coinlist.co/v1/ondo/swap/transaction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "100000000",
"chain": "ethereum_sepolia",
"symbol": "AAPLon",
"wallet_address": "0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512"
}
'import requests
url = "https://api.coinlist.co/v1/ondo/swap/transaction"
payload = {
"amount": "100000000",
"chain": "ethereum_sepolia",
"symbol": "AAPLon",
"wallet_address": "0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512"
}
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({
amount: '100000000',
chain: 'ethereum_sepolia',
symbol: 'AAPLon',
wallet_address: '0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512'
})
};
fetch('https://api.coinlist.co/v1/ondo/swap/transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coinlist.co/v1/ondo/swap/transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '100000000',
'chain' => 'ethereum_sepolia',
'symbol' => 'AAPLon',
'wallet_address' => '0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coinlist.co/v1/ondo/swap/transaction"
payload := strings.NewReader("{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.coinlist.co/v1/ondo/swap/transaction")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinlist.co/v1/ondo/swap/transaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}"
response = http.request(request)
puts response.read_body{
"action": "broadcast_transaction",
"data": "0x0c89df8c",
"expires_at": "2025-01-01T00:00:00.000000Z",
"fee": "0",
"notional_value": "100000000",
"pay_input_amount": "100000000",
"pay_input_decimals": 6,
"receive_output_amount": "264000000000000000",
"receive_output_decimals": 18,
"to": "0xff9c5ade32d9b4102469bd5f3817cb0061b25fec"
}{
"message": "<string>",
"type": "api_error",
"code": "<string>",
"errors": {},
"event_id": "<string>"
}Encode an Ondo swap for broadcast
Encodes the buy the user just confirmed and returns calldata their wallet can sign and broadcast, plus the amounts it commits to. This is the commit step: it consumes an attestation and the calldata expires, so call it once per confirmation and never poll it. Approve the swap contract for the full amount first; an allowance short of it is rejected here rather than reverting on-chain. The addresses are resolved from the offer, so the request names the asset, not the tokens.
curl --request POST \
--url https://api.coinlist.co/v1/ondo/swap/transaction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "100000000",
"chain": "ethereum_sepolia",
"symbol": "AAPLon",
"wallet_address": "0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512"
}
'import requests
url = "https://api.coinlist.co/v1/ondo/swap/transaction"
payload = {
"amount": "100000000",
"chain": "ethereum_sepolia",
"symbol": "AAPLon",
"wallet_address": "0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512"
}
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({
amount: '100000000',
chain: 'ethereum_sepolia',
symbol: 'AAPLon',
wallet_address: '0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512'
})
};
fetch('https://api.coinlist.co/v1/ondo/swap/transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coinlist.co/v1/ondo/swap/transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '100000000',
'chain' => 'ethereum_sepolia',
'symbol' => 'AAPLon',
'wallet_address' => '0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coinlist.co/v1/ondo/swap/transaction"
payload := strings.NewReader("{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.coinlist.co/v1/ondo/swap/transaction")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinlist.co/v1/ondo/swap/transaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100000000\",\n \"chain\": \"ethereum_sepolia\",\n \"symbol\": \"AAPLon\",\n \"wallet_address\": \"0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512\"\n}"
response = http.request(request)
puts response.read_body{
"action": "broadcast_transaction",
"data": "0x0c89df8c",
"expires_at": "2025-01-01T00:00:00.000000Z",
"fee": "0",
"notional_value": "100000000",
"pay_input_amount": "100000000",
"pay_input_decimals": 6,
"receive_output_amount": "264000000000000000",
"receive_output_decimals": 18,
"to": "0xff9c5ade32d9b4102469bd5f3817cb0061b25fec"
}{
"message": "<string>",
"type": "api_error",
"code": "<string>",
"errors": {},
"event_id": "<string>"
}Body
Ondo swap transaction params
The buy to encode: an asset, the wallet buying it, and what it pays.
The EVM chain to swap on. Only chains CoinList has deployed a swap contract on are accepted, which is narrower than both this enum and the chains the on-chain reads serve.
ethereum_sepolia, base_sepolia, ethereum_mainnet, base_mainnet "ethereum_sepolia"
Response
Successful response.
A signed, ready-to-broadcast Ondo swap and the amounts it commits to. Unlike the quote, this spends an attestation and expires, so call it once the user has confirmed and never on a timer.