API Authentication
All GlueX Router API requests require proper authentication using an API key and integrator ID. This dual-authentication approach ensures secure access, enables comprehensive usage tracking, and applies appropriate rate limits based on your access tierGetting your API credentials
- Navigate to the GlueX Portal and complete the registration process by creating your account
- Navigate to the “API Key” section and click “Generate Key” to generate a new API key
- In the same dashboard, locate your unique integrator ID
For a detailed walkthrough of the complete registration process, refer to the
Get a GlueX API key –
Portal guide
Using the Credentials
Authentication Headers Every API request must include your API key in the request headers:uniquePID
parameter in the body of each API request:
Rate Limits and Access Tiers
GlueX provides tiered API access levels to accommodate diverse integration requirements, from initial prototyping and testing to high frequency, large scale production deployments. These tiers ensure fair resource allocation and optimal service performance for all partnersAccess Tiers Overview
To ensure the stability, reliability and equitable access of the Router API for all users, we implement a system of rate limits organized into distinct access tiers. These limits protect our infrastructure from abuse, manage system load efficiently and guarantee a high quality experience even during peak demand. Each access tier offers a specific API request rate, burst capacity and a corresponding level of support, tailored to different development and production needsTier | Requests Per Second (RPS) | Burst Capacity | Use Case |
---|---|---|---|
Basic | 3 | 3 | Ideal for initial development, proof of concept projects, testing and small scale application with infrequent API calls |
Growth | 10 | 30 | Suitable for mid sized production application, services and applications with moderate user traffic |
Premium | 20 | 50 | Designed for large scale production applications, real time trading interfaces and platforms requiring consistent high throughput |
Enterprise | Custom | Custom | Tailored solutions for high volume exchanges, large scale aggregators, institutional trading desks and partners with unique infrastructure requirements |
Understanding RPS and Burst Capacity
- Requests Per Second (RPS): This is the sustained rate at which your application can make API calls over a longer period. For example, a tier with 3 RPS can make, on average, 3 requests every second
- Burst Capacity: This represents the maximum number of requests your application can send in a very short spike above its sustained RPS limit before hitting a rate limit error. It acts as a buffer to absorb sudden, short term surges in traffic. Once the burst capacity is depleted, requests will be throttled back to the sustained RPS rate until the bucket refills
Upgrading your Tier
As your application scales and your API usage grows, GlueX offers seamless tier upgrades to meet your evolving demands. Higher tiers unlock significant advantages, including increased API throughput, enhanced reliability guarantees and dedicated supportPartners interested in upgrading their access tier are encouraged to reach out
directly to the GlueX team via our official Telegram
channel. During this process, we will discuss
your specific needs, projected API usage and provide tailored solutions
/v1/quote
. The /v1/quote
endpoint performs intensive onchain simulations, which are
resource heavy
Conversely, the /v1/price
endpoint is designed to be lightweight and highly performant for frequent polling. It provides rapid price estimates without deep onchain simulation
Best Practice:
/v1/price
should be the primary endpoint used in your application for displaying real time indicative prices and general market information/v1/quote
should be called only when a user is ready to execute a swap and requires precise, executable transaction data.
Benefits of Higher Tiers
- Increased Rate Limits: Access significantly higher RPS and burst capacities to support larger user bases and more demanding applications
- Service Level Agreements (SLAs): Enterprise and Premium tiers often come with formal SLAs, guaranteeing specific uptime, performance metrics and response times for critical issues
- Priority Support: Receive expedited assistance from our technical team, ensuring your queries and issues are addressed promptly
- Custom Integration Guidance: Benefit from dedicated technical consultations and integration support to optimize your application’s performance and integrate the features effectively
- Custom Pricing and Billing: For Enterprise partners, flexible pricing models can be arranged to align with your business operations
Whitelist Domains
GlueX provides an optional security feature that allows you to restrict API key usage to specific domains. This is particularly valuable for frontend integrations and helps prevent unauthorized usage of your credentials Configure- Navigate to the “Keys” page in the GlueX Portal
- Choose the API key you want to configure
- Add the domains you want to whitelist (eg:
gluex.xyz
) - Apply the whitelist settings
Error Codes
The Router API performs various validations and simulations to ensure that transactions are safe and executable before returning calldata. If a request fails validation or simulation, the API responds with a standardized error formatError Format
All API errors follow a consistent JSON structure for predictable error handling:Error Reference
Authorization Errors
Missing API Key- Cause: API key not provided in request headers
- Resolution: Ensure
x-api-key
header is included with valid API key - Common Scenarios: Missing header, empty header value
Domain Not Whitelisted
- Cause: Request originates from a domain not in your whitelist
- Resolution: Add the requesting domain to your whitelist in the portal
- Common Scenarios: New domain deployment, subdomain access, local development
Rate Limiting Errors
- Cause: Request rate exceeds your tier’s RPS or burst capacity limits
- Resolution: Implement proper rate limiting in your application or upgrade your tier
- Prevention Strategies:
- Implement exponential backoff retry logic
- Monitor your request patterns
- Consider tier upgrade for higher limits
- Use
/v1/price
for frequent polling instead of/v1/quote
Simulation Failure
If the transaction fails during pre-trade simulation (to prevent onchain reverts), the API will return:- Cause: The router was unable to find a valid routing path or execution strategy that would succeed based on the current market conditions, balances or configuration
- Common Reasons:
- Insufficient liquidity for the requested trade
- Token pair not supported on specified network
- Amount exceeds available liquidity
- Network congestion or temporary routing issues
- Resolution Strategies:
- Reduce trade amount
- Try different token pairs
- Check network status
- Retry after a brief delay
Validation Error
If the request contains any invalid parameter that is unrecognized or unsupported, the API will return:- Cause: Request contains unrecognized, unsupported, or malformed parameters
- Resolution: Validate all parameters against API specification
- Common Issues:
- Invalid token addresses
- Unsupported chain IDs
- Malformed amounts or addresses
- Missing required parameters