LiquidView API: Getting Started Guide
Everything you need to start using the LiquidView API — from generating your key to making your first request and understanding the response format.
What the LiquidView API Offers
LiquidView's API gives developers and traders programmatic access to real-time and historical execution cost data across all major decentralized perpetual exchanges. Where the LiquidView web application provides a visual interface for comparing execution costs, the API enables you to integrate this data directly into your trading systems, analysis scripts, custom dashboards, and automated bots.
The core value of the API is that it abstracts away the complexity of monitoring order books, spreads, and fees across more than a dozen exchanges simultaneously. Rather than building and maintaining integrations with each exchange's individual data APIs, you make a single call to LiquidView and receive a unified, normalized response with execution cost data pre-computed for any order size you specify.
- Real-time execution cost data: All-in cost in basis points for any supported token and order size, broken down into fee, spread, and price impact components.
- Multi-exchange comparison: A single request returns cost data across all exchanges that list the requested token, sorted and normalized for direct comparison.
- Historical data: Access time-series execution cost data to analyze how costs have evolved and identify long-term trends.
- Token discovery: Query the full list of supported tokens and their available exchanges.
- Size-aware pricing: Pass any order size and receive cost estimates calibrated to that specific notional value, accounting for the non-linear relationship between size and price impact.
The LiquidView API uses standard REST conventions with JSON responses. Any language or tool that can make HTTP requests can use the API — from Python and JavaScript to curl and Postman. There is no proprietary SDK required, though wrapper libraries are available for Python and TypeScript.
Getting Your API Key: Step by Step
Access to the LiquidView API requires an API key associated with your account. The key authenticates your requests and ties usage to your account's rate limit tier. Here is how to obtain your key.
- Step 1 — Create or log into your LiquidView account: Navigate to liquidview.io and sign in. If you do not have an account, the registration process requires only an email address and takes under two minutes.
- Step 2 — Navigate to API settings: From your account dashboard, click on your profile icon in the top right, then select "API Access" from the dropdown menu. This opens the API management panel.
- Step 3 — Generate a new key: Click "Generate New API Key". You will be prompted to give the key a descriptive name (e.g., "trading-bot-production" or "analysis-script"). Naming your keys helps when you need to identify which key is responsible for specific usage or when rotating keys.
- Step 4 — Copy and store the key immediately: Your API key is shown only once at generation time. Copy it and store it securely in your password manager or secrets management system. If you lose the key, you will need to generate a new one — there is no way to retrieve a key after the initial display.
- Step 5 — Set your key as an environment variable: In your development environment, add the key as LIQUIDVIEW_API_KEY to your .env file or shell profile. In production, add it to your hosting platform's environment variable settings.
Treat your API key like a password. Do not share it, do not commit it to version control, and do not include it in client-side code. If you suspect your key has been exposed, revoke it immediately from the API settings panel and generate a replacement.
Authentication
All API requests must include your API key in the Authorization header using the Bearer token scheme. This is the standard HTTP authentication pattern used by most modern REST APIs.
- # curl example
- curl -H "Authorization: Bearer YOUR_API_KEY" \
- "https://api.liquidview.io/v1/tokens"
- # Python example
- import requests
- headers = {"Authorization": "Bearer YOUR_API_KEY"}
- response = requests.get("https://api.liquidview.io/v1/tokens", headers=headers)
- # JavaScript example
- const response = await fetch("https://api.liquidview.io/v1/tokens", {
- headers: { "Authorization": `Bearer ${process.env.LIQUIDVIEW_API_KEY}` }
- });
Requests without a valid Authorization header will receive a 401 Unauthorized response. Requests with a valid key that exceed the rate limit will receive a 429 Too Many Requests response with a Retry-After header indicating how long to wait before retrying. Both of these error conditions should be explicitly handled in any production code.
Your First Request and Understanding the Response
The most commonly used endpoint is /token/{TOKEN}, which returns real-time execution cost data for a specific token across all supported exchanges. Make your first call with BTC at a $10,000 order size to see the full response structure.
- curl -H "Authorization: Bearer YOUR_API_KEY" \
- "https://api.liquidview.io/v1/token/BTC?size=10000"
The response is a JSON object with the following structure:
- {
- "token": "BTC",
- "size_usd": 10000,
- "timestamp": "2026-03-31T08:00:00Z",
- "exchanges": [
- {
- "name": "hyperliquid",
- "display_name": "Hyperliquid",
- "fee_bps": 2.5,
- "spread_bps": 0.8,
- "impact_bps": 0.1,
- "total_cost_bps": 3.4,
- "available": true
- },
- ...
- ]
- }
The exchanges array is pre-sorted by total_cost_bps ascending — the cheapest exchange appears first. Each entry includes the fee component (explicit exchange trading fee), spread component (half the bid-ask spread, representing the cost of crossing), and price impact component (slippage from consuming order book depth). These three components sum to total_cost_bps, which is the true all-in execution cost for one side of the trade at the specified size.
Endpoint Overview
The LiquidView API exposes three primary endpoints covering the full range of common use cases: token discovery, current cost data, and historical data.
- GET /v1/tokens — Returns a list of all tokens supported by the API. Each entry includes the token symbol, full name, and an array of exchange names that list a perpetual for that token. Use this endpoint to discover available tokens and to build dynamic token selector UIs.
- GET /v1/token/{TOKEN} — Returns real-time execution cost data for the specified token across all exchanges that list it. Accepts an optional size query parameter (default: 10000). The response includes the exchanges array described above. This is the endpoint you will use most frequently — in bots, dashboards, and analysis scripts.
- GET /v1/history/{TOKEN} — Returns time-series historical execution cost data for the specified token. Accepts optional parameters: exchange (filter to a specific exchange), from and to (ISO 8601 timestamps for the time range), and interval (data granularity: 1h, 6h, 1d). Returns an array of cost snapshots over the requested period. Use this for trend analysis and backtesting routing logic.
For most real-time applications, you only need the /token/{TOKEN} endpoint. Reserve /tokens for building configuration UIs and /history/{TOKEN} for analytical work where you want to study cost trends over time.
Rate Limits, Common Patterns, and Troubleshooting
LiquidView API rate limits are applied per API key. The standard tier allows up to 60 requests per minute across all endpoints. Exceeding this limit returns a 429 response with a Retry-After header. Higher rate limit tiers are available for teams with high-frequency use cases — contact the LiquidView team for details.
- Batch your requests: If you need costs for multiple tokens, space your requests over the available time window rather than sending them all simultaneously. For 3 tokens at 5-second intervals, you use 3 requests per 15-second window — well within any rate tier.
- Cache responses at the application layer: For a dashboard showing the same token to many users, cache the API response for 10–15 seconds before making a new request. This can reduce your effective request rate by 10x or more with negligible impact on data freshness.
- Handle 429 responses with backoff: When you receive a 429, respect the Retry-After header value. Do not immediately retry — wait the specified number of seconds before the next request.
- Monitor your request count: Log the number of API calls your application makes per minute. If you are consistently near the limit, investigate whether caching or batching can reduce your request rate before upgrading your tier.
Common troubleshooting issues: A 401 error means your API key is missing or malformed — double-check that the Authorization header is formatted exactly as "Bearer YOUR_KEY" with no extra spaces or characters. A 404 on a token endpoint means the token symbol is not recognized — use the /tokens endpoint to verify the exact symbol format used by the API (e.g., "BTC" not "BTCUSD" or "BTC-PERP"). A 200 response with an empty exchanges array means the requested token is not currently listed on any supported exchange — this is rare but possible for very new or recently delisted tokens.
See it in action
Compare execution costs across 9+ DEX perpetuals in real-time with LiquidView.
Related Articles
How to Integrate Execution Cost Data Into Your Trading Strategy
A practical guide to making execution cost data a first-class input in your trading strategy — pre-trade analysis, real-time routing, post-trade review, and full API integration.
Building a Smart Order Router in JavaScript
Step-by-step guide to building a smart order router in Node.js using the LiquidView API. Full code, error handling, caching, and deployment included.
Comparing DEX APIs: Data Quality and Coverage
A comprehensive comparison of DEX data APIs — what data is available, the limitations of direct exchange APIs, aggregator options, and why execution cost data is uniquely hard to get.
How LiquidView Collects Execution Cost Data
An inside look at LiquidView's data pipeline — how order book simulation works, what data is stored, the architecture behind the API, and the accuracy and limitations of the approach.
