Convert
Convert endpoints provide estimates for token conversions by aggregating rates across supported exchanges—even for pairs without direct listings.
Convert vs. Trade Quote Endpoints
Convert endpoints can quote any token pair—even if it isn’t natively traded—by routing through secondary or tertiary markets.
- Flexibility: Supports any token pair via secondary or tertiary routes.
- Accuracy: May under- or overestimate the cost for large sizes since they ignore real order-book depth.
- Trade quote endpoints: Only direct market routes on an exchange; provide exact, order-book-based quotes for specified sizes.
Prefer Token IDs to Avoid Ambiguity
Specify pairs using:
- Token IDs (e.g.,
7312
for ETH,5898
for USDT) - Symbols (e.g.,
ETH
/USDT
)
For token IDs, see Token Information.
Endpoint Overview¶
Method | Endpoint | Description |
---|---|---|
GET | /v1/convert/rate/{baseTokenId}/{targetTokenId} |
Fetch conversion rate using token IDs. |
GET | /v1/convert/rate/symbols/{baseSymbol}/{targetSymbol} |
Fetch conversion rate using symbols. |
GET | /v1/convert/{baseTokenId}/{targetTokenId} |
Converts an amount between token IDs. |
GET | /v1/convert/symbols/{baseSymbol}/{targetSymbol} |
Converts an amount between symbols. |
Retrieve Conversion Rate¶
Purpose: Retrieves the conversion rate for two tokens, identified either by token IDs or by symbols.
Path Parameters (by Token IDs):
Name | Type | Mandatory | Description |
---|---|---|---|
baseTokenId | number | Yes | Token ID of the base token. |
targetTokenId | number | Yes | Token ID of the target token. |
Path Parameters (by Symbols):
Name | Type | Mandatory | Description |
---|---|---|---|
baseSymbol | string | Yes | Symbol of the base token. |
targetSymbol | string | Yes | Symbol of the target token. |
Example Requests
Example Response
{
"data": 1972.7, // Current conversion rate
"success": true,
"timestamp": 1742550355130,
"requestId": "c08700d6-cc6a-4d16-b611-0cad2ae08ca5",
"message": "",
"error": null
}
Convert Tokens¶
Purpose: Converts a specified amount from one token to another, using either token IDs or symbols.
Path Parameters (by Token IDs):
Name | Type | Mandatory | Description |
---|---|---|---|
baseTokenId | number | Yes* | Token ID of the base token. |
targetTokenId | number | Yes* | Token ID of the target token. |
Path Parameters (by Symbols):
Name | Type | Mandatory | Description |
---|---|---|---|
baseSymbol | string | Yes* | Symbol of the base token. |
targetSymbol | string | Yes* | Symbol of the target token. |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
amount | number | Yes | Amount of base token to convert. |
side | string | No | Conversion direction (BUY or SELL ). Default is BUY . |
Example Requests
GET /v1/convert/7312/5898?amount=0.1&side=BUY
GET /v1/convert/symbols/ETH/USDT?amount=100&side=SELL
Example Response
{
"data": {
"conversionRate": 1975.64, // Rate used for conversion
"convertedAmount": 395.128 // Amount converted
},
"success": true,
"timestamp": 1742550205147,
"requestId": "ceeac1fc-dfb3-46a9-b21f-2da73b4bd9f3",
"message": "",
"error": null
}
Notes & Best Practices¶
- Ensure required parameters (amount) are always provided.
- Always specify conversion side explicitly to avoid confusion.
- Cross-verify conversion rates regularly as they fluctuate frequently.
- Use symbol endpoints (
symbols
) for easier readability, token ID endpoints for precision. - Check the timestamp provided to ensure the data freshness.