The GlueX Router API provides a powerful and flexible interface for interacting with decentralized finance protocols. This section outlines the core endpoints you’ll use to fetch real time pricing estimates and generate the necessary transaction calldata for seamless onchain execution
Note: It is highly recommended to call the price endpoint before invoking the quote endpoint. This pattern is especially critical when building applications. The price endpoint can be polled periodically (eg: every few seconds) to provide users with realtime pricing information. Once the user approves the router contract and confirms the intention to swap, the quote endpoint should be called to retrieve the final calldata for onchain execution This architecture reduces unnecessary load on the quote infrastructure and ensures accurate, timely user interactions. Furthermore, GlueX plans to introduce market maker integrations on the quote endpoint, which will enhance price discovery and further optimize rate limits for this endpoint

POST /v1/price

Returns a price estimate for a token swap. This endpoint is intended for off chain estimation and does not include calldata or simulation metadata Description
  • Provides estimated input/output amounts
  • Supports partial fill logic
Example Request
POST /v1/price
x-api-key: your-api-key
Content-Type: application/json
Request Body (Example)
{
  "chainID": "ethereum",
  "inputToken": "0x...",
  "outputToken": "0x...",
  "inputAmount": "100000000",
  "userAddress": "0x...",
  "outputReceiver": "0x...",
  "uniquePID": "partner-xyz"
}
For detailed information on the request and response formats, refer the section here

POST /v1/quote

Returns a price quote along with transaction calldata for executing the trade onchain Description
  • Includes all price endpoint fields
  • Adds transaction-specific fields such as calldata and revert
  • Simulation is enabled by default (computeEstimate: true)
Example Request
POST /v1/quote
x-api-key: your-api-key
Content-Type: application/json
Request Body (Example)
{
  "chainID": "ethereum",
  "inputToken": "0x...",
  "outputToken": "0x...",
  "inputAmount": "100000000",
  "userAddress": "0x...",
  "outputReceiver": "0x...",
  "uniquePID": "partner-xyz",
  "computeEstimate": true
}
Additional Response Fields for quote
  • calldata: ABI encoded transaction data
  • revert: Boolean indicating if the trade would revert
  • computationUnits: Estimated gas
  • lowBalance: Indicates insufficient balance
  • blockNumber: Block number for simulation context
  • simulation: Raw trace/debug metadata
For detailed information on the request and response formats, refer the section here

These endpoints form the foundation of GlueX Router’s programmable interface, providing flexible and secure trade execution capabilities across supported networks