Convert
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
GET /v1/convert/rate/{baseTokenId}/{targetTokenId}
GET /v1/convert/rate/symbols/{baseSymbol}/{targetSymbol}
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
GET /v1/convert/rate/7312/5898
GET /v1/convert/rate/symbols/ETH/USDT
Example Response
{
"data": 1972.7, // Current conversion rate
"success": true,
"timestamp": 1742550355130,
"requestId": "c08700d6-cc6a-4d16-b611-0cad2ae08ca5",
"message": "",
"error": null
}
Convert Tokens
GET /v1/convert/{baseTokenId}/{targetTokenId}
GET /v1/convert/symbols/{baseSymbol}/{targetSymbol}
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.