from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.tokenized_assets.tokenized_assets_order(from_token="<value>", to_token="<value>", amount="578.28", owner="<value>", slippage_bps=50)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.tokenizedAssets.tokenizedAssetsOrder({
fromToken: "<value>",
toToken: "<value>",
amount: "578.28",
owner: "<value>",
slippageBps: 50,
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/tokenized_assets/order \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "100",
"from_token": "USDC",
"owner": "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
"slippage_bps": 50,
"to_token": "TSLAon"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '100',
from_token: 'USDC',
owner: '0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B',
slippage_bps: 50,
to_token: 'TSLAon'
})
};
fetch('https://api.compasslabs.ai/v2/tokenized_assets/order', 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.compasslabs.ai/v2/tokenized_assets/order",
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' => '100',
'from_token' => 'USDC',
'owner' => '0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B',
'slippage_bps' => 50,
'to_token' => 'TSLAon'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/tokenized_assets/order"
payload := strings.NewReader("{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/tokenized_assets/order")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/tokenized_assets/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}"
response = http.request(request)
puts response.read_body{
"approval_safe_tx_eip712": {
"domain": {
"chainId": 1,
"verifyingContract": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F"
},
"message": {
"baseGas": "0",
"data": "0x095ea7b3000000000000000000000000111111125421ca6dc452d289314280a0f8842a65ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "0",
"operation": 0,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "data",
"type": "bytes"
},
{
"name": "operation",
"type": "uint8"
},
{
"name": "safeTxGas",
"type": "uint256"
},
{
"name": "baseGas",
"type": "uint256"
},
{
"name": "gasPrice",
"type": "uint256"
},
{
"name": "gasToken",
"type": "address"
},
{
"name": "refundReceiver",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
}
]
}
},
"order": {
"extension": "0x000000a4000000a4000000a40000005200000000",
"order_hash": "0x14459af3a06abf6f7a0d3c2c1fa3b64d2e1b8a7c5e3d2b1f0a9876543210596b",
"order_message": {
"maker": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F",
"makerAsset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"makerTraits": "0",
"makingAmount": "100000000",
"receiver": "0x399740157391a9f1bf4e9921a8834f9bc8f2678e",
"salt": "102030405060708090",
"takerAsset": "0xf6b1117ec07684D3958caD8BEb1b302bfD21103f",
"takingAmount": "281678000000000000"
},
"quote_id": "9afa6d80-9216-4bcd-b762-87151f9dae51",
"safe_message_eip712": {
"domain": {
"chainId": 1,
"verifyingContract": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F"
},
"message": {
"message": "0x14459af3a06abf6f7a0d3c2c1fa3b64d2e1b8a7c5e3d2b1f0a9876543210596b"
},
"primaryType": "SafeMessage",
"types": {
"EIP712Domain": [
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeMessage": [
{
"name": "message",
"type": "bytes"
}
]
}
}
},
"quote": {
"est_fill_seconds": 180,
"fee": {
"amount_usd": "0.06",
"bps": 6
},
"input": {
"amount": "100",
"amount_usd": "100.00",
"contract_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC"
},
"output": {
"amount": "0.281678",
"amount_usd": "99.94",
"contract_address": "0xf6b1117ec07684D3958caD8BEb1b302bfD21103f",
"symbol": "TSLAon"
}
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Build an order
Build a tokenized-equity (Ondo) buy/sell order; the product account is the maker.
Returns everything needed to place the order in one round-trip: a price quote,
a one-time token approval to sign (only until the settlement contract is
approved), and the order payload the owner signs off-chain. Only the approval
ever touches the chain — the signed order is relayed to market makers, never
broadcast. Equities only; RWA yield tokens use /transact/buy and
/transact/sell.
from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.tokenized_assets.tokenized_assets_order(from_token="<value>", to_token="<value>", amount="578.28", owner="<value>", slippage_bps=50)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.tokenizedAssets.tokenizedAssetsOrder({
fromToken: "<value>",
toToken: "<value>",
amount: "578.28",
owner: "<value>",
slippageBps: 50,
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/tokenized_assets/order \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "100",
"from_token": "USDC",
"owner": "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
"slippage_bps": 50,
"to_token": "TSLAon"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '100',
from_token: 'USDC',
owner: '0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B',
slippage_bps: 50,
to_token: 'TSLAon'
})
};
fetch('https://api.compasslabs.ai/v2/tokenized_assets/order', 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.compasslabs.ai/v2/tokenized_assets/order",
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' => '100',
'from_token' => 'USDC',
'owner' => '0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B',
'slippage_bps' => 50,
'to_token' => 'TSLAon'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/tokenized_assets/order"
payload := strings.NewReader("{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/tokenized_assets/order")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/tokenized_assets/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100\",\n \"from_token\": \"USDC\",\n \"owner\": \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n \"slippage_bps\": 50,\n \"to_token\": \"TSLAon\"\n}"
response = http.request(request)
puts response.read_body{
"approval_safe_tx_eip712": {
"domain": {
"chainId": 1,
"verifyingContract": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F"
},
"message": {
"baseGas": "0",
"data": "0x095ea7b3000000000000000000000000111111125421ca6dc452d289314280a0f8842a65ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "0",
"operation": 0,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "data",
"type": "bytes"
},
{
"name": "operation",
"type": "uint8"
},
{
"name": "safeTxGas",
"type": "uint256"
},
{
"name": "baseGas",
"type": "uint256"
},
{
"name": "gasPrice",
"type": "uint256"
},
{
"name": "gasToken",
"type": "address"
},
{
"name": "refundReceiver",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
}
]
}
},
"order": {
"extension": "0x000000a4000000a4000000a40000005200000000",
"order_hash": "0x14459af3a06abf6f7a0d3c2c1fa3b64d2e1b8a7c5e3d2b1f0a9876543210596b",
"order_message": {
"maker": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F",
"makerAsset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"makerTraits": "0",
"makingAmount": "100000000",
"receiver": "0x399740157391a9f1bf4e9921a8834f9bc8f2678e",
"salt": "102030405060708090",
"takerAsset": "0xf6b1117ec07684D3958caD8BEb1b302bfD21103f",
"takingAmount": "281678000000000000"
},
"quote_id": "9afa6d80-9216-4bcd-b762-87151f9dae51",
"safe_message_eip712": {
"domain": {
"chainId": 1,
"verifyingContract": "0x2ed5C9c14E1F8baA94CD3e9b5b6e3F8e3D27504F"
},
"message": {
"message": "0x14459af3a06abf6f7a0d3c2c1fa3b64d2e1b8a7c5e3d2b1f0a9876543210596b"
},
"primaryType": "SafeMessage",
"types": {
"EIP712Domain": [
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeMessage": [
{
"name": "message",
"type": "bytes"
}
]
}
}
},
"quote": {
"est_fill_seconds": 180,
"fee": {
"amount_usd": "0.06",
"bps": 6
},
"input": {
"amount": "100",
"amount_usd": "100.00",
"contract_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC"
},
"output": {
"amount": "0.281678",
"amount_usd": "99.94",
"contract_address": "0xf6b1117ec07684D3958caD8BEb1b302bfD21103f",
"symbol": "TSLAon"
}
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Body
Build a buy or sell order for a tokenized equity.
Token the sender is paying. Either an on-chain symbol (e.g. TSLAon), the literal USDC, or a 0x-prefixed token address.
"USDC"
"WETH"
"0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8"
Token the sender is receiving. Same accepted forms as from_token.
"USDC"
"WETH"
"0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8"
Human-readable amount of from_token to swap (decimal string). Decimals are applied server-side.
Wallet that owns the Tokenized Assets Account. The product account address is derived deterministically from this owner. The owner signs the EIP-712 payloads returned by this endpoint (the optional approval and the order itself).
Max acceptable slippage in basis points (1 bp = 0.01%). Range 1-5000 (0.01%-50%); defaults to 50 (0.5%). The upper bound is intentionally wide so callers can clear the wide auction floors quoted for thinly-traded tokenized stocks.
1 <= x <= 5000Response
Successful Response
Quote, optional approval payload, and the EIP-712 order to sign.
Preview of input/output amounts and fees for the proposed order.
Show child attributes
Show child attributes
Order metadata plus the EIP-712 payload to sign. The owner signs order.safe_message_eip712 and submits the resulting signature to /order/submit along with the rest of the order fields.
Show child attributes
Show child attributes
EIP-712 payload that authorizes a one-time max-approve of from_token to the settlement contract. Populated when the Tokenized Assets Account's existing allowance is below amount. The owner signs it, then it is broadcast via POST /v2/gas_sponsorship/prepare (or directly by the owner) to set the allowance on-chain. null when the allowance is already sufficient.
Show child attributes
Show child attributes
{
"domain": {
"chainId": 8453,
"verifyingContract": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"
},
"message": {
"baseGas": "0",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "7",
"operation": 1,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{ "name": "to", "type": "address" },
{ "name": "value", "type": "uint256" },
{ "name": "data", "type": "bytes" },
{ "name": "operation", "type": "uint8" },
{ "name": "safeTxGas", "type": "uint256" },
{ "name": "baseGas", "type": "uint256" },
{ "name": "gasPrice", "type": "uint256" },
{ "name": "gasToken", "type": "address" },
{
"name": "refundReceiver",
"type": "address"
},
{ "name": "nonce", "type": "uint256" }
]
}
}
Was this page helpful?