API & On-Chain Reference
Learn more about the API and how to call an onchain swap in your backend
The Emigro On-Chain API provides a standardized interface for developers to fetch real-time swap quotes and generate executable calldata for direct interaction with Emigro’s smart router contracts. It serves as a middleware layer between front-end applications and on-chain DEX infrastructure, abstracting away complex router logic, path discovery, and encoding requirements.
Developers can:
Fetch live quotes for token pairs across supported DEX adapters.
Automatically build calldata compatible with Emigro’s router contracts.
Execute swaps securely from any wallet infrastructure (SCA or EOA).
Track usage and rate limits via API keys.
In short — you ask for a quote, receive swap parameters, build calldata, approve the router, and execute.
However, what makes Emigro truly unique is its modular design: while the API simplifies quoting and calldata generation, these steps are not mandatory for performing swaps. The calldata produced by the API fully conforms to the router’s ABI, which means developers can build and execute transactions entirely on-chain — without relying on the Emigro API — as long as they adhere to the correct ABI structure and contract parameters.
This flexibility makes Emigro ideal both for off-chain integrations that prefer API automation and for purely on-chain systems, aggregators, or autonomous agents that construct calldata locally.
URL Base
https://api.emigro.co
https://api.emigro.coFlow Summary
1️⃣ Quote
→ Request a swap quote using /public/emigroswap/quote.
→ Receive the best route, estimated output, slippage guardrails, and route metadata.
2️⃣ Build Transaction
→ Send those quote parameters to /public/emigroswap/buildTransaction.
→ Get back ABI-encoded calldata (function, parameters, routerAddress) ready for on-chain execution.
3️⃣ Approve → Approve the router to spend the input token (if not already approved).
4️⃣ Swap → Submit the transaction to the router with the provided calldata. → Tokens are swapped on-chain according to the quoted parameters.
This architecture ensures consistent execution and slippage control, while allowing developers to retain full sovereignty over how and when the transaction is broadcast — either through the Emigro API or entirely on-chain.
Supported Chains
Base
Mainnet
8453
0x6b0e33f464dD297cf997DfA96D694aFC153e7F6F
Polygon
Mainnet
137
0x65b192d8a580744AC8c6998D1a9A24929Bb2f604
(More chains coming soon)
All quotes, calldata, and router addresses currently reference Base Mainnet (chainId: 8453) by default.
Last updated

