Quote
The Solana /sor/quote/v3 endpoint returns an optimized swap route and a pathId that can be assembled into transaction data.
Use the Solana API base URL:
https://solana-beta-api.odos.xyz
Request Body Parameters
| Parameter | Description | Required |
|---|---|---|
chainId | Chain ID for Solana mainnet. Use 101. | Yes |
inputTokens | Input token mint addresses and amounts in base units. | Yes |
outputTokens | Output token mint addresses and proportions. | Yes |
userAddr | Solana wallet address that will execute the swap. Required to receive a pathId for assembly. | Yes |
slippageLimitPercent | Slippage percent for path validity. Example: 0.5 = 0.5%. Default is 0.3. | No |
sourceWhitelist | Liquidity sources to exclusively use. Get supported source IDs from /info/liquidity-sources/101. | No |
disableRFQs | Accepted for compatibility. RFQs are currently disabled by default for Solana. | No |
sourceBlacklist | Accepted by the request schema, but source exclusion is not currently applied by Solana routing. Prefer sourceWhitelist when you need source filtering. | No |
referralCode | Referral code, if configured for your integration. | No |
referralFee | Referral fee percentage, if configured. | No |
referralFeeRecipient | Solana wallet address that receives referral fees. | No |
inputTokens
| Parameter | Description | Required |
|---|---|---|
tokenAddress | Solana token mint address in base58 format. | Yes |
amount | Token amount as a string in base units. | Yes |
outputTokens
| Parameter | Description | Required |
|---|---|---|
tokenAddress | Solana token mint address in base58 format. | Yes |
proportion | Output proportion. Use 1 for a single output token. | Yes |
Example: Generate a Quote
This example swaps 1 USDC for SOL on Solana mainnet. USDC has 6 decimals, so 1000000 is 1 USDC in base units.
- JavaScript
- Python
const quoteUrl = 'https://solana-beta-api.odos.xyz/sor/quote/v3';
const quoteRequestBody = {
chainId: 101,
inputTokens: [
{
tokenAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: '1000000'
}
],
outputTokens: [
{
tokenAddress: 'So11111111111111111111111111111111111111112',
proportion: 1
}
],
userAddr: 'MWd2HaFHzC7fPy4YKMbuJfUqrrn7HsouhPXrBwp8tff',
slippageLimitPercent: 0.5
};
const response = await fetch(quoteUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(quoteRequestBody)
});
const quote = await response.json();
console.log(quote);
import requests
quote_url = "https://solana-beta-api.odos.xyz/sor/quote/v3"
quote_request_body = {
"chainId": 101,
"inputTokens": [
{
"tokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "1000000",
}
],
"outputTokens": [
{
"tokenAddress": "So11111111111111111111111111111111111111112",
"proportion": 1,
}
],
"userAddr": "MWd2HaFHzC7fPy4YKMbuJfUqrrn7HsouhPXrBwp8tff",
"slippageLimitPercent": 0.5,
}
response = requests.post(quote_url, json=quote_request_body)
quote = response.json()
print(quote)
The quote endpoint does not perform server-side transaction simulation.
Response Body
| Parameter | Description |
|---|---|
pathId | Path ID used to assemble the transaction. Valid for 60 seconds. |
blockNumber | Solana slot or block context used for the quote. |
inTokens | Input token mint addresses. |
inAmounts | Input token amounts in base units. |
outTokens | Output token mint addresses. |
outAmounts | Estimated output token amounts in base units. |
inValues | USD values of input tokens, when available. |
outValues | USD values of output tokens, when available. |
netOutValue | Net USD output value, when available. |
priceImpact | Estimated price impact. |
percentDiff | Difference between input and output USD values. |
gasEstimate | Adapter estimate field. Solana quote requests do not require gas price input. |
traceId | Request trace ID, useful for support. |
Example Response
{
"inAmounts": ["1000000"],
"outAmounts": ["14645103"],
"inTokens": ["epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v"],
"outTokens": ["so11111111111111111111111111111111111111112"],
"inValues": [0.99969304],
"outValues": [0.9999168030098284],
"netOutValue": 0.9999168030098284,
"priceImpact": 0.08216074834850318,
"percentDiff": 0.08216074834849962,
"gasEstimate": 250000.0,
"blockNumber": 428813293,
"pathId": "example-path-id",
"traceId": "13b8c84d-4d21-4d2b-8579-71b1f8c0c0c7"
}
Use the pathId immediately with /sor/assemble. If the quote is more than 60 seconds old, request a new quote. Output amounts are returned in base units, such as lamports for SOL.