Overview
Complete API reference for DexAggregator endpoints
DexAggregator provides a RESTful API for optimal token swap routing. All endpoints return JSON responses and follow standard HTTP status codes.
Base URL
http://localhost:8081 # Local development
https://api.yourdomain.com # ProductionAPI Endpoints Overview
/api/v1/route/build
POST
Build optimal swap route automatically
/api/v1/route/custom
POST
Build custom swap route manually
/api/v1/chains
GET
Get supported blockchain networks
/api/v1/contracts
GET
Get contract addresses for a chain
/health
GET
Health check endpoint
Response Format
All API responses follow this structure:
Success Response
{
"code": 0,
"message": "success",
"data": {
// Response data
}
}Error Response
Common Parameters
Chain Identifiers
Binance Smart Chain
bsc
56
Ethereum
ethereum
1
Token Addresses
All token addresses must be:
Valid ERC-20 contract addresses
Checksummed (0x with proper casing)
42 characters long (including
0xprefix)
Amount Format
All token amounts must be in wei (smallest unit):
1 token with 18 decimals =
1000000000000000000wei0.5 tokens =
500000000000000000wei
Conversion:
Slippage Tolerance
Expressed in basis points (1 basis point = 0.01%):
10= 0.1%50= 0.5%100= 1%500= 5%
Deadline
Unix timestamp in seconds:
Rate Limiting
Authentication
Currently, the API does not require authentication for public endpoints. For production deployments, consider implementing:
API keys
IP whitelisting
OAuth 2.0
CORS
CORS is enabled for all origins in development. For production, configure allowed origins in your deployment.
Pagination
Pagination is not currently required as responses are single-item or small lists.
Versioning
The API uses URL versioning:
Current version:
/api/v1/Future versions:
/api/v2/, etc.
Breaking changes will always result in a new version number.
Error Codes
See the Error Codes page for a complete list of error codes and their meanings.
Next Steps
Explore specific endpoints:
Build Route (Auto) - Main endpoint for optimal routing
Custom Route - Manual route configuration
Get Chains - Supported networks
Get Contracts - Contract addresses
Health Check - Service status
Code Examples
Quick examples in different languages:
JavaScript / TypeScript
Python
Go
Need Help?
Check our FAQ or report an issue.
Last updated