# DexPaprika API > This file is very large and may be truncated. For an index of this content, please refer to https://docs.dexpaprika.com/llms.txt instead. > Real-time DEX and on-chain cryptocurrency data: liquidity pools, swaps, token prices, transactions, and live SSE streams (token prices, pool reserves, transactions and candles) across 35 blockchain networks. REST API + streaming, no API key needed to start. # About us & media kit Source: https://docs.dexpaprika.com/about Learn what DexPaprika does, our connection to CoinPaprika, and download our media kit with logos and icons. ## What we do DexPaprika gives you clear, reliable DEX data, live and historical, so you can build with confidence. We bring together on-chain markets across major networks to power dashboards, trading systems, research, and AI agents. * We're a team based in Poznań, Poland, with years of crypto data experience * Our API gives fast access to tokens, pools, and DEX activity * Developer-first docs, SDKs, and examples * Consistent schema across supported blockchains ## Backed by CoinPaprika DexPaprika is built by the team behind CoinPaprika, a crypto data platform trusted since 2018. We started DexPaprika to offer a lightweight, purpose-built layer for DEX markets, backed by CoinPaprika’s reliability and uptime. * Our parent company: [CoinPaprika](https://coinpaprika.com) ## Media kit Download our branding kit with logos and icons for press and integration use. * **Media pack**: [Download media_pack.zip](https://dexpaprika.com/media_pack_dexpaprika.zip) ### FAQs > [accordion] Is DexPaprika data public to use? > > Yes. You can call it keyless at 10,000 credits per rolling 30 days, and a free registered key raises that to 100,000. Paid plans are on [pricing](https://dexpaprika.com/api/pricing). > [accordion] How is DexPaprika related to CoinPaprika? > > DexPaprika is built by the CoinPaprika team to focus specifically on on-chain DEX markets. > [accordion] Where can I find brand assets? > > Use the media pack above; it contains logos and icons for press/integrations. # Brand assets Source: https://docs.dexpaprika.com/ai-integration/brand-assets DexPaprika logos, colors, and the downloadable brand kit. Everything you need to use the DexPaprika mark correctly in an article, app, listing, or integration. Use these when you write about, integrate, or list DexPaprika. The whole kit (logos, symbol, app icons, social banner, and usage rules) is one download, and every logo is also linked individually below for direct use. > [card] [Download the brand kit (v1.0)](https://github.com/coinpaprika/dexpaprika-mcp/releases/download/brand-kit-v1.0/dexpaprika-brand-kit-v1.0.zip) > > Logos (color / white / black), the symbol in four variants, favicon and app > icons, a social banner, and the full README rulebook. SVG + PDF + PNG. ![DexPaprika logo: a green chili pepper in scanner brackets next to the DEXPAPRIKA wordmark, DEX in white and PAPRIKA in green, on a dark background](https://mintcdn.com/coinpaprikaspzoo/7Ja378iUUicebJDE/images/brand/dexpaprika-banner-1200x675.png?fit=max\&auto=format\&n=7Ja378iUUicebJDE\&q=85\&s=cdad67b268c8ef35f549119646acd142) ## Colors | Role | HEX | RGB | | - | - | - | | DexPaprika Green | `#00FF75` | 0, 255, 117 | | White | `#FFFFFF` | 255, 255, 255 | | Ink (logo black) | `#1C1C1C` | 28, 28, 28 | | Dark surface | `#252425` | 37, 36, 37 | Green is the brand. Use it for the pepper, the PAPRIKA wordmark, accents, and CTAs. It is made for dark backgrounds; on light backgrounds pair it with ink. ## Which file do I use | Your background | Logo | Symbol | | - | - | - | | Dark | [logo-color](/images/brand/dexpaprika-logo-color.svg) (primary) | [symbol-color-on-dark](/images/brand/dexpaprika-symbol-color-on-dark.svg) | | Light / white | [logo-black](/images/brand/dexpaprika-logo-black.svg) | [symbol-color-on-light](/images/brand/dexpaprika-symbol-color-on-light.svg) | | Single-color (dark) | [logo-white](/images/brand/dexpaprika-logo-white.svg) | [symbol-white](/images/brand/dexpaprika-symbol-white.svg) | | Single-color (light) | [logo-black](/images/brand/dexpaprika-logo-black.svg) | [symbol-black](/images/brand/dexpaprika-symbol-black.svg) | The primary logo is `dexpaprika-logo-color` (white DEX + green PAPRIKA), used on dark backgrounds by default. SVG is the master; use it wherever you can. ## Logo and symbol > [card] Full logo > > The symbol plus the DEXPAPRIKA wordmark. The default is the color logo (white DEX, green PAPRIKA), shown here on its dark surface. For light backgrounds use [logo-black](/images/brand/dexpaprika-logo-black.svg). > > ![DEXPAPRIKA full logo: a green chili pepper in scanner brackets, DEX in white and PAPRIKA in green. The default color mark, on a dark background.](https://mintcdn.com/coinpaprikaspzoo/7Ja378iUUicebJDE/images/brand/dexpaprika-logo-color.svg?fit=max\&auto=format\&n=7Ja378iUUicebJDE\&q=85\&s=e89c70836c637eeb79bb079d38ca76e1) > [card] Symbol > > The pepper-in-brackets mark alone, for avatars, app icons, and tight spaces. > > ![DexPaprika symbol: a green chili pepper inside green scanner brackets](https://mintcdn.com/coinpaprikaspzoo/7Ja378iUUicebJDE/images/brand/dexpaprika-symbol-color-on-light-512.png?fit=max\&auto=format\&n=7Ja378iUUicebJDE\&q=85\&s=01f160f4bcd89336277de498f5aa053a) ## Clear space and minimum size * **Clear space:** keep empty space around the logo equal to the height of one bracket corner (roughly the cap-height of the DEXPAPRIKA letters). * **Minimum size:** full logo no smaller than 120px wide on screen (25mm print); symbol no smaller than 24px. For anything smaller, use the app icons in the kit. ## Do and don't > [!NOTE] > > **Do** use the SVG, match the logo to the background, and keep clear space. > **Don't** recolor the green, stretch, rotate, add effects, place the logo on a > busy or low-contrast background, separate the pepper from its brackets, or > re-typeset the wordmark. There is no separate brand typeface: the wordmark is > vector artwork inside the logo files. ## Using the DexPaprika name and logo DexPaprika provides free DEX and on-chain data across 35 chains. You are welcome to use these marks to link to or credit DexPaprika as a data source. Please do not imply partnership or endorsement without permission. Questions: contact our Lead Developer Advocate Mateusz Sroka at [msroka@coinpaprika.com](mailto:msroka@coinpaprika.com). # Connect DexPaprika to ChatGPT Source: https://docs.dexpaprika.com/ai-integration/chatgpt-actions Give ChatGPT live DEX market data from DexPaprika. Add it as a custom GPT Action (works on any paid plan, keyless) or as a native MCP connector in ChatGPT Developer Mode (beta). There are two ways to give ChatGPT live DexPaprika data. Start with **GPT Actions**: it works on any paid ChatGPT plan, needs no API key, and is generally available. The **native MCP connector** is a second option, but it is a beta feature behind ChatGPT Developer Mode. ## Option 1: Custom GPT with an Action (recommended) A custom GPT with a DexPaprika Action queries networks, pools, tokens, and search from inside a ChatGPT conversation. Keyless, no beta. > [!NOTE] > > Ready-to-use OpenAPI schema: [`https://mcp.dexpaprika.com/openapi`](https://mcp.dexpaprika.com/openapi). It exposes **12 GET operations** (networks, pools, DEXes, pool details, OHLCV, transactions, token details, top tokens, batch prices, search, stats). All but transactions run keyless with no authentication; transactions need your own Dev, Pro or Enterprise key and answer `401` without one. **Prerequisites:** a paid ChatGPT plan (Plus, Pro, Team, or Enterprise). Custom GPTs are built on the web at [chatgpt.com](https://chatgpt.com); you cannot build one from the mobile app. **1. Create a custom GPT** On the web, open **Explore GPTs**, click **Create**, then open the **Configure** tab. Give it a name (for example "DexPaprika Crypto Assistant") and an instruction like: ``` You are a cryptocurrency and DeFi data assistant powered by DexPaprika. You can query blockchain networks, DEXes, liquidity pools, token prices, OHLCV history, and cross-chain search. Always call the action for live data rather than guessing, and include metrics like liquidity, 24h volume, and price when relevant. ``` **2. Add the DexPaprika action** Scroll to **Actions** and click **Create new action**. In the **Schema** field, choose **Import from URL** and paste: ``` https://mcp.dexpaprika.com/openapi ``` The builder lists the operations by `operationId`. **3. Set authentication to None** DexPaprika is keyless and read-only, so set **Authentication** to **None**. Optionally add a privacy policy URL ([dexpaprika.com/privacy-policy](https://dexpaprika.com/privacy-policy)) if the builder asks for one. **4. Test and save** Click **Test** on an operation, then try a prompt like "What are the top 5 liquidity pools on Ethereum by volume?". When it returns live data, **Save** the GPT and choose its visibility. > [!TIP] > > Building GPTs is web-only, and some ChatGPT mobile builds have had trouble firing Actions. If an Action does not respond on mobile, test it on desktop web. *** ## Option 2: Native MCP connector (Developer Mode, beta) ChatGPT can connect directly to our hosted MCP server as a custom connector. This exposes all 18 DexPaprika tools, but it is a **beta feature** and the setup UI changes between releases. > [!WARNING] > > As of 2026-07, custom MCP connectors live in **ChatGPT Developer Mode (beta)** and require a **paid plan** (Plus, Pro, Business/Team, Enterprise, or Edu). Free ChatGPT cannot add custom connectors. On workspace plans, an admin may need to enable Developer Mode first. The exact menu labels move between releases, so treat the steps below as a guide and confirm the current labels in-product. 1. Open **Settings → Connectors**, find the **Advanced** area, and enable **Developer mode**. 2. In the Connectors panel, choose **Create / Add custom connector**. 3. Paste the DexPaprika MCP server URL: `https://mcp.dexpaprika.com/sse`. If your Developer Mode build expects a Streamable HTTP endpoint instead, use `https://mcp.dexpaprika.com/streamable-http`. (Do not use `/mcp`.) 4. Set **Authentication** to **No authentication**, accept the trust confirmation, and save. 5. The DexPaprika tools then appear in chat. > [!NOTE] > > This is a general chat connector, not a Deep Research or Company Knowledge connector. Those require an MCP server to implement `search` and `fetch` tools in OpenAI's document-retrieval shape; DexPaprika has a `search` tool but no `fetch`, so it works through Developer Mode rather than those modes. *** ## Example prompts Once connected either way, try: * "Which blockchain networks does DexPaprika support?" * "What are the most liquid USDC/ETH pools across all networks?" * "What's the current price of SOL, and which DEX has the deepest liquidity for it?" * "Find newly created pools on Base with high trading volume" * "Compare 24h volume on PancakeSwap versus Uniswap" * "Get hourly OHLCV for the last day for the USDC/ETH pool on Uniswap V3" *** ## Troubleshooting > [accordion] The Action imports but returns errors > > Confirm the schema URL is exactly `https://mcp.dexpaprika.com/openapi`, that your plan supports custom GPTs (any paid plan), and that authentication is set to None. Recreate the Action if the import failed midway. > [accordion] The Action does not fire on mobile > > Build and test on desktop web. Some ChatGPT mobile builds have not reliably triggered Actions. > [accordion] I can't find Developer Mode / custom connectors > > It is a paid-plan beta and Free cannot add custom connectors. On workspace plans, an admin enables Developer Mode first. The toggle has moved between releases; look under Settings, Connectors, then an Advanced area. ## FAQs > [accordion] Which method should I use? > > Use a custom GPT with an Action. It works on any paid plan, needs no API key, and is not a beta feature. Use the native MCP connector only if you are in ChatGPT Developer Mode and want all 20 tools directly in chat. > [accordion] Do I need an API key? > > No. Both paths are keyless. The OpenAPI schema and the MCP server are public and read-only. The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). Limits for direct REST calls are on [rate limits](/knowledge-base/rate-limits). > [accordion] Can I use DexPaprika as a ChatGPT Deep Research connector? > > Not as-is. Deep Research connectors require `search` and `fetch` tools in OpenAI's document-retrieval schema. DexPaprika has `search` but no `fetch`, so it connects through Developer Mode instead. # DexPaprika Claude Code plugin - Quick setup guide Source: https://docs.dexpaprika.com/ai-integration/claude-code-plugin-guide Install the DexPaprika Claude Code plugin with two simple commands. Access real-time DEX data, liquidity pools, and token prices directly in Claude Code. Integrated MCP server with zero additional setup required. ## Tutorial overview Get instant access to real-time DeFi data in Claude Code. The DexPaprika Claude Code plugin provides built-in access to decentralized exchanges, liquidity pools, and token pricing, all with just two commands. > [!NOTE] > > The DexPaprika plugin is a **Claude Code plugin** with built-in MCP server access. Two commands. Zero additional setup. Real-time DEX data ready to use. *** ## What is the DexPaprika Claude Code plugin? The DexPaprika plugin is a native Claude Code plugin that gives you instant access to real-time decentralized exchange (DEX) data, liquidity pool analytics, and token pricing information across 35 blockchain networks. **Key features:** * Real-time DEX and pool data access * Token pricing and market analytics * Liquidity pool information * Coverage across 35 blockchain networks * Built-in MCP server (no separate installation needed) * Works in Claude Desktop and Cursor IDE * Keyless to start: query without an API key, and [register a free key](https://console.dexpaprika.com) later to raise the allowance from 10,000 credits to 100,000 *** ## Quick installation (2 commands) ### Step 1: Add the CoinPaprika marketplace ```bash theme={null} /plugin marketplace add coinpaprika/claude-marketplace ``` This adds access to the CoinPaprika marketplace where the DexPaprika plugin is hosted. ### Step 2: Install the DexPaprika plugin ```bash theme={null} /plugin install dexpaprika ``` Select **"Install now"** when prompted. The plugin bundles the MCP server, so there are no config files, environment variables, or API keys to set up. You now have real-time DeFi data across 35 networks in Claude Code. *** ## Using the plugin Once installed, you can ask Claude about DeFi data naturally: ### Example queries **Get pool information:** ``` What are the top liquidity pools on Ethereum by volume? ``` **Find token prices:** ``` Show me the current price of USDC and USDT on Ethereum. ``` **Analyze specific pools:** ``` Tell me about the USDC/ETH pool on Uniswap V3. ``` **Discover networks:** ``` What blockchain networks are supported by DexPaprika? ``` **Search for tokens:** ``` Find all pools that include the PEPE token. ``` Claude will automatically use the plugin to fetch real-time data and provide you with current market information. *** ## What's included in the plugin The DexPaprika plugin gives Claude access to: ### Network information * List of supported blockchain networks * Network metadata and specifications ### Decentralized exchanges (DEXes) * Available DEXes on each network * DEX volume and activity data * Protocol information ### Liquidity pools * Top pools by volume, price, transactions * Detailed pool metrics and token pairs * Pool fee structures * Recent transaction history (with your own Dev or Pro key) ### Token data * Current token prices in USD * Market data and liquidity information * Trading volume (5m, 15m, 1h, 6h, 24h) * Token metadata and explorer links ### Search functionality * Find tokens, pools, and DEXes across networks * Search by name, symbol, or address *** ## Verify installation After installing the plugin, you can check that it's working: ### Check available commands ``` /help ``` You should see the DexPaprika plugin listed among available commands. ### Test with a simple query ``` What networks does DexPaprika support? ``` Claude should return a list of supported blockchain networks (Ethereum, Solana, Base, Arbitrum, Polygon, etc.). *** ## Managing the plugin ### View installed plugins ``` /plugin ``` Select "Manage Plugins" to see all installed plugins and their status. ### Enable/disable the plugin ``` /plugin disable dexpaprika@coinpaprika ``` Disable the plugin if you want to reduce context usage, but keep it installed. ``` /plugin enable dexpaprika@coinpaprika ``` Re-enable the plugin when you need it again. ### Uninstall the plugin ``` /plugin uninstall dexpaprika@coinpaprika ``` Completely remove the plugin if you no longer need it. ### Update the plugin ``` /plugin marketplace update coinpaprika/claude-marketplace ``` Keep the plugin up-to-date with the latest features and improvements. *** ## Practical use cases ### Portfolio monitoring Ask Claude to track your tokens: ``` Monitor these tokens on Ethereum: - WETH (0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) - USDC (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) - DAI (0x6b175474e89094c44da98b954eedeac495271d0f) Show their current prices and highest volume pools. ``` ### DEX comparison ``` Compare trading volumes on Uniswap and Curve across Ethereum and Polygon. Which DEX has higher volume? Which pools are most active? ``` ### Market research ``` On Solana, what are the top 10 liquidity pools by 24h volume? For each pool, show token pairs, current price, volume in USD, and liquidity. ``` ### Token discovery ``` Find emerging tokens on Base network. Show the ones created recently with highest trading volume. ``` *** ## How it works The DexPaprika Claude Code plugin: 1. **Installs via the marketplace** - `/plugin install dexpaprika` 2. **Includes built-in MCP server access** - No separate MCP configuration needed 3. **Connects to DexPaprika API** - Fetches real-time DEX and token data 4. **Provides data to Claude** - Claude uses the data to answer your questions 5. **Returns formatted results** - Get market analysis, pool data, pricing information The MCP server is **built into the plugin**, so you don't need to install or configure it separately. *** ## Troubleshooting ### Plugin not showing up **Problem:** After installing, you don't see the DexPaprika plugin in `/help` **Solution:** 1. Run `/plugin marketplace update coinpaprika/claude-marketplace` 2. Restart Claude Code 3. Run `/plugin install dexpaprika` again ### Claude not using the plugin **Problem:** You ask about DEX data but Claude doesn't use the plugin **Solution:** * Ask explicitly: "Using DexPaprika, show me..." * Or phrase questions about pools, tokens, and DEXes specifically * Claude automatically recognizes plugin-relevant queries ### Plugin commands not working **Problem:** `/plugin` commands not recognized **Solution:** * Ensure you're in Claude Code (not another terminal) * Check that you're using the correct syntax: `/plugin install dexpaprika` * Verify marketplace is added: `/plugin marketplace add coinpaprika/claude-marketplace` ### No data returned **Problem:** Claude can't find data for your query **Solution:** * Check the network name (use lowercase: `ethereum`, `solana`, not `Ethereum`) * Verify token address format for your blockchain * Some tokens may not have pricing data; try with major tokens (WETH, USDC, DAI) *** ## Integration with CoinPaprika plugin The same marketplace also hosts the **CoinPaprika plugin** for global cryptocurrency market data. **Install both for complete crypto coverage:** ```bash theme={null} /plugin install dexpaprika /plugin install coinpaprika ``` **What you get:** * **DexPaprika plugin** - DEX pools, on-chain liquidity, tokens on specific networks * **CoinPaprika plugin** - Global crypto rankings, market cap, exchange data Use them together to compare DEX prices with exchange prices and find arbitrage opportunities. *** ## Next steps > [card] [API Reference](/api-reference/introduction) > > Explore the complete DexPaprika API documentation for all available data. > [card] [Batch Token Prices](/tutorials/batch-token-prices) > > Learn how to efficiently fetch prices for multiple tokens. > [card] [Fetch Token Prices](/tutorials/fetch-token-price) > > Step-by-step guide to querying token data via the API. > [card] [Plugin Marketplaces](https://docs.claude.com/en/docs/claude-code/plugin-marketplaces) > > Learn more about Claude Code plugins and marketplaces. *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve the plugin. ### FAQs > [accordion] How do I install the DexPaprika plugin? > > Two commands: > > 1. `/plugin marketplace add coinpaprika/claude-marketplace` > 2. `/plugin install dexpaprika` > > No configuration files or environment setup needed. > [accordion] Do I need an API key? > > No. Public read access is keyless, so you can start querying without authentication. > [accordion] Does the plugin work in Cursor IDE? > > Yes. The plugin works in both Claude Desktop and Cursor IDE. > [accordion] What's the difference between this plugin and the MCP server? > > The **Claude Code plugin** is the easy way to get started, just install and use. It includes built-in access to the MCP server. If you need advanced MCP configuration, you can set up the MCP server separately for more control, but the plugin handles this for you automatically. > [accordion] Can I disable the plugin without uninstalling? > > Yes. Run `/plugin disable dexpaprika@coinpaprika` to turn it off, then `/plugin enable dexpaprika@coinpaprika` to turn it back on. > [accordion] How often is the plugin updated? > > The plugin receives updates automatically from the marketplace. Run `/plugin marketplace update coinpaprika/claude-marketplace` to check for updates. > [accordion] What networks are supported? > > 35 networks including Ethereum, Solana, Base, Arbitrum, Polygon, Optimism, Fantom, Avalanche, Binance Smart Chain, and more. Ask Claude: "What networks are supported?" > [accordion] Can I use both DexPaprika and CoinPaprika plugins together? > > Yes! Install both for comprehensive crypto data: > > * `DexPaprika` - DEX and on-chain pool data > * `CoinPaprika` - Global market cap and exchange data > [accordion] What if Claude doesn't use the plugin automatically? > > Ask explicitly: "Using DexPaprika, show me..." or phrase your question about pools, tokens, and DEXes specifically. > [accordion] Is the plugin secure? > > The plugin only makes read-only API calls to public DexPaprika endpoints. No private data is transmitted. All queries are logged per standard Anthropic policy. # Connect DexPaprika MCP to Codex Source: https://docs.dexpaprika.com/ai-integration/codex Add the DexPaprika MCP server to OpenAI Codex CLI with one command. Give Codex live DEX market data across 35 blockchains over streamable HTTP. No API key needed to start. [OpenAI Codex CLI](https://github.com/openai/codex) supports MCP servers, so you can give it live DEX market data from DexPaprika. The hosted server is keyless, so there is no API key or token to configure. ## Add it with one command ```bash theme={null} codex mcp add dexpaprika --url https://mcp.dexpaprika.com/streamable-http ``` This writes the server to `~/.codex/config.toml`. Codex connects to it over streamable HTTP on the next run. ## Or configure it manually Add this to `~/.codex/config.toml`: ```toml theme={null} [mcp_servers.dexpaprika] url = "https://mcp.dexpaprika.com/streamable-http" ``` No `bearer_token_env_var` or OAuth options are needed. The DexPaprika API is keyless. ## Verify Start Codex and ask a question that needs live data: ``` Which blockchain networks does DexPaprika support, and what are the top pools on Base by volume? ``` Codex should call the DexPaprika tools and return current data. List configured servers any time with: ```bash theme={null} codex mcp list ``` ## What you get The server exposes 20 tools covering networks, pools, tokens, OHLCV, transactions, and cross-chain search. See the [MCP tools reference](/ai-integration/mcp-tools) for the full list, parameters, and the `getCapabilities` onboarding tool. ## Resources * [Hosted MCP server](/ai-integration/hosted-mcp-server) * [MCP tools reference](/ai-integration/mcp-tools) * [Codex CLI](https://github.com/openai/codex) ## FAQs > [accordion] Do I need an API key for Codex? > > No. The hosted DexPaprika MCP server is keyless, so there is no token or OAuth to configure. The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). Limits for direct REST calls are on [rate limits](/knowledge-base/rate-limits). > [accordion] Which transport does Codex use? > > Streamable HTTP. Point Codex at `https://mcp.dexpaprika.com/streamable-http`. The same server also serves SSE (`/sse`) for clients that prefer it. > [accordion] How do I remove the server? > > Delete the `[mcp_servers.dexpaprika]` block from `~/.codex/config.toml`, or run `codex mcp` to manage configured servers. # Use DexPaprika with CrewAI Source: https://docs.dexpaprika.com/ai-integration/crewai Give a CrewAI agent live DEX market data by connecting the keyless DexPaprika hosted MCP server with MCPServerAdapter. All 20 tools, zero custom code. CrewAI can use DexPaprika's live DEX data with no custom tool code: its `MCPServerAdapter` connects to our hosted MCP server and hands all 20 tools to your agents. Keyless, no signup. ## Install ```bash theme={null} pip install 'crewai-tools[mcp]' ``` ## Connect the hosted MCP server `MCPServerAdapter` pulls the tools from `https://mcp.dexpaprika.com/sse` and exposes them as native CrewAI tools: ```python theme={null} from crewai import Agent, Task, Crew, Process from crewai_tools import MCPServerAdapter server = {"url": "https://mcp.dexpaprika.com/sse", "transport": "sse"} with MCPServerAdapter(server, connect_timeout=60) as tools: analyst = Agent( role="DeFi Market Analyst", goal="Answer on-chain DEX questions with live data", backstory="Expert in liquidity and trading across 35 chains.", tools=tools, ) task = Task( description="Find the top WETH pools on ethereum and report their 24h volume.", expected_output="A short list of pools with 24h volume.", agent=analyst, ) Crew(agents=[analyst], tasks=[task], process=Process.sequential).kickoff() ``` The `with` block keeps the MCP connection open for the crew's run and closes it afterward. Use the `/sse` transport; it is the tested default. ## Tools and the rationale field All 18 DexPaprika tools appear as CrewAI tools: networks, pools, tokens, OHLCV, transactions, and cross-chain search. See the [MCP tools reference](/ai-integration/mcp-tools) for the full list. Every read tool takes a required `rationale` string (1-2 sentences on why you are calling it). It is part of each tool's schema, so a capable model fills it automatically. If a smaller model returns validation errors, prompt it to include a short rationale. ## Resources * [CrewAI documentation](https://docs.crewai.com) * [Hosted MCP server](/ai-integration/hosted-mcp-server) * [MCP tools reference](/ai-integration/mcp-tools) ## FAQs > [accordion] Do I need an API key? > > No. The hosted server is keyless for read access. The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). Limits for direct REST calls are on [rate limits](/knowledge-base/rate-limits). > [accordion] Which transport should I use? > > Use SSE (`https://mcp.dexpaprika.com/sse`) with CrewAI. The server also serves streamable HTTP, but SSE is the tested path through `MCPServerAdapter`. > [accordion] Do I have to write any tool code? > > No. `MCPServerAdapter` discovers the tools from the server, so you get all 18 without defining any yourself. # Connect DexPaprika MCP to Cursor Source: https://docs.dexpaprika.com/ai-integration/cursor-ide-integration Learn how to integrate DexPaprika documentation and MCP server directly into Cursor IDE for enhanced development workflows with real-time crypto data access. ## Integration overview Connect Cursor IDE to DexPaprika via the hosted MCP server and add docs for rich AI context. ## What is Cursor IDE? Cursor is a powerful AI-first code editor built on top of VS Code that provides advanced AI assistance for developers. With its built-in Claude integration and MCP (Model Context Protocol) support, Cursor can access external data sources and documentation to provide more intelligent coding assistance. ## Why integrate DexPaprika with Cursor? Integrating DexPaprika documentation and data with Cursor IDE provides several powerful benefits: * **Real-time crypto data access** - Get live market data, pool information, and token prices while coding * **Enhanced AI assistance** - Cursor's AI can reference DexPaprika documentation and data for better code suggestions * **DeFi development workflow** - Build DeFi applications with direct access to comprehensive blockchain data * **Documentation context** - AI can reference our API docs, tutorials, and examples while helping you code *** ## Step 1: Install with one click > [card] [Add DexPaprika to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=DexPaprika\&config=eyJuYW1lIjoiRGV4UGFwcmlrYSIsInVybCI6Imh0dHBzOi8vbWNwLmRleHBhcHJpa2EuY29tL3NzZSJ9Cg==) > > Opens Cursor and pre-fills the DexPaprika MCP server (`https://mcp.dexpaprika.com/sse`). Click **Install**, then restart Cursor if prompted. Prefer to configure it manually? Follow the steps below. **1. Configure MCP Server URL** 1. The button will open Cursor IDE (if not already open) 2. In the MCP server configuration dialog, enter the DexPaprika MCP server URL: ``` https://mcp.dexpaprika.com/sse ``` 3. Click "Install" to complete the setup 4. Restart Cursor if prompted to complete the setup ![Screenshot of Cursor IDE showing the MCP server configuration dialog with URL field highlighted and 'https://mcp.dexpaprika.com/sse' entered](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/cursor-ide-integration/2.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=2b66469b856f63c77094bdce3d96caf0) **2. Verify MCP Integration** 1. Open a new chat with Claude in Cursor (Cmd/Ctrl + L) 2. Ask a question like: "What are the top liquidity pools on Ethereum?" 3. You should see DexPaprika data being retrieved and displayed 4. Try asking about specific networks, tokens, or pools to test the integration ![Screenshot of Cursor IDE chat interface showing a conversation with Claude, displaying DexPaprika data response with pool information including volume, TVL, and token pairs](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/cursor-ide-integration/3.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=d8506629e2173fa8bf4fb387986973ad) > [!NOTE] > > **Can't find the button?** The "Connect to Cursor" button appears on pages where MCP integration is relevant. If you don't see it, you can also manually configure the MCP server using the method below. ## Step 2: Add documentation context Once you have the MCP server installed, enhance your development experience by adding our documentation to your Cursor workspace for full API reference indexing. **1. Open Cursor settings** 1. In Cursor, go to **Settings** (Cmd/Ctrl + ,) 2. Navigate to **Indexing & Docs** in the left sidebar 3. This section allows you to add custom documentation for AI context ![Screenshot of Cursor IDE settings panel showing the Indexing & Docs section with the Docs area highlighted](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/cursor-ide-integration/4.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=fd6af81ec884ff1e0ed5cfb6d7038523) **2. Add DexPaprika documentation** 1. In the **Docs** section, click **"+ Add Doc"** 2. Fill out the documentation details: * **Name**: "DexPaprika API Reference" * **URL**: [https://docs.dexpaprika.com/api-reference/introduction](https://docs.dexpaprika.com/api-reference/introduction) 3. Click **"Add"** to complete the setup 4. This will index our full API reference for AI context ![Screenshot of Cursor IDE showing the Add Doc dialog with DexPaprika API Reference name and URL filled out](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/cursor-ide-integration/5.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=369eb1c54f5dbb363a818fa94e578a50) > [!TIP] > > **Pro tip:** Using the URL [https://docs.dexpaprika.com/api-reference/introduction](https://docs.dexpaprika.com/api-reference/introduction) ensures Cursor indexes our complete API reference, giving you access to all endpoints, parameters, and examples in your AI conversations. ## Manual MCP server configuration If you can't find the "Connect to Cursor" button or prefer manual setup, you can configure the MCP server manually by following our [hosted MCP server guide](/ai-integration/hosted-mcp-server). > [!NOTE] > > **Need help with manual setup?** Our hosted MCP server guide provides detailed instructions for configuring the DexPaprika MCP server in Cursor, Claude Desktop, and other MCP-compatible tools. *** ## Available features Once integrated, you can access comprehensive DexPaprika functionality within Cursor: ### Real-time data access * **Network information** - Get details about supported blockchain networks * **DEX data** - Access decentralized exchange information and metrics * **Pool analytics** - Real-time liquidity pool data, volumes, and fees * **Token information** - Current prices, market data, and token details * **Search functionality** - Find tokens, pools, and DEXes across networks ### Documentation context * **API reference** - Complete endpoint documentation and examples * **SDK guides** - Language-specific integration tutorials * **Best practices** - Coding patterns and optimization tips * **Troubleshooting** - Common issues and solutions *** ## Usage examples ### Example 1: Building a DeFi dashboard Ask Cursor to help you build a DeFi dashboard with real-time data: ``` "Help me create a React component that displays the top 5 liquidity pools on Ethereum using the DexPaprika API. Include volume, TVL, and price data." ``` Cursor can now: * Reference our API documentation for correct endpoint usage * Provide real-time pool data for testing * Suggest optimal data fetching patterns * Help with error handling and loading states ### Example 2: Token price monitoring Create a price monitoring application: ``` "Build a Python script that monitors SOL token prices across different DEXes and alerts when there are significant price differences." ``` Cursor can: * Access real-time SOL price data from multiple DEXes * Reference our historical data tutorials * Suggest efficient polling strategies * Help implement price comparison logic ### Example 3: Pool discovery bot Develop a new pool discovery system: ``` "Create a Node.js application that finds newly created liquidity pools with high trading volume and sends notifications." ``` Cursor can: * Use our pool discovery endpoints * Reference our "Find New Pools" tutorial * Provide real-time pool data for testing * Help with notification system implementation *** *** ## Troubleshooting > [accordion] MCP server connection issues > > **Symptoms**: Cursor shows connection errors or timeouts. > > **Solutions**: > > 1. Verify internet connection is stable > 2. Check that the MCP server URL is correct: `https://mcp.dexpaprika.com/sse` > 3. Restart Cursor completely > 4. Try removing and re-adding the MCP server configuration > 5. Check Cursor's console for detailed error messages > [accordion] Documentation not loading > > **Symptoms**: Cursor's AI doesn't reference DexPaprika documentation. > > **Solutions**: > > 1. Ensure documentation files are in your workspace > 2. Enable "Use workspace files as context" in AI settings > 3. Try asking more specific questions about our API > 4. Restart Cursor to refresh context > [accordion] Slow response times > > **Symptoms**: Cursor takes a long time to respond with DexPaprika data. > > **Solutions**: > > 1. Check your internet connection speed > 2. Try breaking complex queries into smaller parts > 3. Use specific network/token names in your queries > 4. Consider using the hosted MCP server for better performance > [accordion] Authentication issues > > **Symptoms**: Getting authentication or permission errors. > > **Solutions**: > > 1. DexPaprika API is publicly accessible - no authentication required > 2. Check if your network has firewall restrictions > 3. Try using the hosted MCP server instead of local installation > 4. Contact support if issues persist *** ## Best practices ### For optimal performance 1. **Use specific queries** - Instead of "show me all pools", ask for "top 5 USDC/ETH pools on Ethereum" 2. **Cache frequently used data** - Store common queries locally to reduce API calls 3. **Handle errors gracefully** - Implement proper error handling for network issues 4. **Watch your credit spend** - one request costs one credit against 10,000 per rolling 30 days keyless, and the [DexPaprika console](https://console.dexpaprika.com) shows what you have used this month ### For better AI assistance 1. **Provide context** - Tell Cursor what you're building and your goals 2. **Reference documentation** - Ask Cursor to explain concepts from our docs 3. **Iterate on solutions** - Ask follow-up questions to refine the code 4. **Test with real data** - Use actual DexPaprika data in your development *** ## What's next? > [card] [API Documentation](/api-reference/introduction) > > Explore all available endpoints and their capabilities > [card] [SDK Integration](/get-started/sdk-ts) > > Learn how to use our official SDKs in your projects > [card] [Find New Pools](/tutorials/find-new-pools) > > Discover newly created liquidity pools and tokens > [card] [Historical Data](/tutorials/retrieve-historical-data) > > Access and analyze historical price and volume data > [card] [Hosted MCP Server](/ai-integration/hosted-mcp-server) > > Zero-setup MCP integration for instant access > [card] [ChatGPT Actions](/ai-integration/chatgpt-actions) > > Integrate DexPaprika data with ChatGPT ## Need help? > [card] [Join Our Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community for real-time support and discussions > [card] [Direct Support](mailto:support@coinpaprika.com) > > Contact our team for technical assistance and custom integrations > [!NOTE] > > **Building something amazing?** Share your Cursor + DexPaprika integrations with our community! We love seeing what developers build with our tools. [Reach out](mailto:support@coinpaprika.com) to showcase your work. ### FAQs > [accordion] How do I add the MCP server if the button is missing? > > Manually add `https://mcp.dexpaprika.com/sse` via Cursor settings → Tools & Integrations → New MCP server. > [accordion] The AI is not referencing the docs. What now? > > Add [https://docs.dexpaprika.com/api-reference/introduction](https://docs.dexpaprika.com/api-reference/introduction) under Indexing & Docs and enable workspace context. > [accordion] How to troubleshoot connection issues? > > Restart Cursor, re-add the server, and verify the URL; check the developer console for detailed errors. # DexPaprika Hosted MCP Server Source: https://docs.dexpaprika.com/ai-integration/hosted-mcp-server Access real-time DeFi data in Claude, Cursor, and other MCP-compatible tools without any installation or setup. Our hosted MCP server provides instant access to comprehensive DEX data across 35 blockchains. ## Integration overview Use the hosted MCP server URL to enable streaming DeFi data in Claude, Cursor, and other MCP clients. > [!NOTE] > > Having trouble connecting? We're here to help - [reach out](mailto:support@coinpaprika.com) and we'll get you up and running. ## Why use our hosted MCP server? Skip installation entirely. The hosted MCP server is a keyless URL you drop into any MCP client to query live DeFi data across 35 networks. **What you get instantly:** * **Zero setup required** - just add the URL to your config * **Multiple transport options** - SSE, streamable HTTP, and JSON-RPC support * **Always up-to-date** - we run the server, handle updates, and index new pools * **Keyless to start** - query without an API key or signup, at 10,000 credits per rolling 30 days per IP * **Live market data** - current prices, volumes, and pool information * **35 blockchain networks** - Ethereum, Solana, Base, Arbitrum, and more > [!NOTE] > > Visit [mcp.dexpaprika.com](https://mcp.dexpaprika.com) to explore our hosted MCP server interface and see the available data before integrating. *** ## Quick integration guide ### Claude desktop setup Add our hosted MCP server to Claude Desktop in just 2 steps: **1. Locate your configuration file** Find your Claude Desktop configuration file: * **macOS**: `~/Library/Application\ Support/Claude/claude_desktop_config.json` * **Windows**: `%APPDATA%/Claude/claude_desktop_config.json` * **Linux**: `~/.config/Claude/claude_desktop_config.json` **2. Add the hosted server configuration** If the file doesn't exist, create it with this content: ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` If the file already exists, add our server to the existing `mcpServers` object: ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` Save the file and restart Claude Desktop. You're ready to go! ### Cursor setup **1. Access MCP settings** 1. Open Cursor IDE 2. Go to **Settings** (Cmd/Ctrl + ,) 3. Navigate to **Tools & Integrations** 4. Click **New MCP server** **2. Configure in mcp.json** This will open the `mcp.json` file. Add the DexPaprika server configuration: ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` Save the file and restart Cursor if needed. ### ChatGPT integration Want to use DexPaprika data in ChatGPT? You can integrate our API directly into ChatGPT using Actions: 1. **Create a custom GPT** in ChatGPT (requires Plus or Enterprise subscription) 2. **Add our OpenAPI specification** from [mcp.dexpaprika.com/openapi](https://mcp.dexpaprika.com/openapi) 3. **Start asking crypto questions** directly in your ChatGPT conversations > [!NOTE] > > **Ready to set up ChatGPT?** Follow our complete [ChatGPT Actions integration guide](/ai-integration/chatgpt-actions) for step-by-step instructions. *** ## Connection options Our hosted MCP server supports multiple transport protocols to ensure compatibility with different clients and use cases: > [accordion] Server-sent events (SSE) - Recommended > > **Endpoint:** `https://mcp.dexpaprika.com/sse` > > **Best for:** Claude Desktop, Cursor, and most MCP clients\ > **Benefits:** Real-time streaming updates, excellent browser compatibility, automatic reconnection\ > **Use cases:** Live price monitoring, real-time pool updates, continuous market data feeds > > This is the recommended option for most users as it provides the smoothest experience with popular AI tools. > [accordion] Streamable HTTP > > **Endpoint:** `https://mcp.dexpaprika.com/streamable-http` > > **Best for:** Custom applications, web services, and clients that prefer HTTP streaming\ > **Benefits:** Standard HTTP protocol, works well with firewalls, easier debugging\ > **Use cases:** Integration with existing web infrastructure, corporate environments with strict network policies > > Perfect for developers building custom integrations or working in environments where SSE might be restricted. > [accordion] JSON-RPC over HTTP > > **Endpoint:** `https://mcp.dexpaprika.com/json-rpc` > > **Best for:** Traditional API integrations, batch processing, simple request-response patterns\ > **Benefits:** Familiar REST-like interface, stateless communication, easy to cache\ > **Use cases:** Periodic data fetching, batch analysis, integration with existing JSON-RPC systems > > Ideal for applications that don't need real-time updates and prefer traditional API communication patterns. > [!TIP] > > **Getting started?** Use the SSE endpoint (`https://mcp.dexpaprika.com/sse`) for the best experience with Claude Desktop and Cursor. You can always switch protocols later based on your specific needs. > [!NOTE] > > **Need help choosing?** Visit [mcp.dexpaprika.com](https://mcp.dexpaprika.com) to test different connection methods and see which works best for your setup. *** ## Your own API key, for token OHLCV and pool transactions Three tools need a Dev, Pro or Enterprise plan, and on the hosted server they run on your key, never on ours. `getTokenOHLCV` returns USD candles for a token, volume-weighted across every pool it trades in on a network (see the [token OHLCV tutorial](/tutorials/token-ohlcv)). `getTokenIndicator` computes RSI, EMA, MACD, Bollinger Bands or VWAP from those token candles (see the [technical indicators tutorial](/tutorials/technical-indicators)); `getPoolIndicator` gives the same for a single pool on every plan with no key. `getPoolTransactions` returns a pool's recent swaps; the [pool transactions endpoint](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) behind it is paid-only since 30 September 2026. Every other tool works the same with or without a key. Add the key as the `Authorization` header on your connection to the server, the key on its own. Get it in [console.dexpaprika.com](https://console.dexpaprika.com); plans are on [pricing](https://dexpaprika.com/api/pricing). > [tab] Claude Code > > ```bash theme={null} > claude mcp add --transport http dexpaprika https://mcp.dexpaprika.com/streamable-http --header "Authorization: YOUR_API_KEY" > ``` > [tab] Cursor > > In `~/.cursor/mcp.json`: > > ```json theme={null} > { > "mcpServers": { > "dexpaprika": { > "url": "https://mcp.dexpaprika.com/streamable-http", > "headers": { "Authorization": "YOUR_API_KEY" } > } > } > } > ``` > [tab] JSON-RPC > > ```bash theme={null} > curl -s https://mcp.dexpaprika.com/json-rpc \ > -H "Content-Type: application/json" \ > -H "Authorization: $DEXPAPRIKA_API_KEY" \ > -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getTokenOHLCV","arguments":{"network":"ethereum","token_address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","start":"-24h","interval":"1h","limit":24}}}' > ``` * **Reconnect after adding or changing the key.** The server reads it when a session opens, so restart the client or reload the server. JSON-RPC reads it on every request. * **Errors say what to fix.** With no key the tool answers `DP401_API_KEY_REQUIRED` and calls nothing. A key the API rejects answers `DP401_INVALID_API_KEY`, and a key whose plan does not cover the request answers `DP403_PLAN_REQUIRED`. Agents are told to fall back: to `getPoolOHLCV` or `getPoolIndicator` on the token's most liquid pool for candles and indicators, and to `getPoolDetails` for a pool's transaction counts. * **The key goes nowhere else.** It is sent only with these three tools' requests to `api-pro.dexpaprika.com`. It is not logged, and it is kept only with your session, which is deleted with it. * **Clients that cannot set headers**, such as connectors added by URL alone, can use every tool except these three. *** ## Available features Our hosted MCP server provides comprehensive access to DeFi data: ### Core data access * **Multi-chain support** - 35 blockchain networks including Ethereum, Solana, Base, Arbitrum, Polygon, and more * **Real-time prices** - Live token prices and market data * **Liquidity pools** - Detailed pool information, volumes, and fees * **DEX analytics** - Trading data across major decentralized exchanges * **Search functionality** - Find tokens, pools, and DEXes across all networks > [!NOTE] > > Batch token pricing via [`GET /networks/{network}/multi/prices`](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) for efficient multi-token lookups (up to 10 tokens per request). ### Advanced analytics * **Historical data** - Price history and trading volumes over time * **Pool monitoring** - Track new pool creation and liquidity changes * **Cross-chain comparisons** - Compare prices and liquidity across different networks * **Volume analysis** - Trading volume trends and patterns *** ## Usage examples Once configured, you can ask Claude or Cursor powerful questions about DeFi data: ### Example queries you can make | Category | Example Query | | - | - | | **Basic market data** | "What are the top 5 liquidity pools by volume today?" | | **Network information** | "Which blockchain networks does DexPaprika support?" | | **Token prices** | "What's the current price of SOL across different DEXes?" | | **Pool analysis** | "Show me the most liquid USDC/ETH pools across all networks and compare their trading fees" | | **New opportunities** | "Find newly created liquidity pools in the last 24 hours with volume over \$100k" | | **Cross-chain comparison** | "Compare ETH prices between Ethereum mainnet and Layer 2 solutions like Arbitrum and Base" | | **DEX performance** | "Which DEX has the highest trading volume on Solana today?" | | **Token discovery** | "Search for meme tokens with high trading volume in the last hour" | | **Arbitrage opportunities** | "Find price differences for USDC across different DEXes on Ethereum" | > [!TIP] > > **Want to explore more?** Visit [mcp.dexpaprika.com](https://mcp.dexpaprika.com) to test the interface, check out our [tutorials](/tutorials/tutorial_intro) for step-by-step guides, or browse the [API documentation](/api-reference/introduction) for technical details. *** ## Benefits over self-hosted solutions | Feature | Hosted MCP | Self-Hosted MCP | | - | - | - | | **Setup time** | \< 2 minutes | 15-30 minutes | | **Maintenance** | Zero - we handle it | Regular updates required | | **Reliability** | Managed and monitored by us | Depends on your infrastructure | | **Edge caching** | Yes | No | | **Updates** | Automatic | Manual intervention | *** ## Troubleshooting ### Common issues and solutions > [accordion] Server not responding or connection timeout > > **Symptoms**: Claude shows connection errors or timeouts when making requests. > > **Solutions**: > > 1. Check your internet connection > 2. Restart Claude Desktop/Cursor > 3. Verify the configuration syntax in your config file > 4. Try removing and re-adding the server configuration > [accordion] Configuration file not found > > **Symptoms**: Can't locate the Claude Desktop configuration file. > > **Solutions**: > > 1. Create the directories if they don't exist: > * **macOS**: `mkdir -p ~/Library/Application\ Support/Claude/` > * **Windows**: Create the `Claude` folder in your `%APPDATA%` directory > 2. Create the `claude_desktop_config.json` file manually > 3. Ensure proper JSON syntax > [accordion] MCP server not listed in Claude > > **Symptoms**: The DexPaprika server doesn't appear in Claude's available tools. > > **Solutions**: > > 1. Verify JSON syntax in your configuration file > 2. Restart Claude Desktop completely > 3. Check that the server URL is correct: `https://mcp.dexpaprika.com/sse` > 4. Try removing and re-adding the server configuration > [accordion] Rate limiting or API errors > > **Symptoms**: Getting rate limit errors or API failures. > > **Solutions**: > > 1. Our hosted service includes built-in rate limiting protection > 2. `DP429_RATE_LIMITED` means the server's shared capacity is busy. Wait `retry_after_seconds` when it is given, then retry. Your own plan does not change this, except for the tools that run on your own key (see above), which count against your plan like any direct call > 3. Try spacing out your requests if making many in quick succession *** ## API coverage Our hosted MCP server provides access to all DexPaprika API endpoints: > [card] [Networks & DEXes](/api-reference/networks/get-a-list-of-available-blockchain-networks) > > Access all supported blockchain networks and their available decentralized exchanges > [card] [Liquidity Pools](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) > > Comprehensive pool data including TVL, volume, fees, and token pairs > [card] [Token Information](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) > > Real-time token prices, market data, and detailed token information > [card] [Historical Data](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) > > Price history, volume trends, and historical pool performance > [card] [Search & Discovery](/api-reference/search/search-for-tokens-pools-and-dexes) > > Powerful search across tokens, pools, and DEXes with filtering options > [card] [Real-time Updates](/api-reference/introduction) > > Live data feeds with the latest market information and trading activity *** ## What's next? > [card] [API Documentation](/api-reference/introduction) > > Explore all available data endpoints and their capabilities > [card] [Find New Pools](/tutorials/find-new-pools) > > Learn how to discover newly created liquidity pools and tokens > [card] [Self-Hosted Option](/ai-integration/mcp) > > Want to run your own MCP server? Check out our self-hosted guide > [card] [Historical Data](/tutorials/retrieve-historical-data) > > Access and analyze historical price and volume data ## Need help? > [card] [Join Our Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support from other builders > [card] [Direct Support](mailto:support@coinpaprika.com) > > Reach out directly for technical support or feature requests > [!NOTE] > > **Looking for custom integrations?** Our team can help you integrate DexPaprika data into any application or workflow. [Contact us](mailto:support@coinpaprika.com) to discuss your specific needs. ### FAQs > [accordion] Do I need an API key to use the hosted MCP? > > Not for most tools. Add the hosted URL to your client config and every tool except `getTokenOHLCV`, `getTokenIndicator` and `getPoolTransactions` works with no key and no signup. Those three run on your own Dev, Pro or Enterprise key; see [your own API key](#your-own-api-key-for-token-ohlcv-and-pool-transactions). > [accordion] Which transport should I choose? > > Start with SSE for streaming and broad compatibility. Use streamable HTTP or JSON-RPC if your environment restricts SSE. > [accordion] How do I debug connection issues? > > Confirm the URL, restart the client, and test the endpoint in a browser. If using desktop apps, ensure your config JSON is valid. > [accordion] Is rate limiting applied? > > Yes. Tool calls run on the server's shared capacity, not on a plan of yours, so when it is busy a tool returns `DP429_RATE_LIMITED`, with `retry_after_seconds` when the API supplies one. Wait that long and retry. `getTokenOHLCV`, `getTokenIndicator` and `getPoolTransactions` are the exception: they run on your own key and count against your plan like any direct call. For the REST API's own limits, see [rate limits](/knowledge-base/rate-limits) and [pricing](https://dexpaprika.com/api/pricing). # DexPaprika for AI agents and AI-assisted development Source: https://docs.dexpaprika.com/ai-integration/index Connect AI tools to real-time DEX data across 35 blockchains. Choose from Claude Code plugin, hosted MCP server, IDE integrations, ChatGPT Actions, or direct REST API access. Keyless to start. ## Why DexPaprika + AI? DexPaprika provides on-chain DEX data across every chain, token and pool on the [coverage page](/coverage), keyless to start. AI agents and AI-assisted IDEs can query token prices, pool data, historical OHLCV, swap transactions, and more, either through MCP (Model Context Protocol) or direct REST API calls. This page helps you pick the right integration for your setup. > [!NOTE] > > **For AI agents:** fetch [docs.dexpaprika.com/llms.txt](https://docs.dexpaprika.com/llms.txt) for a machine-readable index of this documentation, or [llms-full.txt](https://docs.dexpaprika.com/llms-full.txt) for the full text. To self-onboard against the live server, call the **getCapabilities** MCP tool first: it returns the tool list, network synonyms, and recommended call sequences in one shot. *** ## Fastest path Add the hosted MCP server to Claude, Cursor, or VS Code. One keyless URL, no install: ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` Recommended for most setups. Full walkthrough: [hosted MCP server](/ai-integration/hosted-mcp-server). *** ## Choose your integration > [card] [Hosted MCP server (recommended)](/ai-integration/hosted-mcp-server) > > Add one keyless URL to Claude Desktop, Cursor, or VS Code. No installation. > [card] [Self-hosted MCP server](/ai-integration/mcp) > > Run the MCP server locally via `npx dexpaprika-mcp` for full control. > [card] [Claude Code plugin](/ai-integration/claude-code-plugin-guide) > > Two commands, zero config. Built-in MCP access inside Claude Code. > [card] [Agent skills](/ai-integration/skills) > > One command. Full API knowledge for Claude Code, Cursor, Cline, and 40+ agents. > [card] [LangChain](/ai-integration/langchain) > > `langchain-dexpaprika`: five tools plus a toolkit for Python agents. > [card] [Cursor, VS Code, Codex, and more](/ai-integration/mcp-clients) > > One-click install for popular editors, or the config for any MCP client. > [card] [CLI](/tutorials/cli) > > One install command. Query and stream data from the terminal. > [card] [REST API](/api-reference/introduction) > > Call the API directly from any agent framework or custom application. *** ## Compare the options | | Agent Skills | CLI | Claude Code Plugin | Hosted MCP | Self-hosted MCP | REST API | | - | - | - | - | - | - | - | | **Setup time** | 10 seconds | 10 seconds | 30 seconds | 1-2 minutes | 10-15 minutes | 0 (just call endpoints) | | **Install** | `npx skills add` | One curl command | Plugin marketplace | Add URL to config | npm/npx | No install | | **Works with** | Claude Code, Cursor, Cline, 40+ agents | Any terminal, any agent | Claude Code | Claude Desktop, Cursor, VS Code | Claude Desktop, Cursor | Any HTTP client or agent | | **How it works** | Agent reads API docs and makes calls itself | Direct CLI commands | MCP tools called by agent | MCP tools called by agent | MCP tools called by agent | Direct HTTP calls | | **Streaming prices** | Agent can use REST streaming | Built-in `stream` command | No (use REST streaming) | No (use REST streaming) | No (use REST streaming) | Yes via [SSE streaming](/streaming/introduction) | | **Works offline** | Yes (local files) | Yes (local binary) | No | No | Yes (local server) | No | | **Best for** | Any agent that can make HTTP/CLI calls | Terminal agents, scripting, pipelines | Claude Code users who want everything bundled | Quick AI IDE setup | Custom/private environments | Agent frameworks, custom apps | *** ## What data can AI agents access? Every integration exposes the same dataset, delivered as **20 MCP tools** (see the [MCP tools reference](/ai-integration/mcp-tools)) or as REST endpoints: | Capability | Description | | - | - | | **Token prices** | Real-time USD prices for any token on any supported network | | **Batch prices** | Up to 10 token prices in a single request | | **Pool data** | Liquidity, volume, fees, and token pairs for any pool | | **Pool filtering** | Find pools by volume range, transaction count, or creation date | | **OHLCV history** | Historical candlestick data, 9 intervals (1m to 24h); depth and interval [depend on the plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan) | | **Transactions** | Recent swaps for any pool, on Dev, Pro and Enterprise plans | | **DEX listings** | Every DEX on a network with pool counts | | **Search** | Find tokens, pools, and DEXes by name, symbol, or address across all chains | | **Network info** | All 35 supported blockchain networks | | **Live streaming** | Real-time price and pool-reserve updates via [SSE streaming](/streaming/introduction) | *** ## Example prompts Once connected, try: * "What's the current price of SOL?" * "Show me the top 10 pools on Ethereum by volume" * "Find newly created pools on Base with over \$50k daily volume" * "Get hourly OHLCV for the last day for the USDC/ETH pool on Uniswap V3" * "Compare WETH prices across Ethereum, Arbitrum, and Base" * "Which DEX has the most pools on Solana?" *** ## Next steps > [card] [MCP tools reference](/ai-integration/mcp-tools) > > Every tool, its parameters, pagination, and the getCapabilities onboarding tool > [card] [Knowledge base](/knowledge-base/concepts) > > Core concepts: pools, DEXes, OHLCV, and how DexPaprika data works > [card] [REST API reference](/api-reference/introduction) > > Complete endpoint documentation with an interactive playground > [card] [Streaming API](/streaming/introduction) > > Real-time price and reserve updates via Server-Sent Events ### FAQs > [accordion] Which integration should I use? > > For terminal work and scripting, start with the CLI. If you use Claude Code, the plugin is the fastest path. For Claude Desktop, Cursor, or VS Code, use the hosted MCP server. For Python agents, use `langchain-dexpaprika`. For custom agents and applications, call the REST API directly. > [accordion] Do I need an API key? > > No. DexPaprika is keyless for public read access: no API key, registration, or authentication needed to start. A free registered key raises the allowance from 10,000 credits to 100,000, and Pro raises it to 5,000,000 at 500 requests a minute; see [rate limits](/knowledge-base/rate-limits). > [accordion] Can I use multiple integrations at once? > > Yes. For example, use the MCP server in Cursor for interactive development and call the REST API from your application code. > [accordion] What about rate limits? > > 10,000 credits per rolling 30 days without a key at 15 requests a minute, or 100,000 with a [free key](https://console.dexpaprika.com) at 30 requests a minute. For more, the [Pro API](/api-pro/introduction) is \$99 a month for 5,000,000 credits at 500 requests a minute; [plans and checkout](https://dexpaprika.com/api/pricing) are on the pricing page. One request costs one credit; batch endpoints cost one credit per item. # DexPaprika tools for LangChain agents Source: https://docs.dexpaprika.com/ai-integration/langchain Give a LangChain agent keyless DEX market data with langchain-dexpaprika: five tools plus a toolkit for search, token details, pools, OHLCV, and networks across every supported blockchain. No API key needed to start. [`langchain-dexpaprika`](https://pypi.org/project/langchain-dexpaprika/) gives a LangChain agent live DEX market data from the [DexPaprika API](https://docs.dexpaprika.com). It is keyless: there is no signup and no environment variable to set, so your agent has DEX data across [every supported blockchain](/coverage) as soon as you install the package. The tools are built for LLM consumption: descriptions spell out which parameters exist and where to get their values, error messages quote the API's own allowed-value lists so the model can self-correct, and outputs are compact JSON with long token descriptions trimmed. ## Install ```bash theme={null} pip install -U langchain-dexpaprika ``` There are no credentials to configure. The DexPaprika API is keyless, so there is no environment variable to set. ## Quickstart ```python theme={null} from langchain_dexpaprika import DexPaprikaSearch search = DexPaprikaSearch() print(search.invoke({"query": "WETH"})) ``` This returns compact JSON with matching tokens (contract address, chain, USD price, liquidity), pools, and DEXes. `search` is the entry point when you only have a ticker: it resolves a symbol into a contract address and network id you can feed into the other tools. ## Tools | Tool name | Class | What it returns | | - | - | - | | `dexpaprika_search` | `DexPaprikaSearch` | Tokens, pools, and DEXes matching a name, symbol, or address. Use it first when you only have a ticker. | | `dexpaprika_token_details` | `DexPaprikaTokenDetails` | Price, FDV, liquidity, pool count, and 24h/6h/1h volume with buy/sell breakdown for one token on one network. | | `dexpaprika_token_pools` | `DexPaprikaTokenPools` | Pools where a token trades, sortable by volume, liquidity, transactions, age, price, or 24h price change. | | `dexpaprika_pool_ohlcv` | `DexPaprikaPoolOHLCV` | Historical OHLCV candles for one pool. The package calls the API without a key, so it gets `1h` and longer candles over the last 24 hours ([OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). | | `dexpaprika_networks` | `DexPaprikaNetworks` | Every supported network with its exact id, 24h volume, transactions, and pool counts. | ## Use the toolkit in an agent `DexPaprikaToolkit` bundles all five tools over one shared HTTP client. This example drives them with an Anthropic model, so install the provider and set its key first (swap in any chat model you prefer): ```bash theme={null} pip install -U "langchain[anthropic]" export ANTHROPIC_API_KEY=... ``` ```python theme={null} from langchain.agents import create_agent from langchain_dexpaprika import DexPaprikaToolkit toolkit = DexPaprikaToolkit() agent = create_agent("claude-sonnet-5", toolkit.get_tools()) result = agent.invoke( {"messages": [("user", "Find the most liquid WETH pool on ethereum")]} ) ``` The tool descriptions chain naturally: the agent starts with `dexpaprika_search` to resolve a ticker into a contract address and network id, then feeds those into the other tools. ## Individual tools Every tool works standalone, sync and async: ```python theme={null} from langchain_dexpaprika import DexPaprikaPoolOHLCV ohlcv = DexPaprikaPoolOHLCV() candles = ohlcv.invoke( { "network": "ethereum", "pool_address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "start": "-24h", # the last 24 hours, which works without a key "interval": "1h", "limit": 24, } ) ``` ## Prefer MCP or the raw API? The MCP server exposes the same data as callable tools for Claude, Cursor, and other MCP clients: see the [hosted MCP server](/ai-integration/hosted-mcp-server) and the [MCP tools reference](/ai-integration/mcp-tools). For any framework we do not ship a package for yet, call the [REST API](/api-reference/introduction) directly. ## Resources * [Package on PyPI](https://pypi.org/project/langchain-dexpaprika/) * [Source on GitHub](https://github.com/coinpaprika/langchain-dexpaprika) (MIT) * [DexPaprika API docs](https://docs.dexpaprika.com) ## FAQs > [accordion] Do I need an API key for langchain-dexpaprika? > > No. The DexPaprika API is keyless, so there is nothing to sign up for and no environment variable to set. A free registered key raises the allowance from 10,000 credits to 100,000, and Pro raises it to 5,000,000 at 500 requests a minute; see [rate limits](/knowledge-base/rate-limits). > [accordion] Which chat models work with the toolkit? > > Any LangChain chat model. `DexPaprikaToolkit().get_tools()` returns standard LangChain tools, so you can pass them to `create_agent` with an Anthropic, OpenAI, or other provider model. > [accordion] What is the difference between the tools and the MCP server? > > Same data, different delivery. Use `langchain-dexpaprika` inside a Python LangChain agent; use the [hosted MCP server](/ai-integration/hosted-mcp-server) to expose the tools to Claude, Cursor, or any MCP client without writing code. # DexPaprika MCP server: DEX data for Claude, Cursor & AI agents Source: https://docs.dexpaprika.com/ai-integration/mcp Give AI assistants live DEX data via MCP: pools, tokens and prices on 35 chains. Free to start, no API key. Install locally with npx or use the hosted server. ## Integration overview Install and configure the DexPaprika MCP server so AI tools can query networks, DEXes, pools, tokens, and search. ## What is MCP? MCP (Model Context Protocol) is an [open protocol standard created by Anthropic](https://modelcontextprotocol.io/introduction) that gives AI models a unified way to connect to external data sources and tools. The DexPaprika MCP server leverages this protocol to provide AI assistants like Claude with access to real-time crypto and DeFi market data, enabling advanced conversations about blockchain networks, decentralized exchanges (DEXes), liquidity pools, and tokens across the DeFi ecosystem. > [!NOTE] > > **Looking for an easier setup?** If you prefer not to install anything locally, check out our [DexPaprika Hosted MCP Server](/ai-integration/hosted-mcp-server) for instant access with zero installation required. ## Installation guide [DexPaprika MCP Server Installation Guide](https://www.youtube.com/embed/rIxFn2PhtvI?si=c1BZ5bfS6chC7p-a) ### Prerequisites Before installing the DexPaprika MCP server, ensure you have: * [Node.js](https://nodejs.org/) (v16 or higher) installed on your system * [npm](https://www.npmjs.com/) (comes with Node.js) or [yarn](https://yarnpkg.com/) package manager * [Claude Desktop](https://claude.ai/desktop) or [Cursor](https://cursor.sh/) installed if you want to use the MCP server with these applications ### Installation options #### Option 1: Global installation (recommended) Installing the DexPaprika MCP server globally makes it available throughout your system: ```bash theme={null} npm install -g dexpaprika-mcp ``` After installation, you can start the server by running: ```bash theme={null} dexpaprika-mcp ``` #### Option 2: Use with npx (no installation) Alternatively, you can run the server directly without installation using npx: ```bash theme={null} npx dexpaprika-mcp@latest ``` This is useful for trying out the server without permanently installing it. ### Verification To verify that your installation was successful, run: ```bash theme={null} dexpaprika-mcp --version ``` You should see the current version number of the DexPaprika MCP server. ## Configuration ### Claude Desktop configuration To use the DexPaprika MCP server with Claude Desktop: 1. Download and install [Claude Desktop](https://claude.ai/desktop) if you haven't already 2. Locate your Claude Desktop configuration file: * **macOS**: `~/Library/Application\ Support/Claude/claude_desktop_config.json` * **Windows**: `%APPDATA%/Claude/claude_desktop_config.json` 3. If the file doesn't exist, create it with the following content: ```json theme={null} { "mcpServers": { "dexpaprika": { "command": "dexpaprika-mcp" } } } ``` 4. If the file already exists, add the DexPaprika configuration to the existing `mcpServers` object: ```json theme={null} "dexpaprika": { "command": "dexpaprika-mcp" } ``` 5. Save the file and restart Claude Desktop. 6. To verify the configuration, open Claude Desktop and try asking a question about cryptocurrency data, such as "What are the top liquidity pools on Ethereum?" > [!NOTE] > > Make sure you have the latest version of our package by running `npm update -g dexpaprika-mcp` ### Cursor configuration If you're using Cursor IDE with Claude: 1. Download and install [Cursor](https://cursor.sh/) if you haven't already 2. Open Cursor and click on the Claude button in the sidebar 3. Click the settings (gear) icon and select "Add MCP Server" 4. Fill in the following information: * **Server name**: `dexpaprika` * **Type**: `command` (select from dropdown) * **Command to run**: `npx dexpaprika-mcp@latest` 5. Click "Add" to save the configuration 6. Alternatively, Cursor will automatically use any MCP servers configured in Claude Desktop ## Troubleshooting If you encounter issues with the DexPaprika MCP server: 1. **Server not found errors**: * Ensure the server is installed correctly using `npm list -g dexpaprika-mcp` * Try reinstalling with `npm install -g dexpaprika-mcp` 2. **Connection errors**: * Check that your internet connection is active * Verify that no firewall is blocking the connection 3. **Configuration errors**: * Double-check your configuration file syntax * Ensure the path to the configuration file is correct for your OS 4. **Command not found errors**: * Ensure Node.js is installed and in your PATH * Try using the full path to the npm or npx executables ## Features The DexPaprika MCP server provides access to: * Blockchain network information across multiple chains * Decentralized exchange (DEX) data * Liquidity pool details and metrics * Token information and market data * Price and volume analytics for tokens and pools * Comprehensive search capabilities across DeFi entities ## Available tools > [!NOTE] > > New to the server? Call **getCapabilities** first. In one call it returns the full tool list, network name synonyms, recommended call sequences, and common pitfalls, so an agent can self-onboard before making any data calls. The DexPaprika MCP server exposes 20 tools. **Discovery and onboarding** * **getCapabilities** - Agent onboarding: supported workflows, network synonyms, pitfalls, and recommended call sequences. Call this first. * **getNetworks** - List every supported blockchain network with 24h volume and indexing stats * **getStats** - Platform-wide totals: networks, DEXes, pools, and tokens indexed * **search** - Search across all networks for tokens, pools, and DEXes by name, symbol, or address **Pools** * **getNetworkPools** - Top liquidity pools on a network, ranked by 24h volume by default * **getNetworkPoolsFilter** - Filter pools on a network by volume, liquidity, transactions, or creation time * **getDexPools** - Pools on a specific DEX within a network (backed by pool search with a `dex_name` filter, since the old DEX pools endpoint returns `410 Gone`) * **getPoolDetails** - Full details for one pool: tokens, price, liquidity, and 24h volume * **getPoolOHLCV** - Historical OHLCV (candlestick) data for a pool (`1m` to `24h` intervals; interval and history depth depend on the plan, see [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)) * **getPoolIndicator** - RSI, EMA, MACD, Bollinger Bands or VWAP for a pool, computed from its candles. Every plan, with the same interval and history limits as `getPoolOHLCV`; see the [technical indicators tutorial](/tutorials/technical-indicators) * **getPoolTransactions** - Recent swaps for a pool. Needs your own Dev, Pro or Enterprise key; see [hosted setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions) (`from`/`to` take a relative offset such as `-1h`, Unix seconds, RFC3339 or `YYYY-MM-DD`; capped to the last 7 days) **Tokens** * **getTokenDetails** - Metadata and multi-timeframe price and volume metrics for one token * **getTokenPools** - Liquidity pools containing a specific token on a network * **getTokenOHLCV** - USD candles for a token across every pool it trades in. Needs your own Dev, Pro or Enterprise key; see [hosted setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions) * **getTokenIndicator** - The same indicators computed from a token's USD candles across all its pools. Needs your own Dev, Pro or Enterprise key; see [hosted setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions) * **getTokenMultiPrices** - USD prices for up to 10 tokens in one batched call * **filterNetworkTokens** - Filter tokens on a network by volume, liquidity, FDV, transactions, or creation time * **getTopTokens** - Top tokens on a network ranked by volume, liquidity, transactions, FDV, or 24h change **DEXes** * **getNetworkDexes** - DEXes operating on a specific network **Feedback** (hosted server only) * **submitFeedback** - Report a problem, unexpected response, or missing data back to the DexPaprika team > [!NOTE] > > **Agent notes:** every read tool takes a required `rationale` string (1-2 sentences on what triggered the call). The pool and token list tools (`getNetworkPools`, `getNetworkPoolsFilter`, `getDexPools`, `getTokenPools`, `getTopTokens`, `filterNetworkTokens`) return rows under `results` with cursor pagination (`has_next_page` + `next_cursor`; on the npm server, paging needs `DEXPAPRIKA_API_KEY`, and a free key is enough), and sort with canonical `sort_by` / `sort_dir`. For full parameters, defaults, and return shapes for every tool, see the [MCP tools reference](/ai-integration/mcp-tools). ## Usage examples Once configured, you can ask Claude questions about DeFi data. Here are some example prompts: ### General market data * "What are the top 5 liquidity pools across all networks by volume?" ### Network-specific queries * "Which blockchain networks are supported by DexPaprika?" * "What are the top DEXes on the Solana network?" * "Show me the top 10 liquidity pools on Ethereum, ordered by volume." ### DEX and pool analysis * "What are the most active pools on Uniswap V3?" * "Show me details about the USDC/ETH pool on Uniswap V3." * "Compare the trading volume between PancakeSwap and Uniswap." ### Token information * "What's the current price of SOL in the Raydium pool on Solana?" * "Find all pools that include the SHIB token." ### Search functionality * "Search for pools related to 'Bitcoin'" * "Find tokens with 'Pepe' in their name" ## Advanced queries You can also ask Claude to perform more complex analysis: * "Compare the liquidity and volume of the top 3 DEXes on Ethereum" * "What's the price difference of ETH between Uniswap and SushiSwap?" * "Show me the tokens with the highest price volatility in the last 24 hours" * "Analyze the trading volume trends for BNB on PancakeSwap" ## Support If you need further assistance, you can: * Contact DexPaprika support by [email](mailto:support@coinpaprika.com) * Join the [Discord community](https://discord.gg/DhJge5TUGM) ### FAQs > [accordion] Do I need an API key for the MCP server? > > Not for most tools. `getTokenOHLCV`, `getTokenIndicator` and `getPoolTransactions` need a Dev, Pro or Enterprise key; every other tool runs with no key. On the hosted server that is your own key, sent as the `Authorization` header ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)). > [accordion] Claude vs Cursor setup differences? > > Claude Desktop reads `claude_desktop_config.json`; Cursor can add the same server via “Add MCP Server” or inherit Claude’s config. > [accordion] How to troubleshoot 'Server disconnected'? > > Use absolute paths to `uvx`/`npx` in the config; many desktop apps don’t inherit shell `PATH`. > [accordion] Is the MCP server read-only? > > Yes. Every tool is a read-only data query; the server cannot modify on-chain state or your data, so no flag is needed. # Connect DexPaprika MCP to any client Source: https://docs.dexpaprika.com/ai-integration/mcp-clients Connect the keyless DexPaprika MCP server to any MCP-compatible client (Windsurf, Cline, Zed, and more). One canonical config: a remote SSE/streamable-HTTP URL, or a local stdio command. DexPaprika ships a standard MCP server, so it works with any MCP-compatible client, not just the ones with a dedicated guide. There are two ways to connect, and most clients accept the first. ## Option 1: Remote server (recommended) Point your client at the hosted server. No install, keyless. ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` `/sse` is the recommended transport. The same server also serves streamable HTTP at `https://mcp.dexpaprika.com/streamable-http` for clients that prefer it. ## Option 2: Local server (stdio) Run the server on your machine and have the client launch it: ```json theme={null} { "mcpServers": { "dexpaprika": { "command": "npx", "args": ["-y", "dexpaprika-mcp@latest"] } } } ``` ## Where to put the config The `mcpServers` shape above is what **Claude Desktop, Cursor, VS Code, Cline, and Windsurf** use. The file location differs per client (for example Windsurf keeps it in `~/.codeium/windsurf/mcp_config.json`, Cline in its MCP settings pane), so check your client's MCP docs for the exact path, then paste one of the blocks above. A few clients use a different shape: | Client | Config format | | - | - | | Claude Desktop, Cursor, VS Code, Cline, Windsurf | `mcpServers` JSON (above) | | Codex CLI | TOML in `~/.codex/config.toml` (see the [Codex guide](/ai-integration/codex)) | | Zed | `context_servers` in `settings.json` (Zed's own key), pointing at the same URL or command | We have step-by-step guides for [Cursor](/ai-integration/cursor-ide-integration), [VS Code](/ai-integration/vscode-ide-integration), [Claude Code](/ai-integration/claude-code-plugin-guide), and [Codex](/ai-integration/codex). For anything else, the config above is all you need. ## What you get 20 tools across networks, pools, tokens, OHLCV, transactions, and cross-chain search. Start with `getCapabilities` for the runtime manifest, or read the [MCP tools reference](/ai-integration/mcp-tools). ## FAQs > [accordion] My client isn't listed. Will it work? > > If it supports MCP, yes. DexPaprika is a standard MCP server. Use the remote `url` config for a hosted connection, or the stdio `command` config to run it locally, in whatever place your client keeps MCP servers. > [accordion] Remote or local: which should I choose? > > Remote (`url`) is simplest: no install, always up to date, keyless. Choose local (stdio) if your client does not support remote MCP servers, or you want to run the server in your own environment. > [accordion] Do I need an API key? > > No. Both the hosted server and the npm package read keyless. The npm package calls the API from your machine, so a [free key](https://console.dexpaprika.com) raises your allowance there; see [rate limits](/knowledge-base/rate-limits). The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). # DexPaprika MCP tools reference Source: https://docs.dexpaprika.com/ai-integration/mcp-tools Complete reference for all 18 DexPaprika MCP tools: parameters, defaults, pagination, sorting, and return shapes. The machine-readable manifest an AI agent needs to plan calls before connecting. This page lists every tool the DexPaprika MCP server exposes, with parameters, defaults, and return shapes, so an agent (or a developer) can plan calls before connecting. > [!NOTE] > > **Agents: call `getCapabilities` first.** In one call it returns the workflow patterns, network name synonyms, and common pitfalls below as structured JSON, so the server describes itself at runtime. This page is the human-readable mirror of that manifest. The server exposes **20 tools** across five groups. All data is read-only; `submitFeedback` is the only write tool and is available on the hosted server only. ## Conventions that apply to every tool These rules hold across the whole surface. Read them once and the individual tools get much shorter. | Convention | What to know | | - | - | | **`rationale` (required)** | Every read tool takes a `rationale` string (20-500 chars): 1-2 sentences on what triggered the call and how you will use the result. It is logged to improve the server and never shown to end users. | | **Network ids** | Tools that take a `network` want the canonical slug (`ethereum`, `solana`, `base`). Call `getNetworks` for the list, or `getCapabilities` for the synonym map that resolves `eth`, `matic`, `bnb`, and similar to the right slug. | | **Pagination** | List tools return rows under `results` with **cursor pagination**: read `has_next_page` and pass `next_cursor` back as `cursor` for the next page. On the npm server, paging needs an API key: keyless, an agent gets the first page and the next call returns `403` with `"param": "cursor"`, so set `DEXPAPRIKA_API_KEY` to a [free key](https://console.dexpaprika.com) to page. The hosted server at `mcp.dexpaprika.com` pages without a key of yours. Two older tools (`getNetworkDexes` and `getPoolTransactions`) use 1-indexed `page` numbers instead. | | **Sorting** | Over MCP use `sort_by` (a field name) and `sort_dir` (`asc`/`desc`, default `desc`); `order_by`/`sort` are also accepted and mapped. Default sort is `volume_usd_24h`. **Calling the REST API directly? Use `order_by`/`sort`** ([REST reference](/api-reference/introduction)): those are the names it requires. Until 23 November 2026 an unrecognized name is ignored, so a wrong name looks like a working sort while you get the default order; from that date it answers `400`. | | **Rate limits** | 15 requests/min keyless, 30/min with a [free key](https://console.dexpaprika.com), 500/min on Pro. Over the limit returns HTTP 429; back off and retry after a short pause. See [rate limits](/knowledge-base/rate-limits). | | **Output** | Every tool returns both `content[0].text` (a JSON string) and `structuredContent` (validated against the tool's output schema). Prefer `structuredContent`. | *** ## Discovery and onboarding ### getCapabilities Agent onboarding in one call: supported workflows, network name synonyms, common pitfalls, and recommended call sequences. Read it once at the start of a session. Returns static onboarding docs, not live market data. No parameters beyond `rationale`. ### getNetworks The full list of blockchain networks DexPaprika indexes, each with 24h volume, transaction counts, and pool counts. Start here (or `getCapabilities`) because every other DEX query needs a valid network slug. No parameters beyond `rationale`. ### getStats Platform-wide totals: number of networks, DEXes, pools, and tokens indexed. Ecosystem-wide counts, not per-network figures (use `getNetworks` for the per-chain breakdown). No parameters beyond `rationale`. ### search Search across **all** networks at once for tokens, pools, and DEXes by name, symbol, or address. Returns three arrays: `tokens`, `pools`, `dexes`. This is the cross-chain entry point; once you have a network slug, switch to the network-scoped tools. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `query` | yes | string | | Name, symbol, or address (for example `uniswap`, `PEPE`, `0x...`) | | `limit` | no | number | | Max results per category, applied client-side | *** ## Pools ### getNetworkPools The top liquidity pools on one network, ranked by 24h volume by default. The primary pool-discovery tool for a whole chain. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug from `getNetworks` | | `limit` | no | number | 10 | Max 100 | | `cursor` | no | string | | `next_cursor` from a previous response | | `sort_by` | no | enum | `volume_usd_24h` | `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `price_usd`, `price_change_percentage_24h`, `price_change_percentage_48h`, `price_change_percentage_6h`, `price_change_percentage_1h`, `price_change_percentage_5m`, `created_at` | | `sort_dir` | no | `asc`/`desc` | `desc` | | Rows return under `results` with cursor pagination. ### getNetworkPoolsFilter Pools on one network filtered by exact thresholds for volume, liquidity, transaction count, price change, or creation time. Choose this over `getNetworkPools` when the user gives numeric constraints or a time window. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `limit` | no | number | 50 | Max 100 | | `cursor` | no | string | | Cursor pagination | | `volume_24h_min` / `volume_24h_max` | no | number | | 24h volume in USD | | `volume_7d_min` / `volume_7d_max` | no | number | | 7d volume in USD | | `liquidity_usd_min` / `liquidity_usd_max` | no | number | | Pool liquidity in USD | | `txns_24h_min` | no | number | | Minimum 24h transactions | | `price_change_percentage_24h_min` / `_max` | no | number | | 24h price change, percent | | `price_change_percentage_48h_min` / `_max` | no | number | | 48h price change, percent | | `price_change_percentage_6h_min` / `_max` | no | number | | 6h price change, percent | | `price_change_percentage_1h_min` / `_max` | no | number | | 1h price change, percent | | `price_change_percentage_5m_min` / `_max` | no | number | | 5m price change, percent | | `created_after` / `created_before` | no | string | | Creation-time window, both ends included: a relative offset such as `-24h`, Unix seconds, RFC3339 or `YYYY-MM-DD` | | `sort_by` | no | enum | `volume_usd_24h` | Same fields as `getNetworkPools` | | `sort_dir` | no | `asc`/`desc` | `desc` | | To find new pools: set `created_after` and sort by `created_at` descending. The hosted server searches like a free key, so pools created in the last hour are left out and a `created_after` window shorter than an hour comes back empty ([search freshness](/knowledge-base/rate-limits#search-freshness)). To find movers, pass a signed percentage bound: `price_change_percentage_1h_max: -20` returns pools down 20 percent or more over the last hour. ### getDexPools The pools that belong to one specific DEX on one network (for example all Uniswap v3 pools on ethereum). Narrower than `getNetworkPools`. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `dex` | yes | string | | DEX id from `getNetworkDexes`, its `dex_id` field (for example `uniswap_v3`), case-insensitive. A display name (`Uniswap V3`) returns no rows instead of an error | | `limit` | no | number | 10 | Max 100 | | `cursor` | no | string | | Cursor pagination | | `sort_by` | no | enum | `volume_usd_24h` | Same pool sort fields as `getNetworkPools` | | `sort_dir` | no | `asc`/`desc` | `desc` | | > [!NOTE] > > The REST endpoint behind this tool changed. `GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`, so the tool now calls `GET /networks/{network}/pools/search` with the `dex_name` filter. Two consequences: there is no `page` parameter any more, and the legacy sort values (`volume_usd`, `transactions`, `last_price_change_usd_24h`) are mapped to their canonical names before the request goes out. Rows arrive under `results` with `has_next_page` and `next_cursor`, and the 24h volume field on each row is `volume_usd_24h`. ### getPoolDetails Full details for one pool by address: the two tokens, current price, liquidity, 24h volume, and transaction counts. The live snapshot only, use `getPoolOHLCV` for history. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `pool_address` | yes | string | | Pool address | | `inversed` | no | boolean | false | Invert the price ratio for the other pair perspective | ### getPoolOHLCV Historical open/high/low/close/volume candles for one pool across a date range and interval. Historical time series, use `getPoolDetails` for the single current price. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `pool_address` | yes | string | | Pool address | | `start` | yes | string | | A relative offset such as `-24h` or `-7d`, UNIX timestamp, RFC3339, or `yyyy-mm-dd` | | `end` | no | string | | Same formats as `start` | | `limit` | no | number | 100 | Max 1000 | | `interval` | no | enum | `24h` | `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` | | `inversed` | no | boolean | false | Invert the price ratio | ### getPoolIndicator RSI, EMA, MACD, Bollinger Bands or VWAP for one pool, computed by the API from the pool's candles. Use it instead of pulling `getPoolOHLCV` and computing the indicator yourself. Works on every plan, keyless included, with the same interval and history limits as `getPoolOHLCV` ([limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). Values come oldest first, one per completed candle: `value` for rsi, ema and vwap; `macd`, `signal` and `histogram` for macd; `upper`, `middle` and `lower` for bbands. RSI, EMA and MACD are smoothed, so start well before the first value you rely on. Tutorial: [technical indicators](/tutorials/technical-indicators). | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `pool_address` | yes | string | | Pool address | | `indicator` | yes | enum | | `rsi`, `ema`, `macd`, `bbands`, `vwap` | | `interval` | no | enum | | `1m` to `24h`, or `1d`. Pass it every time | | `start` | no | string | | A relative offset such as `-24h` or `-7d`, Unix seconds, RFC3339 or `yyyy-mm-dd`. Without it you get the last `limit` values | | `end` | no | string | | Exclusive, same formats as `start` | | `limit` | no | number | 100 | Max 1000 | | `cursor` | no | string | | `next_cursor` from the previous page; not with `start` | | `period` | no | number | | rsi (14), ema (20), bbands (20), vwap (14). Not for macd | | `fast_period` / `slow_period` / `signal_period` | no | number | 12 / 26 / 9 | macd only | | `std_dev` | no | number | 2 | bbands only | A parameter that belongs to another indicator (`fast_period` on `rsi`, say) is refused with a 400. ### getPoolTransactions The recent individual swap transactions for one pool, newest first. Per-trade records, not aggregated candles. Needs a Dev, Pro or Enterprise key. On the hosted server it runs on your own key, sent as the `Authorization` header on your connection ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)); without one it returns `DP401_API_KEY_REQUIRED`. With the npm package, set `DEXPAPRIKA_API_KEY` and `DEXPAPRIKA_API_BASE_URL=https://api-pro.dexpaprika.com`. Keyless and free keys cannot call it: `getPoolDetails` gives the pool's transaction counts and volume instead. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `pool_address` | yes | string | | Pool address | | `page` | no | number | 1 | 1-indexed, up to 100 pages | | `limit` | no | number | 10 | Max 100 | | `cursor` | no | string | | Transaction id for cursor pagination | | `from` / `to` | no | string | | A relative offset such as `-1h`, Unix seconds, RFC3339 or `YYYY-MM-DD`. `from` is inclusive, `to` exclusive. Results are always capped to the last 7 days | *** ## Tokens ### getTokenDetails Metadata and multi-timeframe price and volume metrics for one token by contract address, including website, Twitter, and Telegram links. If you only have a symbol, call `search` first to resolve the address. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `token_address` | yes | string | | Token contract address | ### getTokenPools The liquidity pools that contain a specific token on one network. The token filter is network-scoped, so run `search` first if you do not know the network. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `token_address` | yes | string | | An unknown address returns an empty `results` array, not an error | | `limit` | no | number | 10 | Max 100 | | `cursor` | no | string | | Cursor pagination | | `sort_by` | no | enum | `volume_usd_24h` | Same pool sort fields as `getNetworkPools` | | `sort_dir` | no | `asc`/`desc` | `desc` | | > [!NOTE] > > `inversed`/`reorder` and `paired_token_address`/`address` are no longer supported (the underlying endpoint changed). Passing them returns a structured error. To flip a price, compute `1/price` client-side; for pair queries, filter `results[].tokens` client-side. ### getTokenOHLCV USD candles for one token, volume-weighted across every pool it trades in on the network, with volume summed across those pools. Use it for a token's price history; for one pair's candles use `getPoolOHLCV`. Needs a Dev, Pro or Enterprise key. On the hosted server it runs on your own key, sent as the `Authorization` header on your connection ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)); without one it returns `DP401_API_KEY_REQUIRED`. With the npm package, set `DEXPAPRIKA_API_KEY` and `DEXPAPRIKA_API_BASE_URL=https://api-pro.dexpaprika.com`. Keyless and free keys cannot call it: fall back to `getPoolOHLCV` on the token's most liquid pool. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `token_address` | yes | string | | Token address | | `start` | yes | string | | A relative offset such as `-24h`, UNIX timestamp, RFC3339, or `yyyy-mm-dd` | | `end` | no | string | | Same formats as `start` | | `limit` | no | number | 10 | Max 1000 | | `interval` | no | enum | `24h` | `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` | ### getTokenIndicator The same indicators computed from a token's USD candles across every pool it trades in. Same parameters as `getPoolIndicator`, with `token_address` in place of `pool_address`. Needs a Dev, Pro or Enterprise key. On the hosted server it runs on your own key, sent as the `Authorization` header on your connection ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)); without one it returns `DP401_API_KEY_REQUIRED`. With the npm package, set `DEXPAPRIKA_API_KEY` and `DEXPAPRIKA_API_BASE_URL=https://api-pro.dexpaprika.com`. Keyless and free keys cannot call it: fall back to `getPoolIndicator` on the token's most liquid pool. ### getTokenMultiPrices Current USD prices for up to 10 tokens on the same network in one batched call. Tokens that cannot be priced come back under `missing_tokens` rather than being dropped, so check that list for partial failures. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `tokens` | yes | string\[] | | 1 to 10 token addresses on the same network | ### filterNetworkTokens Tokens on one network filtered by exact thresholds for volume, liquidity, FDV, transactions, or creation time. Choose this over `getTopTokens` when the user gives numeric constraints. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `limit` | no | number | 50 | Max 100 | | `cursor` | no | string | | Cursor pagination | | `volume_24h_min` / `volume_24h_max` | no | number | | 24h volume in USD | | `liquidity_usd_min` / `liquidity_usd_max` | no | number | | Token liquidity in USD | | `fdv_min` / `fdv_max` | no | number | | Fully diluted valuation in USD | | `txns_24h_min` | no | number | | Minimum 24h transactions | | `created_after` / `created_before` | no | string | | Creation-time window, both ends included: a relative offset such as `-24h`, Unix seconds, RFC3339 or `YYYY-MM-DD` | | `sort_by` | no | enum | `volume_usd_24h` | `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `fdv_usd`, `price_change_percentage_24h`, `created_at` | | `sort_dir` | no | `asc`/`desc` | `desc` | | As with pools, tokens created in the last hour are left out on the hosted server. ### getTopTokens The top tokens on one network ranked by volume, liquidity, transactions, FDV, or 24h price change. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `limit` | no | number | 50 | Max 100 | | `cursor` | no | string | | Cursor pagination | | `sort_by` | no | enum | `volume_usd_24h` | Same token sort fields as `filterNetworkTokens` | | `sort_dir` | no | `asc`/`desc` | `desc` | | Ranking by raw price is not supported and falls back to volume. *** ## DEXes ### getNetworkDexes The DEXes (exchanges) operating on one specific network, for example Uniswap on ethereum or Raydium on solana. Use the returned `dex_id` with `getDexPools`. Each row carries both `dex_id` and `dex_name`. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `network` | yes | string | | Network slug | | `page` | no | number | 1 | 1-indexed | | `limit` | no | number | 10 | Max 100 | | `sort_by` | no | enum | | Only `pool` | | `sort_dir` | no | `asc`/`desc` | `desc` | | *** ## Feedback (hosted server only) ### submitFeedback Report a problem, unexpected response, or missing data back to the DexPaprika team. Available on the hosted server (`mcp.dexpaprika.com`) only; the self-host build does not include it. Unlike the read tools, it takes no `rationale`, the fields below are the context. | Param | Required | Type | Default | Notes | | - | - | - | - | - | | `goal` | yes | string | | What you were trying to accomplish (10-500 chars) | | `attempted_tools` | no | string\[] | | Tools you tried before getting stuck | | `blocked_at` | no | string | | Where exactly you got blocked | | `expected` | no | string | | What you expected to happen | | `observed` | no | string | | What actually happened | | `severity` | no | enum | `minor` | `blocker`, `major`, `minor`, `nit` | *** ## Recommended call sequences Common tasks map to short tool chains. `getCapabilities` returns this list at runtime. | Task | Sequence | | - | - | | Discover supported chains | `getNetworks` | | Top pools on a chain | `getNetworks` then `getNetworkPools` | | Pools above a volume/liquidity threshold | `getNetworks` then `getNetworkPoolsFilter` | | Newly created pools (older than an hour) | `getNetworkPoolsFilter` with `created_after`, sort `created_at` desc | | Token profile and its venues | `getTokenDetails` then `getTokenPools` | | Pools on one DEX | `getNetworkDexes` then `getDexPools` with the `dex_id` | | Batch price snapshot | `getTokenMultiPrices` (max 10 tokens) | | Top or filtered tokens | `getTopTokens` or `filterNetworkTokens` | | Historical price chart | `getPoolOHLCV` with `start` and `interval` | | Token price history across all pools | `getTokenOHLCV` (your Dev or Pro key); without one, `getTokenPools` then `getPoolOHLCV` | | Technical indicators (RSI, MACD, Bollinger Bands) | `getPoolIndicator` on the pool; `getTokenIndicator` for a token across all its pools (your Dev or Pro key) | | Raw swap feed | `getPoolTransactions` with `from`/`to` (your Dev or Pro key); without one, `getPoolDetails` for counts | | Find something across all chains | `search` | ## Common pitfalls * **List tools return rows under `results`** (not `pools`/`tokens`/`data`) with cursor pagination (`has_next_page` + `next_cursor`), not page numbers. This applies to `getNetworkPools`, `getNetworkPoolsFilter`, `getDexPools`, `getTokenPools`, `getTopTokens`, and `filterNetworkTokens`. * **`getDexPools` reads a filter, not a path.** The REST endpoint it used to wrap was removed and returns `410 Gone`; the tool now calls pool search with `dex_name`. If you were building the old URL by hand, stop: there is no `page`, and the 24h volume field is `volume_usd_24h`. * **`getTokenPools` is network-scoped.** The cross-network `search` cannot filter by token. An unknown `token_address` returns empty `results`, not an error. The old pair-flip and second-token parameters were removed and now return a structured error. * **Sort field names are canonical.** Prefer `volume_usd_24h`, `txns_24h`, `price_change_percentage_24h`, `fdv_usd`. Short legacy names are auto-mapped. Tokens cannot be ordered by raw price. * **Every price change window but 24h is pool-only.** `price_change_percentage_48h`, `_6h`, `_1h` and `_5m` sort the four tools that return pool rows: `getNetworkPools`, `getNetworkPoolsFilter`, `getDexPools` and `getTokenPools`. Only `getNetworkPoolsFilter` takes them as `_min` / `_max` bounds. The token tools (`getTopTokens`, `filterNetworkTokens`) sort by `price_change_percentage_24h` and no other window, and token rows never include those four fields. The 48h window needs dexpaprika-mcp 2.7.3 or later. * **`filterNetworkTokens` has no price-change bound.** The REST endpoint behind it, `GET /networks/{network}/tokens/search`, does accept `price_change_percentage_24h_min` / `_max`, and the tool does not surface them. Call the endpoint directly when you need to screen tokens by 24h move. * **`getTokenMultiPrices` is capped at 10 tokens** per request. * **`getPoolTransactions` `from`/`to` take a relative offset** such as `-1h`, as well as Unix seconds, RFC3339 or `YYYY-MM-DD`. Results are always capped to the last 7 days. * **Token addresses must match the network.** Do not send a Solana address to an ethereum query. ## FAQs > [accordion] How many tools does the DexPaprika MCP server have? > > 20: nineteen read-only data tools plus `submitFeedback`, which is available on the hosted server only. Call `getCapabilities` for the live list. > [accordion] Do I need an API key to call the tools? > > For every tool but three, no. `getTokenOHLCV`, `getTokenIndicator` and `getPoolTransactions` need a Dev, Pro or Enterprise key: on the hosted server it is your own key, sent as the `Authorization` header ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)). The npm package calls the API from your machine, so your own plan's limits apply there; see [rate limits](/knowledge-base/rate-limits) and [pricing](https://dexpaprika.com/api/pricing). > [accordion] What is the rationale field for? > > Every read tool requires a short `rationale` string describing why you are calling it. It is logged to improve the server and is never shown to end users. Include no secrets or personal data. > [accordion] How does pagination work? > > Most list tools use cursor pagination: read `has_next_page` and pass `next_cursor` back as `cursor`. `getNetworkDexes` and `getPoolTransactions` are the two that still use 1-indexed `page` numbers. # Use DexPaprika in n8n Source: https://docs.dexpaprika.com/ai-integration/n8n Two ways to use live DEX market data in n8n: the dedicated n8n-nodes-dexpaprika community node with typed operations, or the built-in MCP Client Tool pointed at the keyless hosted MCP server. No API key needed to start. There are two ways to pull live DexPaprika data into n8n, and both are keyless: * **The dedicated `n8n-nodes-dexpaprika` community node** gives you typed operations (token prices, pools, OHLCV, search) you can drop straight into a workflow or hand to an AI Agent as a tool. * **The built-in MCP Client Tool node** connects an AI Agent to all 18 DexPaprika tools over the hosted MCP server with nothing to install. Use the community node when you want explicit, deterministic steps in a workflow. Use the MCP Client Tool when you want a model to pick from the full tool set on its own. ## Option 1: the DexPaprika community node `n8n-nodes-dexpaprika` is published on npm and carries the `n8n-community-node-package` tag, so it shows up in n8n's community node search. ### Install On a self-hosted n8n instance: 1. Go to **Settings > Community Nodes**. 2. Click **Install**. 3. Enter `n8n-nodes-dexpaprika` and confirm. The **DexPaprika** node then appears in the node panel. > [!NOTE] > > Community nodes install on self-hosted n8n. We are submitting the node to the n8n Creator Portal for the verified badge, which also makes verified nodes available on n8n Cloud. ### Operations The node covers three resources: * **Token**: search, get details, get USD prices for up to 10 tokens at once, get top tokens on a network, and, with a Dev, Pro or Enterprise key, token OHLCV and technical indicators. * **Pool**: get top pools on a network, get pool details, get historical OHLCV candles, get a technical indicator (RSI, EMA, MACD, Bollinger Bands or VWAP) on every plan. Indicators need node version 0.5.0 or later. * **Network**: list networks, list DEXes on a network, get platform stats. It is also marked `usableAsTool`, so you can wire it into an **AI Agent** node's **Tool** input and let the agent call these operations directly. ## Option 2: the built-in MCP Client Tool node If you would rather not install anything, n8n's **MCP Client Tool** node connects an AI Agent to the hosted server and exposes all 20 tools. 1. In your workflow, add an **AI Agent** node (Tools Agent). 2. Add an **MCP Client Tool** node and connect its output into the AI Agent node's **Tool** input. 3. On the MCP Client Tool node, create an MCP credential: * **Transport:** SSE * **SSE Endpoint:** `https://mcp.dexpaprika.com/sse` * **Authentication:** None 4. Set **Tools to Include** to **All**. The agent can now call any of the 18 DexPaprika tools when it needs live data. > [!NOTE] > > Use the **SSE** transport. n8n also has an HTTP Streamable option, but an open issue (n8n-io/n8n#24967) reports the transport selector being ignored on some builds, so prefer SSE until it is confirmed fixed on your version. ## Tools and the rationale field The hosted server exposes all 18 DexPaprika tools: networks, pools, tokens, OHLCV, transactions, and cross-chain search. See the [MCP tools reference](/ai-integration/mcp-tools) for the full list. Every read tool takes a required `rationale` string. It is part of each tool's schema, so the agent model fills it automatically. If you drive the agent with a smaller model and hit validation errors, add an instruction telling it to include a short rationale. ## Example Wire either node into a Tools Agent and prompt it with, for example, "What are the top 5 pools on Base by 24h volume?" The agent calls the top-pools operation and returns live results, which you can pass to any downstream n8n node (a message, a spreadsheet, a database). ## Resources * [n8n-nodes-dexpaprika on npm](https://www.npmjs.com/package/n8n-nodes-dexpaprika) * [n8n community nodes docs](https://docs.n8n.io/integrations/community-nodes/installation/) * [n8n MCP Client Tool node docs](https://docs.n8n.io) * [Hosted MCP server](/ai-integration/hosted-mcp-server) * [MCP tools reference](/ai-integration/mcp-tools) ## FAQs > [accordion] Do I need an API key? > > No. The hosted server and the community node both read keyless. The community node calls the API directly, so a [free key](https://console.dexpaprika.com) in its credential raises your allowance; see [rate limits](/knowledge-base/rate-limits). The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). > [accordion] Community node or MCP Client Tool? > > The community node gives typed operations you can place directly in a workflow or attach to an AI Agent. The built-in MCP Client Tool needs no install and exposes all 20 tools to an agent. Pick the node for deterministic steps, the MCP Client Tool for open-ended agent use. > [accordion] How do I install the community node? > > On self-hosted n8n, go to Settings > Community Nodes, click Install, and enter `n8n-nodes-dexpaprika`. Verified nodes are also available on n8n Cloud; our Creator Portal submission is in progress. > [accordion] SSE or HTTP Streamable for the MCP Client Tool? > > Use SSE (`https://mcp.dexpaprika.com/sse`) for now. HTTP Streamable exists but has a known transport-selection bug on some n8n builds. # Install DexPaprika agent skills Source: https://docs.dexpaprika.com/ai-integration/skills Add the DexPaprika skill to Claude Code, Cursor, or any compatible AI agent with one command. Gives your agent full knowledge of the DexPaprika REST API, CLI, and streaming service. ## What are agent skills? Agent skills are reusable instruction files that teach AI agents how to use a specific tool or API. When you install the DexPaprika skill, your AI agent gets a complete reference of every endpoint, CLI command, streaming parameter, and common workflow, so it can make correct API calls without guessing. > [!NOTE] > > Skills work with Claude Code, Cursor, Cline, OpenCode, and [many other AI agents](https://github.com/vercel-labs/skills). One install command, and no API key needed to start. *** ## What's included The DexPaprika skill installs the following files into your project: | File | What it provides | | - | - | | `SKILL.md` | Full API reference: all REST endpoints, CLI commands, MCP setup, streaming API, SDKs, common workflows, token addresses, pagination, error handling | | `references/openapi.yml` | Complete OpenAPI 3.1 specification with all schemas, parameters, and response types | | `references/cli-reference.md` | Every `dexpaprika-cli` command with flags, examples, and output formats | | `references/streaming-api.md` | SSE streaming documentation: GET/POST endpoints, response fields, connection handling | Your AI agent reads `SKILL.md` automatically. The reference files are loaded on demand when the agent needs deeper detail (like exact response schemas or CLI flag options). *** ## Install ### One command ```bash theme={null} npx skills add github.com/coinpaprika/skills/ --skill dexpaprika-api ``` This copies the skill files into `.claude/skills/dexpaprika-api/` in your current project. ![Terminal output showing npx skills add github.com/coinpaprika/skills/ --skill dexpaprika-api completing successfully, with files copied to .claude/skills/dexpaprika-api/](https://mintcdn.com/coinpaprikaspzoo/U1f3kwLDfml_ouAf/images/tutorials/skills-tut/npxskills.png?fit=max\&auto=format\&n=U1f3kwLDfml_ouAf\&q=85\&s=90fe95c3650e536039ba75e56e01dccc) > [!TIP] > > To install both CoinPaprika and DexPaprika skills at once, drop the `--skill` flag: > > ```bash theme={null} > npx skills add github.com/coinpaprika/skills/ > ``` ### What happens 1. The `skills` CLI (by [Vercel Labs](https://github.com/vercel-labs/skills)) fetches the skill from GitHub 2. Files are copied to `.claude/skills/dexpaprika-api/` 3. On next startup, your AI agent auto-discovers and loads the skill Your project directory should now look like this: ``` .claude/skills/ dexpaprika-api/ SKILL.md references/ openapi.yml cli-reference.md streaming-api.md ``` ![File tree showing .claude/skills/dexpaprika-api/ directory containing SKILL.md and references folder with openapi.yml, cli-reference.md, and streaming-api.md](https://mintcdn.com/coinpaprikaspzoo/U1f3kwLDfml_ouAf/images/tutorials/skills-tut/tree.png?fit=max\&auto=format\&n=U1f3kwLDfml_ouAf\&q=85\&s=81d75cbd379355e4b68c144f95902ebe) ### Restart your agent After installing, restart Claude Code (or your AI tool) so it picks up the new skill files. *** ## Verify it works After restarting, ask your AI agent a DexPaprika question: ``` What blockchain networks does DexPaprika support? ``` The agent should return a list of supported networks (Ethereum, Solana, Base, Arbitrum, Polygon, and more). If it does, the skill is loaded and working. Try a more specific query: ``` Get the current price of WETH on Ethereum using DexPaprika ``` The agent should call `https://api.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` and return the price. ![Claude Code answering a DexPaprika query about blockchain networks after skill installation, showing live API data returned](https://mintcdn.com/coinpaprikaspzoo/U1f3kwLDfml_ouAf/images/tutorials/skills-tut/queryresult.png?fit=max\&auto=format\&n=U1f3kwLDfml_ouAf\&q=85\&s=bc68967d1856b1461d010aafb1c25d55) *** ## Example queries Once the skill is loaded, your agent knows how to use the full DexPaprika stack. Here are some things you can ask: ### REST API queries ``` Show me the top 5 pools on Ethereum by 24h volume ``` ``` Get hourly OHLCV for the last day for the USDC/ETH pool on Uniswap V3 ``` ``` Search for PEPE token across all chains ``` ### CLI commands The skill teaches your agent to use `dexpaprika-cli` if it's installed: ``` Use dexpaprika-cli to stream live prices for WETH on Ethereum ``` ``` Run dexpaprika-cli to find newly created pools on Solana ``` ### Batch pricing ``` Get prices for WETH, USDC, and DAI on Ethereum in a single request ``` ### Streaming ``` Write a Python script that streams real-time WETH prices using DexPaprika's SSE endpoint ``` *** ## Skills vs MCP server vs Claude Code plugin | | Agent Skills | Hosted MCP Server | Claude Code Plugin | | - | - | - | - | | **Install** | `npx skills add` | Add URL to config | `/plugin install` | | **What it gives the agent** | Full API knowledge (endpoints, CLI, streaming docs) | Live tool calls (20 MCP tools) | MCP tools + agents + skills | | **Agent makes API calls** | Yes, directly via REST or CLI | No, MCP server handles calls | MCP server handles calls | | **Works offline** | Yes (skill files are local) | No (needs mcp.dexpaprika.com) | No (needs MCP server) | | **Works with** | Claude Code (default), Cursor, Cline, and more via `--agent` flag | Claude Desktop, Cursor, VS Code | Claude Code only | | **Best for** | Any agent that can make HTTP calls or run CLI commands | Quick AI IDE setup with managed tools | Claude Code users who want everything bundled | > [!NOTE] > > You can combine approaches. Install the skill for API knowledge **and** connect the MCP server for tool-based access. They complement each other. *** ## Manage skills ### List installed skills ```bash theme={null} npx skills list ``` ### Remove the skill ```bash theme={null} npx skills remove dexpaprika-api ``` ### Update to latest version ```bash theme={null} npx skills update ``` *** ## Troubleshooting > [accordion] Skill not loading after install > > Restart your AI agent (Claude Code, Cursor, etc.). Skills are discovered at startup. If it still doesn't load, check that the files are in the right location: > > ```bash theme={null} > ls .claude/skills/dexpaprika-api/ > ``` > > You should see `SKILL.md` and a `references/` directory. > [accordion] npx skills command not found > > The `skills` CLI requires Node.js. Make sure you have Node.js 16+ installed: > > ```bash theme={null} > node --version > ``` > > If Node.js is installed and it still fails, try running with a fresh npx cache: > > ```bash theme={null} > npx --yes skills add github.com/coinpaprika/skills/ --skill dexpaprika-api > ``` > [accordion] Agent not using DexPaprika for queries > > Be specific in your prompt. Instead of "What's the price of ETH?", try "Using the DexPaprika API, get the price of WETH on Ethereum." The agent should recognize the skill context and use the correct endpoints. > [accordion] Wrong directory structure > > Skills must be direct children of `.claude/skills/`. If the files ended up nested differently (e.g., `.claude/skills/skills/dexpaprika-api/`), move the `dexpaprika-api` folder so it sits directly inside `.claude/skills/`. See the directory tree in the [Install](#install) section for the expected layout. *** ## Next steps > [card] [CLI guide](/tutorials/cli) > > Install dexpaprika-cli for direct terminal access to all endpoints > [card] [Hosted MCP Server](/ai-integration/hosted-mcp-server) > > Add MCP server access to Claude Desktop, Cursor, or VS Code > [card] [Claude Code Plugin](/ai-integration/claude-code-plugin-guide) > > Get the full plugin bundle with MCP tools, agents, and skills > [card] [REST API Reference](/api-reference/introduction) > > Complete endpoint documentation with interactive playground *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. ### FAQs > [accordion] Do I need an API key? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP, and [registering a free key](https://console.dexpaprika.com) raises that to 100,000. The skill teaches your agent to call the API directly either way. > [accordion] What's the difference between skills and MCP? > > Skills give your agent knowledge (API docs, CLI commands, common patterns). MCP gives your agent tools (callable functions that return live data). Skills make your agent smarter about the API; MCP does the calling for it. > [accordion] Which AI agents support skills? > > Claude Code, Cursor, Cline, OpenCode, Aider, and many others. The `skills` CLI auto-detects your agent, or you can target one explicitly with the `--agent` flag. See the [full list of supported agents](https://github.com/vercel-labs/skills). > [accordion] Can I use skills and MCP together? > > Yes. Install the skill for deep API knowledge and connect the MCP server for tool-based access. They complement each other well. > [accordion] Does installing the skill send data to DexPaprika? > > No. The skill files are static reference documents stored locally in your project. Your agent reads them locally. API calls only happen when your agent decides to query the DexPaprika API based on what it learned from the skill. # Use DexPaprika with the Vercel AI SDK Source: https://docs.dexpaprika.com/ai-integration/vercel-ai-sdk Pull all 18 DexPaprika tools into the Vercel AI SDK with createMCPClient and the keyless hosted MCP server, then use them with generateText and streamText. No custom code. The Vercel AI SDK's MCP client connects to DexPaprika's hosted server and returns all 20 tools as ready-to-use AI SDK tools. Drop them into `generateText` or `streamText`. Keyless, no custom code. ## Install ```bash theme={null} npm install ai @ai-sdk/mcp @ai-sdk/anthropic ``` > [!NOTE] > > The AI SDK moves quickly. These snippets were verified against `ai@7.0.40` and `@ai-sdk/mcp@2.0.18`; pin those versions, or check the current [AI SDK MCP docs](https://ai-sdk.dev) if the API has shifted. ## Connect and get the tools ```ts theme={null} import { createMCPClient } from '@ai-sdk/mcp'; const mcp = await createMCPClient({ transport: { type: 'http', url: 'https://mcp.dexpaprika.com/streamable-http' }, }); const tools = await mcp.tools(); // all 18 DexPaprika tools ``` ## Use them in a generation ```ts theme={null} import { generateText } from 'ai'; import { anthropic } from '@ai-sdk/anthropic'; const { text } = await generateText({ model: anthropic('claude-sonnet-5'), tools, maxSteps: 5, prompt: 'Find the most liquid WETH pool on ethereum and report its 24h volume.', }); console.log(text); await mcp.close(); ``` Call `mcp.close()` when you are done so the connection is released. Swap in any AI SDK model provider you prefer. ## Tools and the rationale field The client returns all 18 DexPaprika tools: networks, pools, tokens, OHLCV, transactions, and cross-chain search. See the [MCP tools reference](/ai-integration/mcp-tools) for the full list. Every read tool takes a required `rationale` string. It is part of each tool's schema, so a capable model fills it automatically. If a smaller model omits it and errors, add a system instruction telling it to include a short rationale. ## Resources * [Vercel AI SDK docs](https://ai-sdk.dev) * [Hosted MCP server](/ai-integration/hosted-mcp-server) * [MCP tools reference](/ai-integration/mcp-tools) ## FAQs > [accordion] Do I need an API key for DexPaprika? > > No. The hosted server is keyless for read access. You still need a key for your model provider (Anthropic, OpenAI, and so on). The hosted server runs tool calls on its own shared capacity, not on a plan of yours, so a key raises no limit there. The exceptions are the tools that need a paid plan, which run on your own Dev, Pro or Enterprise key; see [the hosted server page](/ai-integration/hosted-mcp-server). Limits for direct REST calls are on [rate limits](/knowledge-base/rate-limits). > [accordion] Which transport does the AI SDK use? > > Streamable HTTP: `https://mcp.dexpaprika.com/streamable-http`. The server also serves SSE if you configure the client for it. > [accordion] Do I have to define the tools myself? > > No. `mcp.tools()` discovers all 20 tools from the server and returns them in the AI SDK tool shape. # Vibe code a crypto dashboard with AI Source: https://docs.dexpaprika.com/ai-integration/vibe-coding-with-ai Use Claude Code, Cursor, or any AI-assisted IDE with DexPaprika access to build a crypto dashboard from a natural language prompt. No manual API calls, let the AI do the work. ## What is vibe coding? Vibe coding means describing what you want in natural language and letting an AI assistant write the code. With DexPaprika connected to your AI tool, the AI can fetch real crypto data while it builds, testing endpoints, checking response shapes, and writing working code from the start. This tutorial shows the workflow, not a fixed script. Your results will vary based on your AI tool, your prompts, and what you ask for. *** ## Prerequisites Connect DexPaprika to your AI tool using one of these methods: | Tool | Setup | | - | - | | **Claude Code** | `/plugin marketplace add coinpaprika/claude-marketplace` then `/plugin install dexpaprika` | | **Cursor** | Add MCP server URL `https://mcp.dexpaprika.com/sse` in Settings → Tools & Integrations | | **VS Code** | Add MCP server via Copilot Chat settings | | **Claude Desktop** | Add `"dexpaprika": {"url": "https://mcp.dexpaprika.com/sse"}` to `claude_desktop_config.json` | See the [AI Integration overview](/ai-integration) for detailed setup instructions. *** ## Example 1: "Build me a token price dashboard" ### The prompt Give your AI a clear, specific prompt: ``` Build a single-page HTML dashboard that shows: 1. The current price of SOL, ETH, and BTC 2. Their 24h volume and price change percentage 3. Auto-refreshes every 30 seconds Use the DexPaprika API. No frameworks, just vanilla HTML, CSS, and JavaScript. The SOL address on Solana is So11111111111111111111111111111111111111112. Use the search endpoint to find ETH and BTC addresses. ``` ### What happens The AI will: 1. Call the DexPaprika search endpoint to find ETH and BTC token addresses and networks 2. Read the token details endpoint to understand the response format 3. Write HTML/CSS/JS that fetches from the DexPaprika REST API 4. Use `summary.price_usd` for the price, `summary.24h.volume_usd` for volume, and `summary.24h.last_price_usd_change` for the percentage change 5. Add a `setInterval` for auto-refresh ### Tips for better results * **Be specific about data fields.** "Show the 24h price change" is better than "show some stats" * **Name the tokens and networks.** Don't assume the AI knows every address * **Mention the API by name.** Say "Use the DexPaprika API" so the AI uses the MCP tools or REST endpoints * **Start simple, then iterate.** Get a working version first, then ask for styling, charts, or more features *** ## Example 2: "Find me the hottest new pools" ### The prompt ``` Use DexPaprika to find pools created in the last 24 hours on Solana that have more than $10,000 in daily volume and at least 100 transactions. Show them in a table sorted by volume, with the pool address, DEX, volume, and transaction count. ``` ### What the AI does The AI will use the pool search endpoint: ``` GET /networks/solana/pools/search?created_after=-24h&volume_usd_24h_min=10000&txns_24h_min=100&order_by=volume_usd_24h&sort=desc ``` Then format the results. It might also follow up with pool detail calls to get token pair names. *** ## Example 3: "Build a price comparison tool" ### The prompt ``` Build a Python script that compares the price of WETH across Ethereum, Arbitrum, and Base networks. Use DexPaprika batch pricing. Show the price on each network and highlight the highest and lowest. ``` ### What the AI does 1. Finds WETH addresses on each network (via search or by knowing common addresses) 2. Makes three batch pricing calls (one per network) 3. Compares results and formats output *** ## Example 4: "Add a live price ticker" ### The prompt ``` Add a live price ticker to the dashboard that streams real-time prices for SOL and ETH using the DexPaprika streaming API at streaming.dexpaprika.com. Use Server-Sent Events. ``` ### What the AI does The AI will use the streaming API: ```javascript theme={null} const evtSource = new EventSource( "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=solana&address=So11111111111111111111111111111111111111112" ); evtSource.addEventListener("token_price", (event) => { const data = JSON.parse(event.data); // data.price is the price as a string; parse as decimal for precision updatePrice(data.chain, data.address, data.price); }); ``` For multiple tokens, the AI should use the POST endpoint with a JSON array. *** ## Iteration tips Once you have a working first version, iterate with follow-up prompts: * "Add a chart showing the last 7 days of price history" (AI will use OHLCV endpoint) * "Show the top 5 pools for each token" (AI will use pool search with the `token_address` filter) * "Add error handling for when the API is down" * "Make it responsive for mobile" * "Add dark mode" * "Export the data to CSV" Each iteration builds on the previous code. The AI already has context about which endpoints to use and what the response formats look like. *** ## Common issues > [accordion] AI doesn't use DexPaprika > > Be explicit: "Use the DexPaprika API at api.dexpaprika.com" or "Use the DexPaprika MCP tool." If using an IDE integration, make sure the MCP server is connected and showing as active. > [accordion] AI uses wrong endpoint or field names > > Point the AI to specific documentation: "Check the token endpoint response format at docs.dexpaprika.com" or provide the correct field path directly: "The price is at response.summary.price_usd, not response.price." > [accordion] CORS errors in browser > > The API doesn't send CORS headers to other sites, so a browser blocks direct calls to `api.dexpaprika.com` and `streaming.dexpaprika.com` from your page. Changing the URL won't fix it. Make the call from your backend or a small proxy (a Next.js route handler, a Cloudflare Worker) and have the page call that. Tell the AI exactly that: "Fetch DexPaprika from a server route, not from the browser." [Response headers and CORS](/knowledge-base/response-headers#cors) has the options. > [accordion] AI hallucinates endpoints that don't exist > > If the AI invents endpoints, ground it: "Only use endpoints from the DexPaprika API reference at docs.dexpaprika.com/api-reference/introduction. The available endpoints are: /networks, /search, /networks//pools, /networks//tokens/, /networks//pools//ohlcv, etc." *** ## Next steps > [card] [AI Integration Setup](/ai-integration) > > Connect DexPaprika to your AI tool > [card] [Common Patterns](/knowledge-base/common-patterns) > > Standard API workflows to reference in your prompts > [card] [Streaming API](/streaming/introduction) > > Real-time price streaming for live dashboards > [card] [Pool Filtering](/tutorials/pool-filtering) > > Advanced pool screening with the filter endpoint # Connect DexPaprika MCP to VS Code Source: https://docs.dexpaprika.com/ai-integration/vscode-ide-integration Learn how to integrate DexPaprika documentation and the hosted MCP server directly into VS Code for enhanced AI-assisted workflows. ## Integration overview Add the hosted MCP server to VS Code’s Copilot Chat and index docs for better AI assistance. ## What is VS Code? Visual Studio Code is a popular open-source editor with rich AI and extension capabilities. With MCP (Model Context Protocol) support in Copilot Chat, VS Code can access external data sources and documentation to provide more intelligent coding assistance. ## Why integrate DexPaprika with VS Code? * **Real-time crypto data access** - Live market data, pool information, and token prices while coding * **Enhanced AI assistance** - Copilot Chat can reference DexPaprika data for better suggestions * **DeFi development workflow** - Build faster with comprehensive blockchain data * **Documentation context** - Quickly reference our API docs and tutorials while you work *** ## Step 1: Install with one click > [card] [Add DexPaprika to VS Code](vscode:mcp/install?%7B%22name%22%3A%22DexPaprika%20API%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.dexpaprika.com%2Fsse%22%7D) > > Opens VS Code and pre-fills the DexPaprika MCP server (`https://mcp.dexpaprika.com/sse`) in Copilot Chat. Click **Install**, then restart VS Code if prompted. Prefer to configure it manually? Follow the steps below. **1. Confirm the Server URL** 1. The install dialog pre-fills the DexPaprika hosted MCP SSE URL: ``` https://mcp.dexpaprika.com/sse ``` 2. Click **Install** to complete the setup 3. Restart VS Code if prompted ![VS Code MCP server configuration dialog with 'https://mcp.dexpaprika.com/sse' entered in the URL field](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/vscode-ide-integration/2.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=7ca6a259a424f2d2a642a8250acadfd5) **2. Verify MCP Integration** 1. Open **Copilot Chat** in VS Code 2. Ask: "What are the top liquidity pools on Ethereum?" 3. You should see DexPaprika data being retrieved and displayed 4. Ask about specific networks, tokens, or pools to test further ![VS Code Copilot Chat showing a response with DexPaprika pool data including volume, TVL, and token pairs](https://mintcdn.com/coinpaprikaspzoo/p-TDivGTznmTj8bf/images/tutorials/vscode-ide-integration/3.png?fit=max\&auto=format\&n=p-TDivGTznmTj8bf\&q=85\&s=5947a7936be8575acc3894986126ff2c) > [!NOTE] > > If the button is not visible, copy this URL into the prompt when VS Code asks for the server address: `https://mcp.dexpaprika.com/sse`. ## Available features Once integrated, you can access comprehensive DexPaprika functionality in Copilot Chat: ### Real-time data access * **Network information** - Supported blockchain networks * **DEX data** - Decentralized exchange information and metrics * **Pool analytics** - Real-time liquidity pool data, volumes, and fees * **Token information** - Current prices, market data, and token details * **Search functionality** - Find tokens, pools, and DEXes across networks ### Documentation context * **API reference** - Complete endpoint docs and examples * **SDK guides** - Language-specific integration tutorials * **Best practices** - Coding patterns and optimization tips * **Troubleshooting** - Common issues and solutions *** ## Usage examples ### Example 1: Building a DeFi dashboard ``` "Help me create a React component that displays the top 5 liquidity pools on Ethereum using the DexPaprika API. Include volume, TVL, and price data." ``` ### Example 2: Token price monitoring ``` "Build a Python script that monitors SOL token prices across different DEXes and alerts when there are significant price differences." ``` ### Example 3: Pool discovery bot ``` "Create a Node.js application that finds newly created liquidity pools with high trading volume and sends notifications." ``` *** ## Troubleshooting > [accordion] MCP server connection issues > > **Symptoms**: Errors or timeouts when connecting. > > **Solutions**: > > 1. Verify internet connection is stable > 2. Check the server URL is exactly: `https://mcp.dexpaprika.com/sse` > 3. Restart VS Code completely > 4. Remove and re-add the MCP configuration > 5. Check VS Code output/logs for MCP-related errors > [accordion] No tools or data showing in chat > > **Symptoms**: DexPaprika tools do not appear or responses lack data. > > **Solutions**: > > 1. Ensure the server is added and enabled in MCP settings > 2. Try re-adding via the **Connect to VS Code** button > 3. Ask more specific questions (e.g., network or token names) > 4. Restart VS Code > [accordion] Performance issues > > **Symptoms**: Slow responses. > > **Solutions**: > > 1. Check network speed > 2. Break complex queries into smaller parts > 3. Use specific network/token names in queries *** ## Need help? > [card] [Join Our Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community for real-time support and discussions > [card] [Direct Support](mailto:support@coinpaprika.com) > > Contact our team for technical assistance and custom integrations > [!NOTE] > > Share your VS Code + DexPaprika integrations with our community! We love seeing what developers build. [Reach out](mailto:support@coinpaprika.com) to showcase your work. ### FAQs > [accordion] How do I add the hosted MCP URL manually? > > In the MCP prompt, paste `https://mcp.dexpaprika.com/sse`, confirm, and restart VS Code if needed. > [accordion] Copilot Chat doesn’t show DexPaprika tools? > > Re-add the server and retry a scoped prompt (include network or token) to ensure the tools activate. > [accordion] How to debug connection errors? > > Check the Output/Logs panel for MCP errors, verify the URL, and restart VS Code; re-add the server if necessary. # Pro API: authenticated access on api-pro.dexpaprika.com Source: https://docs.dexpaprika.com/api-pro/introduction api-pro.dexpaprika.com serves paid plans only and needs your API key in the Authorization header. What to send, what each error means, and how to move an existing integration across. `api-pro.dexpaprika.com` serves paid plans only. Every request to it needs your API key in the `Authorization` header, sent as the entire header value with no scheme word in front of it. If you are keyless or on a free key, this is not your host. Build against `api.dexpaprika.com`, where the same endpoints, paths and parameters answer with the same data, except [token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) and [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), which need a paid plan. Get or copy your key in [console.dexpaprika.com](https://console.dexpaprika.com), compare plans on [pricing](https://dexpaprika.com/api/pricing), and if you already have a working free-tier integration, [upgrading to Pro](/api-pro/upgrading) is the whole list of changes it needs. ```bash A request that works theme={null} curl "https://api-pro.dexpaprika.com/networks" \ -H "Authorization: api_YOUR_KEY" ``` ## If your request just failed | What you sent | What comes back | | - | - | | No `Authorization` header, on `/` | `401` and JSON: `{"message": "missing or invalid api key"}` | | No `Authorization` header, on a data path | `403` and an HTML block page from the edge, with no JSON body | | A key we do not recognise | `401` and JSON: `{"message": "api key verification has failed"}` | | A free key | `403` and JSON carrying `"error": "wrong_host"`, naming `api.dexpaprika.com` as your host | The HTML body is the one that surprises people. This host sits behind an edge rule that can reject a request before it reaches the API, and that rule answers with an HTML page rather than the JSON everything else here returns. Treat an HTML body as a prompt to check the header and the base URL first, before you regenerate anything. Every status code and body is listed on [error handling](/knowledge-base/error-handling). ## What Pro changes Both hosts serve the same data on the same 35 chains, and every free endpoint is here too. What changes is freshness, headroom, OHLCV depth, access to [token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) and [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), and support. Free-tier responses can be up to 60 seconds behind; Pro is real time. Pro also raises the monthly credit allowance and the per-minute rate, carries a 99.5% SLA, and includes priority support. Current numbers for every tier are on [rate limits](/knowledge-base/rate-limits) and [pricing](https://dexpaprika.com/api/pricing). Enterprise is this same host and this same API, with the limits set per contract. *** ## Getting started ### 1. Get your API key Pro is self-serve. You do not need to talk to anyone to start. **1. Create your account** Sign up at [console.dexpaprika.com](https://console.dexpaprika.com). No card is required to create the account. **2. Subscribe to Pro** Pick Pro on the [pricing page](https://dexpaprika.com/api/pricing) at $99/month, or $1,032 billed annually. Enterprise is the same API with limits agreed per contract; that one does start with a conversation. **3. Copy your key** Your key is under **Keys** in the console. Each account has a single API key, so this is the one you use everywhere. > [card] [Open the console](https://console.dexpaprika.com) > > Create an account, manage your subscription, and read your usage > [card] [Customer portal](https://console.dexpaprika.com) > > Create your API key and track credit usage Enterprise is the one that goes through us. [Email the team](mailto:support@coinpaprika.com) for custom limits, unmetered streaming and a 99.95% SLA. > [!NOTE] > > Building on the free tier first is the right move: `api.dexpaprika.com` needs > no key at all and serves the same data. Come here when you hit the ceiling. ### 2. Authentication All Pro API requests require authentication via the `Authorization` header: ```bash cURL theme={null} curl "https://api-pro.dexpaprika.com/networks/ethereum/pools/search" \ -H "Authorization: api_YOUR_API_KEY_HERE" ``` ```python Python theme={null} import requests headers = { "Authorization": "api_YOUR_API_KEY_HERE" } response = requests.get( "https://api-pro.dexpaprika.com/networks/ethereum/pools/search", headers=headers ) print(response.json()) ``` ```javascript JavaScript theme={null} const headers = { 'Authorization': 'api_YOUR_API_KEY_HERE' }; fetch('https://api-pro.dexpaprika.com/networks/ethereum/pools/search', { headers: headers }) .then(response => response.json()) .then(data => console.log(data)); ``` ```go Go theme={null} package main import ( "fmt" "io" "net/http" ) func main() { req, _ := http.NewRequest("GET", "https://api-pro.dexpaprika.com/networks/ethereum/pools/search", nil) req.Header.Set("Authorization", "api_YOUR_API_KEY_HERE") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ### 3. API key format Your API key will follow this format: ``` api_your_personal_api_key ``` Your key already starts with `api_`. Send it exactly as the console shows it, as the entire value of the `Authorization` header, with nothing added in front. > [!WARNING] > > Send the key as the entire `Authorization` header value, nothing before it and nothing > after it. If your HTTP client only offers a token field that prepends a scheme word, do > not use it; set a raw header instead. On `api-pro.dexpaprika.com` a request the edge does > not recognise is answered with a `403` HTML page rather than a JSON error body, so do not > assume every failure parses as JSON. *** ## Differences from the free API | Feature | Free API | Pro API | | - | - | - | | **Base URL** | `https://api.dexpaprika.com` | `https://api-pro.dexpaprika.com` | | **Authentication** | None required | API key required | | **Credits** | 10,000 keyless, 100,000 with a free key, per rolling 30 days | 5,000,000 a month included, then \$20 per additional 1M | | **Requests per minute** | 15 keyless, 30 with a [free key](https://console.dexpaprika.com) | 500 | | **Max data delay** | up to 60 seconds | real time | | **SLA** | best effort | 99.5% | | **Infrastructure** | Shared | Dedicated | | **Support** | Community | Priority support | | **REST endpoints** | All endpoints except pool transactions and token OHLCV | All endpoints, including [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) and [token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) | | **Pool transactions** (REST and `/sse/transactions`) | `403` | full access | | **OHLCV history / candles** | 24 hours and `1h`+ keyless, 7 days and `10m`+ with a free key | no plan limit on history, all intervals, pool and token OHLCV | | **SSE streaming** | 34 public price streams keyless; prices on any token and reserves, up to 10 concurrent, with a free key | all four feeds, metered, up to 100 concurrent | Credit detail lives on the [rate limits page](/knowledge-base/rate-limits), and plans on [pricing](https://dexpaprika.com/api/pricing). All 35 chains and every REST endpoint except [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) and [token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) are available on the free tier as well; what the paid plans change is freshness, allowance, OHLCV depth (see [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)), the [paid-only endpoints](/knowledge-base/rate-limits#paid-only-endpoints) (transactions over REST and SSE, token OHLCV, candle streaming), streaming scope and support. **Enterprise is this same API with the limits raised for your workload**, so everything below applies unchanged. **Dev sits between the two.** For $30 a month you get 500,000 credits per billing month, 120 requests a minute and up to 30 concurrent streams, on this same host and with the same key format as Pro. Data is real time and support is email; the SLA stays best effort rather than the 99.5% Pro carries, and past the included credits Dev bills at the same $20 per additional 1M. Check [pricing](https://dexpaprika.com/api/pricing) for the current numbers. > [!TIP] > > All REST endpoints available in the free API are also available in the Pro API, plus the paid-only [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) endpoint. Simply replace the base URL and add authentication. *** ## Quick start example Let's fetch Solana SOL token data using the Pro API: **1. Prepare your request** Replace `YOUR_API_KEY_HERE` with your actual API key: ```bash theme={null} curl "https://api-pro.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" \ -H "Authorization: api_YOUR_API_KEY_HERE" ``` **2. Receive the response** The same data the free API returns, captured live. The `30m`, `15m`, `5m` and `1m` interval objects and the social links are trimmed here for length; the real response carries them: ```json Response [expandable] theme={null} { "id": "So11111111111111111111111111111111111111112", "name": "Wrapped SOL", "symbol": "SOL", "chain": "solana", "decimals": 9, "total_supply": 9729104.429281628, "has_image": true, "added_at": "2026-08-10T14:20:16Z", "price_stats": { "high_24h": 97.72851812469702, "low_24h": 92.53839547091638, "ath": 2094.381880389729, "ath_date": "2025-02-18T22:43:00Z" }, "summary": { "chain": "solana", "id": "So11111111111111111111111111111111111111112", "price_usd": 95.00021242163845, "fdv": 924266987.4540582, "liquidity_usd": 553757948.2095541, "pools": 79958, "24h": { "volume": 55022471.30115615, "volume_usd": 5215005748.220995, "sells": 15117657, "buys": 8886063, "txns": 24126210, "buy_usd": 2528611480.8570423, "sell_usd": 2686394267.3639526, "last_price_usd_change": 1.36503236687871 }, "6h": { "volume": 15008105.889129847, "volume_usd": 1415167906.7786279, "sells": 3848462, "buys": 2257851, "txns": 6135660, "buy_usd": 686184008.4416271, "sell_usd": 728983898.3370007, "last_price_usd_change": 0.8177448219626 }, "1h": { "volume": 2522513.1508265836, "volume_usd": 239070465.79418552, "sells": 694311, "buys": 363197, "txns": 1063751, "buy_usd": 115287924.18944858, "sell_usd": 123782541.60473694, "last_price_usd_change": 0.20697823770267 } }, "last_updated": "2026-08-24T10:33:47.365548003Z" } ``` *** ## Error handling ### Authentication errors > [accordion] 403 and an HTML page saying you have been blocked > > The response is not JSON. The body is an HTML page headed **"Sorry, you have been > blocked"** with a Cloudflare ray ID. > > **What it means:** the request reached this host carrying no `Authorization` header at > all, so it was stopped at the edge before the API saw it. It is not an IP ban and there > is no cooldown: the next request with a header is served normally. > > **Solution:** send your key in the `Authorization` header. If you are parsing responses > as JSON, check the content type first, because this one will not parse. > [accordion] 401 Unauthorized - no key, or a key we do not recognise > > **Error response:** > > ```json theme={null} > { > "message": "api key verification has failed" > } > ``` > > The host root answers `{"message": "missing or invalid api key"}` for the same reason. > > **Solution:** the header arrived but its value is not a key we know. Copy the key again > from [console.dexpaprika.com](https://console.dexpaprika.com). Each account has exactly > one key and regenerating has no overlap window, so if you regenerated it, every > integration needs the new value. > [accordion] 403 Forbidden - the key and the host disagree > > A key that is valid for one plan sent to the other plan's host returns a structured > `wrong_host` body naming the host to use. > > **Solution:** match the host to your plan. Keyless traffic and free keys go to > `api.dexpaprika.com` and `streaming.dexpaprika.com`; paid keys go to > `api-pro.dexpaprika.com` and `streaming-pro.dexpaprika.com`. Paths, query parameters and > response shapes are identical, so only the base URL changes. Full detail on > [403 Forbidden (wrong host)](/knowledge-base/error-handling#403-forbidden-wrong-host), > and the whole switch is in [upgrading to Pro](/api-pro/upgrading). ### Other errors All other error codes match the [standard DexPaprika API](/api-reference/introduction): * `400 Bad Request` - Invalid parameters * `402 Payment Required` - credit allowance for the billing period exhausted. Retrying does not help. Turn on autoscaling in [console.dexpaprika.com](https://console.dexpaprika.com) to let usage run past the cap at \$20 per additional 1,000,000, up to your spend limit. See [error handling](/knowledge-base/error-handling#402-payment-required) * `404 Not Found` - Resource not found * `429 Too Many Requests` - per-minute rate exceeded. Retry after the `Retry-After` header * `500 Internal Server Error` - Server error *** ## Available endpoints The Pro API provides access to all DexPaprika endpoints: > [card] [Tokens](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) > > Get detailed token information including price, liquidity, and trading volume > [card] [Pools](/api-reference/pools/get-a-pool-on-a-network) > > Access liquidity pool data and trading statistics > [card] [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) > > List all supported blockchain networks > [card] [Pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) > > Query swap transactions, adds, and removes. Dev, Pro and Enterprise > [card] [Search](/api-reference/search/search-for-tokens-pools-and-dexes) > > Search across tokens, pools, and DEXes > [card] [Batched prices](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) > > Retrieve multiple token prices in a single request > [!NOTE] > > View complete API documentation in the [REST API Reference](/api-reference/introduction) section. All examples use the free API URL - simply replace with `api-pro.dexpaprika.com` and add authentication. *** ## Migration guide Moving an existing free-tier integration across takes two changes: the base URL, and your key in the `Authorization` header on every request. The full walkthrough, with before and after code in four languages, what each failure looks like on the wire, and a checklist to run before you deploy, is on [upgrading to Pro](/api-pro/upgrading). *** ## Best practices > [accordion] Secure your API key > > **Never expose your API key in client-side code or public repositories.** > > * Store API keys in environment variables or secure vaults (e.g., AWS Secrets Manager, HashiCorp Vault) > * Use `.env` files locally and add them to `.gitignore` > * Rotate keys periodically as part of security best practices > * Never hardcode keys in your application source code > > ```bash Example .env file theme={null} > DEXPAPRIKA_PRO_API_KEY=api_your_personal_api_key > ``` > [accordion] Monitor your API usage > > **Track your API usage to optimize performance and identify issues early.** > > * Watch credit spend against your allowance in [console.dexpaprika.com](https://console.dexpaprika.com), or call `GET https://api-pro.dexpaprika.com/usage` with your key in the `Authorization` header; `requests_used`, `requests_left` and the period dates come back only for an authenticated call on that host > * Log all API requests and responses for debugging > * Set up monitoring dashboards to track request volumes > * Monitor response times and error rates > * Alert on unusual patterns or spikes in traffic > * Review usage patterns to optimize your integration > [accordion] Implement robust error handling > > **Always handle authentication errors gracefully and implement retry logic.** > > * Treat 401 and 403 as configuration faults, not key faults: check the header and the base URL before touching the key > * Implement exponential backoff for transient failures > * Don't retry on authentication errors; fix the header or the base URL first > * Log errors with context for easier troubleshooting > * Provide meaningful error messages to end users > > ```javascript Example error handling theme={null} > try { > const response = await fetch(url, { headers }); > if (response.status === 403) { > // On api-pro a 403 means the request was rejected before the API saw it, or the > // key belongs to the other host. Check that the Authorization header is present > // and holds the key alone, and that the base URL is api-pro.dexpaprika.com. > // Do not regenerate the key: there is one key per account, and regenerating it > // breaks every other integration at once. > return; > } > if (response.status === 401) { > // The header is missing, or the key was not recognised. Fix the header, do not retry. > return; > } > // Handle other errors with retry logic > } catch (error) { > console.error('Request failed:', error); > } > ``` > [accordion] Use connection pooling > > **Reuse HTTP connections to reduce latency and improve throughput.** > > * Configure HTTP clients to reuse connections > * Set appropriate connection pool sizes (e.g., 10-50 connections) > * Enable keep-alive headers > * Use persistent connections for high-volume applications > * Monitor connection pool metrics > > ```python Example with Python requests theme={null} > import requests > from requests.adapters import HTTPAdapter > > session = requests.Session() > adapter = HTTPAdapter(pool_connections=20, pool_maxsize=20) > session.mount('https://', adapter) > > # Reuse session for all requests > response = session.get(url, headers=headers) > ``` *** ## Next steps > [card] [REST API reference](/api-reference/introduction) > > Explore all available endpoints and their parameters > [card] [Streaming API](/streaming/introduction) > > Real-time token price updates over Server-Sent Events. On Pro, connect to streaming-pro.dexpaprika.com. > [card] [Tutorials](/tutorials/tutorial_intro) > > Learn how to build applications with DexPaprika > [card] [Coverage checker](/tools/coverage-checker) > > Check which tokens and pools are available in our database *** ## Get support > [card] [Enterprise support](mailto:support@coinpaprika.com) > > Get priority technical support from our engineering team > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community for general questions *** ## FAQs > [accordion] How do I get a Pro API key? > > Sign up at [console.dexpaprika.com](https://console.dexpaprika.com), subscribe to Pro, and copy the key from the Keys page. No sales call and no waiting. Enterprise is the exception: those limits are agreed per contract, so email [support@coinpaprika.com](mailto:support@coinpaprika.com). > [accordion] Can I use both the free and the Pro API at once? > > You can call `api.dexpaprika.com` without a key from the same application, and that keyless > traffic is metered on free-tier terms. Your paid key belongs on `api-pro.dexpaprika.com`. > The monthly credit allowance, overage handling, real-time data and the 99.5% SLA are all > attached to the paid hosts, so paid traffic sent anywhere else is paying for entitlements > it is not receiving. > [accordion] What are the Pro limits? > > 5,000,000 credits a month included, at up to 500 requests a minute, with \$20 per additional 1M beyond that. One request costs one credit, batch endpoints cost one credit per item, and each streaming update delivered costs one credit. Enterprise raises both numbers to fit your workload. See [rate limits](/knowledge-base/rate-limits) and [pricing](https://dexpaprika.com/api/pricing); these numbers move. > [accordion] What happens if my API key is compromised? > > Regenerate it yourself from the Keys page in the console. Because each account has exactly one key, regenerating replaces the old one immediately, so plan a moment when you can redeploy: every integration using the old key stops working at once. If you cannot get into the account, email [support@coinpaprika.com](mailto:support@coinpaprika.com). > [accordion] Do you offer dedicated infrastructure or on-premise deployment? > > Yes, we can provide custom infrastructure solutions for enterprise customers. Contact our sales team to discuss your specific requirements. > [accordion] How do I tell whether the problem is me or you? > > Two different questions, two different calls. `GET /usage` tells you which plan and which > host you are really talking to, and it is never served from cache, so it is the one to > reach for when a key or a base URL is in doubt. Separately, every host answers `GET /health` > with a plain up or down for the service itself. It takes no key and says nothing about your > key, your plan or your host, so it only answers "is the service running", never "is my > request right". > [accordion] Is the data the same as the free API? > > The chains are identical, and so is every endpoint except token OHLCV and pool transactions, which need Dev or Pro. Two more things differ. Freshness: the free tier is served with a delay of up to 60 seconds, Pro is real time. OHLCV depth: the free tier gets 24 hours of `1h`+ candles keyless or 7 days of `10m`+ candles with a key, Pro has no plan limit on history, at every interval, for pool and token OHLCV alike. Pro also adds dedicated infrastructure, a much higher credit allowance, a 99.5% SLA and priority support. # Upgrading to Pro: switch your base URL to api-pro.dexpaprika.com Source: https://docs.dexpaprika.com/api-pro/upgrading Paid DexPaprika plans are served on api-pro.dexpaprika.com and need your API key in the Authorization header. One base URL change, everything else stays the same. Includes the exact errors you see if either half is missing. Paid plans are served on a different host from the free tier. If you have just subscribed to Pro and your existing code is failing, this is why, and there are only two things to change. **1. Change the base URL** `https://api.dexpaprika.com` becomes `https://api-pro.dexpaprika.com` **2. Send your API key on every request** `Authorization: api_your_personal_api_key`, with the key as the entire header value. Copy it from [console.dexpaprika.com](https://console.dexpaprika.com). Nothing else moves. Paths, query parameters, response shapes and your key itself are identical to the free API, so a find and replace on the hostname plus a header is the whole migration. > [!WARNING] > > Both halves are required together. Your plan's allowance, real-time data and SLA > are attached to `api-pro.dexpaprika.com`, so the base URL change is what puts your > traffic on them. Sending your key to the right host without the header gets you a > block page from the edge rather than our JSON; see > [what each error means](#what-each-error-means) below. ## Before and after ```bash cURL theme={null} # Free tier curl "https://api.dexpaprika.com/networks/ethereum/pools/search?token_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" # Pro curl "https://api-pro.dexpaprika.com/networks/ethereum/pools/search?token_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" \ -H "Authorization: api_your_personal_api_key" ``` ```python Python theme={null} import requests BASE = "https://api-pro.dexpaprika.com" # was https://api.dexpaprika.com HEADERS = {"Authorization": "api_your_personal_api_key"} # new on Pro response = requests.get( f"{BASE}/networks/ethereum/pools/search", params={"token_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}, headers=HEADERS, ) response.raise_for_status() print(response.json()) ``` ```javascript JavaScript theme={null} const BASE = 'https://api-pro.dexpaprika.com'; // was https://api.dexpaprika.com const HEADERS = { Authorization: 'api_your_personal_api_key' }; // new on Pro const res = await fetch(`${BASE}/networks/ethereum/pools/search?token_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`, { headers: HEADERS, }); if (!res.ok) throw new Error(`${res.status} ${await res.text()}`); console.log(await res.json()); ``` ```go Go theme={null} const base = "https://api-pro.dexpaprika.com" // was https://api.dexpaprika.com req, _ := http.NewRequest("GET", base+"/networks/ethereum/pools/search?token_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", nil) req.Header.Set("Authorization", "api_your_personal_api_key") // new on Pro resp, err := http.DefaultClient.Do(req) ``` > [!NOTE] > > Send the key as the entire `Authorization` header value, nothing before it and > nothing after it. If your HTTP client only offers a token field that prepends a > scheme word for you, do not use it; set a raw header instead. ## If you use our SDKs or the streaming API > [accordion] SDKs and the CLI > > Every official SDK takes the base URL and the key as configuration, so you do > not have to touch call sites. Set the Pro host and your key once where the > client is constructed. The [SDK pages](/get-started/sdk-ts) show the option > name for each language. > [accordion] Streaming > > Streaming has the same split. `streaming.dexpaprika.com` serves the free tier > and `streaming-pro.dexpaprika.com` serves paid plans, with the same > `Authorization` header. Moving your REST calls does not move your streams, so > point every event source at `streaming-pro.dexpaprika.com` as well. Details on > the [streaming introduction](/streaming/introduction). > [accordion] MCP servers and AI agents > > Anything configured with a DexPaprika base URL needs the same change, including > MCP server configs and agent tool definitions. See > [AI integration](/ai-integration/index). ## What each error means The two hosts fail in different ways, and telling them apart tells you which half of the change is missing. | What you see | What it means | What to do | | - | - | - | | `403` and an HTML page headed **"Sorry, you have been blocked"** | Your request reached the Pro host with no `Authorization` header at all. It was stopped at the edge before our API saw it, which is why the body is a Cloudflare page and not our JSON. This is not an IP ban. | Add the `Authorization` header. | | `401` with `{"message":"api key verification has failed"}` | The header arrived, but the value is not a key we recognise. | Copy the key again from [the console](https://console.dexpaprika.com). It has no overlap window, so if you regenerated it, every integration needs the new one. | | `401` with `{"message":"missing or invalid api key"}` | The same missing or unrecognised key, returned from the host root rather than an endpoint. | As above. | | `403` with `"error": "wrong_host"` | A free key reached `api-pro.` or `streaming-pro.`, which serve paid plans only. The body names the host to use and links the console, the docs and pricing. | Match the host to your plan. Free and keyless traffic on `api.` and `streaming.`, paid keys on `api-pro.` and `streaming-pro.` | | `402` | Your monthly credit allowance is spent. Retrying does not help. | Enable overage in the [console](https://console.dexpaprika.com). See [error handling](/knowledge-base/error-handling#402-payment-required). | | `429` | You are over the per-minute ceiling for your plan. | Back off for the interval in the `Retry-After` header, then raise your throttle to the Pro ceiling on the [rate limits page](/knowledge-base/rate-limits). | ## One check that confirms the upgrade took `GET /usage` is never served from cache, so it always reflects the plan your request was actually evaluated against. Run it against the paid host with your key: ```bash theme={null} curl -s -H "Authorization: api_your_personal_api_key" \ https://api-pro.dexpaprika.com/usage ``` A working Pro setup answers `200` with `plan` set to your paid plan, plus `requests_used` and `requests_left` for the current billing period. Those two fields are the ones to look for: they are returned for a key on `api-pro.dexpaprika.com` and omitted otherwise, so seeing them is how you know your traffic is being counted against the allowance you are paying for. If `plan` is not the plan you bought, or the credit fields are absent, your requests are not receiving the Pro entitlements. The monthly allowance, overage handling, real-time data and the 99.5% SLA are all attached to `api-pro.` and `streaming-pro.` > [!TIP] > > `/usage` is the reliable probe because it is the one path that is never cached, so it > cannot hand you a stale answer from another caller. Do not confuse it with `GET /health`, > which every host answers without a key: that one reports whether the service is up and > tells you nothing about your key, your plan or your host. ## Retune your client **1. Raise your rate limiter** Pro's per-minute ceiling is far above the free tier's, so a throttle tuned for free-tier traffic now leaves most of your allowance unused. Keep the throttle and the `429` backoff, and raise the threshold to the figure for your plan on the [rate limits page](/knowledge-base/rate-limits). **2. Drop the polling you added to work around the delay** The free tier serves data with a delay; Pro is real time. Anything you built to re-poll for fresher numbers is now spending credits for nothing. **3. Watch your credits** Track spend in the [console](https://console.dexpaprika.com), or call `GET /usage` from your own code. One request costs one credit, batch endpoints cost one credit per item, and every streaming update delivered costs one credit. **4. Check both environments** Each account has exactly one API key, so staging and production share a quota. A test loop spends the same allowance your production traffic depends on. ## Checklist > [accordion] Before you deploy > > * Every `api.dexpaprika.com` in your codebase, config and environment files is now `api-pro.dexpaprika.com` > * The `Authorization` header is set on every request, not only the first one > * The key comes from an environment variable or a secret store, never from source > * Streaming clients point at `streaming-pro.dexpaprika.com` > * Your rate limiter is set to your plan's ceiling > * You have handled `402` separately from `429`, because retrying a `402` never succeeds ## Where to go next > [card] [Pro API introduction](/api-pro/introduction) > > What the Pro API includes, endpoint by endpoint > [card] [Rate limits and credits](/knowledge-base/rate-limits) > > Current ceilings and allowances for every plan > [card] [Error handling](/knowledge-base/error-handling) > > Every status code the API returns and how to handle it > [card] [Console](https://console.dexpaprika.com) > > Your key, your usage and your billing Still stuck after the switch? Email [support@coinpaprika.com](mailto:support@coinpaprika.com) or ask in [Discord](https://discord.gg/DhJge5TUGM). Plans and prices are on the [pricing page](https://dexpaprika.com/api/pricing). # Get a list of available dexes on a network. Source: https://docs.dexpaprika.com/api-reference/dexes/get-a-list-of-available-dexes-on-a-network api-reference/openapi.yml GET /networks/{network}/dexes List all decentralized exchanges available on a specific blockchain network ## Endpoint overview List decentralized exchanges available on a specific network. > [!TIP] > > See also: [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pools by DEX](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) ### FAQs > [accordion] What does a DEX object contain? > > Identifier, display name, and often counts/metrics used to navigate to pools. > [accordion] How do I fetch pools for one DEX? > > Call [`GET /networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) > with `dex_name` set to the `dex_id` from this response, matched case-insensitively. > Pass the `dex_id`, not the `dex_name` display name: a display name returns an empty > `results` array rather than an error. The old `/networks/{network}/dexes/{dex}/pools` > path was removed and returns `410 Gone`. > [accordion] Are DEX ids stable? > > Yes; ids are stable across requests and are used throughout the API. > [card] [Tutorial: List DEXes on a blockchain network](/tutorials/list-dexes) > > DEX market share on a chain and each DEX's busiest pools. # API reference: endpoints and parameters Source: https://docs.dexpaprika.com/api-reference/introduction Every DexPaprika REST endpoint with its parameters, response shape and a runnable example: networks, DEXes, pools, tokens, OHLCV and transactions. > [!NOTE] > > **Need a higher allowance and dedicated infrastructure?** Check out the [Pro API](/api-pro/introduction). Current allowances, rates and prices are on the [pricing page](https://dexpaprika.com/api/pricing). This is the endpoint reference. If you are new to the API, start at the [DEX API introduction](/introduction), which covers what we index, the networks we cover and a first request. The DexPaprika DEX API provides near real-time data about tokens, liquidity pools, and decentralized exchanges on 35 blockchains. Below you can find the most popular endpoints that you can use to build your own applications: > [!TIP] > > See also: [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Liquidity pool endpoint](/api-reference/pools/get-a-pool-on-a-network), > [Swap transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), > [Token data](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) **Pool search:** [filter pools](/tutorials/pool-filtering) by volume, liquidity, transactions, and creation date on `/networks/{network}/pools/search`. Plus [batch token prices](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) in a single request. ### Popular endpoints > [card] [Tokens](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) > > Get detailed information about any token on a given network like latest price, liquidity, and trading volume > [card] [Pools](/api-reference/pools/get-a-pool-on-a-network) > > Access liquidity pool data and trading statistics for a given pool address > [card] [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) > > List supported networks > [card] [Pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) > > Fetch swaps/adds/removes. Dev, Pro and Enterprise ## Quick start We will make a GET request to the [Token](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) endpoint in order to get the latest price in USD of TRUMP. All we need is the [network ID](/api-reference/networks/get-a-list-of-available-blockchain-networks) and the token address. ```bash theme={null} curl -X GET "https://api.dexpaprika.com/networks/solana/tokens/6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" ``` This will return latest data about TRUMP (TRUMP) on Solana: ```json Response [expandable] theme={null} { "id": "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN", "name": "OFFICIAL TRUMP", "symbol": "TRUMP", "chain": "solana", "decimals": 6, "total_supply": 1000000000000000, "description": "", "website": "", "explorer": "", "added_at": "2025-01-17T23:26:21Z", "summary": { "price_usd": 13.14091959123721, "fdv": 13140919591.23721, "liquidity_usd": 149423162.71562782, "24h": { "volume": 21068441.593753017, "volume_usd": 281073979.6428536, "sells": 64806, "buys": 69661, "txns": 134467 }, "6h": { "volume": 3947009.6413350017, "volume_usd": 51291873.69781224, "sells": 15636, "buys": 16434, "txns": 32070 }, "1h": { "volume": 412765.81969400006, "volume_usd": 5443526.242503976, "sells": 1965, "buys": 1934, "txns": 3899 }, "30m": { "volume": 138223.89740200003, "volume_usd": 1826042.0489568561, "sells": 666, "buys": 942, "txns": 1608 }, "15m": { "volume": 102904.73769500002, "volume_usd": 1356865.0163336615, "sells": 499, "buys": 634, "txns": 1133 }, "5m": { "volume": 16003.968976, "volume_usd": 210782.49285099082, "sells": 77, "buys": 155, "txns": 232 } }, "last_updated": "2025-02-25T13:42:32.093353071Z" } ``` ## Base URL All API endpoints use the following base URL: ``` https://api.dexpaprika.com/ ``` That is the host for keyless calls and for free registered keys. Paid plans call `https://api-pro.dexpaprika.com` instead, with the key in the `Authorization` header. See [upgrading to Pro](/api-pro/upgrading). ## Authentication Requests work with no key at all. To use one, send it as the entire `Authorization` header value: ```bash theme={null} curl -H "Authorization: api_YOUR_KEY" "https://api.dexpaprika.com/networks" ``` > [!WARNING] > > **The key is the entire header value.** Nothing goes in front of it and nothing after it. > Almost every other API expects a scheme word first, which is why this is the most common > cause of a failed first authenticated call. If your HTTP client only offers a token field > that prepends one for you, set a raw header instead. See > [401 Unauthorized](/knowledge-base/error-handling#401-unauthorized). Free keys stay on `https://api.dexpaprika.com`. Only [Pro](/api-pro/introduction) moves to `api-pro.dexpaprika.com`, and sending a free key there returns `403`. Get a key at [console.dexpaprika.com](https://console.dexpaprika.com). ## Common use cases Here are some popular ways to use our API: > [accordion] Track Token Prices > > ```bash theme={null} > # Get USDC price and trading data > curl -X GET "https://api.dexpaprika.com/networks/solana/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" > ``` > [accordion] Monitor Liquidity Pools > > ```bash theme={null} > # Get all pools where SOL is traded > curl -X GET "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112" > ``` > [accordion] Search Tokens > > ```bash theme={null} > # Search for "Jupiter" token across all networks > curl -X GET "https://api.dexpaprika.com/search?query=jupiter" > ``` ### FAQs > [accordion] Do I need an API key? > > Not to start. No key, no card, no email: a curl works right now. [Registering a free key](https://console.dexpaprika.com) raises both the per-minute rate and the 30-day allowance, and still needs no card. Current figures are on the [pricing page](https://dexpaprika.com/api/pricing) and in [rate limits](/knowledge-base/rate-limits). > [accordion] What data can I query? > > Liquidity pools, swap transactions, token metrics/prices, and network coverage across multiple chains. > [accordion] How do I find a pool or token identifier? > > Use the Coverage Checker tool or the Networks/Token endpoints to locate addresses. > [accordion] How fast is the data? > > Collection is near real-time; responses reflect the latest indexed blocks and events. ## Rate limits Keyless callers get a rolling 30-day credit allowance and a per-minute rate with no signup at all. A [free key](https://console.dexpaprika.com) raises both, and [Pro](/api-pro/introduction) raises them again. The current figures are on the [pricing page](https://dexpaprika.com/api/pricing). One request costs one credit and batch endpoints cost one credit per item; there are no compute units or per-endpoint weights. > [!NOTE] > > Need higher limits? Pro is self-serve on [pricing](https://dexpaprika.com/api/pricing). For Enterprise, [contact us](mailto:support@coinpaprika.com). # Get a list of available blockchain networks. Source: https://docs.dexpaprika.com/api-reference/networks/get-a-list-of-available-blockchain-networks api-reference/openapi.yml GET /networks List all supported blockchain networks and their canonical IDs for use in API requests ## Endpoint overview Enumerate supported blockchain networks and canonical ids for requests. > [!TIP] > > See also: [DEXes on a network](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network), > [Tokens](/api-reference/tokens/get-a-tokens-latest-data-on-a-network), > [Pools](/api-reference/pools/get-a-pool-on-a-network) ### FAQs > [accordion] What does each network object include? > > An `id` used in all endpoints plus display metadata and, where available, counts of related entities. > [accordion] How do I choose the right network id? > > Prefer lowercase canonical ids like `ethereum`, `solana`. Use this list as the source of truth. > [accordion] How to enumerate DEXes for a network? > > Call the network DEXes endpoint and then drill into pools for each DEX. > [card] [Tutorial: List supported blockchain networks](/tutorials/list-networks) > > Rank chains by activity, with a working curl and Python script. # Advanced pool filtering across multiple networks. Source: https://docs.dexpaprika.com/api-reference/pools/advanced-pool-filtering-across-multiple-networks api-reference/openapi.yml GET /pools/search Retrieves a paginated list of pools matching the advanced search criteria across multiple chains. Supports various filters and cursor-based pagination. **Keyless and free keys** only see results created at least 1 hour ago; newer ones are returned on Dev, Pro and Enterprise keys. Metrics of the visible results stay realtime. > [card] [Tutorial: Filter and screen liquidity pools](/tutorials/pool-filtering) > > Every pool filter and sort, with a working curl and Python script. > [!NOTE] > > Keyless requests and free keys do not see pools created in the last hour. Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see them as soon as they are indexed. See [search freshness](/knowledge-base/rate-limits#search-freshness). # Advanced pool filtering on a specific network. Source: https://docs.dexpaprika.com/api-reference/pools/advanced-pool-filtering-on-a-specific-network api-reference/openapi.yml GET /networks/{network}/pools/search Retrieves a paginated list of pools matching the advanced search criteria. Supports various filters and cursor-based pagination. **Keyless and free keys** only see results created at least 1 hour ago; newer ones are returned on Dev, Pro and Enterprise keys. Metrics of the visible results stay realtime. > [card] [Tutorial: Filter and screen liquidity pools](/tutorials/pool-filtering) > > Every pool filter and sort, with a working curl and Python script. > [!NOTE] > > Keyless requests and free keys do not see pools created in the last hour. Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see them as soon as they are indexed. See [search freshness](/knowledge-base/rate-limits#search-freshness). # Get a pool on a network. Source: https://docs.dexpaprika.com/api-reference/pools/get-a-pool-on-a-network api-reference/openapi.yml GET /networks/{network}/pools/{pool_address} Get detailed liquidity, reserves, pricing, and metadata for a specific pool on a blockchain network ## Endpoint overview Get detailed liquidity, reserves, pricing, and metadata for a specific pool. > [!TIP] > > See also: [Pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), > [Token data](/api-reference/tokens/get-a-tokens-latest-data-on-a-network), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) ### FAQs > [accordion] Which parameters are required? > > Provide both `network` (e.g., `ethereum`, `solana`) and `pool_address` (on-chain pool address). Optional: `inversed` to flip the price ratio. > [accordion] What does the `inversed` flag do? > > It returns prices and ratios from the opposite pair perspective (token1/token0). Leave it `false` for the default token0/token1 view. > [accordion] How can I find a pool address? > > Use the Coverage Checker tool or search a network's pools with `GET /networks/{network}/pools/search?token_address={address}`, then copy the desired pool's `id`. > [accordion] What units are returned? > > Prices are in USD where available; liquidity and volumes include USD fields. Raw token amounts are returned in token units. > [accordion] How fresh is the data? > > Collection is near real-time; responses reflect the latest indexed blocks/events per network. > [card] [Tutorial: Get liquidity pool data by address](/tutorials/pool-details) > > Price, reserves and 5m to 24h activity for one pool, read field by field. # Get a technical indicator for a pool. Source: https://docs.dexpaprika.com/api-reference/pools/get-a-technical-indicator-for-a-pool api-reference/openapi.yml GET /networks/{network}/pools/{pool_address}/indicators Computed from completed pool OHLCV candles. Every indicator is available on every plan, with the same interval and history limits as pool OHLCV: | Plan | `interval` | History | |------|------------|---------| | Keyless | `1h` and up | last 24 hours | | Free key | `10m` and up | last 7 days | | Dev | all | last 30 days | | Pro, Enterprise | all | unlimited | A finer `interval`, or an `end` or `start` before the window, gets `403`. A range that only partly overlaps the window, such as the default range without `start`, is cut to the window; if no candle of the requested `interval` is left, it gets `403` too. Keyless callers default to `interval=1h`, since a `24h` candle does not fit their 24-hour window. Without `start` the response holds the last `limit` candles. When `limit` cuts the range, `next_cursor` holds the start of the next page. > [card] [Tutorial: RSI, EMA, MACD, Bollinger Bands and VWAP](/tutorials/technical-indicators) > > Which plan unlocks which indicator, a Python screen and the pitfalls. # Get OHLCV data for a pool pair. Source: https://docs.dexpaprika.com/api-reference/pools/get-ohlcv-data-for-a-pool-pair api-reference/openapi.yml GET /networks/{network}/pools/{pool_address}/ohlcv Retrieve historical OHLCV candles for a pool. Interval and history depth depend on your plan, from 24 hours of 1h candles without a key to unlimited on Pro. ## Endpoint overview Retrieve historical OHLCV for a pool at granular intervals. On Dev or Pro you can also chart a token without choosing a pool: [token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) returns USD candles aggregated across every pool the token trades in. ## Plan limits How far back you can query and how fine the candles can be depends on your plan. A request outside the limits returns `403` with a message naming the plan that lifts it. | Plan | Candle intervals | History depth | | - | - | - | | **Free (no key)** | `1h`, `6h`, `12h`, `24h` | last 24 hours | | **Free (registered key)** | `10m` and longer | last 7 days | | **Dev** | all | last 30 days | | **Pro / Enterprise** | all | unlimited | `start`, `end` and `count_back` are all checked against the window. A range that starts inside the window but reaches before it is trimmed to the window instead of rejected. Details on the [rate limits page](/knowledge-base/rate-limits#ohlcv-limits-by-plan). > [!TIP] > > See also: [Pool details](/api-reference/pools/get-a-pool-on-a-network), > [Pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) ### FAQs > [accordion] Which intervals are supported? > > `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` with a max of 1000 points per request. Without a key only `1h` and up are available; a free key adds `10m`, `15m` and `30m`; `1m` and `5m` need Dev or Pro. > [accordion] How to request a specific time range? > > Provide `start`: a relative offset from now (`-24h` for the last 24 hours, `-7d`, `-90m`), an ISO timestamp, a date or Unix seconds. `end` is optional and takes the same formats. The range must fit your plan's history window: 24 hours without a key, 7 days on a free key, 30 days on Dev, unlimited on Pro. > [accordion] Why do I get 403? > > The request asked for more history or finer candles than your plan allows. The `message` in the body says which plan lifts the limit. Fix `start`, `end`, `count_back` or `interval`, or upgrade. > [accordion] What does `inversed` change? > > It flips the price ratio so the series reflects token1/token0 instead of token0/token1. > [card] [Tutorial: Get pool price history and OHLCV data](/tutorials/retrieve-historical-data) > > Pool candles with a working curl and Python script. # Get transactions of a pool on a network. Paging can be used up to 100 pages. Source: https://docs.dexpaprika.com/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages api-reference/openapi.yml GET /networks/{network}/pools/{pool_address}/transactions List recent swaps, liquidity adds, and removes for a pool with page or cursor-based pagination. Paid plans only: Dev, Pro and Enterprise keys on api-pro.dexpaprika.com. ## Endpoint overview List recent swaps, adds, and removes for a pool with paging. ## Plan access This endpoint is available on paid plans only. Call it on `https://api-pro.dexpaprika.com` with a Dev, Pro or Enterprise key in the `Authorization` header. Keyless requests and free keys get `403` with the standard error envelope. `error` is the code to branch on, `tier` is the plan the request was served as (`keyless` or `free`), `required_tier` the lowest plan that unlocks the endpoint: ```json theme={null} { "error": "plan_required", "tier": "keyless", "required_tier": "dev", "message": "this endpoint requires a Dev or Pro plan", "links": { "register": "https://console.dexpaprika.com", "pricing": "https://dexpaprika.com/api/pricing", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10" } } ``` A free key gets `"tier": "free"` and the same `required_tier`. A `403` here is not retryable and costs no credits. Plans are on [pricing](https://dexpaprika.com/api/pricing); the host and header changes are in [upgrading to Pro](/api-pro/upgrading). The full list of plan-gated features is on the [rate limits page](/knowledge-base/rate-limits#paid-only-endpoints). > [!TIP] > > See also: [Pool details](/api-reference/pools/get-a-pool-on-a-network), > [Token data](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) ### FAQs > [accordion] Which pagination parameters are supported? > > Use `page`/`limit` or the `cursor` for deep pagination. `cursor` points to a specific transaction id for resume. > [accordion] Which transaction types are included? > > Swaps, liquidity adds, and removes with token amounts, USD values when available, and timestamps. > [accordion] How to fetch only recent swaps? > > Request with `limit` (e.g., 20 to 100) and without `page` to get the latest batch; poll periodically for new entries. > [accordion] How to get only transactions from a time window? > > Pass `from` and `to`. Both take unix seconds, a relative offset from now (`-1h`, `-24h`, `-7d`; units s, m, h, d), RFC3339 or `YYYY-MM-DD`. For example, the last hour of swaps: > > ```bash theme={null} > curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ > "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?from=-1h&limit=100" > ``` > [accordion] Is ordering guaranteed? > > Results are returned in reverse chronological order (most recent first) per pool. > [accordion] Why do I get 403 on this endpoint? > > Transactions are a paid-plan endpoint. Keyless calls and free keys answer `403` with `"error": "plan_required"` (the `message` reads `this endpoint requires a Dev or Pro plan`). Use a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. > [card] [Tutorial: Get swap transactions for a DEX pool](/tutorials/pool-transactions) > > Page through a pool's swaps on a Dev, Pro or Enterprise key. # Search for tokens, pools, and DEXes Source: https://docs.dexpaprika.com/api-reference/search/search-for-tokens-pools-and-dexes api-reference/openapi.yml GET /search Search for tokens, liquidity pools, and DEXes by name, symbol, or contract address > [!TIP] > > See also: [Tokens](/api-reference/tokens/get-a-tokens-latest-data-on-a-network), > [Pools](/api-reference/pools/get-a-pool-on-a-network), > [DEXes on a network](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) ### FAQs > [accordion] What can I search for? > > Tokens, pools, and DEXes by name, symbol, or address/identifier depending on the network. > [accordion] Is the search case-sensitive? > > No; queries are normalized internally. > [accordion] How do I use results to make requests? > > Copy the `network` and `id`/`address` from the result and pass them to the corresponding endpoints. > [card] [Tutorial: Search tokens, pools and DEXes by name](/tutorials/search) > > From a name, symbol or address to the right contract address. # Stream real-time prices for an asset Source: https://docs.dexpaprika.com/api-reference/stream-real-time-prices-for-an-asset streaming/api-streaming.yml GET /sse/prices Establishes an SSE stream for a single token's price using query parameters. **Emitted events:** `token_price` · `ping` · `warning` · `error` > [card] [Tutorial: Your first stream](/streaming/tutorials/quick-start) > > Live token prices over SSE in a few minutes, no key for the showcase tokens. # Stream real-time prices for multiple assets Source: https://docs.dexpaprika.com/api-reference/stream-real-time-prices-for-multiple-assets streaming/api-streaming.yml POST /sse/prices Establishes a multiplexed SSE stream for up to 25 token price subscriptions in a single connection. **Emitted events:** `token_price` · `ping` · `warning` · `error` > [card] [Tutorial: Your first stream](/streaming/tutorials/quick-start) > > Live token prices over SSE in a few minutes, no key for the showcase tokens. # Stream real-time reserve updates for a single pool or token Source: https://docs.dexpaprika.com/api-reference/stream-real-time-reserve-updates-for-a-single-pool-or-token streaming/api-streaming.yml GET /sse/reserves Establishes an SSE stream for reserve updates on a specific pool or token using query string parameters. **Supported Channel Events:** - `pool_reserves`: Per-block reserve update for a pool. Schema matches `PoolReservesResponse`. - `token_reserves`: Aggregated reserve update across all pools for a token. Schema matches `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time pool reserves streaming](/streaming/reserves-streaming) > > Subscribe to reserve changes and keep a pool's liquidity current. # Stream real-time reserve updates for multiple pools or tokens Source: https://docs.dexpaprika.com/api-reference/stream-real-time-reserve-updates-for-multiple-pools-or-tokens streaming/api-streaming.yml POST /sse/reserves Establishes a multiplexed SSE stream for reserve updates across multiple pools or tokens within a single connection. **Stream Constraints:** Maximum payload array length is **25 subscriptions**. **Supported Channel Events:** - `pool_reserves`: Per-block reserve update for a pool. Schema matches `PoolReservesResponse`. - `token_reserves`: Aggregated reserve update for a token. Schema matches `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time pool reserves streaming](/streaming/reserves-streaming) > > Subscribe to reserve changes and keep a pool's liquidity current. # Stream real-time swap transactions for a single pool or token Source: https://docs.dexpaprika.com/api-reference/stream-real-time-swap-transactions-for-a-single-pool-or-token-for-paid-plans streaming/api-streaming.yml GET /sse/transactions **Paid plans only.** Available on Dev, Pro and Enterprise keys on `https://streaming-pro.dexpaprika.com`; keyless requests and free keys receive HTTP 403. Establishes an SSE stream for swap transactions on a specific pool or token using query string parameters. **Resume:** each swap event has an SSE `id`. Send the last one back as `Last-Event-ID` (browsers do this on reconnect), or pass `since`, to get missed swaps first (last 15 minutes, up to 100). **Supported Channel Events:** - `pool`: Swap transactions for a pool. Schema matches `TransactionResponse`. - `token`: Swap transactions involving a token. Schema matches `TransactionResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time swap transactions streaming](/streaming/transactions-streaming) > > Live swaps for a pool or token, including resuming after a disconnect. # Stream real-time swap transactions for multiple pools or tokens Source: https://docs.dexpaprika.com/api-reference/stream-real-time-swap-transactions-for-multiple-pools-or-tokens-for-paid-plans streaming/api-streaming.yml POST /sse/transactions **Paid plans only.** Available on Dev, Pro and Enterprise keys on `https://streaming-pro.dexpaprika.com`; keyless requests and free keys receive HTTP 403. Establishes a multiplexed SSE stream for swap transactions across multiple pools or tokens within a single connection. **Stream Constraints:** Maximum payload array length is **25 subscriptions**. **Resume:** same as GET. One `since` or `Last-Event-ID` covers all subscriptions. Missed swaps are capped at 500 per connection. When subscriptions span several chains, swaps from other chains than the one in `Last-Event-ID` may be sent again; dedupe by `id`. **Supported Channel Events:** - `pool`: Swap transactions for a pool. Schema matches `TransactionResponse`. - `token`: Swap transactions involving a token. Schema matches `TransactionResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time swap transactions streaming](/streaming/transactions-streaming) > > Live swaps for a pool or token, including resuming after a disconnect. # Stream real-time token OHLCV candles for paid plans Source: https://docs.dexpaprika.com/api-reference/stream-real-time-token-ohlcv-candles-for-paid-plans streaming/api-streaming.yml GET /sse/ohlcv Stream real time token candles over SSE for paid plans. Reconnect using Last-Event-ID or backfill with since. > [card] [Tutorial: Real-time token OHLCV candle streaming](/streaming/ohlcv-streaming) > > Live candles for a token, and how sealed candles are republished. # Advanced token filtering across multiple networks. Source: https://docs.dexpaprika.com/api-reference/tokens/advanced-token-filtering-across-multiple-networks api-reference/openapi.yml GET /tokens/search Retrieves a paginated list of tokens matching the advanced search criteria across multiple chains. Supports various filters and cursor-based pagination. **Keyless and free keys** only see results created at least 1 hour ago; newer ones are returned on Dev, Pro and Enterprise keys. Metrics of the visible results stay realtime. > [card] [Tutorial: Screen tokens by volume and liquidity](/tutorials/token-screener) > > Filter and sort tokens on one chain or many, with a screener script. > [!NOTE] > > Keyless requests and free keys do not see tokens created in the last hour. Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see them as soon as they are indexed. See [search freshness](/knowledge-base/rate-limits#search-freshness). # Advanced token filtering on a specific network. Source: https://docs.dexpaprika.com/api-reference/tokens/advanced-token-filtering-on-a-specific-network api-reference/openapi.yml GET /networks/{network}/tokens/search Retrieves a paginated list of tokens on a specific network matching the advanced search criteria. Supports various filters and cursor-based pagination. **Keyless and free keys** only see results created at least 1 hour ago; newer ones are returned on Dev, Pro and Enterprise keys. Metrics of the visible results stay realtime. > [card] [Tutorial: Screen tokens by volume and liquidity](/tutorials/token-screener) > > Filter and sort tokens on one chain or many, with a screener script. > [!NOTE] > > Keyless requests and free keys do not see tokens created in the last hour. Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see them as soon as they are indexed. See [search freshness](/knowledge-base/rate-limits#search-freshness). # Get a technical indicator for a token. Source: https://docs.dexpaprika.com/api-reference/tokens/get-a-technical-indicator-for-a-token api-reference/openapi.yml GET /networks/{network}/tokens/{token_address}/indicators Computed from completed token OHLCV candles. **Paid plans only.** Available on Dev, Pro and Enterprise keys. Keyless requests and free keys receive HTTP 403. Without `start` the response holds the last `limit` candles. When `limit` cuts the range, `next_cursor` holds the start of the next page. > [card] [Tutorial: RSI, EMA, MACD, Bollinger Bands and VWAP](/tutorials/technical-indicators) > > Which plan unlocks which indicator, a Python screen and the pitfalls. # Get a token's latest data on a network. Source: https://docs.dexpaprika.com/api-reference/tokens/get-a-tokens-latest-data-on-a-network api-reference/openapi.yml GET /networks/{network}/tokens/{token_address} Retrieves detailed information about a specific token on the given network, including latest price, metadata, status, and recent summary metrics such as price changes and volumes over multiple timeframes. The `token_supply` is a raw integer. To get the actual supply, move the decimal point left by the `decimals` value. Example: supply = `raw_supply` / 10^`decimals` ## Endpoint overview Fetch token metadata, price, FDV, liquidity summary, and recent metrics. > [!TIP] > > See also: [Pool search](/tutorials/pool-filtering), > [Pool details](/api-reference/pools/get-a-pool-on-a-network), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) ### FAQs > [accordion] Which identifiers are accepted? > > Provide `token_address` (contract or canonical address) and `network` (e.g., `ethereum`, `solana`). > [accordion] How do I interpret supply fields? > > `total_supply` is raw; divide by 10^`decimals` to get human-readable supply. > [accordion] How to discover pools for this token? > > Use `GET /networks/{network}/pools/search` with the `token_address` query parameter to list pools that contain this token on the network. > [accordion] What are the summary timeframes? > > Aggregated metrics for 24h, 6h, 1h, 30m, 15m, and 5m where available. > [card] [Tutorial: Fetch a token's price](/tutorials/fetch-token-price) > > A token's price and market data from its contract address. # Get batched prices for multiple tokens on a network. Source: https://docs.dexpaprika.com/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network api-reference/openapi.yml GET /networks/{network}/multi/prices Fetch current USD prices for up to 10 token addresses in a single request ## Endpoint overview Fetch current USD prices for multiple token addresses in a single request. > [!NOTE] > > This endpoint needs an API key, and a free key is enough. Send it as the entire `Authorization` header value. A request without a key gets `403` with `"error": "plan_required"` and `"required_tier": "free"`. The key is free: create one at [console.dexpaprika.com](https://console.dexpaprika.com). > [!TIP] > > See also: [Token details](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) ### Usage Pass the `network` path parameter and provide a comma-separated list in the `tokens` query parameter. ```bash theme={null} curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdac17f958d2ee523a2206206994597c13d831ec7" | jq ``` Notes: * Only tokens with available prices are returned (unknown/unpriced tokens are omitted). * The order of results is not guaranteed. * If all provided tokens are invalid or unpriced, the response is an empty array with HTTP 200. * Duplicate input addresses may produce duplicate entries; dedupe client-side if needed. * Provide tokens as a comma-separated list in a single `tokens` parameter (explode=false). * Maximum 10 `tokens` per request. More than 10 will return HTTP 400. * Each address in the batch costs one credit, so ten tokens in one call cost the same ten credits as ten single-token calls. Batching saves round trips, not credits. See [pricing](https://dexpaprika.com/api/pricing) for what each plan includes. ### Response example ```json Response theme={null} [ { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chain": "ethereum", "price_usd": 4400.5697112921535 }, { "id": "0xdac17f958d2ee523a2206206994597c13d831ec7", "chain": "ethereum", "price_usd": 1.0002529851244053 } ] ``` ### FAQs > [accordion] How do I pass multiple tokens? > > Send one `tokens` parameter with the addresses separated by commas (e.g., `?tokens=0x...,0x...`). Repeating the parameter does not work; only the first value is read. > [accordion] What happens to unknown tokens? > > They are ignored and omitted from the response. > [accordion] Is the result order guaranteed? > > No. Do not rely on response order. > [accordion] What if all tokens are invalid or unpriced? > > The endpoint returns HTTP 200 with an empty array. > [accordion] Are duplicate token addresses deduped? > > No. Duplicate inputs may yield duplicate entries; dedupe client-side if required. > [accordion] Can I send a comma-separated list in one tokens param? > > Yes. Provide a single `tokens` parameter with comma-separated addresses. > [accordion] How many tokens can I request at once? > > Up to 10. Requests with more than 10 tokens return HTTP 400. > [card] [Tutorial: Batch token prices](/tutorials/batch-token-prices) > > Many token prices in one request. # Get OHLCV data for a token Source: https://docs.dexpaprika.com/api-reference/tokens/get-ohlcv-data-for-a-token api-reference/openapi.yml GET /networks/{network}/tokens/{token_address}/ohlcv Historical OHLCV candles for a token in USD, built from a volume-weighted price across every pool the token trades in. Needs a Dev or Pro plan. ## Endpoint overview One candle series per token, in USD. Where [pool OHLCV](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) gives you the price of one pair in one pool, this endpoint gives you the token's price across every pool it trades in on the network, weighted by volume. You do not have to pick a pool first, and a thin pool with a stray trade does not become your chart. The candles come from the same token price series as the [real-time OHLCV stream](/streaming/ohlcv-streaming), so you can load history here and continue live on `/sse/ohlcv`. > [!WARNING] > > **Dev, Pro or Enterprise only.** Keyless requests and free keys get `403` with `"error": "plan_required"` (the `message` reads `this endpoint requires a Dev or Pro plan`); see [403 for paid-only endpoints](/knowledge-base/error-handling#403-forbidden-paid-only-endpoint) for the full body. Paid plans call `https://api-pro.dexpaprika.com` with the key as the whole `Authorization` header. Get a key in [console.dexpaprika.com](https://console.dexpaprika.com) and compare plans on [pricing](https://dexpaprika.com/api/pricing). ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/ohlcv?start=-24h&interval=1h&limit=24" ``` ## Plan limits | Plan | Candle intervals | History depth | | - | - | - | | **Free (no key or registered key)** | not available | not available | | **Dev** | all (`1m` to `24h`) | last 30 days | | **Pro / Enterprise** | all | no plan limit | `start`, `end` and the number of candles are checked against the window the same way as on pool OHLCV. Details on the [rate limits page](/knowledge-base/rate-limits#ohlcv-limits-by-plan). Each request costs one credit, whatever the number of candles it returns. ## Reading the response * `open`, `high`, `low` and `close` are USD prices. There is no `inversed` flag here, because a token series has no second token to flip to. * `volume` is the USD value traded in the token across all its pools during the candle, as a whole number. * A candle only exists for an interval in which the token traded. On a quiet token a series of `1m` candles has gaps; fill them on your side if your chart needs a continuous axis. * The latest candle can still be open. Its `time_close` is then earlier than a full interval after `time_open`, and its values change until the interval ends. Re-read it rather than caching it. > [!TIP] > > Walkthrough with charts and code: [Token price history across every pool](/tutorials/token-ohlcv). > See also: [Pool OHLCV](/api-reference/pools/get-ohlcv-data-for-a-pool-pair), > [Token details](/api-reference/tokens/get-a-tokens-latest-data-on-a-network), > [Real-time OHLCV streaming](/streaming/ohlcv-streaming) ### FAQs > [accordion] How is this different from pool OHLCV? > > Pool OHLCV is the price of one pair in one pool, quoted in the other token of that pair unless you flip it with `inversed`. Token OHLCV is the token's USD price across every pool it trades in on the network, weighted by volume, with volume summed across those pools. Use token OHLCV for charts, backtests and valuation; use pool OHLCV when you care about one specific market. > [accordion] Which plans can call it? > > Dev, Pro and Enterprise, on `https://api-pro.dexpaprika.com`. Dev can query the last 30 days; Pro and Enterprise have no plan limit on history. Keyless requests and free keys get `403`. Plans are on [pricing](https://dexpaprika.com/api/pricing). > [accordion] Which intervals are supported? > > `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h`, up to 1000 candles per request. `interval` defaults to `24h` and `limit` to 10, so set both. > [accordion] How do I request a time range? > > `start` is required: a relative offset from now (`-24h`, `-7d`, `-90m`), an RFC3339 timestamp, a date or Unix seconds. `end` is optional and takes the same formats. On Dev the range must fit inside the last 30 days. > [accordion] Why are some minutes missing? > > A candle is only produced for an interval in which the token traded. No trades, no candle. This is expected on less active tokens and on short intervals. ```json 200 theme={null} [ { "time_open": "2026-09-27T00:00:00Z", "time_close": "2026-09-28T00:00:00Z", "open": 0.3385795783277411, "high": 0.3740961105857449, "low": 0.3323047258016061, "close": 0.372185779287911, "volume": 7807591 }, { "time_open": "2026-09-28T00:00:00Z", "time_close": "2026-09-29T00:00:00Z", "open": 0.3721839403410761, "high": 0.3722067508040842, "low": 0.3197222116990852, "close": 0.3273354476716349, "volume": 10731703 } ] ``` > [card] [Tutorial: Token price history across every pool](/tutorials/token-ohlcv) > > USD candles for a token, built from every pool it trades in. # Get your plan and current-period credit usage. Source: https://docs.dexpaprika.com/api-reference/utils/get-your-plan-and-current-period-credit-usage api-reference/openapi.yml GET /usage Returns the plan the request was evaluated against and, for requests authenticated with an API key on `api-pro.dexpaprika.com`, the account email plus credits used and remaining in the current billing period. Without an API key the response carries the plan only; all other fields are omitted. > [card] [Tutorial: Check your plan and credit usage](/tutorials/check-credit-usage) > > Read your plan and remaining credits, and warn before you run out. # Retrieve high-level asset statistics Source: https://docs.dexpaprika.com/api-reference/utils/retrieve-high-level-asset-statistics api-reference/openapi.yml GET /stats Get high-level platform statistics including total networks, DEXes, pools, and tokens ## Endpoint overview Get high-level counts and coverage information across the platform. > [!TIP] > > See also: [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pool search](/tutorials/pool-filtering) ### FAQs > [accordion] What does the stats endpoint summarize? > > High-level counts for networks, DEXes, pools, and tokens available on DexPaprika. > [accordion] How often does this update? > > Stats are rebuilt periodically; values reflect the latest successful aggregation. > [accordion] Is this suitable for health checks? > > Yes. Many users poll it to confirm platform availability and catalog growth. > [card] [Tutorial: List supported networks and coverage totals](/tutorials/list-networks#coverage-totals-with-stats) > > What the four totals count, and how they differ from per-chain counts. # Changelog Source: https://docs.dexpaprika.com/changelog/changelog Track all updates and changes to DexPaprika API This page contains all significant updates, improvements, and bug fixes for the DexPaprika API. We're committed to making our product better with each release. Check our [API reference](/api-reference) for the latest version. **2026-11-18** Batch token prices need an API key: a free key is enough ## Changed * **`GET /networks/{network}/multi/prices`** no longer answers requests without an API key. They get `403` with `"error": "plan_required"` and `"required_tier": "free"`, before any data is read, so the refusal costs no credits. * Any key unlocks it, a free one included. Free, Dev, Pro and Enterprise keys work as before, and each token in the batch still costs one credit. * Single-token prices on `/networks/{network}/tokens/{token_address}` still work without a key. ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ``` A free key takes under a minute at [console.dexpaprika.com](https://console.dexpaprika.com). Send it as the entire `Authorization` header value; paid keys call `https://api-pro.dexpaprika.com` instead. Reference: [batched token prices](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network). **2026-11-16** From 23 November, an unknown or misspelled query parameter answers 400 instead of being ignored ## Changed on 23 November 2026 * **Query parameter names are checked.** Today a parameter the endpoint does not know is dropped, and the request returns `200` without the filter, sort or flag you meant to apply. From 23 November 2026 the same request answers `400`, so a typo shows up as an error instead of as data you did not ask for. * The body names the first rejected parameter in `param`, lists what the endpoint accepts in `allowed`, and lists every rejected parameter in `violations`. For `GET /search?query=weth&limit=5`: ```json theme={null} {"error":"unknown_param","message":"invalid query parameters: limit (unknown parameter)","param":"limit","allowed":["query"],"violations":[{"in":"query","param":"limit","error":"unknown_param"}]} ``` * The same date brings three more `400` cases: a name in the wrong case, such as `INTERVAL=1h` (`wrong_case_param`, with the right name in `expected`); the same parameter sent twice, such as `chains=ethereum&chains=base` (`repeated_param`; send `chains=ethereum,base`); and more than 100 parameters in one request (`too_many_params`). * It applies to every REST endpoint on `api.dexpaprika.com` and `api-pro.dexpaprika.com`, on every plan, with or without a key. ## Migration Check your requests against the [API reference](/api-reference/introduction) before 23 November. Every correct name below works today, so you can switch and test now. The wrong names we see most often: | Sent today | Endpoint | Send instead | | - | - | - | | `sort_by`, `sort_dir`, `order` | pool and token search | `order_by` and `sort` | | `volume_24h_min`, `min_volume_usd` | pool and token search | `volume_usd_24h_min` | | `created_at_min`, `created_at_max` | pool and token search | `created_after`, `created_before` | | `details` | pool and token search | `detailed` | | `details` | token details | nothing, the endpoint takes no parameters | | `inverted` | pool details, pool OHLCV | `inversed` | | `query` | pool search | nothing; text search is `/search?query=` | | `page` | pool and token search | `cursor`, taken from `next_cursor` | Paging with `cursor` past the first page needs an API key; a free one is on the [console](https://console.dexpaprika.com). How to read a `400`: [error handling](/knowledge-base/error-handling#400-bad-request). Plans: [pricing](https://dexpaprika.com/api/pricing). **2026-11-06** Blast retired: the REST API and the streams no longer serve it ## Removed * **Blast is no longer indexed.** Requests under `/networks/blast/` answer `404` with `"error": "unsupported_network"`, and the SSE streams answer `400` for `chain=blast`. `/networks` lists 35 networks. * The Blast showcase stream went with it, so 34 assets now stream prices without a key. The list is on [showcase streams](/streaming/showcase-streams). Every network we index, with its DEXes: [coverage](/coverage). **2026-11-05** Search on the free tiers leaves out pools and tokens created in the last hour ## Changed * **Free-tier search runs an hour behind on new pools and tokens.** On `/networks/{network}/pools/search`, `/pools/search`, `/networks/{network}/tokens/search` and `/tokens/search`, keyless requests and free keys no longer see pools and tokens created in the last 60 minutes. Everything older comes back as before. * The request does not fail. Sorting by `created_at` returns the newest rows that are at least an hour old, and a `created_after` window shorter than an hour, such as `created_after=-10m`, returns `200` with an empty `results` array. The response does not mark the cutoff. * A token's pools and a DEX's pools come from `/networks/{network}/pools/search`, so they follow the same delay. `/search` and the pool and token detail endpoints are unchanged. * Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see new pools and tokens as soon as they are indexed. Send the key in the `Authorization` header, the key on its own. ```bash theme={null} curl -H "Authorization: YOUR_API_KEY" "https://api-pro.dexpaprika.com/networks/solana/pools/search?order_by=created_at&sort=desc&created_after=-10m" ``` Details: [search freshness](/knowledge-base/rate-limits#search-freshness). Plans: [pricing](https://dexpaprika.com/api/pricing). **2026-10-30** OHLCV and the SSE streams accept checksummed EVM addresses ## Fixed * **OHLCV for a checksummed pool address.** `GET /networks/{network}/pools/{pool_address}/ohlcv` with a mixed-case EVM address returned `200` with no candles. It now returns the same candles as the lowercase address. * **Checksummed addresses on the SSE streams.** A stream opened with a mixed-case EVM address received no events. It now does, on `GET` and `POST`. Events carry the address in lowercase. * **A key repeated in one `POST`** subscribed the connection once per copy, so each event arrived several times. Repeats are now dropped. ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640/ohlcv?start=-6h&interval=1h" ``` Details: [historical OHLCV](/tutorials/retrieve-historical-data) and [streaming](/streaming/introduction). **2026-10-26** Paging through search results needs an API key past the first page ## Changed * **Search pages past the first need an API key.** On `/networks/{network}/pools/search`, `/pools/search`, `/networks/{network}/tokens/search` and `/tokens/search`, a request without a key gets the first page: up to 100 rows with `limit=100`. * A keyless request that carries `cursor` answers `403` with `"error": "plan_required"`, `"required_tier": "free"` and `"param": "cursor"`. It is refused before any data is read and costs no credits. * Any API key pages without limit, a free one from the [console](https://console.dexpaprika.com) included. Send it in the `Authorization` header, the key on its own. ```bash theme={null} curl -H "Authorization: YOUR_API_KEY" "https://api.dexpaprika.com/networks/solana/pools/search?limit=100&cursor=NEXT_CURSOR" ``` Since 14 October keyless paging requests carried an `x-api-warning` header; from today they are refused. Details: [pagination rules](/knowledge-base/rate-limits#pagination-rules). Limits by plan: [pricing](https://dexpaprika.com/api/pricing). **2026-10-21** Every SDK, the CLI, the MCP server, LangChain and n8n check network ids and addresses before they reach the request path ## Security * **An id can no longer change which endpoint your key goes to.** The clients placed network ids, pool addresses and token addresses into the request path as given, so an application that passed user input or a model's tool arguments to them could be made to send its API key to a different endpoint, for example with a pool address of `../../../stats`. Each client now refuses such a value before any request is sent. Real ids pass unchanged, including Sui and Aptos type tags with `::` and TON addresses. * **SDKs:** [TypeScript](/get-started/sdk-ts) [1.14.1](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.14.1) throws a `DexPaprikaError`, [Python](/get-started/sdk-python) [0.14.1](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.14.1) raises `ValueError`, [Go](/get-started/sdk-go) [v1.13.1](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.13.1) returns an error and [PHP](/get-started/sdk-php) [1.13.1](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.13.1) throws a `ValidationException` for a value that is `.` or `..` or contains `/`, `\`, `?`, `#`, `%`, whitespace or a control character. TypeScript, Python and PHP also refuse an empty value. * **MCP server, `dexpaprika-mcp` [2.9.2](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.9.2).** `network` must match `[a-z0-9_-]` and addresses `[A-Za-z0-9:_-]`; anything else returns `DP400_INVALID_NETWORK` or `DP400_INVALID_ADDRESS`. A redirect from the API is followed only to the same host and a path that passes the same check, otherwise the tool returns `DP502_REDIRECT_REFUSED`. * **[CLI](/tutorials/cli) [0.12.0](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.12.0).** Ids are checked the same way, terminal output drops control characters that on-chain token names could carry, and the CLI warns before sending a key to a host outside dexpaprika.com. `config set-key` without an argument prompts for the key, and `--api-key-file` or `DEXPAPRIKA_API_KEY_FILE` keep it out of your shell history. The install script checks each download against the release's `SHA256SUMS`. * **[`langchain-dexpaprika`](https://github.com/coinpaprika/langchain-dexpaprika/releases/tag/v0.5.1) 0.5.1 and [`n8n-nodes-dexpaprika`](/ai-integration/n8n) [0.5.1](https://github.com/coinpaprika/n8n-nodes-dexpaprika/releases/tag/v0.5.1)** refuse the same values in their tool and node fields. ## Fixed * **Response caches in the SDKs are bounded.** TypeScript [1.14.2](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.14.2) skips the cache for a request whose cache key is longer than 2,048 characters. Python [0.14.2](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.14.2) keeps at most `max_cache_entries` responses per service (256 by default) and evicts the least recently used. * **PHP [1.13.2](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.13.2): `FilesystemCache` is private to your user.** The default directory used to be shared by every account on the host. It is now `dexpaprika_cache_` with mode `0700`, entries are JSON with an HMAC check instead of `serialize()`, and a directory owned by someone else is refused. A directory you pass yourself is held to the same check. If your application passes user input or model output to one of these clients, upgrade. Install commands for every client: [tools](/tools/all-tools). **2026-10-16** SDKs and CLI: the 48h price-change window on pool search, a clear error when a key is refused before it reaches the API, and 429 retries that wait as long as the server asks ## Added * **48h price-change window on pool search** in [TypeScript](/get-started/sdk-ts) [1.14.0](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.14.0), [Python](/get-started/sdk-python) [0.14.0](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.14.0), [Go](/get-started/sdk-go) [v1.13.0](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.13.0), [PHP](/get-started/sdk-php) [1.13.0](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.13.0) and the [CLI](/tutorials/cli) [0.11.0](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.11.0). Sort by `price_change_percentage_48h` and bound it with `priceChange48hMin` / `priceChange48hMax` (TypeScript), `price_change_percentage_48h_min` / `_max` (Python), `PriceChange48hMin` / `PriceChange48hMax` (Go), `priceChangePercentage48hMin` / `Max` (PHP) or `--price-change-48h-min` / `--price-change-48h-max` (CLI). * Pool results in TypeScript, Python and Go carry the `price_change_percentage_48h` field. Token search is unchanged and sorts and filters on the 24h window only. ## Fixed * **A 48h sort no longer turns into a different sort.** The four SDKs were missing `price_change_percentage_48h` from their list of pool sort fields and silently fell back to the default sort, so asking for the 48h window returned pools in another order with no warning. * **A key refused before it reaches the API now says so.** When the `Authorization` header does not carry the key in the form it was issued, `api-pro.dexpaprika.com` answers with a `403` HTML page instead of our JSON error, and the SDKs reported it as an unknown error or a bare `403 Forbidden`. The SDKs and the CLI now say the key was refused before it reached the API and ask you to check that the whole key is in `Authorization` with nothing in front of it. Python raises `KeyRefusedError`. A `403` with a JSON body, such as `plan_required`, is handled as before. * **A `429` retry waits as long as the server asks**, in TypeScript and PHP. The SDK reads the `Retry-After` header first, then the `retry_after` field in the body, and caps the wait at 60 seconds. Other `4xx` responses are still not retried. Keys: [console.dexpaprika.com](https://console.dexpaprika.com). Plans: [pricing](https://dexpaprika.com/api/pricing). **2026-10-14** Technical indicators in the MCP servers, the SDKs, the CLI, LangChain and n8n ## Added * **MCP server, `dexpaprika-mcp` [2.8.0](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.8.0), and hosted MCP 2.10.0 at `mcp.dexpaprika.com`.** Two new tools, 20 in total: `getPoolIndicator` on every plan and `getTokenIndicator` on your own Dev, Pro or Enterprise key. See the [MCP tools reference](/ai-integration/mcp-tools). * **SDKs.** `pools.getIndicator` and `tokens.getIndicator` in [TypeScript](/get-started/sdk-ts) 1.13.0, `get_indicator` in [Python](/get-started/sdk-python) 0.13.0, `GetIndicator` in [Go](/get-started/sdk-go) v1.12.0, and `getPoolIndicator` / `getTokenIndicator` in [PHP](/get-started/sdk-php) 1.12.0. * **CLI 0.10.0.** `pool-indicator` and `token-indicator` commands; see the [CLI guide](/tutorials/cli). * **LangChain 0.5.0 and n8n 0.5.0.** Pool and token indicator tools in `langchain-dexpaprika`, and a Get Indicator operation for pools and tokens in [`n8n-nodes-dexpaprika`](/ai-integration/n8n). Pool indicators work without a key, with the same interval and history limits as pool OHLCV; token indicators need a Dev, Pro or Enterprise key. See the [technical indicators tutorial](/tutorials/technical-indicators). **2026-10-13** Technical indicators move to one endpoint per pool and per token, and every pool indicator opens on every plan; a tutorial for every endpoint ## Added * **Seven new tutorials**, each with a working curl and Python script for the free tier and for paid keys: [list networks](/tutorials/list-networks), [list DEXes](/tutorials/list-dexes), [search](/tutorials/search), [screen tokens](/tutorials/token-screener), [pool details](/tutorials/pool-details), [pool transactions](/tutorials/pool-transactions) and [check your credit usage](/tutorials/check-credit-usage). * **Every API reference page links its tutorial**, in the same place on each page, REST and streaming alike. * **[Feed an AI trading agent with technical indicators](/tutorials/agent-trading-signals)**: a paper-trading agent that reads RSI, MACD and Bollinger Bands for a watchlist of pools every hour and asks a model for buy, sell or hold. Runs without a key. ## Changed * **The ten indicator endpoints are now two.** Pools use `GET /networks/{network}/pools/{pool_address}/indicators` and tokens use `GET /networks/{network}/tokens/{token_address}/indicators`, with the indicator in the required `indicator` query parameter: `rsi`, `ema`, `macd`, `bbands` or `vwap`. * The old paths, such as `/indicators/rsi`, answer `404`. * The parameters per indicator and the response are unchanged. * **All five pool indicators work on every plan**, Bollinger Bands and VWAP included, with the same interval and history limits as pool OHLCV: without a key `1h` and up over the last 24 hours, with a free key `10m` and up over 7 days, on Dev every interval over 30 days, on Pro and Enterprise no limit. See [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). Without `interval`, a keyless request now defaults to `1h`. * Token indicators still need a Dev, Pro or Enterprise key on `https://api-pro.dexpaprika.com`. * A request without `indicator` answers `400` with `"error":"missing_param"`, and a parameter that belongs to another indicator, such as `fast_period` with `indicator=rsi`, answers `400` with `"error":"invalid_param"`. ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/indicators?indicator=rsi&interval=1h&start=-24h" ``` ## Migration * Move the indicator name from the path into the query: `/indicators/macd?interval=1h` becomes `/indicators?indicator=macd&interval=1h`. Walkthrough: [Technical indicators](/tutorials/technical-indicators). Reference: [pool indicators](/api-reference/pools/get-a-technical-indicator-for-a-pool) and [token indicators](/api-reference/tokens/get-a-technical-indicator-for-a-token). **2026-10-12** Curve pools on Ethereum and Base move to their own DEX ids; 48h price-change sorting and filtering in both MCP servers ## Changed * **Curve pools have their own DEX ids.** Pools from Curve's StableSwap factory on Ethereum and Base now report `curve_stableswap`, and pools from its TriCrypto factory on Base report `curve_tricrypto`. Existing pools moved too, so they no longer come back under `dex_name=curve`. Other Curve pools keep `curve`. * **MCP server, `dexpaprika-mcp` [2.7.3](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.7.3).** The pool tools accept `sort_by=price_change_percentage_48h`, and `getNetworkPoolsFilter` takes `price_change_percentage_48h_min` and `_max`. Before this release the 48h sort failed the tool's own validation. * **Hosted MCP, `mcp.dexpaprika.com` 2.9.2, live.** The same 48h sort and bounds, on the MCP tools and on the ChatGPT app. ## Migration * If you filter on `dex_name=curve` on Ethereum or Base, run the same search with `dex_name=curve_stableswap` and, on Base, `dex_name=curve_tricrypto`, or those pools drop out of your results. ```bash theme={null} curl "https://api.dexpaprika.com/networks/base/pools/search?dex_name=curve_tricrypto&limit=5" ``` Details: [Filter and screen liquidity pools](/tutorials/pool-filtering). **2026-10-07** Technical indicators: RSI, EMA, MACD, Bollinger Bands and VWAP for pools and tokens, computed from OHLCV candles ## Added * **Ten indicator endpoints** return RSI, EMA, MACD, Bollinger Bands and rolling VWAP computed from OHLCV candles, so you no longer download candles and run the maths yourself. Pools use `GET /networks/{network}/pools/{pool_address}/indicators/{name}`, tokens use `GET /networks/{network}/tokens/{token_address}/indicators/{name}`, with `rsi`, `ema`, `macd`, `bbands` or `vwap` as the name. * Same range parameters as OHLCV: `interval` from `1m` to `24h`, `start` and `end` (relative offsets such as `-24h` work), up to 1000 values per request and a `next_cursor` to page. Each indicator takes its own window parameters, such as `period` for RSI or `fast_period`, `slow_period` and `signal_period` for MACD. * Pool RSI, EMA and MACD work on every plan. Keyless callers and free keys get candles of `10m` and up and the last 7 days. Pool Bollinger Bands and VWAP, and all five token indicators, need a Dev, Pro or Enterprise plan on `https://api-pro.dexpaprika.com`; without one they answer `403` with `"error":"plan_required"`. ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/indicators?indicator=rsi&interval=1h&start=-24h" ``` Walkthrough: [Technical indicators](/tutorials/technical-indicators). Reference: [pool indicators](/api-reference/pools/get-a-technical-indicator-for-a-pool) and [token indicators](/api-reference/tokens/get-a-technical-indicator-for-a-token). The paths changed on 13 October, see above. Plans: [pricing](https://dexpaprika.com/api/pricing). Keys: [console.dexpaprika.com](https://console.dexpaprika.com). **2026-10-05** The transactions stream replays the swaps you missed after a reconnect, up to 15 minutes back ## Added * **Resume on `/sse/transactions`.** Every swap event now carries an SSE `id:`. Reconnect with that id in the `Last-Event-ID` header, which `EventSource` does by itself, or with `since` in Unix seconds, and the stream replays the swaps you missed before it continues live. * The replay reaches back 15 minutes. A `GET` replays up to 100 swaps and a `POST` up to 500 across its subscriptions; past the cap you get the most recent ones. The replay starts with the swap you named, so deduplicate. ```bash theme={null} curl --http1.1 -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/transactions?method=pool&chain=ethereum&address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640&since=$(( $(date +%s) - 600 ))" ``` Details and a consumer that resumes: [Transactions streaming](/streaming/transactions-streaming#resume-after-a-disconnect). Dev, Pro and Enterprise plans, as before. **2026-10-02** Pool search sorts and filters on the 48h price change; MCP server 2.7.2 says what to do when a tool needs a paid plan ## Added * **`price_change_percentage_48h` on pool search.** Both `GET /networks/{network}/pools/search` and `GET /pools/search` take it as an `order_by` value and as `price_change_percentage_48h_min` / `_max` bounds, next to the 24h, 6h, 1h and 5m windows. Pool rows carry the field. * Token search is unchanged: it sorts and filters on the 24h window only, rejects `order_by=price_change_percentage_48h` with a `400`, and drops the 48h bounds. ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?price_change_percentage_48h_min=100&order_by=volume_usd_24h&limit=10" ``` Details: [Filter and screen liquidity pools](/tutorials/pool-filtering). ## Changed * **MCP server, `dexpaprika-mcp` [2.7.2](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.7.2).** `getPoolTransactions` no longer describes itself as keyless. When a tool hits a paid-only endpoint without a paid key, it returns `DP403_PLAN_REQUIRED` with the plan it needs, the `https://api-pro.dexpaprika.com` host to set with `DEXPAPRIKA_API_BASE_URL`, and `console_url`, `docs_url` and `pricing_url` fields, instead of a bare `403`. **2026-09-30** Pool transactions are paid-only: the REST endpoint and the /sse/transactions stream need a Dev, Pro or Enterprise plan; API errors now carry an error code ## Changed * **`GET /networks/{network}/pools/{pool_address}/transactions`** answers only Dev, Pro and Enterprise keys, on `https://api-pro.dexpaprika.com`. Keyless requests and free keys get `403` with `"error":"plan_required"` and `"required_tier":"dev"`. * **`/sse/transactions`** (GET and POST) needs the same plans, on `https://streaming-pro.dexpaprika.com`. Keyless callers and free keys get the same `403` before a stream opens. * `/sse/ohlcv` refusals now carry the same body, with `"error":"plan_required"`. The gate itself is unchanged: Dev, Pro and Enterprise keys pass it, as before. * REST error bodies carry an `error` code next to `message`, and a field naming what failed where there is one: `invalid_param` with `param`, `not_found` with `resource`, `unsupported_network`, `plan_required` with `required_tier`. `message` is still there, so code that reads it keeps working; branch on `error` from now on, since message text can change. Examples on [error handling](/knowledge-base/error-handling). * Unchanged: prices stream keyless on the [showcase assets](/streaming/showcase-streams) and with any key on any token, and reserves stream with any key, free ones included. On the free tier, [pool details](/api-reference/pools/get-a-pool-on-a-network) still carry each pool's transaction counts and volume, and [pool search](/tutorials/pool-filtering) filters on them. ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?limit=20" ``` The hosted MCP server runs `getPoolTransactions` on your own key, the same way as `getTokenOHLCV`: set it as the `Authorization` header on your connection ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)). Without one the tool answers `DP401_API_KEY_REQUIRED`. Reference: [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), [transactions streaming](/streaming/transactions-streaming). Plans: [pricing](https://dexpaprika.com/api/pricing). Keys: [console.dexpaprika.com](https://console.dexpaprika.com). **2026-09-29** Token OHLCV: USD candles for a token across every pool it trades in, on Dev and Pro, in the API and our clients ## Added * **`GET /networks/{network}/tokens/{token_address}/ohlcv`** returns OHLCV candles for a token instead of a pool. Prices are a volume-weighted USD price across every pool the token trades in on the network, and `volume` is the USD traded across all of them. You no longer have to pick a pool or convert a pair price to dollars to chart a token. * Same parameters as pool OHLCV: `start` (relative offsets such as `-24h` work), `end`, `interval` from `1m` to `24h`, and up to 1000 candles per request. * The candles come from the same series as the [`/sse/ohlcv` stream](/streaming/ohlcv-streaming), so history from REST and live candles from the stream line up. ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/ohlcv?start=-24h&interval=1h&limit=24" ``` Available on Dev (last 30 days of history), Pro and Enterprise, on `https://api-pro.dexpaprika.com`. Keyless requests and free keys get `403` with a message naming the plan. Walkthrough: [Token price history across every pool](/tutorials/token-ohlcv). Reference: [Get OHLCV data for a token](/api-reference/tokens/get-ohlcv-data-for-a-token). Plans: [pricing](https://dexpaprika.com/api/pricing). Our clients call it too. Point them at `https://api-pro.dexpaprika.com` with a Dev or Pro key: | Package | Release | How to call it | | - | - | - | | TypeScript SDK, `dexpaprika-sdk` on npm | [1.12.0](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.12.0) | `client.tokens.getOHLCV(network, address, { start, interval, limit })` | | Python SDK, `dexpaprika-sdk` on PyPI | [0.12.1](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.12.1) | `client.tokens.get_ohlcv(network, address, start=..., interval=...)` | | PHP SDK, `coinpaprika/dexpaprika-sdk` | [1.11.0](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.11.0) | `$client->tokens->getTokenOHLCV($network, $address, $start, $options)` | | Go SDK | [1.11.0](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.11.0) | `client.Tokens.GetOHLCV(ctx, network, address, &dexpaprika.TokenOHLCVOptions{...})` | | CLI, `dexpaprika-cli` | [0.9.0](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.9.0) | `dexpaprika-cli token-ohlcv
--start -24h --interval 1h`. Set the host with `--base-url` or `DEXPAPRIKA_API_BASE_URL`. | | MCP server, `dexpaprika-mcp` on npm | [2.7.0](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.7.0) | `getTokenOHLCV` tool. Set `DEXPAPRIKA_API_KEY` and `DEXPAPRIKA_API_BASE_URL`. | | n8n node, `n8n-nodes-dexpaprika` | [0.4.0](https://github.com/coinpaprika/n8n-nodes-dexpaprika/releases/tag/v0.4.0) | **Get Token OHLCV** on the Token resource, with the DexPaprika API credential attached | | Hosted MCP, `mcp.dexpaprika.com` | 2.7.0, live | `getTokenOHLCV` tool, on your own key: set it as the `Authorization` header on your connection ([setup](/ai-integration/hosted-mcp-server#your-own-api-key-for-token-ohlcv-and-pool-transactions)). Every other tool still needs no key. | **2026-09-28** Relative times on transaction and search filters, in the API and every client; SDKs, CLI and MCP server updated for the OHLCV plan limits ## Added * **`from` and `to` on `GET /networks/{network}/pools/{pool_address}/transactions`** accept a relative offset from now (`-1h`, `-24h`, `-7d`), RFC3339 or `YYYY-MM-DD`, next to unix seconds. `from=-1h` returns the last hour of transactions. * **`created_after` and `created_before` on the four search endpoints** (`/pools/search`, `/networks/{network}/pools/search`, `/tokens/search`, `/networks/{network}/tokens/search`) accept the same shapes. `created_after=-24h` returns what was created in the last day. * Unix seconds keep working unchanged. The `query` block of a search response shows the resolved unix timestamp. Every client we publish takes the new shapes: | Package | Release | What changed for time filters | | - | - | - | | TypeScript SDK, `dexpaprika-sdk` on npm | [1.11.0](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.11.0) | `from` and `to` in the `pools.getTransactions()` options take a string such as `'-1h'` as well as a number. | | Python SDK, `dexpaprika-sdk` on PyPI | [0.11.0](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.11.0) | `from_timestamp` and `to_timestamp` on `pools.get_transactions()` take a string such as `"-1h"` as well as an int. | | PHP SDK, `coinpaprika/dexpaprika-sdk` | [1.10.0](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.10.0) | `$client->pools->getPoolTransactions()` now sends `from` and `to`. Earlier releases dropped both, so a time filter set through the client returned the latest transactions. | | Go SDK | [1.10.0](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.10.0) | `WithFrom` and `WithTo` take a string such as `"-1h"`, next to `WithFromTimestamp` and `WithToTimestamp`. | | CLI, `dexpaprika-cli` | [0.8.0](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.8.0) | `--from` and `--to` on `transactions`, and `--created-after` and `--created-before` on `pool-filter` and `filter-tokens`, accept `-1h`. Earlier releases refused it. | | MCP server, `dexpaprika-mcp` on npm | [2.6.0](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.6.0) | `from`, `to`, `created_after` and `created_before` accept `-24h`. Earlier releases rejected it before the call left. | The hosted MCP server at `https://mcp.dexpaprika.com` accepts the same values. ## Changed Every client we publish now follows the two OHLCV changes below. Examples ask for `start=-24h`, which every plan can query, keyless included; the per-plan history window is documented where you call OHLCV; and client-side `limit` caps match the API maximum of 1000 candles. | Package | Release | What changed for OHLCV | | - | - | - | | TypeScript SDK, `dexpaprika-sdk` on npm | [1.10.1](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.10.1) | Examples and doc comments use `-24h` and describe the plan window. No API change. | | Python SDK, `dexpaprika-sdk` on PyPI | [0.10.0](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.10.0) | `limit` up to 1000 (was 366). `HTTPError` text now carries the API's message, so a `403` says which plan lifts the limit. | | PHP SDK, `coinpaprika/dexpaprika-sdk` | [1.9.0](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.9.0) | `limit` up to 1000 (was 366). Examples use hourly candles over `-24h`. | | Go SDK | [1.9.0](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.9.0) | `Limit` above 366 is no longer cut to 366 without an error; the cap is 1000. | | CLI, `dexpaprika-cli` | [0.7.0](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.7.0) | `pool-ohlcv --start -24h` works; earlier releases refused it. The help lists the window per plan. | | MCP server, `dexpaprika-mcp` on npm | [2.5.2](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.5.2) | `getPoolOHLCV` leads with `-24h`, `limit` up to 1000, and a `403` returns the API's message instead of a bare status. | | LangChain, `langchain-dexpaprika` | [0.3.0](https://github.com/coinpaprika/langchain-dexpaprika/releases/tag/v0.3.0) | `limit` up to 1000 (was 366), and a `403` reaches the agent with the API's message. | | n8n, `n8n-nodes-dexpaprika` | [0.3.0](https://github.com/coinpaprika/n8n-nodes-dexpaprika/releases/tag/v0.3.0) | `10 Minutes` interval added, up to 1000 candles (was 100), Start defaults to `-24h`. | The hosted MCP server at `https://mcp.dexpaprika.com` carries the same `getPoolOHLCV` guidance. ## Fixed | Package | Release | What changed | | - | - | - | | TypeScript SDK, `dexpaprika-sdk` on npm | [1.11.1](https://github.com/coinpaprika/dexpaprika-sdk-ts/releases/tag/v1.11.1) | `pools.getTransactions()` is typed: it returns `{ transactions, page_info }` instead of `unknown`. Each transaction carries `created_at`, the token symbols, `volume_0`/`volume_1` and USD prices, and `tokens.getMultiPrices()` rows carry `last_updated`. | | Python SDK, `dexpaprika-sdk` on PyPI | [0.11.1](https://github.com/coinpaprika/dexpaprika-sdk-python/releases/tag/v0.11.1) | Transaction rows keep `created_at`, the token symbols, volumes and USD prices, and multi-price rows keep `last_updated`. Earlier releases dropped them. | | PHP SDK, `coinpaprika/dexpaprika-sdk` | [1.10.1](https://github.com/coinpaprika/dexpaprika-sdk-php/releases/tag/v1.10.1) | `$client->networks->getNetworkDexes()`, `findNetwork()` and `findDex()` work. Earlier releases failed on the first and always returned `null` from the other two. | | Go SDK | [1.10.1](https://github.com/coinpaprika/dexpaprika-sdk-go/releases/tag/v1.10.1) | `Transaction` carries `CreatedAt`, the token symbols, volumes and USD prices, and `TokenPrice` carries `LastUpdated`. Earlier releases dropped them. | | CLI, `dexpaprika-cli` | [0.8.1](https://github.com/coinpaprika/dexpaprika-cli/releases/tag/v0.8.1) | Streaming without a key on a token or feed that needs one says how to add a free key, instead of printing a bare `403`. | | MCP server, `dexpaprika-mcp` on npm | [2.6.1](https://github.com/coinpaprika/dexpaprika-mcp/releases/tag/v2.6.1) | `getCapabilities` reports 36 networks and the server's real version. | ## Migration * Upgrading is optional. `start` is passed through as a string in every SDK, so `-24h` works on older releases too. Two exceptions: the CLI before 0.7.0 refuses `-24h`, and the Go SDK before 1.9.0 lowers any `Limit` above 366 to 366. * Relative times on transactions and search need the CLI 0.8.0 or later and the MCP server 2.6.0 or later; older releases refuse them. On the PHP SDK before 1.10.0, `from` and `to` set through `$client->pools` never reach the API. The search filters `created_after` and `created_before` already passed strings through in every SDK, so they work on older releases. * A `403` from OHLCV is a plan limit, not a transient failure, so do not retry it unchanged. See [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan), or [register a free key](https://console.dexpaprika.com) for 7 days at `10m` and longer. **2026-09-25** OHLCV history depth and candle size now depend on your plan; start and end accept offsets such as -24h ## Changed * **`GET /networks/{network}/pools/{pool_address}/ohlcv` is limited per plan.** How far back you can query and how fine the candles can be now depends on the plan behind the request: | Plan | Candle intervals | History depth | | - | - | - | | Free (no key) | `1h`, `6h`, `12h`, `24h` | last 24 hours | | Free (registered key) | `10m` and longer | last 7 days | | Dev | all | last 30 days | | Pro / Enterprise | all | unlimited | * `start`, `end` and `count_back` are all checked against the window. A range that starts inside the window but reaches before it is trimmed to the window; a range that lies entirely before it is rejected. * A request outside the plan's limits returns `403` with `{"message": "..."}`. The message names the plan that lifts the limit, for example `OHLCV history beyond the last 7 days requires a Dev plan (30 days) or a Pro plan (unlimited)`. The interval check runs before the history check. ## Added * **`start` and `end` on `GET /networks/{network}/pools/{pool_address}/ohlcv` accept a relative offset from now:** `-24h`, `-7d`, `-90m`, `-30s`. `start=-24h` always selects the last 24 hours, which every plan may query. `start` stays required. * `limit` defaults to 10 candles (was 1). ## Fixed * A missing or malformed `start` or `end` returns `400` again instead of `403` on the free tiers. ## Migration * Keyless integrations that pull sub-hour candles or more than 24 hours of history: [register a free key](https://console.dexpaprika.com) for `10m`+ candles over 7 days, or move to Dev / Pro for `1m` and `5m` candles and deeper history. * Treat `403` on this endpoint as a parameter error, not a transient failure: do not retry it with backoff. Full details on the [rate limits page](/knowledge-base/rate-limits#ohlcv-limits-by-plan). **2026-09-23** Keyless credit allowance lowered to 10,000 per rolling 30 days ## Changed * **Keyless requests get 10,000 credits per IP per rolling 30 days**, down from 30,000. The per-minute rate (15) and everything else about the keyless tier are unchanged. Both REST and streaming draw from the same per-IP budget. ## Migration * Anything that ran keyless above 10,000 credits a month should [register a free key](https://console.dexpaprika.com): 100,000 credits per rolling 30 days at 30 requests a minute, no card. See [rate limits](/knowledge-base/rate-limits). **2026-09-15** Pricing v2.0: Dev plan, new rate limits and credit quotas on every tier ## Added * **Dev plan**, \$30 a month: 120 requests per minute, 500,000 credits per billing period, 30 concurrent streams, real-time data. Same hosts and key format as Pro: `https://api-pro.dexpaprika.com` for REST and `https://streaming-pro.dexpaprika.com` for SSE. ## Changed * Free key: 30 requests per minute and 100,000 credits, down from 50 and 300,000. Keyless: 15 requests per minute per IP and 30,000 credits per IP, down from 50,000. * Keyless and free keys now count usage over a rolling 30-day window instead of a calendar month. There is no reset date, and their `402` bodies carry no `resets_at`. Dev and Pro reset with the billing period. * Pro: 500 requests per minute, up from 300. Credits stay at 5,000,000 per billing period. * Overage on Dev and Pro: \$20 per additional 1,000,000 records, capped by the limit you set in the console. * Bulk credit packs are no longer sold. Packs already purchased keep draining. ## Migration * An integration sized against the old free-key limits will start seeing `429`. Read `ratelimit-limit` and `x-credits-remaining` on every response, or move to Dev. Current figures are always on [pricing](https://dexpaprika.com/api/pricing); limits by tier are on [rate limits](/knowledge-base/rate-limits). **2026-09-10** Token OHLCV streaming over SSE for paid plans ## Added * `GET /sse/ohlcv` on `https://streaming-pro.dexpaprika.com` streams sealed token candles for any indexed token on every chain we index, at `1s`, `5s` or `60s`. The event type is `token_ohlcv`. * Resume a dropped connection with `Last-Event-ID`, or backfill the last 15 minutes with `since`. Each candle, backfilled ones included, is one credit; pings are free. * Available on Dev, Pro and Enterprise keys. Keyless and free keys get `403`. Full guide in [OHLCV streaming](/streaming/ohlcv-streaming), parameters at [GET /sse/ohlcv](/streaming/stream-real-time-ohlcv-for-a-single-asset). **2026-08-07** Paid plans launched, served from api-pro.dexpaprika.com ## Added * Pro and Enterprise now authenticate against `https://api-pro.dexpaprika.com`, and `https://streaming-pro.dexpaprika.com` for SSE, with the API key sent as the entire `Authorization` header value. * Keys, usage and billing live in [console.dexpaprika.com](https://console.dexpaprika.com). Each account has one active key. ## Unchanged * Keyless and free registered keys keep calling `api.dexpaprika.com` and `streaming.dexpaprika.com`. Endpoints, paths, parameters and response shapes are identical on every host. ## Migration * Only the base URL changes, plus the `Authorization` header. A key sent to the host that does not match its plan returns `403` with `"error": "wrong_host"`, and the body names the host to use. Full steps in [upgrading to Pro](/api-pro/upgrading), plans on [pricing](https://dexpaprika.com/api/pricing). **2026-08-05** DEX pools endpoint replaced by the pool search dex_name filter ## Removed * `GET /networks/{network}/dexes/{dex}/pools` has been removed and now returns `410 Gone`. Use `GET /networks/{network}/pools/search` with the `dex_name` query parameter instead. The whole route is gone, so an unknown DEX slug returns the same 410 rather than a 404. ## Migration * The DEX moves out of the path and into a query parameter: `/networks/ethereum/dexes/curve/pools` becomes `/networks/ethereum/pools/search?dex_name=curve`. * `dex_name` takes the DEX id, the `dex_id` field from `GET /networks/{network}/dexes`, matched case-insensitively. Passing that response's `dex_name` field instead, a display name like `Uniswap V3`, returns an empty `results` array rather than an error. * Pagination is cursor-based. Read `has_next_page` and `next_cursor` from the response and pass `next_cursor` back as `cursor`, instead of using `page`. There is no `page_info` object on the replacement. * Rows arrive in a `results` array rather than `pools`. * The 24h volume field is `volume_usd_24h`. There is no bare `volume_usd`, and `order_by=volume_usd` is rejected with a `400`, so sort with `order_by=volume_usd_24h`. * `dex_name` also applies on the cross-network `GET /pools/search`, which the removed endpoint had no equivalent for. Combine it with `chains` to scope the result, for example `?dex_name=uniswap_v3&chains=base`. **2026-07-15** Token pools endpoint replaced by the pool search token_address filter ## Removed * `GET /networks/{network}/tokens/{token_address}/pools` has been removed and now returns `410 Gone`. Use `GET /networks/{network}/pools/search` with the new `token_address` query parameter instead. ## Added * **`token_address` filter on pool search.** `GET /networks/{network}/pools/search` now accepts `token_address` to restrict results to pools that contain the token on the given network. It combines with all existing search filters and sorting (`order_by`, default `volume_usd_24h`). ## Migration * The filter is network-scoped only. The cross-network `GET /pools/search` accepts `token_address` but silently ignores it, so use the per-network path when filtering by token. * `token_address` takes a single token. Repeating the parameter does not act as a pair filter; the API uses only one of the values (not guaranteed by order). The old `address` (second-token pair filter) and `reorder` (pair-perspective flip) parameters have no equivalent on pool search. * Pagination is cursor-based (`has_next_page` + `next_cursor`), rows are in a `results` array, and sorting uses `order_by=volume_usd_24h` instead of the old `order_by=volume_usd`. * An unknown `token_address` returns HTTP 200 with an empty `results` array, not an error. **2026-06-30** Pool and token list/filter endpoints replaced by search ## Removed The legacy pool and token list/filter endpoints have been removed and now return `410 Gone`. Each is replaced by a unified search endpoint: * `GET /networks/{network}/pools` and `GET /networks/{network}/pools/filter` are replaced by `GET /networks/{network}/pools/search` * `GET /pools` is replaced by `GET /pools/search` * `GET /networks/{network}/tokens/filter` and `GET /networks/{network}/tokens/top` are replaced by `GET /networks/{network}/tokens/search` * Need results across several networks in one call? Use `GET /pools/search` and `GET /tokens/search` with a `chains` filter (for example `chains=ethereum,base,solana`). ## Added * **Richer filtering on the search endpoints.** Min/max ranges for `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `price_usd`, and `price_change_percentage_24h`; `created_after` / `created_before`; `dex_name` (pools); `fdv_usd_min` / `fdv_usd_max` (tokens). The `volume_7d`, `volume_30d`, and `liquidity_usd` filters now work, which they did not on the old filter endpoint. ## Migration * Parameter renames: `volume_24h_min` becomes `volume_usd_24h_min`, `sort_by` becomes `order_by`, `sort_dir` becomes `sort`. * Pagination is now cursor-based. Read `has_next_page` and `next_cursor` from the response and pass `next_cursor` back as `cursor`, instead of using `page`. * Response rows are in a `results` array. Each pool row uses `id` (the pool address) and `transactions_24h`. ## Deprecated * The legacy `/stream` price endpoint is deprecated and scheduled for removal in 2027. Migrate to `/sse/prices`. The `t_p` event is replaced by `token_price`. **2026-06-03** Reserves stream restructure + request_id correlation ## Changed * **Reserves stream restructure.** The `/sse/reserves` feed no longer emits a single shared `reserve_update` event. Each subscription method now has its own event name, so you match on the method you asked for: * `method=pool_reserves` emits a `pool_reserves` event with the full pool snapshot. That means the `tokens` array with per-token reserve and delta, plus two new fields: `timestamp` and `block_timestamp`. * `method=token_reserves` emits a `token_reserves` event flattened to the subscribed token's reserve state in the affected pool, plus two new fields: `updated_at` and `timestamp`. * If you were matching on `reserve_update`, stop. Switch your handler to the method-named event or you will receive nothing. ## Added * **`request_id` correlation on streams.** Every SSE endpoint (`/sse/prices` and `/sse/reserves`, both GET and POST) now takes an optional `request_id` query parameter, and the POST body accepts it per asset. The server echoes it back on data events as an SSE `request_id:` line, which is what you want when several subscriptions share one multiplexed POST connection. It is omitted from `ping`, `warning`, and `error` events. The value has to be a non-negative integer (`0` to `4294967295`); send anything non-numeric and the request is rejected with `{"message": "invalid query parameters: request_id (must be a number)"}`. On the POST body the default is the asset's array index. ## Notes * Stream `error` events always carry a single `{"message": "..."}` payload. That is now stated explicitly in the streaming reference. **2026-05-15** MCP v2.0.0 Hosted MCP server (`mcp.dexpaprika.com`) refactored end-to-end. All 17 tools now emit `structuredContent` (MCP 2025-06-18+), declare `outputSchema`, and ship with read-only/idempotent annotations so well-behaved clients stop safe-prompting every call. ## Breaking changes * **`getTokenMultiPrices` response shape.** Previously returned a bare array of price entries; now returns an object `{ prices: [...], missing_tokens: [...] }`. Tokens that upstream cannot price (invalid address, no liquidity, unknown contract) are surfaced in `missing_tokens` rather than silently dropped. * **Migration:** replace `response.map(...)` with `response.prices.map(...)`. Check `response.missing_tokens.length > 0` to detect partial failures. * **`search` response `pools[].dex_id` renamed to `factory_id`.** In `search.pools[]`, upstream emits the DEX factory contract address under `dex_id`, while `getNetworkPools` emits the slug under the same key. The MCP layer now renames this to `factory_id` in search responses, matching `getPoolDetails` and `getPoolTransactions` which already use `factory_id` for this concept. * **Migration:** if you read `search.pools[].dex_id` expecting a slug, read `dex_name` (human-readable) or look up `factory_id` against `getNetworkDexes`. ## Added * **Network synonym resolution.** Common alternate names (`eth`, `matic`, `avax`, `bnb`, `sol`, `arb`, `op`, `pol`, `cro`, `mnt`, `ftm`, `trx`, etc.) now resolve to their canonical network IDs at the wire layer. `getCapabilities.network_synonyms` advertised these previously; now the upstream actually honors them on every endpoint that takes a `network` parameter. * **`search` optional `limit` parameter.** Caps items returned per category (tokens, pools, dexes). Applies independently to each category: `limit=3` returns up to 3 hits in each of the 5 categories. * **`getCapabilities.tools_count`** field exposing the canonical 17-tool count. * **`getTokenMultiPrices.missing_tokens`** array surfacing tokens upstream could not price. * **`getPoolOHLCV.interval`** now accepts `1m` and `10m` (in addition to existing `5m`/`15m`/`30m`/`1h`/`6h`/`12h`/`24h`). * **Canonical alias parameters** added alongside legacy names. Both accepted; canonical is recommended for new code: * `sort_dir` (canonical) / `sort` (legacy alias): sort direction * `sort_by` (canonical) / `order_by` (legacy alias): sort field * `paired_token_address` (canonical) / `address` (legacy alias): second-token filter on `getTokenPools` * `inversed` (canonical) / `reorder` (legacy alias): pair-perspective flip on `getTokenPools` and `getPoolDetails` * **`outputSchema`** declared on every tool. Strict-validating MCP clients (Cursor, Claude Desktop) now validate responses against documented shapes. * **`structuredContent`** emitted on every tool result (MCP spec 2025-06-18+). Agents can consume parsed objects directly instead of re-parsing `content[0].text`. * **Tool annotations** (`readOnlyHint`, `idempotentHint`, `destructiveHint`, `openWorldHint`) on every tool so hosts stop safe-prompting reads. * **Server-level `instructions`** field in the MCP `initialize` response, a curated onboarding doc for agents. ## Fixed * **`getNetworkDexes` `limit` parameter.** Upstream `/networks/{network}/dexes` silently ignored `limit` and always reported `page_info.total_items=0, total_pages=0`. The MCP layer now slices client-side to the requested limit and patches `page_info` to reflect the real total count. * **`getTokenDetails` strict-validation rejection.** Previously failed on strict-validating MCP clients with `-32602 "data must NOT have additional properties"` when upstream returned fields beyond the declared schema. Outer `outputSchema` is now permissive (`additionalProperties: true`) while declared fields remain typed. Same fix applied across all single-item-object tools (`getTokenDetails`, `getPoolDetails`, etc.). ## Changed * **`server.version`** bumped from `1.4.0` to `2.0.0`. * **JSON Schema dialect on `/json-rpc`** transport upgraded from `draft-07` to `2020-12`, aligning with the underlying OpenAPI 3.1 contract. SDK-managed `/sse` and `/streamable-http` transports still emit `draft-07` (Zod v3 limitation); full 2020-12 alignment pending a future Zod v4 Mini migration. * **Rationale boilerplate** in tool descriptions shortened from 506 to 249 characters to reduce input-token cost on every tool registration. * **`submitFeedback`** field descriptions now document the 500-character caps on `expected` and `observed` (exceeding triggers `-32602` input validation). ## Known limitations * `liquidity_usd` values returned by `getNetworkPoolsFilter`, `getTopTokens`, and `getTokenDetails.summary` are currently unreliable upstream: filter results may be empty and reported values may be incorrect. Upstream fix pending. * `total_supply` decimal handling differs across endpoints (raw units in pool listings, decimal-adjusted in `getTokenDetails`). Upstream consistency pending. * `getTopTokens` reports `fdv: 0` for some major stablecoins (USDT, DAI). Upstream data quality fix pending. * Field naming varies across endpoints (`id` vs `address` for token references; `fdv` vs `fdv_usd`; response wrappers `pools`/`results`/`tokens`). Naming alignment is on the roadmap. **2026-04-14** v1.7.0 ## Added * `GET /networks/{network}/pools/{pool_address}/transactions`: new optional `from` and `to` query parameters (UNIX timestamps, int64) to filter transactions by time range. * `from` is inclusive, `to` is exclusive. Results are always capped to the last 7 days. * Token schema: new `telegram` and `twitter` string fields for official social links. **2026-03-27** v1.6.0 ## Added * New endpoint: `GET /networks/{network}/tokens/filter` for advanced token filtering. Removed since; use `GET /networks/{network}/tokens/search`. * Filter tokens by volume (`volume_24h`, `volume_7d`, `volume_30d`), liquidity (`liquidity_usd`), FDV (`fdv_min`, `fdv_max`), transaction count (`txns_24h_min`), and creation date (`created_after`, `created_before`). * Sort by `volume_24h`, `volume_7d`, `volume_30d`, `liquidity_usd`, `txns_24h`, `created_at`, or `fdv`. * Paginated response with `page_info`. * New endpoint: `GET /networks/{network}/tokens/top` for top tokens on a network. Removed since; use `GET /networks/{network}/tokens/search`. * Ranked token list with enriched metadata and multi-timeframe metrics (24h, 1h, 5m). * Order by `volume_24h`, `price_usd`, `liquidity_usd`, `txns`, or `price_change`. * Each token includes buy/sell counts, volume, and price change per interval. * New schemas: `TokenFilterResponse`, `TokenSearchResult`, `TopTokenResponse`, `TopTokenItem`, `TopTokenTimeData`. ## Changed * `GET /networks` response schema updated from `Network` to `NetworkMetrics` with new fields: `volume_usd_24h`, `txns_24h`, `pools_count`. * `GET /networks/{network}/dexes` response enriched with `dex_id`, `volume_usd_24h`, `txns_24h`, `pools_count` per DEX. * `GET /networks/{network}/pools/filter`: `PoolSearchResult` now extends `PoolWithPrices` via `allOf`, adding `volume_usd_7d` and `liquidity_usd`. * Pool filter parameters `volume_7d_min`, `liquidity_usd_min`, and `liquidity_usd_max` are now functional. * New pool filter parameters: `volume_7d_max`, `volume_30d_max`. ## Known limitations * `volume_30d_min` and `volume_30d_max` parameters on pool and token filter endpoints are documented but not yet functional. **2026-03-02** v1.5.0 ## Added * New endpoint: `GET /networks/{network}/pools/filter` for advanced pool filtering. * Filter pools by 24h volume range (`volume_24h_min`, `volume_24h_max`), transaction count (`txns_24h_min`), and creation date (`created_after`, `created_before`). * Sort by `volume_24h`, `volume_7d`, `volume_30d`, `liquidity`, `txns_24h`, or `created_at` with `asc`/`desc` direction. * Paginated response with `page_info` including `total_items` and `total_pages`. * New schemas: `PoolFilterResponse` and `PoolSearchResult`. ## Known limitations * `volume_7d_min`, `volume_30d_min`, `liquidity_usd_min`, and `liquidity_usd_max` parameters are documented but not yet functional. These will be enabled in a future update. **2025-10-16** v1.4.1 ## Changed * `GET /networks/{network}/multi/prices`: requests are now limited to a maximum of 10 `tokens` per call. * Parameter encoding updated to a single comma-separated `tokens` list (`explode=false`). ## Error handling * Requests with more than 10 tokens return `400 Bad Request`. * Requests with zero tokens still return `400 Bad Request` (unchanged). ## Docs * Updated API reference, tutorial, and MCP notes to reflect the cap, edge-case behavior, and comma-separated encoding. **2025-10-14** v1.4.0 ## Added * New endpoint: `GET /networks/{network}/multi/prices` for batch token price retrieval on a network. * Request: repeatable `tokens` query parameter (e.g., `?tokens=0x...&tokens=0x...`). * Response: array of `{ id, chain, price_usd }` objects for tokens with available prices; unknown/unpriced tokens are omitted. ## Changed * `AssetPrice` schema added and documented in OpenAPI. * Internals: performance optimization to fetch token summaries conditionally. ## Compatibility * Certain price-related fields now use `omitempty` semantics in responses. If you previously relied on nulls for absent values, note these keys may now be omitted when data is unavailable. ## Docs * New API page: [Get batched token prices on a network](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network). * Updated tutorials and references to include batch pricing guidance. **2025-06-17** v1.3.1 ## Enhanced * **Transaction Schema:** * Added `token_0_symbol` and `token_1_symbol` fields to transaction objects for explicit token symbol tracking. * Added `price_0`, `price_1`, `price_0_usd`, and `price_1_usd` fields to transaction objects for detailed price reporting. * Added `created_at` field to transaction objects for precise transaction timestamping. ## Migration/Compatibility * No breaking changes to existing endpoints, but clients parsing transaction objects should update their models to support the new fields for full compatibility. ### FAQs > [accordion] How often is the API updated? > > We ship changes continuously. Breaking changes are called out explicitly with migration guidance. > [accordion] Where do I find migration paths? > > Each breaking change section includes steps and replacement endpoints when applicable. > [accordion] How can I stay notified? > > Watch this changelog and our Discord announcements; major updates are posted there. **2025-01-27** v1.3.0 ## Deprecated * **BREAKING**: The `/pools` endpoint has been permanently deprecated and now returns `410 Gone` * Users should migrate to `/networks/{network}/pools` to get top pools for each specific network ## Changed * Enhanced deprecation messaging with clear migration paths for affected endpoints ## Migration guide Instead of using the deprecated global pools endpoint: ``` GET /pools ``` Use the network-specific pools endpoint for each blockchain: ``` GET /networks/ethereum/pools GET /networks/solana/pools GET /networks/fantom/pools ``` This change provides better performance and more relevant results by focusing on network-specific data. **2025-05-12** v1.2.1 ## Added * Introduced the optional `reorder` query parameter to the `/networks/{network}/tokens/{token_address}/pools` endpoint. This allows clients to reorder pool data so the specified token becomes the primary token for all metrics and calculations. **2025-04-10** v1.2.0 ## Added * Added operation IDs to all endpoints for better client code generation * Added fully diluted valuation (`fdv`) field to token responses * Added detailed license information and contact details in API specification * Added `buy_usd` and `sell_usd` fields to provide monetary values for trades * Added `last_price_usd_change` field to all time intervals (24h, 6h, 1h, 30m, 15m, 5m, 1m) * Added organized API tags with descriptions for better navigation ## Changed * Updated OpenAPI specification from 3.0.3 to 3.1.0 for improved documentation * Changed [OHLCV endpoint](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) response format from wrapped object to direct array of records (Breaking Change) * Renamed `buy`/`sell` fields to `buys`/`sells` for consistency (Breaking Change) * Changed [network](/api-reference/networks) response format from object to array for cleaner consumption * Updated network schema with improved field naming (`display_name` instead of just `name`) * Standardized ID field in Network schema to use string identifiers instead of numeric IDs * Enhanced token schema with additional fields: chain, total_supply, added_at, last_updated * Improved parameter documentation with examples and clearer descriptions ## Fixed * Improved consistency in representing null values in responses * Updated example responses to more accurately reflect actual API behavior * Fixed formatting inconsistencies in API documentation ## Improved * Enhanced OHLCV schema with time_open and time_close fields to clearly define candlestick periods * Improved validation for time intervals and limits in OHLCV endpoint * Added explicit error response documentation for the /stats endpoint * Enhanced descriptions for all endpoints and parameters **2025-03-15** v1.1.0 ## Added * Support for buy/sell volume metrics across all time intervals * Added transaction counts to pool details * Added initial support for price tracking ## Changed * Improved error messaging with more specific error codes * Enhanced documentation with more descriptive examples ## Fixed * Corrected timestamp format inconsistencies across endpoints * Fixed incorrect price calculations in some edge cases **2025-02-01** v1.0.0 ## Added * Initial public beta release * Support for Solana network * Basic endpoints for [networks](/api-reference/networks), [DEXes](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network), [pools](/api-reference/pools/get-a-pool-on-a-network), and [tokens](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) * [Search functionality](/api-reference/search/search-for-tokens-pools-and-dexes) across tokens, pools, and DEXes * OHLCV data for historical price tracking * Transaction history for pools **2025-01-15** v0.9.0 ## Added * Pool and token details endpoints * Initial version of search functionality ## Changed * Improved error handling and response formats * Enhanced documentation with examples **2024-12-01** v0.8.0 ## Added * Initial development release * Preliminary endpoints for pools and DEXes # Coverage Source: https://docs.dexpaprika.com/coverage Which blockchain networks, DEXes, liquidity pools and tokens the DexPaprika API covers, generated from the live API. This is the canonical record of what DexPaprika covers. If you are citing our coverage anywhere, cite this page: it is regenerated from the live API every day rather than written by hand, so it does not drift. > [card] 35 chains > [card] 42M+ tokens > [card] 46M+ pools > [card] 251 DEXes *Figures below were generated from the live API on 2026-11-18.* ## Networks Every chain DexPaprika covers, ordered by 24 hour trading volume. The `network` column is the value the API expects wherever an endpoint takes a network. | Chain | `network` value | DEXes | Actively traded pools | 24h volume | 24h transactions | | - | - | -: | -: | -: | -: | | Solana | `solana` | 11 | 111,999 | \$2.36B | 31,048,735 | | Ethereum | `ethereum` | 22 | 8,455 | \$1.62B | 311,720 | | Binance Smart Chain | `bsc` | 13 | 21,819 | \$1.44B | 4,145,403 | | Base | `base` | 21 | 13,314 | \$1.19B | 2,044,181 | | Robinhood Chain | `robinhood` | 4 | 8,254 | \$569.1M | 1,386,811 | | Arbitrum | `arbitrum` | 17 | 1,256 | \$114.0M | 204,643 | | HyperEVM | `hyperevm` | 10 | 414 | \$85.0M | 116,954 | | Tron | `tron` | 2 | 56 | \$49.3M | 7,644 | | Polygon | `polygon` | 10 | 2,497 | \$41.0M | 276,722 | | Avalanche | `avalanche` | 8 | 441 | \$33.8M | 60,345 | | x Layer | `x_layer` | 4 | 180 | \$27.4M | 204,436 | | Monad | `monad` | 6 | 241 | \$16.6M | 383,410 | | Arc | `arc` | 3 | 3,329 | \$16.4M | 116,529 | | Unichain | `unichain` | 3 | 203 | \$13.3M | 72,176 | | Sui | `sui` | 3 | 815 | \$8.6M | 244,727 | | Sei | `sei` | 1 | 23 | \$7.3M | 14,383 | | Optimism | `optimism` | 7 | 859 | \$5.2M | 151,785 | | Mantle | `mantle` | 3 | 65 | \$1.7M | 7,494 | | Plasma | `plasma` | 6 | 29 | \$1.7M | 34,113 | | Berachain | `berachain` | 3 | 164 | \$1.6M | 18,202 | | Cronos | `cronos` | 2 | 691 | \$1.5M | 28,294 | | Celo | `celo` | 4 | 96 | \$1.0M | 38,557 | | Sonic | `sonic` | 13 | 329 | \$979K | 28,586 | | Ronin | `ronin` | 2 | 309 | \$445K | 17,160 | | MegaETH | `megaeth` | 3 | 23 | \$414K | 6,232 | | Ton | `ton` | 1 | 342 | \$364K | 7,688 | | ZkSync | `zksync` | 3 | 74 | \$328K | 2,563 | | Katana | `katana` | 2 | 32 | \$312K | 2,579 | | Aptos | `aptos` | 5 | 181 | \$293K | 40,399 | | Tempo | `tempo` | 4 | 15 | \$256K | 429 | | Linea | `linea` | 8 | 106 | \$248K | 3,025 | | Flow EVM | `flow_evm` | 6 | 34 | \$198K | 3,623 | | Scroll | `scroll` | 3 | 17 | \$14K | 568 | | BOB Network | `bob_network` | 1 | 12 | \$244 | 58 | | Fantom | `fantom` | 2 | 22 | \$0 | 92 | ## What these numbers mean The two pool figures count different things, and both are accurate. **46M+ pools** and **42M+ tokens** are total database coverage: everything DexPaprika has recorded across all 35 chains. **Actively traded pools** in the table above counts pools with recent trading activity, which is the set pool search returns. It is a much smaller and faster moving number, because most pools ever created stop trading. Indexing is not instantaneous, so a brand new pool reaches the database before it appears in the active set. Which one you want depends on the question. For "how much of the DEX market does this cover", use the totals. For "how many pools can I query on Base right now", use the table. The DEX columns differ for a similar reason. **251 DEXes** counts every DEX recognised across all chains, while the table lists the 216 currently returned by the per-chain DEXes endpoint. ## Check a specific asset The numbers above answer "how much does DexPaprika cover". To answer "do you have this particular token or pool", use the [coverage checker](/tools/coverage-checker), which searches the live dataset by contract address, name or symbol. ## Get these figures yourself Both endpoints answer keyless requests, so you can run these now and [register a free key](https://console.dexpaprika.com) later for a bigger allowance. ```bash theme={null} # Platform totals curl "https://api.dexpaprika.com/stats" # Every network, with its API value and pool count curl "https://api.dexpaprika.com/networks" # DEXes on one network curl "https://api.dexpaprika.com/networks/ethereum/dexes" ``` Polling `/stats` is also a reasonable liveness check: it costs one credit and reflects the latest successful aggregation. ## Requesting a chain If a network you need is missing, tell us at [support@coinpaprika.com](mailto:support@coinpaprika.com) or in [Discord](https://discord.gg/DhJge5TUGM). Volume and the availability of a reliable node are what usually decide the order we add chains in, so it helps to say what you are building. # DexPaprika DEX API Go SDK: on-chain liquidity and swap data client Source: https://docs.dexpaprika.com/get-started/sdk-go The official Go client library for the DexPaprika API, providing easy access to decentralized exchange data across multiple blockchain networks > [!TIP] > > See also: [REST intro](/api-reference/introduction), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pools](/api-reference/pools/get-a-pool-on-a-network) ## Installation ```bash theme={null} go get github.com/coinpaprika/dexpaprika-sdk-go ``` ## Prerequisites * Go 1.24 or higher * Connection to the internet to access the DexPaprika API * No API key needed to start ## Quick example: get token price ```go theme={null} package main import ( "context" "fmt" "log" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func main() { // Create client client := dexpaprika.NewClient() // Create context with timeout ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() // Get WETH token details on Ethereum token, err := client.Tokens.GetDetails(ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2") if err != nil { log.Fatalf("Error getting token details: %v", err) } if token.Summary != nil { fmt.Printf("%s: $%.2f\n", token.Name, token.Summary.PriceUSD) } // Output: Wrapped Ether: $3245.67 } ``` ## Using an API key (optional) The SDK works without a key, and that is the default. A [free key](https://console.dexpaprika.com) raises both the per-minute request limit and the credit allowance. Current figures are on the [rate limits page](/knowledge-base/rate-limits). Requires v1.8.0 or later. ```go theme={null} // Explicit client := dexpaprika.NewClient(dexpaprika.WithAPIKey("api_your_key_here")) // Or leave it out and set DEXPAPRIKA_API_KEY in the environment client := dexpaprika.NewClient() ``` An explicit key beats the environment variable, and no key at all keeps the keyless behaviour unchanged. The host is never inferred from the key: free keys are served from the default base URL, and [Dev, Pro and Enterprise](/api-pro/introduction) keys move to `api-pro.dexpaprika.com`. > [!WARNING] > > The key is sent as the entire `Authorization` header value. **Nothing goes in front of it**, > no scheme word of any kind. The SDK writes the header for you, so this matters when you are > debugging what went out or calling the API directly. See > [401 Unauthorized](/knowledge-base/error-handling#401-unauthorized). ## API methods reference > [!NOTE] > > Parameters marked with an asterisk (\*) are required. **Networks** `category` **methods** ### client.Networks.List(ctx) **Endpoint:** [GET `/networks`](/api-reference/networks/get-a-list-of-available-blockchain-networks) Gets all supported blockchain networks including Ethereum, Solana, etc. **Parameters:** * `ctx`\* - Context for API request **Returns:** Network IDs, names, and related information. [Response Structure](/api-reference/networks/get-a-list-of-available-blockchain-networks). ```go theme={null} networks, err := client.Networks.List(ctx) ``` **DEXes** `category` **methods** ### client.Networks.ListDexes(ctx, networkId, page, limit) **Endpoint:** [GET `/networks/{network}/dexes`](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) Gets all DEXes on a specific network. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network (e.g., 'ethereum', 'solana') * `page` - Page number for pagination (0 leaves it to the API default) * `limit` - Number of results per page (0 leaves it to the API default) **Returns:** DEX IDs, names, pool counts, and volume information. [Response Structure](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network). ```go theme={null} dexes, err := client.Networks.ListDexes(ctx, "ethereum", 0, 10) ``` **Pools** `category` **methods** ### client.Pools.List(ctx, options) > [!WARNING] > > **The `GET /pools` endpoint was removed and returns `410 Gone`.** Whatever this > method does locally, the request cannot succeed. Use the network-scoped method > below and pass a network, or call `GET /pools/search` with a `chains` filter > directly. See [pool filtering](/tutorials/pool-filtering). **Endpoint:** GET `/pools` (removed, `410 Gone`) Gets top pools across all networks with pagination. **Parameters:** * `ctx`\* - Context for API request * `options` - ListOptions containing pagination and sorting parameters: * `Page` - Page number for pagination (starts at 0) * `Limit` - Number of results per page * `Sort` - Sort direction ('asc' or 'desc') * `OrderBy` - Field to sort by ('volume_usd', 'liquidity_usd', etc.) *** ### client.Pools.ListByNetwork(ctx, networkId, options) **Endpoint:** [GET `/networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific network with pagination and sorting options. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `options` - `ListOptions`. The endpoint is cursor-paginated, so page forward with `Cursor` taken from the previous response's `NextCursor` (paging needs an API key; a free key is enough); `Page` is not sent. Legacy sort values are mapped, so `OrderBy: "volume_usd"` is sent as `order_by=volume_usd_24h`, and REST rejects the legacy spelling with `400` **Returns:** Cursor-paginated pools for the given network: a `results` array plus `has_next_page` and `next_cursor`. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```go theme={null} options := &dexpaprika.ListOptions{ Limit: 5, OrderBy: "volume_usd_24h", Sort: "desc", } pools, err := client.Pools.ListByNetwork(ctx, "ethereum", options) ``` *** ### client.Pools.ListByDex(ctx, networkId, dexId, options) > [!WARNING] > > **`GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?dex_name=...` instead. The DEX id > moved out of the path and into a filter, so `Page` is gone and the response shape changed. > See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?dex_name=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific DEX within a network. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `dexId`\* - ID of the DEX, the `dex_id` field from `client.Networks.ListDexes`, case-insensitive (a display name like `Uniswap V3` returns no rows instead of an error) * `options` - ListOptions containing `Limit`, `OrderBy`, `Sort`, and `Cursor` > [!NOTE] > > `ListOptions.Page` is not sent for this call any more. Page through with `Cursor`, taking the > value from `NextCursor` on the previous response. The SDK normalizes legacy sort values, so > `volume_usd` goes out as `order_by=volume_usd_24h`; REST rejects the legacy spelling with a > `400` that lists the values it will take. **Returns:** Cursor-paginated pools for the given DEX: a `results` array plus `has_next_page` and `next_cursor`. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```go theme={null} options := &dexpaprika.ListOptions{ Limit: 10, OrderBy: "volume_usd_24h", Sort: "desc", } pools, err := client.Pools.ListByDex(ctx, "ethereum", "uniswap_v3", options) ``` *** ### client.Pools.GetDetails(ctx, networkId, poolAddress, inversed) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}`](/api-reference/pools/get-a-pool-on-a-network) Gets detailed information about a specific pool. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Detailed pool information including tokens, volumes, liquidity, and more. [Response Structure](/api-reference/pools/get-a-pool-on-a-network). ```go theme={null} poolDetails, err := client.Pools.GetDetails(ctx, "ethereum", "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", false) ``` *** ### client.Pools.GetTransactions(ctx, networkId, poolAddress, page, limit, cursor, opts...) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/transactions`](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) Gets transaction history for a specific pool with pagination. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL since 30 September 2026; keyless and free keys get `403`. See [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `page`, `limit` - Pagination * `cursor` - Transaction ID for cursor-based pagination, or `""` * `opts` - Optional time window: `dexpaprika.WithFrom("-1h")` and `dexpaprika.WithTo(...)` take a relative offset, Unix seconds, RFC3339 or `YYYY-MM-DD` (1.10.0 and later); `WithFromTimestamp` and `WithToTimestamp` take Unix seconds. `from` is inclusive, `to` exclusive; results go back 7 days at most **Returns:** List of transactions with details about tokens, amounts, and timestamps. [Response Structure](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). ```go theme={null} // Latest 20 transactions transactions, err := client.Pools.GetTransactions(ctx, "ethereum", "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", 0, 20, "") // Only the last hour lastHour, err := client.Pools.GetTransactions(ctx, "ethereum", "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", 0, 20, "", dexpaprika.WithFrom("-1h")) ``` *** ### client.Pools.GetOHLCV(ctx, networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/ohlcv`](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) Gets OHLCV (Open, High, Low, Close, Volume) chart data for a pool. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options` - OHLCVOptions containing: * `Start`\* - Start time as a string (a relative offset such as `-24h`, RFC 3339, `YYYY-MM-DD` or Unix seconds), inside your plan's [history window](/knowledge-base/rate-limits#ohlcv-limits-by-plan) * `End` - End time (optional) * `Limit` - Number of data points to return * `Interval` - Time interval ('1h', '6h', '24h', etc.; finer intervals need a key or a paid plan) * `Inversed` - Whether to invert the price ratio (boolean) **Returns:** Array of OHLCV data points for the specified time range and interval. [Response Structure](/api-reference/pools/get-ohlcv-data-for-a-pool-pair). ```go theme={null} // Hourly candles for the last 24 hours, which works without a key options := &dexpaprika.OHLCVOptions{ Start: "-24h", Limit: 24, Interval: "1h", Inversed: false, } ohlcv, err := client.Pools.GetOHLCV(ctx, "ethereum", "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", options) ``` *** ### client.Pools.GetIndicator(ctx, networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/indicators`](/api-reference/pools/get-a-technical-indicator-for-a-pool) Computes RSI, EMA, MACD, Bollinger Bands or VWAP from a pool's candles. Requires SDK v1.12.0 or later. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options`\* - IndicatorOptions containing: * `Indicator`\* - `dexpaprika.IndicatorRSI`, `IndicatorEMA`, `IndicatorMACD`, `IndicatorBBands` or `IndicatorVWAP` * `Interval` - Candle interval (`"1m"` to `"24h"`, or `"1d"`); pass it every time * `Start`, `End`, `Limit`, `Cursor` - Range and paging, same formats as OHLCV * `Period` - rsi, ema, bbands and vwap * `FastPeriod`, `SlowPeriod`, `SignalPeriod` - macd only * `StdDev` - bbands only Only the fields you set are sent. A parameter that belongs to another indicator, such as `FastPeriod` with rsi, returns a 400 whose `APIError.Param` names it. **Returns:** `*IndicatorResponse`. `Data` is oldest first, one `IndicatorDataPoint` per completed candle with `Value` for rsi, ema and vwap; `MACD`, `Signal` and `Histogram` for macd; `Upper`, `Middle` and `Lower` for bbands (all pointers). `Parameters` echoes the settings used, and `HasNextPage`/`NextCursor` page through longer ranges. [Response Structure](/api-reference/pools/get-a-technical-indicator-for-a-pool). Works on every plan, keyless included, with the same interval and history limits as pool OHLCV ([limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). Tutorial: [technical indicators](/tutorials/technical-indicators). ```go theme={null} // Hourly RSI over the last 24 hours, which works without a key rsi, err := client.Pools.GetIndicator(ctx, "ethereum", "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", &dexpaprika.IndicatorOptions{ Indicator: dexpaprika.IndicatorRSI, Interval: "1h", Start: "-24h", }) if err != nil { log.Fatal(err) } last := rsi.Data[len(rsi.Data)-1] fmt.Printf("RSI %.1f at %s\n", *last.Value, last.Timestamp) ``` **Tokens** `category` **methods** ### client.Tokens.GetDetails(ctx, networkId, tokenAddress) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}`](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) Gets comprehensive token information. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `tokenAddress`\* - Token contract address **Returns:** Token details including price, market cap, volume, and metadata. [Response Structure](/api-reference/tokens/get-a-tokens-latest-data-on-a-network). ```go theme={null} token, err := client.Tokens.GetDetails(ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2") ``` *** ### client.Tokens.GetPools(ctx, networkId, tokenAddress, options) **Endpoint:** [GET `/networks/{network}/pools/search?token_address=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools containing a specific token. **Parameters:** * `ctx`\* - Context for API request * `networkId`\* - ID of the network * `tokenAddress`\* - Token contract address * `options` - `*TokenPoolsOptions`, which embeds `*ListOptions` for `Limit`, `Sort`, `OrderBy` and `Cursor`. `Page` is not sent upstream: the endpoint is cursor-paginated, so page forward with `Cursor` taken from the previous response's `NextCursor` (paging needs an API key; a free key is enough) * `options.AdditionalTokenAddress` - deprecated and no longer sent. `GET /networks/{network}/pools/search` accepts one `token_address` only. Repeating it does not filter for the pair, and from 23 November 2026 it answers `400` (`repeated_param`). Filter `results[].tokens` yourself if you need a specific pair * `options.Reorder` - deprecated and no longer sent; the search endpoint has no equivalent > [!NOTE] > > The SDK normalizes legacy sort values before they go on the wire, so `OrderBy: "volume_usd"` is sent as `order_by=volume_usd_24h`. REST rejects the legacy spelling with `400`, so use the canonical value when you call the API directly. **Returns:** List of pools where the queried token is found. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```go theme={null} options := &dexpaprika.TokenPoolsOptions{ ListOptions: &dexpaprika.ListOptions{ Limit: 10, OrderBy: "volume_usd_24h", Sort: "desc", }, } // Get the busiest WETH pools on Ethereum pools, err := client.Tokens.GetPools( ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH options, ) ``` *** ### client.Tokens.GetIndicator(ctx, networkId, tokenAddress, options) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}/indicators`](/api-reference/tokens/get-a-technical-indicator-for-a-token) The same indicators computed from the token's USD candles across every pool it trades in. Same `IndicatorOptions` and response shape as `client.Pools.GetIndicator`, with `TokenAddress` set instead of `PoolAddress`. Requires SDK v1.12.0 or later. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL; keyless and free keys get `403`, which matches `errors.Is(err, dexpaprika.ErrForbidden)`, with `APIError.RequiredTier` naming the plan. ```go theme={null} macd, err := client.Tokens.GetIndicator(ctx, "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", &dexpaprika.IndicatorOptions{ Indicator: dexpaprika.IndicatorMACD, Interval: "1h", Start: "-7d", }) ``` **Search** `category` **methods** ### client.Search.Search(ctx, query) **Endpoint:** [GET `/search`](/api-reference/search/search-for-tokens-pools-and-dexes) Searches across tokens, pools, and DEXes using a query string. **Parameters:** * `ctx`\* - Context for API request * `query`\* - Search query string **Returns:** Matching entities from all categories (tokens, pools, DEXes). [Response Structure](/api-reference/search/search-for-tokens-pools-and-dexes). ```go theme={null} results, err := client.Search.Search(ctx, "ethereum") ``` **Utils** `category` **methods** ### client.Utils.GetStats(ctx) **Endpoint:** [GET `/stats`](/api-reference/utils/retrieve-high-level-asset-statistics) Gets platform-wide statistics. **Parameters:** * `ctx`\* - Context for API request **Returns:** Counts of chains, DEXes, pools, and tokens indexed. [Response Structure](/api-reference/utils/retrieve-high-level-asset-statistics). ```go theme={null} stats, err := client.Utils.GetStats(ctx) ``` ## Complete example **example** ```go theme={null} package main import ( "context" "fmt" "log" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) const ( weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ) func main() { client := dexpaprika.NewClient() ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() // Networks come back as a slice of Network{ID, DisplayName} networks, err := client.Networks.List(ctx) if err != nil { log.Fatalf("Error fetching networks: %v", err) } for _, network := range networks { if network.ID == "ethereum" { fmt.Printf("%s is one of %d networks\n", network.DisplayName, len(networks)) } } // Price lives under Summary token, err := client.Tokens.GetDetails(ctx, "ethereum", weth) if err != nil { log.Fatalf("Error fetching token details: %v", err) } fmt.Printf("%s price: $%.2f\n", token.Name, token.Summary.PriceUSD) // Pools for a token are served by pool search. The SDK copies the rows // into Pools and fills VolumeUSD from volume_usd_24h. There is no pair // filter, so match the second token client-side. pools, err := client.Tokens.GetPools(ctx, "ethereum", weth, &dexpaprika.TokenPoolsOptions{ ListOptions: &dexpaprika.ListOptions{Limit: 20, OrderBy: "volume_usd_24h", Sort: "desc"}, }) if err != nil { log.Fatalf("Error fetching pools: %v", err) } fmt.Println("Top WETH/USDC pools:") shown := 0 for _, pool := range pools.Pools { for _, t := range pool.Tokens { if t.ID == usdc && shown < 5 { fmt.Printf("%s: $%.2f 24h volume\n", pool.DexName, pool.VolumeUSD) shown++ } } } } ``` ## Advanced features ### Error handling **error handling** ```go theme={null} import ( "context" "errors" "fmt" "log" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func handleAPIErrors() { client := dexpaprika.NewClient() ctx := context.Background() // Attempt to get a token with an invalid address _, err := client.Tokens.GetDetails(ctx, "ethereum", "0xinvalidaddress") if err != nil { // Check for specific error types var apiErr *dexpaprika.APIError if errors.As(err, &apiErr) { switch apiErr.StatusCode { case 404: fmt.Println("Token not found") case 429: fmt.Println("Rate limit exceeded, retry after a delay") case 500: fmt.Println("Server error, retry may succeed") default: fmt.Printf("API error: %s\n", apiErr.Message) } } else { // Handle non-API errors (like network issues) fmt.Printf("Non-API error: %v\n", err) } // Check if error is retryable if dexpaprika.IsRetryable(err) { fmt.Println("This error is retryable") } } } ``` ### Caching **caching** ```go theme={null} import ( "context" "fmt" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func useCaching() { // Create a regular client client := dexpaprika.NewClient() // Create a cached client with 5-minute TTL cachedClient := dexpaprika.NewCachedClient(client, nil, 5*time.Minute) // Create context ctx := context.Background() // First call - hits the API startTime := time.Now() networks, err := cachedClient.GetNetworks(ctx) if err != nil { fmt.Printf("Error: %v\n", err) return } fmt.Printf("First call (API): %d networks, took %v\n", len(networks), time.Since(startTime)) // Second call - served from cache (much faster) startTime = time.Now() networks, err = cachedClient.GetNetworks(ctx) if err != nil { fmt.Printf("Error: %v\n", err) return } fmt.Printf("Second call (cached): %d networks, took %v\n", len(networks), time.Since(startTime)) } ``` ### Pagination helpers Paging past the first page of a search endpoint needs an API key. `NewClient()` reads it from `DEXPAPRIKA_API_KEY`; a [free key](https://console.dexpaprika.com) pages without limit. Without a key the second page returns `403` with `"param": "cursor"`. `dexpaprika.IsKeyRequiredForPaging(err)` detects that case. **pagination** ```go theme={null} import ( "context" "fmt" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func usePagination() { client := dexpaprika.NewClient() ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() // Create a paginator for Ethereum pools with 50 items per page options := &dexpaprika.ListOptions{ Limit: 50, OrderBy: "volume_usd_24h", Sort: "desc", } paginator := dexpaprika.NewPoolsPaginator(client, options).ForNetwork("ethereum") // Count total pools processed totalPools := 0 // Process first 3 pages (or fewer if there aren't that many) for i := 0; i < 3 && paginator.HasNextPage(); i++ { // Get next page of results if err := paginator.GetNextPage(ctx); err != nil { fmt.Printf("Error getting page: %v\n", err) break } // Process current page pools := paginator.GetCurrentPage() totalPools += len(pools) // Process first few pools in each page fmt.Printf("=== Page %d ===\n", i+1) for j, pool := range pools { if j >= 3 { fmt.Printf("...and %d more pools\n", len(pools)-3) break } var vol float64 if pool.VolumeUSD24h != nil { vol = *pool.VolumeUSD24h } fmt.Printf("%s: $%.2f 24h volume\n", pool.DexName, vol) } } fmt.Printf("Processed %d pools total\n", totalPools) } ``` ### Custom configuration **configuration** ```go theme={null} import ( "net/http" "time" "github.com/coinpaprika/dexpaprika-sdk-go/dexpaprika" ) func configureClient() *dexpaprika.Client { // Create a client with custom configuration client := dexpaprika.NewClient( // Custom HTTP client with longer timeout dexpaprika.WithHTTPClient(&http.Client{ Timeout: 60 * time.Second, }), // Custom retry configuration (5 retries with backoff) dexpaprika.WithRetryConfig(5, 2*time.Second, 30*time.Second), // Rate limiting to 3 requests per second dexpaprika.WithRateLimit(3.0), // Custom user agent dexpaprika.WithUserAgent("MyApp/1.0 DexPaprikaClient"), ) return client } ``` ## Resources * [GitHub Repository](https://github.com/coinpaprika/dexpaprika-sdk-go) * [DexPaprika Website](https://dexpaprika.com) * [API Reference](/api-reference/introduction) ## API status The DexPaprika API provides consistent data with stable endpoints. Requests are answered without an API key on the free tier, and a free key raises the credit allowance. We aim to maintain backward compatibility and provide notice of any significant changes. ### FAQs > [accordion] Do I need an API key with this SDK? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP, and a [free registered key](https://console.dexpaprika.com/dashboard) raises that to 100,000 with no card. > [accordion] How do I find identifiers? > > Use Coverage Checker or list Networks and query Tokens/Pools to discover addresses. > [accordion] How do I get historical or transactions data? > > Use pools/transactions endpoints with `pool_address`, `network`, and time/paging params as documented. Transactions need a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. > [accordion] What about rate limiting? > > 15 requests a minute keyless, 30 with a [free key](https://console.dexpaprika.com) and 500 on Pro, against 10,000 credits keyless and 100,000 with a free key over a rolling 30 days, or 5,000,000 a month on Pro. Retry transient HTTP errors with backoff. See [rate limits](/knowledge-base/rate-limits) for how the counters work, and [Pro pricing](https://dexpaprika.com/api/pricing) for what the 5,000,000 credit tier costs. # DexPaprika DEX API PHP SDK: on-chain liquidity and swap data client Source: https://docs.dexpaprika.com/get-started/sdk-php The official PHP client library for the DexPaprika API, providing easy access to decentralized exchange data across multiple blockchain networks > [!TIP] > > See also: [REST intro](/api-reference/introduction), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pools](/api-reference/pools/get-a-pool-on-a-network) ## Installation ```bash theme={null} # Using Composer composer require coinpaprika/dexpaprika-sdk # From source git clone https://github.com/coinpaprika/dexpaprika-sdk-php cd dexpaprika-sdk-php composer install ``` ## Prerequisites * PHP 7.4 or higher * [Composer](https://getcomposer.org/) * `ext-json` PHP extension * Connection to the internet to access the DexPaprika API * No API key needed to start ## PHP SDK quickstart ```php theme={null} tokens->getTokenDetails('ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'); echo "{$weth['name']}: \${$weth['summary']['price_usd']}"; // Output: Wrapped Ether: $3245.67 ``` ## Using an API key (optional) The SDK works without a key, and that is the default. A [free key](https://console.dexpaprika.com) raises both the per-minute request limit and the credit allowance. Current figures are on the [rate limits page](/knowledge-base/rate-limits). Requires v1.8.0 or later. ```php theme={null} use DexPaprika\Client; use DexPaprika\Config; // Explicit $config = (new Config())->setApiKey('api_your_key_here'); $client = new Client(null, null, false, $config); // Or leave it out and set DEXPAPRIKA_API_KEY in the environment $client = new Client(); ``` An explicit key beats the environment variable, and no key at all keeps the keyless behaviour unchanged. The host is never inferred from the key: free keys are served from the default base URL, and [Dev, Pro and Enterprise](/api-pro/introduction) keys move to `api-pro.dexpaprika.com`. > [!WARNING] > > The key is sent as the entire `Authorization` header value. **Nothing goes in front of it**, > no scheme word of any kind. The SDK writes the header for you, so this matters when you are > debugging what went out or calling the API directly. See > [401 Unauthorized](/knowledge-base/error-handling#401-unauthorized). ## API methods reference > [!NOTE] > > Parameters marked with an asterisk (\*) are required. **Networks** `category` **methods** ### client->networks->getNetworks() **Endpoint:** [GET `/networks`](/api-reference/networks/get-a-list-of-available-blockchain-networks) Gets all supported blockchain networks including Ethereum, Solana, etc. **Parameters:** None **Returns:** Network IDs, names, and related information. [Response Structure](/api-reference/networks/get-a-list-of-available-blockchain-networks). ```php theme={null} // Get all networks $networks = $client->networks->getNetworks(); echo "Found " . count($networks) . " networks"; ``` ### Finding a network by id `getNetworks()` returns a plain list of networks, so look one up by its `id`. ```php theme={null} // Find Ethereum in the network list foreach ($client->networks->getNetworks() as $network) { if ($network['id'] === 'ethereum') { echo "Found network: {$network['display_name']}"; } } ``` **DEXes** `category` **methods** ### client->dexes->getNetworkDexes(networkId, options) **Endpoint:** [GET `/networks/{network}/dexes`](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) Gets all DEXes on a specific network. **Parameters:** * `networkId`\* - ID of the network (e.g., 'ethereum', 'solana') * `options` - Additional options: * `page` - Page number for pagination (starts at 0) * `limit` - Number of results per page **Returns:** DEX IDs, names, pool counts, and volume information. [Response Structure](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network). ```php theme={null} // Get all DEXes on Ethereum $dexes = $client->dexes->getNetworkDexes('ethereum'); echo "Found " . count($dexes['dexes']) . " DEXes on Ethereum"; ``` ### Finding a DEX by id Match on `dex_id`, the value `getDexPools` expects. `dex_name` is the display name. ```php theme={null} // Find Uniswap V3 on Ethereum $dexes = $client->dexes->getNetworkDexes('ethereum'); foreach ($dexes['dexes'] as $dex) { if ($dex['dex_id'] === 'uniswap_v3') { echo "Found DEX: {$dex['dex_name']}"; } } ``` **Pools** `category` **methods** ### client->pools->getTopPools(options) > [!WARNING] > > **The `GET /pools` endpoint was removed and returns `410 Gone`.** Whatever this > method does locally, the request cannot succeed. Use the network-scoped method > below and pass a network, or call `GET /pools/search` with a `chains` filter > directly. See [pool filtering](/tutorials/pool-filtering). **Endpoint:** GET `/pools` (removed, `410 Gone`) Gets top pools across all networks with pagination. **Parameters:** * `options` - Additional options: * `page` - Page number for pagination (starts at 0) * `limit` - Number of results per page * `orderBy` - Field to sort by ('volume_usd', 'liquidity_usd', etc.) * `sort` - Sort direction ('asc' or 'desc') ### client->pools->getNetworkPools(networkId, options) **Endpoint:** [GET `/networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific network with pagination and sorting options. **Parameters:** * `networkId`\* - ID of the network * `options` - Additional options: * `limit` - Number of results per page * `orderBy` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list). Legacy values are mapped, so `volume_usd` is sent as `order_by=volume_usd_24h`, and REST rejects the legacy spelling with `400` * `sort` - Sort direction ('asc' or 'desc') * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough). There is no `page` option: the endpoint is cursor-paginated **Returns:** Cursor-paginated pools for the given network: a `results` array plus `has_next_page` and `next_cursor`. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```php theme={null} // Get top 5 pools on Ethereum by volume $pools = $client->pools->getNetworkPools('ethereum', [ 'limit' => 5, 'orderBy' => 'volume_usd_24h', 'sort' => 'desc' ]); echo "Found " . count($pools['results']) . " pools on Ethereum"; ``` ### client->dexes->getDexPools(networkId, dexId, options) > [!WARNING] > > **`GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?dex_name=...` instead. The DEX id > moved out of the path and into a filter, so `page` is gone and the response shape changed. > See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?dex_name=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific DEX within a network. **Parameters:** * `networkId`\* - ID of the network * `dexId`\* - ID of the DEX, the `dex_id` field from `getNetworkDexes`, case-insensitive (a display name like `Uniswap V3` returns no rows instead of an error) * `options` - Additional options: * `limit` - Number of results per page (max 100) * `orderBy` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list) * `sort` - Sort direction ('asc' or 'desc') * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) > [!NOTE] > > There is no `page` option any more. The SDK normalizes legacy sort values, so `volume_usd` is > sent as `order_by=volume_usd_24h`; REST rejects the legacy spelling with a `400` that lists the > values it will take. **Returns:** A `results` array plus `has_next_page` and `next_cursor` for cursor pagination. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```php theme={null} // Get the busiest Uniswap V3 pools on Ethereum $uniswapPools = $client->dexes->getDexPools('ethereum', 'uniswap_v3', [ 'limit' => 10, 'orderBy' => 'volume_usd_24h', 'sort' => 'desc' ]); foreach ($uniswapPools['results'] as $pool) { echo "{$pool['dex_name']}: $" . number_format($pool['volume_usd_24h'], 2) . " 24h volume\n"; } ``` ### client->pools->getPoolDetails(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}`](/api-reference/pools/get-a-pool-on-a-network) Gets detailed information about a specific pool. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options` - Additional options: * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Detailed pool information including tokens, volumes, liquidity, and more. [Response Structure](/api-reference/pools/get-a-pool-on-a-network). ```php theme={null} // Get details for a specific pool (WETH/USDC on Uniswap V2) $pool = $client->pools->getPoolDetails( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', ['inversed' => false] ); echo "Pool: {$pool['tokens'][0]['symbol']}/{$pool['tokens'][1]['symbol']}"; ``` ### client->pools->getPoolTransactions(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/transactions`](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) Gets transaction history for a specific pool with pagination. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL since 30 September 2026; keyless and free keys get `403`. See [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options` - Additional options: * `page` - Page number for pagination * `limit` - Number of transactions per page * `cursor` - Transaction ID used for cursor-based pagination * `from` / `to` - Time window: a relative offset such as `'-1h'`, Unix seconds, RFC3339 or `YYYY-MM-DD`. `from` is inclusive, `to` exclusive; results go back 7 days at most. Needs 1.10.0 or later: earlier releases did not send these two options **Returns:** List of transactions with details about tokens, amounts, and timestamps. [Response Structure](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). ```php theme={null} // Get the latest 20 transactions for a pool $transactions = $client->pools->getPoolTransactions( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', ['limit' => 20] ); $latest = $transactions['transactions'][0]; echo "Latest transaction: {$latest['id']} at {$latest['created_at']}"; // Only the last hour $lastHour = $client->pools->getPoolTransactions( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', ['limit' => 20, 'from' => '-1h'] ); ``` ### client->pools->getPoolOHLCV(networkId, poolAddress, start, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/ohlcv`](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) Gets OHLCV (Open, High, Low, Close, Volume) chart data for a pool. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `start`\* - Start time (relative offset such as `-24h`, ISO date string, YYYY-MM-DD, or Unix timestamp), inside your plan's [history window](/knowledge-base/rate-limits#ohlcv-limits-by-plan) * `options` - Additional options: * `end` - End time (optional) * `limit` - Number of data points to return * `interval` - Time interval ('1m', '5m', '10m', '15m', '30m', '1h', '6h', '12h', '24h'); without a key only '1h' and up * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Array of OHLCV data points for the specified time range and interval. [Response Structure](/api-reference/pools/get-ohlcv-data-for-a-pool-pair). ```php theme={null} // Hourly candles for the last 24 hours, which works without a key $ohlcv = $client->pools->getPoolOHLCV( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', '-24h', [ 'interval' => '1h', 'limit' => 24 ] ); echo "Received " . count($ohlcv) . " OHLCV data points"; ``` *** ### client->pools->getPoolIndicator(networkId, poolAddress, indicator, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/indicators`](/api-reference/pools/get-a-technical-indicator-for-a-pool) Computes RSI, EMA, MACD, Bollinger Bands or VWAP from a pool's candles. Requires SDK 1.12.0 or later. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `indicator`\* - `'rsi'`, `'ema'`, `'macd'`, `'bbands'` or `'vwap'` * `options` - Additional options: * `interval` - Candle interval (`'1m'` to `'24h'`, or `'1d'`); pass it every time * `start`, `end`, `limit`, `cursor` - Range and paging, same formats as OHLCV * `period` - rsi, ema, bbands and vwap * `fast_period`, `slow_period`, `signal_period` - macd only * `std_dev` - bbands only Set only the options the chosen indicator uses: one that belongs to another indicator is refused by the API with a 400. **Returns:** `data`, oldest first, one point per completed candle: `value` for rsi, ema and vwap; `macd`, `signal` and `histogram` for macd; `upper`, `middle` and `lower` for bbands. `parameters` echoes the settings used, defaults included, and `has_next_page`/`next_cursor` page through longer ranges. [Response Structure](/api-reference/pools/get-a-technical-indicator-for-a-pool). Works on every plan, keyless included, with the same interval and history limits as pool OHLCV ([limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). Tutorial: [technical indicators](/tutorials/technical-indicators). ```php theme={null} // Hourly RSI over the last 24 hours, which works without a key $rsi = $client->pools->getPoolIndicator( 'ethereum', '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', 'rsi', ['interval' => '1h', 'start' => '-24h'] ); $last = end($rsi['data']); echo "RSI {$last['value']} at {$last['timestamp']}"; ``` **Tokens** `category` **methods** ### client->tokens->getTokenDetails(networkId, tokenAddress) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}`](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) Gets comprehensive token information. **Parameters:** * `networkId`\* - ID of the network * `tokenAddress`\* - Token contract address **Returns:** Token details including price, market cap, volume, and metadata. [Response Structure](/api-reference/tokens/get-a-tokens-latest-data-on-a-network). ```php theme={null} // Get WETH token details $weth = $client->tokens->getTokenDetails( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ); echo "{$weth['name']} price: \${$weth['summary']['price_usd']}"; ``` ### client->tokens->getTokenPools(networkId, tokenAddress, options) > [!WARNING] > > **`GET /networks/{network}/tokens/{token_address}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?token_address=...` instead. The old > second-token `address` pair filter and the `reorder` flag have no replacement and are not sent. > See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?token_address=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools containing a specific token. **Parameters:** * `networkId`\* - ID of the network * `tokenAddress`\* - Token contract address * `options` - Additional options: * `limit` - Number of results per page (max 100) * `sort` - Sort direction ('asc' or 'desc') * `orderBy` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list) * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) > [!NOTE] > > There is no `page` option and no second-token `address` option. The endpoint is cursor-paginated, > and `GET /networks/{network}/pools/search` has no pair filter, so anything you pass under those > names is dropped before the request goes out. Filter `results[].tokens` yourself to match a pair. > The SDK also normalizes legacy sort values, so `volume_usd` is sent as `order_by=volume_usd_24h`; > REST rejects the legacy spelling with `400`. **Returns:** A `results` array plus `has_next_page` and `next_cursor` for cursor pagination. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```php theme={null} // Get the busiest WETH pools on Ethereum $pools = $client->tokens->getTokenPools( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH [ 'limit' => 5, 'orderBy' => 'volume_usd_24h', 'sort' => 'desc' ] ); foreach ($pools['results'] as $pool) { echo "{$pool['dex_name']}: $" . number_format($pool['volume_usd_24h'], 2) . " 24h volume\n"; } ``` ### client->tokens->findToken(networkId, tokenAddress) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}`](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) Same call as `getTokenDetails`, wrapped so a missing token raises `NotFoundException` instead of handing you an empty payload to check. **Parameters:** * `networkId`\* - ID of the network * `tokenAddress`\* - Contract address of the token * `asObject` - Return an object instead of an array (default: `false`) **Returns:** Token details, the same shape as `getTokenDetails`. ```php theme={null} // Find WETH by its contract address try { $token = $client->tokens->findToken( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ); echo "Found {$token['name']} at {$token['id']}"; } catch (DexPaprika\Exception\NotFoundException $e) { echo "Token not found"; } ``` *** ### client->tokens->getTokenIndicator(networkId, tokenAddress, indicator, options) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}/indicators`](/api-reference/tokens/get-a-technical-indicator-for-a-token) The same indicators computed from the token's USD candles across every pool it trades in. Same options and response shape as `getPoolIndicator`. Requires SDK 1.12.0 or later. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL; keyless and free keys get `403`, thrown as a `ClientException` whose `getErrorData()['required_tier']` names the plan. ```php theme={null} $macd = $client->tokens->getTokenIndicator( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH 'macd', ['interval' => '1h', 'start' => '-7d'] ); ``` **Search** `category` **methods** ### client->search->search(query) **Endpoint:** [GET `/search`](/api-reference/search/search-for-tokens-pools-and-dexes) Searches across tokens, pools, and DEXes using a query string. **Parameters:** * `query`\* - Search query string **Returns:** Matching entities from all categories (tokens, pools, DEXes). [Response Structure](/api-reference/search/search-for-tokens-pools-and-dexes). ```php theme={null} // Search for "ethereum" across all entities $results = $client->search->search("ethereum"); echo "Found " . count($results['tokens']) . " tokens\n"; echo "Found " . count($results['pools']) . " pools\n"; echo "Found " . count($results['dexes']) . " dexes\n"; ``` **Stats** `category` **methods** ### client->stats->getStats() **Endpoint:** [GET `/stats`](/api-reference/utils/retrieve-high-level-asset-statistics) Gets platform-wide statistics. **Parameters:** None **Returns:** Counts of chains, DEXes, pools, and tokens indexed. [Response Structure](/api-reference/utils/retrieve-high-level-asset-statistics). ```php theme={null} // Get platform statistics $stats = $client->stats->getStats(); echo "Total chains: {$stats['chains']}\n"; echo "Total DEX factories: {$stats['factories']}\n"; echo "Total pools: {$stats['pools']}\n"; echo "Total tokens: {$stats['tokens']}\n"; ``` ## Complete example **example** ```php theme={null} ..., 'display_name' => ...] $networks = $client->networks->getNetworks(); foreach ($networks as $network) { if ($network['id'] === 'ethereum') { echo "{$network['display_name']} is one of " . count($networks) . " networks\n"; } } // Price lives under summary $weth = $client->tokens->getTokenDetails('ethereum', WETH); echo "{$weth['name']} price: $" . number_format($weth['summary']['price_usd'], 2) . "\n"; // Pools for a token are served by pool search. Rows sit under results, // sorted by volume_usd_24h. There is no pair filter, so match the second // token client-side. $pools = $client->tokens->getTokenPools('ethereum', WETH, [ 'limit' => 20, 'orderBy' => 'volume_usd_24h', 'sort' => 'desc', ]); echo "Top WETH/USDC pools:\n"; $shown = 0; foreach ($pools['results'] as $pool) { $ids = array_column($pool['tokens'], 'id'); if (in_array(USDC, $ids, true) && $shown < 5) { echo "{$pool['dex_name']}: $" . number_format($pool['volume_usd_24h'], 2) . " 24h volume\n"; $shown++; } } } catch (DexPaprikaApiException $e) { echo "API Error: {$e->getMessage()}\n"; } } main(); ``` ## Advanced features ### Error handling **error handling** ```php theme={null} tokens->getTokenDetails('ethereum', '0xinvalidaddress'); } catch (NotFoundException $e) { echo "Token not found: {$e->getMessage()}\n"; } catch (RateLimitException $e) { echo "Rate limit exceeded: {$e->getMessage()}\n"; } catch (ServerException $e) { echo "Server error occurred: {$e->getMessage()}\n"; } catch (NetworkException $e) { echo "Network error: {$e->getMessage()}\n"; } catch (DexPaprikaApiException $e) { echo "API error: {$e->getMessage()} (Code: {$e->getCode()})\n"; } catch (Exception $e) { echo "General error: {$e->getMessage()}\n"; } // The SDK automatically retries 429 (Too Many Requests), any 5xx // (server errors) and connection failures // Custom retry configuration use DexPaprika\Config; $config = new Config(); $config->setMaxRetries(4); // Number of retry attempts (default: 5) $config->setRetryDelays([100, 500, 1000, 5000]); // Delay in milliseconds $client = new Client(null, null, false, $config); // All API requests will now use these retry settings try { $networks = $client->networks->getNetworks(); } catch (Exception $e) { echo "Failed after multiple retries: {$e->getMessage()}\n"; } ``` ### Caching system **caching** ```php theme={null} setupCache(); // First call - hits the API $startTime = microtime(true); $networks = $client->networks->getNetworks(); $firstCallTime = microtime(true) - $startTime; echo "First call (API): " . count($networks) . " networks, took {$firstCallTime} s\n"; // Second call - served from cache (much faster) $startTime = microtime(true); $networks = $client->networks->getNetworks(); $secondCallTime = microtime(true) - $startTime; echo "Second call (cached): " . count($networks) . " networks, took {$secondCallTime} s\n"; echo "Cache speedup: " . ($firstCallTime / $secondCallTime) . "x\n"; // You can skip the cache when you need fresh data $client->getConfig()->setCacheEnabled(false); $freshNetworks = $client->networks->getNetworks(); $client->getConfig()->setCacheEnabled(true); // Custom cache configuration $cache = new FilesystemCache('/path/to/custom/cache'); $client->setupCache($cache, 300); // 5 minutes TTL // Clear the entire cache $client->getConfig()->getCache()->clear(); ``` ### Pagination helper Paging past the first page of a search endpoint needs an API key. The client below reads it from `DEXPAPRIKA_API_KEY`; a [free key](https://console.dexpaprika.com) pages without limit. Without a key the second page returns `403` with `"param": "cursor"`. **pagination** ```php theme={null} $limit, 'sort' => 'desc', 'orderBy' => 'volume_usd_24h' ]; if ($cursor !== null) { $options['cursor'] = $cursor; } $response = $client->pools->getNetworkPools($networkId, $options); $allPools = array_merge($allPools, $response['results']); // The search endpoint is cursor-paginated, not page-numbered if (empty($response['has_next_page']) || empty($response['next_cursor'])) { break; } $cursor = $response['next_cursor']; // Pause between pages to stay under your per-minute limit: // https://docs.dexpaprika.com/knowledge-base/rate-limits sleep(4); } echo "Fetched a total of " . count($allPools) . " pools on {$networkId}\n"; return $allPools; } // Alternative approach using built-in paginator function fetchAllPoolsWithPaginator($networkId) { $client = new Client(); $allPools = []; // Create a paginator for network pools. Arguments are keyed by the // method's parameter names; whatever is left becomes the options array. $paginator = $client->createPaginator( $client->pools, 'getNetworkPools', [ 'networkId' => $networkId, 'limit' => 50, 'orderBy' => 'volume_usd_24h', 'sort' => 'desc' ] ); // Paginator is not Traversable and has no setMaxPages(), so walk it explicitly. $page = 0; while ($paginator->hasNextPage() && $page < 10) { $response = $paginator->getNextPage(); $allPools = array_merge($allPools, $response['results']); echo "Processed page {$page}, got " . count($response['results']) . " pools\n"; $page++; } echo "Fetched a total of " . count($allPools) . " pools on {$networkId}\n"; return $allPools; } // Usage example $ethereumPools = fetchAllPools('ethereum'); // or $ethereumPools = fetchAllPoolsWithPaginator('ethereum'); ``` ### Working with objects **objects** ```php theme={null} true to get an object instead of an array $pool = $client->pools->getPoolDetails( 'ethereum', '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', // USDC/WETH Uniswap v3 pool ['asObject' => true] ); // Access pool properties as object properties echo "Pool: {$pool->tokens[0]->symbol}/{$pool->tokens[1]->symbol}\n"; echo "Price: \${$pool->last_price_usd}\n"; // Time windows are keyed '24h', '6h', '1h', '30m', '15m' and '5m', so use // the brace syntax to read them echo "Volume (24h): \${$pool->{'24h'}->volume_usd}\n"; echo "Transactions (24h): {$pool->{'24h'}->txns}\n"; echo "1h price change: {$pool->{'1h'}->last_price_usd_change}%\n"; echo "24h price change: {$pool->{'24h'}->last_price_usd_change}%\n"; // Calls without the option keep returning arrays $networks = $client->networks->getNetworks(); $token = $client->tokens->getTokenDetails( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', ['asObject' => true] ); echo "{$token->name} price: \${$token->summary->price_usd}\n"; ``` ## Resources * [GitHub Repository](https://github.com/coinpaprika/dexpaprika-sdk-php) * [DexPaprika Website](https://dexpaprika.com) * [API Reference](/api-reference/introduction) * [Discord Community](https://discord.gg/DhJge5TUGM) ## API status The DexPaprika API provides consistent data with stable endpoints. Requests are answered without an API key on the free tier, and a free key raises the credit allowance. We aim to maintain backward compatibility and provide notice of any significant changes. ### FAQs > [accordion] Do I need an API key with this SDK? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP, and a [free registered key](https://console.dexpaprika.com/dashboard) raises that to 100,000 with no card. > [accordion] How do I find identifiers? > > Use Coverage Checker or list Networks and query Tokens/Pools to discover addresses. > [accordion] How do I get historical or transactions data? > > Use pools/transactions endpoints with `pool_address`, `network`, and time/paging params as documented. Transactions need a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. > [accordion] What about rate limiting? > > 15 requests a minute keyless, 30 with a [free key](https://console.dexpaprika.com) and 500 on Pro, against 10,000 credits keyless and 100,000 with a free key over a rolling 30 days, or 5,000,000 a month on Pro. Retry transient HTTP errors with backoff. See [rate limits](/knowledge-base/rate-limits) for how the counters work, and [Pro pricing](https://dexpaprika.com/api/pricing) for what the 5,000,000 credit tier costs. # DexPaprika DEX API Python SDK: on-chain liquidity and swap data client Source: https://docs.dexpaprika.com/get-started/sdk-python The official Python client library for the DexPaprika API, providing easy access to decentralized exchange data across multiple blockchain networks > [!TIP] > > See also: [REST intro](/api-reference/introduction), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pools](/api-reference/pools/get-a-pool-on-a-network) ## Installation ```bash theme={null} # Using pip pip install dexpaprika-sdk # Using poetry poetry add dexpaprika-sdk # From source git clone https://github.com/coinpaprika/dexpaprika-sdk-python cd dexpaprika-sdk-python pip install -e . ``` ## Prerequisites * Python 3.8 or higher * Connection to the internet to access the DexPaprika API * No API key needed to start ## Quick example: get token price ```python theme={null} from dexpaprika_sdk import DexPaprikaClient from dexpaprika_sdk.models import TokenDetails # Type hint example # Create client and get WETH price on Ethereum client = DexPaprikaClient() token: TokenDetails = client.tokens.get_details("ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2") print(f"{token.name}: ${token.summary.price_usd:.2f}") # Output: Wrapped Ether: $3245.67 ``` ## Using an API key (optional) The SDK works without a key, and that is the default. A [free key](https://console.dexpaprika.com) raises both the per-minute request limit and the credit allowance. Current figures are on the [rate limits page](/knowledge-base/rate-limits). Requires 0.9.0 or later. ```python theme={null} from dexpaprika_sdk import DexPaprikaClient # Explicit client = DexPaprikaClient(api_key="api_your_key_here") # Or leave it out and set DEXPAPRIKA_API_KEY in the environment client = DexPaprikaClient() ``` An explicit key beats the environment variable, and no key at all keeps the keyless behaviour unchanged. The host is never inferred from the key: free keys are served from the default base URL, and [Dev, Pro and Enterprise](/api-pro/introduction) keys move to `api-pro.dexpaprika.com`. > [!WARNING] > > The key is sent as the entire `Authorization` header value. **Nothing goes in front of it**, > no scheme word of any kind. The SDK writes the header for you, so this matters when you are > debugging what went out or calling the API directly. See > [401 Unauthorized](/knowledge-base/error-handling#401-unauthorized). ## API methods reference > [!NOTE] > > Parameters marked with an asterisk (\*) are required. **Networks** `category` **methods** ### client.networks.list() **Endpoint:** [GET `/networks`](/api-reference/networks/get-a-list-of-available-blockchain-networks) Gets all supported blockchain networks including Ethereum, Solana, etc. **Parameters:** None **Returns:** Network IDs, names, and related information. [Response Structure](/api-reference/networks/get-a-list-of-available-blockchain-networks). ```python theme={null} # Get all networks networks = client.networks.list() print(f"Found {len(networks)} networks") ``` **DEXes** `category` **methods** ### client.dexes.list(network, page, limit) **Endpoint:** [GET `/networks/{network}/dexes`](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) Gets all DEXes on a specific network. **Parameters:** * `network`\* - ID of the network (e.g., 'ethereum', 'solana') * `page` - Page number for pagination (starts at 0) * `limit` - Number of results per page **Returns:** DEX IDs, names, pool counts, and volume information. [Response Structure](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network). ```python theme={null} # Get all DEXes on Ethereum dexes = client.dexes.list("ethereum") print(f"Found {len(dexes.dexes)} DEXes on Ethereum") ``` **Pools** `category` **methods** ### client.pools.list(page, limit, sort, order_by) > [!WARNING] > > **The `GET /pools` endpoint was removed and returns `410 Gone`.** Whatever this > method does locally, the request cannot succeed. Use the network-scoped method > below and pass a network, or call `GET /pools/search` with a `chains` filter > directly. See [pool filtering](/tutorials/pool-filtering). **Endpoint:** GET `/pools` (removed, `410 Gone`) Gets top pools across all networks with pagination. **Parameters:** * `page` - Page number for pagination (starts at 0) * `limit` - Number of results per page * `sort` - Sort direction ('asc' or 'desc') * `order_by` - Field to sort by ('volume_usd', 'liquidity_usd', etc.) *** ### client.pools.list_by_network(network_id, page, limit, sort, order_by) **Endpoint:** [GET `/networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific network with pagination and sorting options. **Parameters:** * `network_id`\* - ID of the network * `limit` - Number of results per page * `sort` - Sort direction ('asc' or 'desc') * `order_by` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list). Legacy values are mapped, so `volume_usd` is sent as `order_by=volume_usd_24h`, and REST rejects the legacy spelling with `400` * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough). `page` is validated but never sent: the endpoint is cursor-paginated **Returns:** Cursor-paginated pools for the given network: a `results` array plus `has_next_page` and `next_cursor`. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```python theme={null} # Get top 5 pools on Ethereum by volume pools = client.pools.list_by_network( network_id="ethereum", limit=5, order_by="volume_usd_24h", sort="desc" ) print(f"Found {len(pools.results)} pools on Ethereum") ``` *** ### client.pools.list_by_dex(network_id, dex_id, limit, sort, order_by, cursor) > [!WARNING] > > **`GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?dex_name=...` instead. The DEX id > moved out of the path and into a filter, so `page` is gone and the response shape changed. > See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?dex_name=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific DEX within a network. **Parameters:** * `network_id`\* - ID of the network * `dex_id`\* - ID of the DEX, the `dex_id` field from `client.dexes.list_by_network()`, case-insensitive (a display name like `Uniswap V3` returns no rows instead of an error) * `limit` - Number of results per page (max 100) * `sort` - Sort direction ('asc' or 'desc') * `order_by` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list) * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) > [!NOTE] > > There is no `page` argument any more. The SDK normalizes legacy sort values, so `volume_usd` is > sent as `order_by=volume_usd_24h`; REST rejects the legacy spelling with a `400` that lists the > values it will take. **Returns:** A `results` list plus `has_next_page` and `next_cursor` for cursor pagination. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```python theme={null} # Get the busiest Uniswap V3 pools on Ethereum uniswap_pools = client.pools.list_by_dex( network_id="ethereum", dex_id="uniswap_v3", limit=10, order_by="volume_usd_24h", sort="desc" ) for pool in uniswap_pools.results: print(f"{pool.dex_name}: ${pool.volume_usd_24h:,.2f} 24h volume") ``` *** ### client.pools.get_details(network_id, pool_address, inversed) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}`](/api-reference/pools/get-a-pool-on-a-network) Gets detailed information about a specific pool. **Parameters:** * `network_id`\* - ID of the network * `pool_address`\* - On-chain address of the pool * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Detailed pool information including tokens, volumes, liquidity, and more. [Response Structure](/api-reference/pools/get-a-pool-on-a-network). ```python theme={null} from dexpaprika_sdk.models import PoolDetails # Type hint example # Get details for a specific pool (WETH/USDC on Uniswap V2) pool: PoolDetails = client.pools.get_details( network_id="ethereum", pool_address="0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", inversed=False ) print(f"Pool: {pool.tokens[0].symbol}/{pool.tokens[1].symbol}") ``` *** ### client.pools.get_transactions(network_id, pool_address, page, limit, cursor, from_timestamp, to_timestamp) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/transactions`](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) Gets transaction history for a specific pool with pagination. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL since 30 September 2026; keyless and free keys get `403`. See [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). **Parameters:** * `network_id`\* - ID of the network * `pool_address`\* - On-chain address of the pool * `page` - Page number for pagination * `limit` - Number of transactions per page * `cursor` - Transaction ID for cursor-based pagination * `from_timestamp` / `to_timestamp` - Time window: a relative offset such as `"-1h"`, Unix seconds, RFC3339 or `YYYY-MM-DD`. `from_timestamp` is inclusive, `to_timestamp` exclusive; results go back 7 days at most **Returns:** List of transactions with details about tokens, amounts, and timestamps. [Response Structure](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). ```python theme={null} # Get the latest 20 transactions for a pool transactions = client.pools.get_transactions( network_id="ethereum", pool_address="0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", limit=20 ) latest = transactions.transactions[0] print(f"Latest transaction: {latest.id} in block {latest.created_at_block_number}") # Only the last hour last_hour = client.pools.get_transactions( network_id="ethereum", pool_address="0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", limit=20, from_timestamp="-1h" ) ``` *** ### client.pools.get_ohlcv(network_id, pool_address, start, end, limit, interval, inversed) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/ohlcv`](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) Gets OHLCV (Open, High, Low, Close, Volume) chart data for a pool. **Parameters:** * `network_id`\* - ID of the network * `pool_address`\* - On-chain address of the pool * `start`\* - Start time (relative offset such as `-24h`, ISO date string, YYYY-MM-DD, or Unix timestamp), inside your plan's [history window](/knowledge-base/rate-limits#ohlcv-limits-by-plan) * `end` - End time (optional) * `limit` - Number of data points to return * `interval` - Time interval ('1m', '5m', '10m', '15m', '30m', '1h', '6h', '12h', '24h'); without a key only '1h' and up * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Array of OHLCV data points for the specified time range and interval. [Response Structure](/api-reference/pools/get-ohlcv-data-for-a-pool-pair). ```python theme={null} # Hourly candles for the last 24 hours, which works without a key ohlcv = client.pools.get_ohlcv( network_id="ethereum", pool_address="0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc", start="-24h", interval="1h", limit=24 ) print(f"Received {len(ohlcv)} OHLCV data points") ``` *** ### client.pools.get_indicator(network_id, pool_address, indicator, interval, start, end, limit, cursor, period, fast_period, slow_period, signal_period, std_dev) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/indicators`](/api-reference/pools/get-a-technical-indicator-for-a-pool) Computes RSI, EMA, MACD, Bollinger Bands or VWAP from a pool's candles. Requires SDK 0.13.0 or later. **Parameters:** * `network_id`\* - ID of the network * `pool_address`\* - On-chain address of the pool * `indicator`\* - `'rsi'`, `'ema'`, `'macd'`, `'bbands'` or `'vwap'` * `interval` - Candle interval (`'1m'` to `'24h'`, or `'1d'`); pass it every time * `start`, `end`, `limit`, `cursor` - Range and paging, same formats as OHLCV * `period` - rsi, ema, bbands and vwap * `fast_period`, `slow_period`, `signal_period` - macd only * `std_dev` - bbands only Only the parameters you pass are sent. One that belongs to another indicator, such as `fast_period` with `indicator="rsi"`, raises `requests.HTTPError` with status 400. **Returns:** `data`, oldest first, one point per completed candle: `value` for rsi, ema and vwap; `macd`, `signal` and `histogram` for macd; `upper`, `middle` and `lower` for bbands. `parameters` echoes the settings used, defaults included, and `has_next_page`/`next_cursor` page through longer ranges. [Response Structure](/api-reference/pools/get-a-technical-indicator-for-a-pool). Works on every plan, keyless included, with the same interval and history limits as pool OHLCV ([limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). Tutorial: [technical indicators](/tutorials/technical-indicators). ```python theme={null} # Hourly RSI over the last 24 hours, which works without a key rsi = client.pools.get_indicator( network_id="ethereum", pool_address="0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", indicator="rsi", interval="1h", start="-24h", ) last = rsi.data[-1] print(f"RSI {last.value:.1f} at {last.timestamp}") ``` **Tokens** `category` **methods** ### client.tokens.get_details(network_id, token_address) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}`](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) Gets comprehensive token information. **Parameters:** * `network_id`\* - ID of the network * `token_address`\* - Token contract address **Returns:** Token details including price, market cap, volume, and metadata. [Response Structure](/api-reference/tokens/get-a-tokens-latest-data-on-a-network). ```python theme={null} # Get WETH token details weth = client.tokens.get_details( network_id="ethereum", token_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ) print(f"{weth.name} price: ${weth.summary.price_usd:,.2f}") ``` *** ### client.tokens.get_pools(network_id, token_address, limit, sort, order_by, cursor) > [!WARNING] > > **`GET /networks/{network}/tokens/{token_address}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?token_address=...` instead, so it still > works. The old second-token `address` pair filter and the `reorder` flag have no replacement: pass > either and the SDK raises a `DeprecationWarning` and drops it. See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?token_address=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools containing a specific token. **Parameters:** * `network_id`\* - ID of the network * `token_address`\* - Token contract address * `limit` - Number of results per page (1 to 100) * `sort` - Sort direction ('asc' or 'desc') * `order_by` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list). Legacy values are mapped, so `volume_usd` is sent as `order_by=volume_usd_24h`; REST rejects the legacy spelling with `400` * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough). `page` is validated but never sent: the endpoint is cursor-paginated * `address`, `reorder` - deprecated and ignored **Returns:** A `PoolSearchResponse` with `results`, `has_next_page` and `next_cursor`. [Response Structure](/api-reference/pools/advanced-pool-filtering-on-a-specific-network). ```python theme={null} # Get the busiest WETH pools on Ethereum pools = client.tokens.get_pools( network_id="ethereum", token_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH limit=5, order_by="volume_usd_24h", sort="desc", ) for pool in pools.results: print(f"{pool.dex_name}: ${pool.volume_usd_24h:,.2f} 24h volume") ``` *** ### client.tokens.get_indicator(network_id, token_address, indicator, ...) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}/indicators`](/api-reference/tokens/get-a-technical-indicator-for-a-token) The same indicators computed from the token's USD candles across every pool it trades in. Same parameters and response shape as `client.pools.get_indicator`. Requires SDK 0.13.0 or later. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL; keyless and free keys get `403` with the required plan named in the message. ```python theme={null} macd = client.tokens.get_indicator( network_id="ethereum", token_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH indicator="macd", interval="1h", start="-7d", ) last = macd.data[-1] print(last.macd, last.signal, last.histogram) ``` **Search** `category` **methods** ### client.search.search(query) **Endpoint:** [GET `/search`](/api-reference/search/search-for-tokens-pools-and-dexes) Searches across tokens, pools, and DEXes using a query string. **Parameters:** * `query`\* - Search query string **Returns:** Matching entities from all categories (tokens, pools, DEXes). [Response Structure](/api-reference/search/search-for-tokens-pools-and-dexes). ```python theme={null} # Search for "ethereum" across all entities results = client.search.search("ethereum") print(f"Found {len(results.tokens)} tokens") print(f"Found {len(results.pools)} pools") print(f"Found {len(results.dexes)} dexes") ``` **Utils** `category` **methods** ### client.utils.get_stats() **Endpoint:** [GET `/stats`](/api-reference/utils/retrieve-high-level-asset-statistics) Gets platform-wide statistics. **Parameters:** None **Returns:** Counts of chains, DEXes, pools, and tokens indexed. [Response Structure](/api-reference/utils/retrieve-high-level-asset-statistics). ```python theme={null} # Get platform statistics stats = client.utils.get_stats() print(f"Total chains: {stats.chains}") print(f"Total DEX factories: {stats.factories}") print(f"Total pools: {stats.pools}") print(f"Total tokens: {stats.tokens}") ``` ## Complete example **example** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" def main(): client = DexPaprikaClient() # Networks come back as a list of Network(id, display_name) networks = client.networks.list() ethereum = next(n for n in networks if n.id == "ethereum") print(f"{ethereum.display_name} is one of {len(networks)} networks") # Price lives under summary weth = client.tokens.get_details(network_id="ethereum", token_address=WETH) print(f"{weth.name} price: ${weth.summary.price_usd:,.2f}") # Pools for a token are served by pool search. Rows sit under results, # sorted by volume_usd_24h. There is no pair filter, so match the second # token client-side. pools = client.tokens.get_pools( network_id="ethereum", token_address=WETH, limit=20, order_by="volume_usd_24h", sort="desc", ) weth_usdc = [p for p in pools.results if any(t.id == USDC for t in p.tokens)] print("Top WETH/USDC pools:") for pool in weth_usdc[:5]: print(f"{pool.dex_name}: ${pool.volume_usd_24h:,.2f} 24h volume") if __name__ == "__main__": main() ``` ## Advanced features ### Error handling **error handling** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient import requests # Basic error handling try: client = DexPaprikaClient() token = client.tokens.get_details("ethereum", "0xinvalidaddress") except Exception as e: if "404" in str(e): print("Token not found") elif "429" in str(e): print("Rate limit exceeded") else: print(f"An error occurred: {e}") # The SDK automatically retries 429 (Too Many Requests), any 5xx # (server errors), connection errors and timeouts. On a 429 it waits # as long as the API's Retry-After header asks. # Custom retry configuration client = DexPaprikaClient( max_retries=4, # Number of retry attempts (default: 4) backoff_times=[0.1, 0.5, 1.0, 5.0] # Backoff times in seconds ) # All API requests will now use these retry settings try: networks = client.networks.list() except requests.exceptions.RequestException as e: print(f"Request failed: {e}") ``` ### Caching system **caching** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient import time # The SDK includes built-in caching by default # Demonstration of cache behavior # Create a regular client with default cache (5 minutes TTL) client = DexPaprikaClient() # First call - hits the API start_time = time.time() networks = client.networks.list() first_call_time = time.time() - start_time print(f"First call (API): {len(networks)} networks, took {first_call_time:.4f}s") # Second call - served from cache (much faster) start_time = time.time() networks = client.networks.list() second_call_time = time.time() - start_time print(f"Second call (cached): {len(networks)} networks, took {second_call_time:.4f}s") print(f"Cache speedup: {first_call_time / second_call_time:.1f}x") # You can skip the cache when you need fresh data fresh_networks = client.networks._get("/networks", skip_cache=True) # Clear the entire cache client.clear_cache() # Clear cache only for specific endpoints client.clear_cache(endpoint_prefix="/networks") # Different types of data have different cache durations: # - Network data: 24 hours # - Pool data: 5 minutes # - Token data: 10 minutes # - Statistics: 15 minutes # - Other data: 5 minutes (default) ``` ### Pagination helper Paging past the first page of a search endpoint needs an API key. The client below reads it from `DEXPAPRIKA_API_KEY`; a [free key](https://console.dexpaprika.com) pages without limit. Without a key the second page returns `403` with `"param": "cursor"`. **pagination** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient import time def fetch_all_pools(network_id, max_pages=10): client = DexPaprikaClient() all_pools = [] limit = 50 cursor = None # Every page is one request against your allowance, so cap the walk for _ in range(max_pages): response = client.pools.list_by_network( network_id=network_id, limit=limit, sort="desc", order_by="volume_usd_24h", cursor=cursor, ) all_pools.extend(response.results) # The search endpoint is cursor-paginated, not page-numbered if not response.has_next_page or not response.next_cursor: break cursor = response.next_cursor # Pause between pages to stay under your per-minute limit: # https://docs.dexpaprika.com/knowledge-base/rate-limits time.sleep(4) print(f"Fetched a total of {len(all_pools)} pools on {network_id}") return all_pools # Usage example ethereum_pools = fetch_all_pools("ethereum") ``` ### Parameter validation **validation** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient # The SDK automatically validates parameters before making API requests client = DexPaprikaClient() # Invalid parameter examples will raise helpful error messages try: # Invalid network ID client.pools.list_by_network(network_id="", limit=5) except ValueError as e: print(e) # "network_id is required" try: # Invalid sort parameter client.pools.list_by_network(network_id="ethereum", sort="invalid_sort") except ValueError as e: print(e) # "sort must be one of: asc, desc" try: # Invalid limit parameter client.pools.list_by_network(network_id="ethereum", limit=500) except ValueError as e: print(e) # "limit must be at most 100" ``` ### Working with models **models** ```python theme={null} from dexpaprika_sdk import DexPaprikaClient from dexpaprika_sdk.models import PoolDetails # Type hint example client = DexPaprikaClient() # Get pool details pool: PoolDetails = client.pools.get_details( network_id="ethereum", pool_address="0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" # USDC/WETH Uniswap v3 pool ) # Access pool properties with type checking and auto-completion print(f"Pool: {pool.tokens[0].symbol}/{pool.tokens[1].symbol}") print(f"Volume (24h): ${pool.day.volume_usd:.2f}") print(f"Transactions (24h): {pool.day.txns}") print(f"Price: ${pool.last_price_usd:.4f}") # Time interval data is available for multiple timeframes print(f"1h price change: {pool.hour1.last_price_usd_change:.2f}%") print(f"24h price change: {pool.day.last_price_usd_change:.2f}%") # All API responses are converted to typed Pydantic models # This provides automatic validation, serialization/deserialization, # and IDE auto-completion support through Python type hints ``` ## Resources * [GitHub Repository](https://github.com/coinpaprika/dexpaprika-sdk-python) * [DexPaprika Website](https://dexpaprika.com) * [API Reference](/api-reference/introduction) * [Discord Community](https://discord.gg/DhJge5TUGM) ## API status The DexPaprika API provides consistent data with stable endpoints. Requests are answered without an API key on the free tier, and a free key raises the credit allowance. We aim to maintain backward compatibility and provide notice of any significant changes. ### FAQs > [accordion] Do I need an API key with this SDK? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP, and a [free registered key](https://console.dexpaprika.com/dashboard) raises that to 100,000 with no card. > [accordion] How do I find identifiers? > > Use Coverage Checker or list Networks and query Tokens/Pools to discover addresses. > [accordion] How do I get historical or transactions data? > > Use pools/transactions endpoints with `pool_address`, `network`, and time/paging params as documented. Transactions need a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. > [accordion] What about rate limiting? > > 15 requests a minute keyless, 30 with a [free key](https://console.dexpaprika.com) and 500 on Pro, against 10,000 credits keyless and 100,000 with a free key over a rolling 30 days, or 5,000,000 a month on Pro. Retry transient HTTP errors with backoff. See [rate limits](/knowledge-base/rate-limits) for how the counters work, and [Pro pricing](https://dexpaprika.com/api/pricing) for what the 5,000,000 credit tier costs. # DexPaprika DEX API TypeScript SDK: on-chain liquidity and swap data client Source: https://docs.dexpaprika.com/get-started/sdk-ts JavaScript client library for accessing decentralized exchange data across multiple blockchain networks > [!TIP] > > See also: [REST intro](/api-reference/introduction), > [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Pools](/api-reference/pools/get-a-pool-on-a-network) ## Prerequisites * Node.js 14.0.0 or higher * Connection to the internet to access the DexPaprika API * No API key needed to start ## Installation Install the DexPaprika SDK using your preferred package manager: ```bash theme={null} # using npm npm install dexpaprika-sdk # using yarn yarn add dexpaprika-sdk # using pnpm pnpm add dexpaprika-sdk ``` ## Quick example ```javascript theme={null} import { DexPaprikaClient } from 'dexpaprika-sdk'; // Initialize the client const client = new DexPaprikaClient(); // Get the price of Wrapped Ether (WETH) on Ethereum async function getWethPrice() { const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; const token = await client.tokens.getDetails('ethereum', wethAddress); console.log(`Current WETH price: $${token.summary.price_usd}`); } getWethPrice(); ``` ## Using an API key (optional) The SDK works without a key, and that is the default. A [free key](https://console.dexpaprika.com) raises both the per-minute request limit and the credit allowance. Current figures are on the [rate limits page](/knowledge-base/rate-limits). Requires 1.10.0 or later. ```typescript theme={null} import { DexPaprikaClient } from 'dexpaprika-sdk'; // Explicit const client = new DexPaprikaClient('https://api.dexpaprika.com', {}, { apiKey: 'api_your_key_here', }); // Or leave it out and set DEXPAPRIKA_API_KEY in the environment const envClient = new DexPaprikaClient(); ``` An explicit key beats the environment variable, and no key at all keeps the keyless behaviour unchanged. The host is never inferred from the key: free keys are served from the default base URL, and [Dev, Pro and Enterprise](/api-pro/introduction) keys move to `api-pro.dexpaprika.com`. > [!WARNING] > > The key is sent as the entire `Authorization` header value. **Nothing goes in front of it**, > no scheme word of any kind. The SDK writes the header for you, so this matters when you are > debugging what went out or calling the API directly. See > [401 Unauthorized](/knowledge-base/error-handling#401-unauthorized). ## API methods reference All API methods in the DexPaprika SDK follow a consistent pattern, accepting required parameters first, followed by an optional `options` object for additional configuration. This options pattern provides flexibility while keeping the API clean and easy to use. For example, most listing methods accept pagination and sorting options: ```javascript theme={null} // Get pools with custom pagination and sorting const pools = await client.pools.listByNetwork('ethereum', { limit: 20, // get 20 results sort: 'desc', // sort descending orderBy: 'volume_usd_24h' // sort by 24h volume }); // The next page: pass the cursor from the previous response const morePools = await client.pools.listByNetwork('ethereum', { limit: 20, cursor: pools.next_cursor }); ``` **Networks** `category` **Network methods** ### client.networks.list() **Endpoint:** [GET `/networks`](/api-reference/networks/get-a-list-of-available-blockchain-networks) Retrieves all supported blockchain networks and their metadata. **Parameters:** None **Returns:** Array of network objects containing network ID, name, and other information. ```javascript theme={null} const networks = await client.networks.list(); console.log(`Supported networks: ${networks.length}`); ``` **DEXes** `category` **DEX methods** ### client.dexes.listByNetwork(networkId, options) **Endpoint:** [GET `/networks/{network}/dexes`](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) Retrieves all DEXes on a specific network. **Parameters:** * `networkId`\* - Network ID (e.g., "ethereum", "solana") * `options` - Optional configuration: * `page` - Page number for pagination (defaults to 0) * `limit` - Number of DEXes per page (defaults to 10) **Returns:** Paginated list of DEX objects with name, ID, and metadata. ```javascript theme={null} const dexes = await client.dexes.listByNetwork('ethereum', { limit: 20 }); dexes.dexes.forEach(dex => console.log(dex.dex_name)); ``` **Pools** `category` **Pool methods** ### client.pools.list(options) > [!WARNING] > > **Removed.** The `GET /pools` endpoint returns `410 Gone`, and this method throws > `DeprecatedEndpointError` rather than making a request. Use > `client.pools.listByNetwork(network, options)` and pass a network. *** ### client.pools.listByNetwork(networkId, options) **Endpoint:** [GET `/networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific network with cursor pagination and sorting options. **Parameters:** * `networkId`\* - ID of the network * `options` - Options object for pagination and sorting: * `limit` - Number of pools per page * `sort` - Sort direction ('asc' or 'desc') * `orderBy` - Field to sort by ('volume_usd', 'price_usd', etc.). Legacy values are mapped to the canonical sort fields. * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) **Returns:** `results` array plus `has_next_page` and `next_cursor` for cursor pagination. ```javascript theme={null} const ethereumPools = await client.pools.listByNetwork('ethereum', { limit: 5, orderBy: 'volume_usd_24h', sort: 'desc' }); console.log(`Top pool volume: $${ethereumPools.results[0].volume_usd_24h}`); if (ethereumPools.has_next_page) { const nextPage = await client.pools.listByNetwork('ethereum', { limit: 5, cursor: ethereumPools.next_cursor }); } ``` *** ### client.pools.listByDex(networkId, dexId, options) > [!WARNING] > > **`GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`.** > This method now calls `GET /networks/{network}/pools/search?dex_name=...` instead. The DEX id > moved out of the path and into a filter, so `page` is gone and the response shape changed. > See [pool filtering](/tutorials/pool-filtering). **Endpoint:** [GET `/networks/{network}/pools/search?dex_name=...`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets pools on a specific DEX within a network. **Parameters:** * `networkId`\* - ID of the network * `dexId`\* - ID of the DEX, the `dex_id` field from `client.dexes.listByNetwork()`, case-insensitive (a display name like `Uniswap V3` returns no rows instead of an error) * `options` - Options object for pagination and sorting: * `limit` - Number of pools per page (max 100) * `sort` - Sort direction ('asc' or 'desc') * `orderBy` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list) * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) > [!NOTE] > > There is no `page` option any more. The SDK normalizes legacy sort values, so `volume_usd` is > sent as `order_by=volume_usd_24h`; REST rejects the legacy spelling with a `400` that lists the > values it will take. **Returns:** A `results` array plus `has_next_page` and `next_cursor` for cursor pagination. ```javascript theme={null} const uniswapPools = await client.pools.listByDex('ethereum', 'uniswap_v3', { limit: 10, orderBy: 'volume_usd_24h', sort: 'desc' }); for (const pool of uniswapPools.results) { console.log(`${pool.dex_name}: $${pool.volume_usd_24h.toLocaleString()} 24h volume`); } ``` *** ### client.pools.getDetails(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}`](/api-reference/pools/get-a-pool-on-a-network) Gets detailed information about a specific pool. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options` - Options object: * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Detailed pool information including tokens, volumes, liquidity, and more. ```javascript theme={null} // Get details for a specific pool (WETH/USDC on Uniswap V2) const pool = await client.pools.getDetails( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', { inversed: false } ); console.log(`Pool: ${pool.tokens[0].symbol}/${pool.tokens[1].symbol}`); ``` *** ### client.pools.getTransactions(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/transactions`](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) Gets transaction history for a specific pool with pagination. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL since 30 September 2026; keyless and free keys get `403`. See [pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options` - Options object for pagination: * `page` - Page number for pagination * `limit` - Number of transactions per page * `cursor` - Transaction ID for cursor-based pagination * `from` / `to` - Time window: a relative offset such as `'-1h'`, Unix seconds, RFC3339 or `YYYY-MM-DD` (1.11.0 and later take a string). `from` is inclusive, `to` exclusive; results go back 7 days at most **Returns:** List of transactions with details about tokens, amounts, and timestamps. ```javascript theme={null} // Get the latest 20 transactions for a pool const transactions = await client.pools.getTransactions( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', { limit: 20 } ); console.log(`Latest transaction: ${transactions.transactions[0].id}`); // Only the last hour const lastHour = await client.pools.getTransactions( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', { limit: 20, from: '-1h' } ); ``` *** ### client.pools.getOHLCV(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/ohlcv`](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) Gets OHLCV (Open, High, Low, Close, Volume) chart data for a pool. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options`\* - OHLCV options object: * `start`\* - Start time (relative offset such as `-24h`, ISO date string or timestamp), inside your plan's [history window](/knowledge-base/rate-limits#ohlcv-limits-by-plan) * `end` - End time (optional) * `limit` - Number of data points to return * `interval` - Time interval ('1h', '6h', '24h', etc.; finer intervals need a key or a paid plan) * `inversed` - Whether to invert the price ratio (boolean) **Returns:** Array of OHLCV data points for the specified time range and interval. ```javascript theme={null} // Hourly candles for the last 24 hours, which works without a key const ohlcvData = await client.pools.getOHLCV( 'ethereum', '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', { start: '-24h', interval: '1h', limit: 24 } ); console.log(`Data points: ${ohlcvData.length}`); console.log(`Current price: ${ohlcvData[ohlcvData.length-1].close}`); ``` *** ### client.pools.getIndicator(networkId, poolAddress, options) **Endpoint:** [GET `/networks/{network}/pools/{pool_address}/indicators`](/api-reference/pools/get-a-technical-indicator-for-a-pool) Computes RSI, EMA, MACD, Bollinger Bands or VWAP from a pool's candles. Requires SDK 1.13.0 or later. **Parameters:** * `networkId`\* - ID of the network * `poolAddress`\* - On-chain address of the pool * `options`\* - Indicator options object: * `indicator`\* - `'rsi'`, `'ema'`, `'macd'`, `'bbands'` or `'vwap'` * `interval` - Candle interval (`'1m'` to `'24h'`, or `'1d'`); pass it every time * `start`, `end`, `limit`, `cursor` - Range and paging, same formats as OHLCV * `period` - rsi, ema, bbands and vwap * `fast_period`, `slow_period`, `signal_period` - macd only * `std_dev` - bbands only Only the options you set are sent. A parameter that belongs to another indicator, such as `fast_period` with `'rsi'`, is refused with a 400. **Returns:** `data`, oldest first, one point per completed candle: `value` for rsi, ema and vwap; `macd`, `signal` and `histogram` for macd; `upper`, `middle` and `lower` for bbands. `parameters` echoes the settings used, defaults included, and `has_next_page`/`next_cursor` page through longer ranges. [Response Structure](/api-reference/pools/get-a-technical-indicator-for-a-pool). Works on every plan, keyless included, with the same interval and history limits as pool OHLCV ([limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan)). Tutorial: [technical indicators](/tutorials/technical-indicators). ```javascript theme={null} // Hourly RSI over the last 24 hours, which works without a key const rsi = await client.pools.getIndicator( 'ethereum', '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', { indicator: 'rsi', interval: '1h', start: '-24h' } ); const last = rsi.data[rsi.data.length - 1]; console.log(`RSI ${last.value.toFixed(1)} at ${last.timestamp}`); ``` **Tokens** `category` **Token methods** ### client.tokens.getDetails(networkId, tokenAddress) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}`](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) Gets detailed information about a specific token on a network. **Parameters:** * `networkId`\* - ID of the network * `tokenAddress`\* - Token address or identifier **Returns:** Detailed token information including price, volume, and metadata. ```javascript theme={null} // Get details for WETH on Ethereum const weth = await client.tokens.getDetails( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' ); console.log(`${weth.name} (${weth.symbol}): $${weth.summary.price_usd}`); ``` *** ### client.tokens.getPools(networkId, tokenAddress, options) **Endpoint:** [GET `/networks/{network}/pools/search`](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) Gets a list of liquidity pools that include the specified token. Backed by the unified pool search endpoint with its `token_address` filter; the old `/networks/{network}/tokens/{token_address}/pools` endpoint was removed and returns `410 Gone`. The filter is network-scoped, so a network is always required. An unknown token address returns an empty result set rather than an error. **Parameters:** * `networkId`\* - ID of the network * `tokenAddress`\* - Token address or identifier * `options` - Options object for sorting and pagination: * `limit` - Number of pools per page * `sort` - Sort direction ('asc' or 'desc') * `orderBy` - Field to sort by ('volume_usd_24h', 'liquidity_usd', 'txns_24h', and the rest of the canonical list). Legacy values are mapped, so `volume_usd` is sent as `order_by=volume_usd_24h`; REST rejects the legacy spelling with `400`. * `cursor` - Cursor for the next page, taken from `next_cursor` on the previous response (paging needs an API key; a free key is enough) > [!NOTE] > > `pairWith` is no longer supported. Pool search has no pair filter, so the option is > accepted for backwards compatibility but never sent. To find a specific pair, filter > the returned pools on the second token yourself. **Returns:** `results` array plus `has_next_page` and `next_cursor` for cursor pagination. ```javascript theme={null} // Find the busiest WETH pools on Ethereum const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; const pools = await client.tokens.getPools( 'ethereum', wethAddress, { limit: 5, orderBy: 'volume_usd_24h', sort: 'desc' } ); pools.results.forEach(pool => { console.log(`${pool.dex_name}: $${pool.volume_usd_24h} 24h volume`); }); ``` *** ### client.tokens.getIndicator(networkId, tokenAddress, options) **Endpoint:** [GET `/networks/{network}/tokens/{token_address}/indicators`](/api-reference/tokens/get-a-technical-indicator-for-a-token) The same indicators computed from the token's USD candles across every pool it trades in. Same options and response shape as `client.pools.getIndicator`, with `token_address` in place of `pool_address`. Requires SDK 1.13.0 or later. Needs a Dev, Pro or Enterprise key and the `https://api-pro.dexpaprika.com` base URL; keyless and free keys get `403`, thrown as an `ApiError` with `requiredTier` set. ```javascript theme={null} const macd = await client.tokens.getIndicator( 'ethereum', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH { indicator: 'macd', interval: '1h', start: '-7d' } ); const last = macd.data[macd.data.length - 1]; console.log(last.macd, last.signal, last.histogram); ``` **Search** `category` **Search methods** ### client.search.search(query) **Endpoint:** [GET `/search`](/api-reference/search/search-for-tokens-pools-and-dexes) Searches for tokens, pools, and DEXes by name or identifier. **Parameters:** * `query`\* - Search term (e.g., "uniswap", "bitcoin", or a token address) **Returns:** Search results organized by category (tokens, pools, DEXes). ```javascript theme={null} // Search for "ethereum" const results = await client.search.search('ethereum'); console.log(`Found ${results.tokens.length} tokens`); console.log(`Found ${results.pools.length} pools`); console.log(`Found ${results.dexes.length} DEXes`); ``` **Utils** `category` **Utility methods** ### client.utils.getStats() **Endpoint:** [GET `/stats`](/api-reference/utils/retrieve-high-level-asset-statistics) Gets high-level statistics about the DexPaprika ecosystem. **Parameters:** None **Returns:** Statistics about chains, DEXes, pools, and tokens. ```javascript theme={null} const stats = await client.utils.getStats(); console.log(`Chains: ${stats.chains}`); console.log(`DEX factories: ${stats.factories}`); console.log(`Pools: ${stats.pools}`); console.log(`Tokens: ${stats.tokens}`); ``` ## Complete example **example** ```javascript theme={null} import { DexPaprikaClient } from 'dexpaprika-sdk'; const WETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'; async function main() { const client = new DexPaprikaClient(); // Networks come back as a plain array of { id, display_name } const networks = await client.networks.list(); const ethereum = networks.find(n => n.id === 'ethereum'); console.log(`${ethereum.display_name} is one of ${networks.length} networks`); // Price lives under summary const weth = await client.tokens.getDetails('ethereum', WETH); console.log(`${weth.name} price: $${weth.summary.price_usd.toFixed(2)}`); // Pools for a token are served by pool search. Rows sit under results, // sorted by volume_usd_24h. There is no pair filter, so match the second // token client-side. const pools = await client.tokens.getPools('ethereum', WETH, { limit: 20, orderBy: 'volume_usd_24h', sort: 'desc', }); const wethUsdc = pools.results.filter(p => p.tokens.some(t => t.id === USDC)); console.log('Top WETH/USDC pools:'); for (const pool of wethUsdc.slice(0, 5)) { console.log(`${pool.dex_name}: $${pool.volume_usd_24h.toLocaleString('en-US', { maximumFractionDigits: 2 })} 24h volume`); } } main().catch(console.error); ``` ## Advanced features ### Error handling **error handling** ```javascript theme={null} import { DexPaprikaClient, ApiError, NetworkNotFoundError, PoolNotFoundError, } from 'dexpaprika-sdk'; // Basic error handling try { const client = new DexPaprikaClient(); const token = await client.tokens.getDetails('ethereum', '0xinvalidaddress'); } catch (error) { // Every SDK error has a readable message that includes the HTTP status console.error('Error:', error.message); // Or branch on the error class if (error instanceof NetworkNotFoundError || error instanceof PoolNotFoundError) { console.error('Unknown network or pool'); } else if (error instanceof ApiError && error.statusCode === 404) { console.error('Resource not found'); } else if (error instanceof ApiError && error.statusCode === 429) { console.error('Rate limit exceeded'); } } // The SDK automatically retries on these status codes: // 408 (Request Timeout), 429 (Too Many Requests), // 500, 502, 503, 504 (Server Errors) // Custom retry configuration const client = new DexPaprikaClient('https://api.dexpaprika.com', {}, { retry: { maxRetries: 3, delaySequenceMs: [200, 500, 1000], retryableStatuses: [429, 500, 503] } }); ``` ### Caching **caching** ```javascript theme={null} import { DexPaprikaClient, Cache } from 'dexpaprika-sdk'; // The SDK includes built-in caching by default // This example shows how to configure it // Configure caching with custom settings const client = new DexPaprikaClient('https://api.dexpaprika.com', {}, { cache: { ttl: 60 * 1000, // 1 minute cache TTL (default is 5 minutes) maxSize: 100, // Store up to 100 responses (default is 1000) enabled: true // Enable caching (enabled by default) } }); // Demonstration of cache behavior async function demonstrateCaching() { console.time('First call'); await client.networks.list(); // Makes an API request console.timeEnd('First call'); console.time('Second call'); await client.networks.list(); // Returns cached result console.timeEnd('Second call'); // You can also manage the cache manually client.clearCache(); // Clear all cached data console.log(client.cacheSize); // Get current cache size client.setCacheEnabled(false); // Disable caching } // Using the Cache class directly const manualCache = new Cache({ ttl: 30 * 1000, // 30 second TTL maxSize: 50 // Store maximum 50 items }); manualCache.set('myKey', { data: 'example data' }); const data = manualCache.get('myKey'); manualCache.delete('myKey'); manualCache.clear(); ``` ### Pagination helper Paging past the first page of a search endpoint needs an API key. The client below reads it from `DEXPAPRIKA_API_KEY`; a [free key](https://console.dexpaprika.com) pages without limit. Without a key the second page returns `403` with `"param": "cursor"`. **pagination** ```javascript theme={null} import { DexPaprikaClient } from 'dexpaprika-sdk'; async function fetchAllPools(networkId, maxPages = 10) { const client = new DexPaprikaClient(); const allPools = []; const limit = 50; let cursor; // Every page is one request against your allowance, so cap the walk for (let page = 0; page < maxPages; page++) { const response = await client.pools.listByNetwork( networkId, { limit, sort: 'desc', orderBy: 'volume_usd_24h', cursor } ); allPools.push(...response.results); // The search endpoint is cursor-paginated, not page-numbered if (!response.has_next_page || !response.next_cursor) break; cursor = response.next_cursor; // Pause between pages to stay under your per-minute limit: // https://docs.dexpaprika.com/knowledge-base/rate-limits await new Promise(resolve => setTimeout(resolve, 4000)); } console.log(`Fetched a total of ${allPools.length} pools on ${networkId}`); return allPools; } // Usage example fetchAllPools('ethereum').catch(console.error); ``` ### Custom configuration **configuration** ```javascript theme={null} import { DexPaprikaClient } from 'dexpaprika-sdk'; // Create client with custom configuration const client = new DexPaprikaClient( 'https://api.dexpaprika.com', // Base URL (optional) { // axios request config (optional) timeout: 60000, // 60 second timeout headers: { 'User-Agent': 'MyApp/1.0 DexPaprikaSDK' } }, { // Retry configuration (optional) retry: { maxRetries: 5, delaySequenceMs: [100, 500, 1000, 2000, 5000], retryableStatuses: [429, 500, 502, 503, 504] }, // Cache configuration (optional) cache: { ttl: 10 * 60 * 1000, // 10 minutes TTL maxSize: 500, // Store up to 500 responses enabled: true // Enable caching } } ); // Usage example async function fetchWithCustomClient() { try { const networks = await client.networks.list(); console.log(`Fetched ${networks.length} networks with custom client`); } catch (err) { console.error('Error:', err); } } ``` ## Resources * [GitHub Repository](https://github.com/coinpaprika/dexpaprika-sdk-ts) * [DexPaprika Website](https://dexpaprika.com) * [API Reference](/api-reference/introduction) ## API status The DexPaprika API provides consistent data with stable endpoints. Requests are answered without an API key on the free tier, and a free key raises the credit allowance. We aim to maintain backward compatibility and provide notice of any significant changes. ### FAQs > [accordion] Do I need an API key with this SDK? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP, and a [free registered key](https://console.dexpaprika.com/dashboard) raises that to 100,000 with no card. > [accordion] How do I find identifiers? > > Use Coverage Checker or list Networks and query Tokens/Pools to discover addresses. > [accordion] How do I get historical or transactions data? > > Use pools/transactions endpoints with `pool_address`, `network`, and time/paging params as documented. Transactions need a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. > [accordion] What about rate limiting? > > 15 requests a minute keyless, 30 with a [free key](https://console.dexpaprika.com) and 500 on Pro, against 10,000 credits keyless and 100,000 with a free key over a rolling 30 days, or 5,000,000 a month on Pro. Retry transient HTTP errors with backoff. See [rate limits](/knowledge-base/rate-limits) for how the counters work, and [Pro pricing](https://dexpaprika.com/api/pricing) for what the 5,000,000 credit tier costs. # DEX API for on-chain liquidity and swaps Source: https://docs.dexpaprika.com/introduction A DEX API for liquidity pools, swaps, OHLCV and token prices across 35 chains. Call it right now with no key and no signup. REST plus SSE streaming. DexPaprika is a DEX API for on-chain market data: liquidity pools, swap transactions, OHLCV history and token prices across 35 blockchain networks, over REST and over SSE streaming. **No signup to start.** No key, no card, no email. This returns the current price of SOL right now: ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" ``` A [free API key](https://console.dexpaprika.com) raises the per-minute rate and the monthly allowance and opens every streaming feed, and still needs no card. Current allowances and prices are on the [pricing page](https://dexpaprika.com/api/pricing). > [!TIP] > > See also: [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Liquidity pool endpoint](/api-reference/pools/get-a-pool-on-a-network), > [Swap transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages), > [Token data](/api-reference/tokens/get-a-tokens-latest-data-on-a-network), > [Real-time streaming](/streaming/introduction) > [card] [Quick API reference](/api-reference/introduction) > > Jump straight into the API documentation and start making requests within minutes > [card] [Follow tutorials](/tutorials/tutorial_intro) > > Learn step-by-step how to integrate DexPaprika into your applications > [card] [Stream real-time data](/streaming/introduction) > > Subscribe to live token prices, pool reserves and swap transactions over SSE. Prices need no key on 34 showcase assets; a free key opens prices and reserves on any token; transactions need a paid plan. No polling. ## DEX API quickstart \[!TIP] You can also make your first request directly in our API Playground available in the API Reference section. Visit [GET Token](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) to try it out. In the next steps we will make a GET request to the [Token](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) endpoint in order to get the latest price in USD of SOL. All we need is the network ID and the token address. * Network ID: `solana` * Token address: `So11111111111111111111111111111111111111112` \[!NOTE] You can find the list of all supported networks in the [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) endpoint. **1. Make a GET request** Simply make a GET request to the following endpoint in order to fetch latest data about any token. In this case we will use the specified above network ID and token address to populate the endpoint in a format of `https://api.dexpaprika.com/networks/{network_id}/tokens/{address}`. ```bash bash theme={null} curl -X GET "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" ``` ```python python.py theme={null} import requests response = requests.get("https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112") print(response.json()) ``` ```javascript javascript.js theme={null} fetch("https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112") .then(response => response.json()) .then(data => console.log(data)); ``` **2. Get latest data about Solana (SOL)** This will return quite lengthy response of the latest data about Solana (SOL) that will look similar to this. We send a lot of data in the response, so in the next step we will extract only the price of SOL in USD. ```json Response [expandable] theme={null} { "id": "So11111111111111111111111111111111111111112", "name": "Wrapped SOL", "symbol": "SOL", "chain": "solana", "decimals": 9, "total_supply": 9729104.429281628, "description": "", "website": "https://solana.com", "has_image": true, "added_at": "2026-08-10T14:20:16Z", "price_stats": { "high_24h": 105.2222398215612, "low_24h": 101.7557716484886, "ath": 2094.381880389729, "ath_date": "2025-02-18T22:43:00Z" }, "summary": { "chain": "solana", "id": "So11111111111111111111111111111111111111112", "price_usd": 103.80801725347543, "fdv": 1009959040.4557314, "liquidity_usd": 553505769.7967274, "pools": 12897286, "24h": { "volume": 49644910.41035922, "volume_usd": 5148862944.818152, "sells": 17537961, "buys": 10792419, "txns": 28330380, "buy_usd": 2338055804.0819945, "sell_usd": 2810807140.736158, "last_price_usd_change": 0.6781950008702846 }, "6h": { "volume": 12456183.587342199, "volume_usd": 1299454515.4826088, "sells": 4440706, "buys": 2451162, "txns": 6891868, "buy_usd": 593480507.282577, "sell_usd": 705974008.2000318, "last_price_usd_change": -0.21690798406796685 }, "1h": { "volume": 2084186.3205519284, "volume_usd": 216030300.54251012, "sells": 741684, "buys": 408334, "txns": 1150018, "buy_usd": 99891646.27039005, "sell_usd": 116138654.27212007, "last_price_usd_change": -0.1472757911066832 }, "30m": { "volume": 1004748.8770371348, "volume_usd": 104112790.66620025, "sells": 378988, "buys": 213688, "txns": 592676, "buy_usd": 47812329.58183849, "sell_usd": 56300461.08436176, "last_price_usd_change": 0.23928305430469934 }, "15m": { "volume": 497530.0271521555, "volume_usd": 51622450.059017375, "sells": 189987, "buys": 110343, "txns": 300330, "buy_usd": 24039604.05452173, "sell_usd": 27582846.004495647, "last_price_usd_change": 0.1522228820748769 }, "5m": { "volume": 156540.3813851585, "volume_usd": 16240562.550119922, "sells": 62237, "buys": 36579, "txns": 98816, "buy_usd": 7513931.736361665, "sell_usd": 8726630.813758258, "last_price_usd_change": 0.011172859580195807 }, "1m": { "volume": 18507.42904617516, "volume_usd": 1919881.560174483, "sells": 6720, "buys": 3610, "txns": 10330, "buy_usd": 900147.1867926873, "sell_usd": 1019734.3733817958, "last_price_usd_change": 0 } }, "last_updated": "2026-09-09T11:40:47.439035121Z", "twitter": "https://twitter.com/solana" } ``` **3. Extract the price (or any other data)** As you can see, the response is very rich of data. You can extract only the price of SOL in USD from the full response by navigating to the `summary` object (*or any other object*) and then to the `price_usd` key (*or any other key*) simply by modyfying the previously used GET request: ```bash bash theme={null} curl -s "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" | jq '.summary.price_usd' ``` ```python python.py theme={null} import requests response = requests.get("https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112") print(response.json()["summary"]["price_usd"]) ``` ```javascript javascript.js theme={null} fetch("https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112") .then(response => response.json()) .then(data => { const onlyPrice = data.summary.price_usd; console.log(onlyPrice); }); ``` And as a result you will get the price of SOL in USD: ```json summary.price_usd theme={null} 103.80801725347543 ``` Congratulations! You just successfully retrieved the latest price of SOL in USD! > [!NOTE] > > **Need more than the free allowance?** The [Pro API](/api-pro/introduction) raises the monthly > allowance and the per-minute rate, serves real-time data instead of the free tier's delay, and > adds dedicated infrastructure and priority support. Current allowances, prices and checkout are > on the [pricing page](https://dexpaprika.com/api/pricing). Enterprise is the same API with its > limits raised for your workload. **Pool search:** [filter pools](/tutorials/pool-filtering) by volume, liquidity, transactions, and creation date on `/networks/{network}/pools/search`. Plus [batch token prices](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) in a single request. ## Need real-time data? The REST API is the right choice when you're querying historical or on-demand data. For applications that need live updates the moment a swap or liquidity change settles on-chain, DexPaprika ships four SSE streaming feeds. No polling and no log decoding. Prices stream with no API key on the 34 showcase assets; reserves need a free key, and transactions and candles a paid plan. > [card] [Token price streaming](/streaming/introduction) > > Subscribe to USD price updates for any token across 35 chains. An event is pushed when a swap moves the price, so the rate tracks how actively the asset trades. > [card] [Pool reserves streaming](/streaming/reserves-streaming) > > Pool reserve deltas, USD-denominated, pushed for each block in which a subscribed pool's reserves changed. For any DEX pool or any token. ## Next steps > [card] [Quick API reference](/api-reference/introduction) > > Jump straight into the API documentation and start making requests within minutes > [card] [Follow tutorials](/tutorials/tutorial_intro) > > Learn step-by-step how to integrate DexPaprika into your applications > [card] [Use an SDK](/get-started/sdk-ts) > > Official TypeScript, Python, Go and PHP clients, each taking an optional API key > [card] [Connect an AI agent](/ai-integration/index) > > A hosted MCP server, plus LangChain, CrewAI, the Vercel AI SDK, n8n, Cursor and Claude ## Popular use cases > [card] Track token prices > > Get real-time and historical price data for any token across 35 blockchains > [card] Monitor liquidity > > Access detailed liquidity pool data across major DEXes on any network > [card] Trading analytics > > Analyze trading volumes, price changes, and market trends > [card] DEX aggregation > > Compare prices and liquidity across different DEXes ## DexPaprika API support We're here to help you succeed with DexPaprika. > [card] [Join Discord community](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support > [card] [Give feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve ## DEX API by network Every network has its own page with the DEXes we index there, its largest pools and a live streaming sample. The value in brackets is the `network` parameter to pass in your requests. [Aptos](https://dexpaprika.com/api/aptos) (`aptos`), [Arc](https://dexpaprika.com/api/arc) (`arc`), [Arbitrum](https://dexpaprika.com/api/arbitrum) (`arbitrum`), [Avalanche](https://dexpaprika.com/api/avalanche) (`avalanche`), [Base](https://dexpaprika.com/api/base) (`base`), [Berachain](https://dexpaprika.com/api/berachain) (`berachain`), [Binance Smart Chain](https://dexpaprika.com/api/bsc) (`bsc`), [BOB Network](https://dexpaprika.com/api/bob_network) (`bob_network`), [Celo](https://dexpaprika.com/api/celo) (`celo`), [Cronos](https://dexpaprika.com/api/cronos) (`cronos`), [Ethereum](https://dexpaprika.com/api/ethereum) (`ethereum`), [Fantom](https://dexpaprika.com/api/fantom) (`fantom`), [Flow EVM](https://dexpaprika.com/api/flow_evm) (`flow_evm`), [HyperEVM](https://dexpaprika.com/api/hyperevm) (`hyperevm`), [Katana](https://dexpaprika.com/api/katana) (`katana`), [Linea](https://dexpaprika.com/api/linea) (`linea`), [Mantle](https://dexpaprika.com/api/mantle) (`mantle`), [MegaETH](https://dexpaprika.com/api/megaeth) (`megaeth`), [Monad](https://dexpaprika.com/api/monad) (`monad`), [Optimism](https://dexpaprika.com/api/optimism) (`optimism`), [Plasma](https://dexpaprika.com/api/plasma) (`plasma`), [Polygon](https://dexpaprika.com/api/polygon) (`polygon`), [Robinhood Chain](https://dexpaprika.com/api/robinhood) (`robinhood`), [Ronin](https://dexpaprika.com/api/ronin) (`ronin`), [Scroll](https://dexpaprika.com/api/scroll) (`scroll`), [Sei](https://dexpaprika.com/api/sei) (`sei`), [Solana](https://dexpaprika.com/api/solana) (`solana`), [Sonic](https://dexpaprika.com/api/sonic) (`sonic`), [Sui](https://dexpaprika.com/api/sui) (`sui`), [Tempo](https://dexpaprika.com/api/tempo) (`tempo`), [Ton](https://dexpaprika.com/api/ton) (`ton`), [Tron](https://dexpaprika.com/api/tron) (`tron`), [Unichain](https://dexpaprika.com/api/unichain) (`unichain`), [x Layer](https://dexpaprika.com/api/x_layer) (`x_layer`), [ZkSync](https://dexpaprika.com/api/zksync) (`zksync`) To check a specific token, pool or DEX before you write any code, use the [coverage checker](/tools/coverage-checker). [Coverage](/coverage) is the canonical record of what we index and is regenerated from the live API daily. The [networks endpoint](/api-reference/networks/get-a-list-of-available-blockchain-networks) returns the same list as JSON. ### FAQs > [accordion] Do I need an API key? > > Not to start. No key, no card, no email: a curl works right now. [Registering a free key](https://console.dexpaprika.com) raises both the per-minute rate and the 30-day allowance, and still needs no card. Current figures are on the [pricing page](https://dexpaprika.com/api/pricing) and in [rate limits](/knowledge-base/rate-limits). > [accordion] What data can I query? > > Liquidity pools, swap transactions, token metrics/prices, and network coverage across multiple chains. > [accordion] How do I find a pool or token identifier? > > Use the Coverage Checker tool or the Networks/Token endpoints to locate addresses. > [accordion] How fast is the data? > > Collection is near real-time and REST responses reflect the latest indexed blocks and events. Your plan sets the ceiling: the free tier is served with a short delay, Pro is real time. The current delay is stated on the [pricing page](https://dexpaprika.com/api/pricing). For push updates, use the [streaming API](/streaming/introduction) (SSE). > [accordion] Does DexPaprika offer real-time streaming? > > Yes. Four SSE feeds: `/sse/prices` pushes token-price updates, `/sse/reserves` pushes pool reserve deltas per block in which reserves changed, `/sse/transactions` pushes individual swaps with USD amounts, and `/sse/ohlcv` pushes sealed token candles to paid plans on `streaming-pro.dexpaprika.com`. Prices and reserves run on `streaming.dexpaprika.com`; transactions and candles on `streaming-pro.dexpaprika.com`. Prices stream with no API key on 34 showcase assets, one per chain. Reserves need a [free key](https://console.dexpaprika.com), which also opens prices on every token. Transactions, like candles, need a paid plan (Dev, Pro or Enterprise) on `streaming-pro.dexpaprika.com`. See the [Streaming introduction](/streaming/introduction) or the [reserves deep-dive](/streaming/reserves-streaming). > [!NOTE] > > **Looking for enterprise solutions?** We offer dedicated support, higher rate limits, and custom features. > [Contact our team](mailto:support@coinpaprika.com) to learn more. # Common patterns and workflows Source: https://docs.dexpaprika.com/knowledge-base/common-patterns Standard workflows for DexPaprika API: looking up token prices, finding pools, getting historical data, filtering pools, batch pricing, and combining REST with streaming for real-time updates. ## Overview This page covers the most common sequences of API calls for typical tasks. Each pattern shows the exact endpoints, parameters, and response fields you need. Base URL: `https://api.dexpaprika.com` *** ## Pattern 1: Get a token's price **When you know the network and token address:** ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" ``` The price is at `response.summary.price_usd`. **When you only know the token name or symbol:** 1. Search first: ```bash theme={null} curl "https://api.dexpaprika.com/search?query=jupiter" ``` 2. From the `tokens` array in the response, find the matching token. Note the `chain` and `id` (address) fields. 3. Call the token endpoint: ```bash theme={null} curl "https://api.dexpaprika.com/networks/{chain}/tokens/{id}" ``` *** ## Pattern 2: Compare prices of multiple tokens Use batch pricing when you need prices for 2 to 10 tokens on the same network. It needs an API key; a free key is enough: ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ``` Response is an array of `{id, chain, price_usd}` objects. Order is not guaranteed. Tokens without pricing data are silently omitted (not an error). **Limits:** Max 10 tokens per request. More than 10 returns HTTP 400. Zero tokens also returns HTTP 400. For tokens across different networks, make separate requests per network. *** ## Pattern 3: Find top pools on a network ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?limit=10&order_by=volume_usd_24h&sort=desc" ``` **Sorting options for `order_by`:** `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_48h`, `price_change_percentage_24h`, `price_change_percentage_6h`, `price_change_percentage_1h`, `price_change_percentage_5m`. Anything else returns HTTP 400 with the valid list in the message. **Pagination:** Cursor-based. Read `has_next_page` and `next_cursor`, then pass `next_cursor` back as `cursor`. The first page works without a key; paging needs an API key, and a [free key](https://console.dexpaprika.com) pages without limit. The response wraps rows in a `results` array (not `pools`). *** ## Pattern 4: Find pools for a specific token ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112&order_by=volume_usd_24h&sort=desc&limit=5" ``` This returns pools on that network containing the token, sorted by volume. The highest-volume pool is typically the best source for price data and OHLCV history. The [token pools tutorial](/tutorials/token-pools) walks through this pattern end to end, with cursor paging and the migration table for the removed endpoint. **Network-scoped only:** The `token_address` filter works on `GET /networks/{network}/pools/search`. The cross-network `GET /pools/search` ignores it until 23 November 2026 and answers `400` (`unknown_param`) from that date. One token per query: repeating `token_address` is not a pair filter. Until 23 November 2026 the API uses one of the values (not guaranteed by order); from that date a repeated parameter answers `400` (`repeated_param`). An unknown address returns HTTP 200 with an empty `results` array. > [!NOTE] > > The old `GET /networks/{network}/tokens/{token_address}/pools` endpoint was removed and returns `410 Gone`. Its `reorder` and second-token `address` parameters have no equivalent on pool search. *** ## Pattern 5: Get historical price data (OHLCV) OHLCV data is per pool, not per token. The workflow is: 1. **Find the best pool.** Take the highest-volume pool for the token: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?token_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&order_by=volume_usd_24h&sort=desc&limit=1" ``` 2. **Get OHLCV data** for that pool: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/{pool_address}/ohlcv?start=-24h&interval=1h&limit=24" ``` **Intervals:** `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` **`start` is required.** Give it a relative offset such as `-24h` (the last 24 hours), an ISO 8601 date or a UNIX timestamp. Optional `end` parameter, same formats. Max 1000 data points per request. `start` and `end` must fall inside your plan's history window and `interval` must be one your plan allows, or the API answers `403`: see [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). Response is a JSON array of candlestick objects with `time_open`, `time_close`, `open`, `high`, `low`, `close`, `volume`. Use `inversed=true` to flip the pair (e.g., get ETH/USDC instead of USDC/ETH). *** ## Pattern 6: Filter pools by criteria Use the pool search endpoint to find pools matching specific conditions: ```bash theme={null} # High-volume Ethereum pools curl "https://api.dexpaprika.com/networks/ethereum/pools/search?volume_usd_24h_min=100000&order_by=volume_usd_24h&sort=desc" # New Solana pools with activity (created in the last 7 days) curl "https://api.dexpaprika.com/networks/solana/pools/search?created_after=-7d&txns_24h_min=50&order_by=created_at&sort=desc" ``` **Available filter parameters:** | Parameter | Type | Description | | - | - | - | | `volume_usd_24h_min` | number | Minimum 24h volume in USD | | `volume_usd_24h_max` | number | Maximum 24h volume in USD | | `volume_usd_7d_min` / `_max` | number | 7-day volume in USD | | `volume_usd_30d_min` / `_max` | number | 30-day volume in USD | | `liquidity_usd_min` / `_max` | number | Pool liquidity in USD | | `txns_24h_min` | integer | Minimum transactions in last 24h | | `price_change_percentage_24h_min` / `_max` | number | 24h price change, percent | | `price_change_percentage_48h_min` / `_max` | number | 48h price change, percent | | `price_change_percentage_6h_min` / `_max` | number | 6h price change, percent | | `price_change_percentage_1h_min` / `_max` | number | 1h price change, percent | | `price_change_percentage_5m_min` / `_max` | number | 5m price change, percent | | `created_after` | string | Only pools created at or after this time: unix seconds or relative (`-24h`, `-7d`), RFC3339 or `YYYY-MM-DD`. Keyless and free keys do not see the last hour ([search freshness](/knowledge-base/rate-limits#search-freshness)) | | `created_before` | string | Only pools created at or before this time, same formats | | `order_by` | string | `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_48h`, `price_change_percentage_24h`, `price_change_percentage_6h`, `price_change_percentage_1h`, `price_change_percentage_5m` | | `sort` | string | `asc` or `desc` | | `limit` | integer | Items per page (default: 50, maximum 100) | | `cursor` | string | Pass `next_cursor` from the previous response to page forward. Needs an API key | All filters combine with AND logic. The response wraps rows in a `results` array (not `pools`) and pages with `has_next_page` + `next_cursor` (cursor-based; there is no `page_info`/`total_pages`). > [!NOTE] > > Use the canonical `volume_usd_*` parameter names (e.g. `volume_usd_7d_min`, `volume_usd_30d_max`). The volume, liquidity, and transaction filters are all functional. Older short names like `volume_7d_min` are ignored until 23 November 2026 and answer `400` (`unknown_param`) from then on. > > Percentage filters take signed numbers, so `price_change_percentage_1h_max=-20` screens for pools down 20 percent or more over the last hour. Only the 24h window works on tokens; 48h, 6h, 1h and 5m are pool-only. Token search takes the 24h window for both sorting and filtering, rejects the other four as `order_by` with a 400, and silently drops them as `_min` / `_max` bounds. *** ## Pattern 7: Monitor pool transactions Transactions are a [paid-only endpoint](/knowledge-base/rate-limits#paid-only-endpoints): Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`. Keyless calls and free keys get `403`. ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?limit=20&page=1" ``` Transactions are returned in reverse chronological order. Each includes: * `amount_0`, `amount_1`: token amounts * `volume_0`, `volume_1`: volumes * `price_0_usd`, `price_1_usd`: USD prices for each token * `token_0_symbol`, `token_1_symbol`: token symbols * `type`: `swap`, `add`, or `remove` * `created_at`: timestamp **Pagination:** Max 100 pages. For deep history, use `cursor` parameter (a transaction ID) instead of page numbers. *** ## Pattern 8: Discover DEXes on a network ```bash theme={null} # List all DEXes on a network curl "https://api.dexpaprika.com/networks/solana/dexes" # Get pools for a specific DEX curl "https://api.dexpaprika.com/networks/solana/pools/search?dex_name=raydium&order_by=volume_usd_24h&sort=desc&limit=10" ``` > [!NOTE] > > The old `GET /networks/{network}/dexes/{dex}/pools` endpoint was removed and returns `410 Gone`. The DEX is now the `dex_name` filter on pool search, which takes the `dex_id` from the DEX list above (`raydium`, `uniswap_v3`). Display names such as `Uniswap V3` match nothing and return an empty `results`. Rows come back under `results` with `has_next_page` + `next_cursor`, and the sort field is `volume_usd_24h`. *** ## Pattern 9: Stream live prices For real-time updates, use the streaming API instead of polling REST. **Single token (GET):** ```bash theme={null} curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ``` **Multiple tokens (POST), up to 25 per connection:** ```bash theme={null} curl -N -X POST "https://streaming.dexpaprika.com/sse/prices" \ -H "Accept: text/event-stream" \ -H "Content-Type: application/json" \ -d '[ {"chain": "solana", "address": "So11111111111111111111111111111111111111112", "method": "token_price"}, {"chain": "ethereum", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "method": "token_price"} ]' ``` Each SSE event: ``` data: {"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","chain":"ethereum","price":"2255.59","timestamp":1778847592,"timestamp_price":1778847592,"token_price":1778847592} event: token_price ``` The `price` field is a string, not a number, so parse it as a decimal for precision. Open additional connections in parallel if you need more than 25 subscriptions, up to **10 concurrent SSE streams** keyless or on a free key (30 on Dev, 100 on Pro). *** ## Pattern 10: REST + Streaming combined The most common production pattern: 1. **REST for discovery.** Use search, token details, and pool listing to find what you want to track 2. **Validate.** Confirm the tokens exist and have pricing data via REST 3. **Stream for live updates.** Open an SSE connection for real-time prices 4. **REST for enrichment.** Periodically call REST for OHLCV history, pool details, or transaction data that streaming doesn't cover *** ## Quick reference: which endpoint for what? | I want to... | Endpoint | | - | - | | Get a token's current price | `GET /networks/{network}/tokens/{address}` → `.summary.price_usd` | | Get multiple token prices at once | `GET /networks/{network}/multi/prices?tokens=a,b,c` | | Find a token I don't have the address for | `GET /search?query={name_or_symbol}` | | See top pools by volume | `GET /networks/{network}/pools/search?order_by=volume_usd_24h&sort=desc` | | Find pools for a specific token | `GET /networks/{network}/pools/search?token_address={address}` | | Filter pools by volume/txns/age | `GET /networks/{network}/pools/search?volume_usd_24h_min=X` | | Get historical candlestick data | `GET /networks/{network}/pools/{pool}/ohlcv?start=X&interval=24h` | | See recent swaps on a pool (paid plans) | `GET /networks/{network}/pools/{pool}/transactions` | | List DEXes on a network | `GET /networks/{network}/dexes` | | Get pools on a specific DEX | `GET /networks/{network}/pools/search?dex_name={dex_id}` | | Stream live prices | `GET https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=X&address=Y` | | Get API stats | `GET /stats` | ### FAQs > [accordion] Why do I get an empty array from batch pricing? > > If all requested tokens are unknown or don't have pricing data, you get HTTP 200 with an empty array, not an error. Verify the token addresses are correct. > [accordion] What replaced the old pool list and filter endpoints? > > `GET /networks/{network}/pools`, `/pools`, and `/networks/{network}/pools/filter` were removed (they return `410 Gone`). Use `GET /networks/{network}/pools/search` (single network) or `GET /pools/search` (multiple networks via a `chains` filter). The search response wraps rows in a `results` array; each pool uses `id` (the pool address), `volume_usd_24h`, and `transactions_24h`. Pagination is cursor-based (`has_next_page` + `next_cursor`). > [accordion] How do I get OHLCV for a token that's in many pools? > > Use the highest-volume pool. It has the most representative pricing. Find it via `GET /networks/{network}/pools/search?token_address={address}&limit=1` (the default sort is `volume_usd_24h` descending). > [accordion] What replaced the token pools endpoint? > > `GET /networks/{network}/tokens/{token_address}/pools` was removed (it returns `410 Gone`). Use `GET /networks/{network}/pools/search` with the `token_address` query parameter. The filter is network-scoped only: the cross-network `GET /pools/search` ignores it until 23 November 2026 and answers `400` (`unknown_param`) from that date. The old `reorder` and second-token `address` parameters have no equivalent. > [accordion] What replaced the DEX pools endpoint? > > `GET /networks/{network}/dexes/{dex}/pools` was removed (it returns `410 Gone`). Use `GET /networks/{network}/pools/search` with the `dex_name` query parameter, which takes the `dex_id` field from `GET /networks/{network}/dexes` (`uniswap_v3`), matched case-insensitively. Passing that response's `dex_name` field instead, a display name like `Uniswap V3`, returns an empty `results` array rather than an error. Unlike `token_address`, `dex_name` also works on the cross-network `GET /pools/search`. Rows come back under `results` with `has_next_page` + `next_cursor`, and the 24h volume field is `volume_usd_24h`, not `volume_usd`. # Core concepts Source: https://docs.dexpaprika.com/knowledge-base/concepts Understand the key concepts behind DexPaprika: blockchain networks, DEXes, liquidity pools, tokens, OHLCV data, and how on-chain data flows from blockchains to the API. ## How DexPaprika works DexPaprika indexes on-chain activity from 35 blockchain networks in near real-time. It watches smart contract events on decentralized exchanges (DEXes), extracts swap transactions, liquidity changes, and price data, and serves it through a REST API and SSE streaming API. ``` Blockchains → Indexer → DexPaprika API → Your app / AI agent (35 chains) (near real-time) (REST + Streaming) ``` No API key needed to start. Just make HTTP requests, and [register a free key](https://console.dexpaprika.com) when you want the higher allowance. *** ## Networks A **network** (also called a chain or blockchain) is the underlying blockchain where DEXes operate. Each network has its own token addresses and pool addresses. DexPaprika currently supports 35 networks including Ethereum, Solana, Base, Arbitrum, Polygon, BSC, Optimism, Avalanche, Fantom, Sui, Aptos, TON, Tron, and more. Every API call that involves a specific token or pool requires a `network` parameter, the lowercase identifier like `ethereum`, `solana`, `bsc`, `base`. ```bash theme={null} # List all supported networks curl "https://api.dexpaprika.com/networks" ``` The response is a JSON array of objects with `id` and `display_name`. *** ## DEXes (Decentralized Exchanges) A **DEX** is a decentralized exchange protocol, a set of smart contracts that allows users to swap tokens without an intermediary. Examples: Uniswap, Raydium, PancakeSwap, Curve. Each DEX operates on one or more networks. For instance, Uniswap V3 runs on Ethereum, Arbitrum, Base, Polygon, and others. In DexPaprika, DEXes are identified by a `dex_id` string like `uniswap_v3`, `raydium`, `pancakeswap_v3`. ```bash theme={null} # List DEXes on Ethereum curl "https://api.dexpaprika.com/networks/ethereum/dexes" ``` *** ## Liquidity pools A **liquidity pool** is a smart contract that holds reserves of two (or more) tokens. Users swap one token for the other, and the pool's reserves shift accordingly. That shift is how prices are determined on a DEX. Each pool has: * **Pool address**: the smart contract address on-chain * **Token pair**: the two tokens in the pool (e.g., USDC/WETH) * **Liquidity**: the total USD value of tokens held in the pool * **Volume**: how much has been traded through the pool in a time period * **Transactions**: how many swap/add/remove events happened * **Price**: the current exchange rate between the two tokens Pools are the central data object in DexPaprika. Most queries revolve around finding pools, inspecting them, and tracking their activity. ```bash theme={null} # Get the top pool on Ethereum by volume curl "https://api.dexpaprika.com/networks/ethereum/pools/search?limit=1&order_by=volume_usd_24h&sort=desc" ``` *** ## Tokens A **token** is a digital asset on a blockchain, identified by its contract address. The same token concept (like "USDC") can exist on multiple networks with different addresses. DexPaprika tracks token data by aggregating activity across all pools that contain that token. The token endpoint returns: * **Price in USD**: aggregated from pool data * **Fully diluted valuation (FDV)** * **Liquidity**: total across all pools * **Volume and transactions**: across multiple time windows (24h, 6h, 1h, 30m, 15m, 5m, 1m) * **Buy/sell counts and USD values** * **Price stats**: 24h high/low and all-time high ```bash theme={null} # Get SOL token data on Solana curl "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" ``` The price is at `response.summary.price_usd`. *** ## OHLCV data **OHLCV** stands for Open, High, Low, Close, Volume. That is the standard candlestick format used in financial charts. DexPaprika provides OHLCV data per pool (not per token). To get historical price data for a token, first find its highest-volume pool, then request OHLCV data for that pool. Available intervals: `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` Limits: up to 1000 data points per request. How far back you can reach and how fine the candles can be depends on your plan: without a key you get `1h` and up over the last 24 hours. See [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). ```bash theme={null} # Hourly candles for the USDC/WETH pool on Uniswap V3 over the last 24 hours, no key needed curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-24h&interval=1h&limit=24" ``` *** ## Transactions **Transactions** are individual on-chain events on a pool: swaps, liquidity additions, and removals. Each transaction includes token amounts, USD values, prices, and timestamps. Transactions are returned in reverse chronological order and are available for any pool. The endpoint is [paid-only](/knowledge-base/rate-limits#paid-only-endpoints): call it on `api-pro.dexpaprika.com` with a Dev, Pro or Enterprise key. Keyless calls and free keys get `403`. ```bash theme={null} # Recent transactions for a pool (paid plan) curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?limit=10" ``` *** ## Search The **search** endpoint lets you find tokens, pools, and DEXes by name, symbol, or address across all networks. Use this when you don't know the exact network or address for something. ```bash theme={null} # Find "Jupiter" across all networks curl "https://api.dexpaprika.com/search?query=jupiter" ``` The response includes `tokens`, `pools`, and `dexes` arrays with matching results. *** ## Pool filtering The **pool search** endpoint lets you search for pools matching specific criteria: volume range, liquidity, transaction count, and creation date. This is useful for building pool screeners or finding recently created pools with significant activity. ```bash theme={null} # Ethereum pools with >$100k daily volume, sorted by volume curl "https://api.dexpaprika.com/networks/ethereum/pools/search?volume_usd_24h_min=100000&order_by=volume_usd_24h&sort=desc" ``` *** ## Streaming (real-time prices) The **streaming API** delivers real-time price updates via Server-Sent Events (SSE). Instead of polling the REST API repeatedly, you open one connection and receive a price update whenever a swap moves the price. The rate tracks trading activity, from about 1 update a minute on a quiet asset to about 52 on a busy one. Base URL: `https://streaming.dexpaprika.com` ```bash theme={null} # Stream WETH price on Ethereum curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ``` Each `token_price` SSE event contains: `address`, `chain`, `price` (string, USD), and unix timestamps (`timestamp`, `timestamp_price`). The legacy `t_p` method emits the compact `{a, c, p, t, t_p}` shape and is **deprecated**. *** ## Key things to know * **No authentication needed to start**: keyless requests work, and a free key raises the allowance * **Credit allowance**: 10,000 credits per rolling 30 days keyless (100,000 with a [free API key](https://console.dexpaprika.com)), at 15 requests a minute keyless and 30 with a key; one request costs one credit, batch endpoints one credit per item * **Pagination**: the search endpoints are cursor-based (read `has_next_page`, pass `next_cursor` back as `cursor`), and paging past the first page needs an API key (a free key pages without limit). Only `GET /networks/{network}/dexes` and `GET /networks/{network}/pools/{pool_address}/transactions` still take `page`, and those are 1-indexed (`page=0` is silently treated as page 1) * **Max page size**: 100 items per page across all endpoints * **Addresses are case-sensitive**: use the exact on-chain format * **Prices are numbers** in REST responses but **strings** in streaming SSE events (for decimal precision) * **OHLCV is per pool, not per token**: find the highest-volume pool first, then request candles ### FAQs > [accordion] What's the difference between DexPaprika and CoinPaprika? > > DexPaprika covers on-chain DEX data (pools, swaps, on-chain token prices). CoinPaprika covers centralized exchange data (market cap rankings, exchange listings, global metrics). They're separate APIs from the same company. > [accordion] How fresh is the data? > > The indexer processes new blocks as they arrive, typically within seconds of on-chain confirmation. What you see depends on your plan: the free tier is served with a delay of up to 60 seconds, [Pro](https://dexpaprika.com/api/pricing) is real time. > [accordion] Can I trade or swap through DexPaprika? > > No. DexPaprika is read-only. It provides market data but does not execute trades. # The console: keys, usage and billing Source: https://docs.dexpaprika.com/knowledge-base/console Where to get an API key, rotate it, watch what you have spent, connect an AI client and find your invoices. Everything account-shaped lives in one place: [console.dexpaprika.com](https://console.dexpaprika.com). Your key, what you have spent this period, the errors your calls returned, the MCP setup for AI clients, and billing. You do not need it to start. The API answers keyless requests, and a key is what raises the allowance and unlocks any-token streaming. See [pricing](https://dexpaprika.com/api/pricing) for what each tier includes. ![Console dashboard showing four summary cards across the top: current plan, usage this period against the monthly cap, autoscaling state, and next billing cycle. Below them a stacked usage-over-time chart for the last 30 days, and two panels listing top endpoints and top API keys by share of calls.](https://mintcdn.com/coinpaprikaspzoo/CAdFDWYL26W-QZmy/images/console/dashboard.png?fit=max\&auto=format\&n=CAdFDWYL26W-QZmy\&q=85\&s=d35fc917232781fbb12152fa654bc10b) ## What each section is for | Section | What you do there | | - | - | | **Dashboard** | The one-screen answer to "am I fine?". Current plan, credits spent against the cap, whether autoscaling is on, and when the next billing cycle starts | | **Usage** | The same numbers with history: which endpoints you call, how the spend moved day to day | | **Error Log** | What your failed calls actually returned. Start here before assuming the API is down | | **API Keys** | Reveal, copy, revoke. One active key per account | | **MCP & AI Setup** | Ready-made configuration for Claude, Cursor, Cline and anything else that speaks MCP | | **Billing** | Plan and billing period, the autoscaling switch, and invoices with an export | | **Notifications** | Where quota and billing alerts are delivered | ## Frequently asked > [accordion] Where do I get an API key? > > **API Keys** in the sidebar. A key is generated for your account, and there is exactly one active key at a time. > > The same screen shows the base URLs your key is valid for. Free keys authenticate against `https://api.dexpaprika.com` and `https://streaming.dexpaprika.com`. Pro moves you to `https://api-pro.dexpaprika.com` and `https://streaming-pro.dexpaprika.com`. > > That pairing matters: a free key sent to a Pro host answers `403 wrong_host`, and the body tells you which host to use. > > If you have just moved to Pro, read [upgrading to Pro](/api-pro/upgrading) before your first call, and [403 Forbidden (wrong host)](/knowledge-base/error-handling#403-forbidden-wrong-host) if you already have the error in front of you. > > ![API Keys screen showing the REST and streaming base URLs with copy buttons, the active key masked with reveal and copy controls, a revoke button, and a quick-start curl example using the Authorization header.](https://mintcdn.com/coinpaprikaspzoo/CAdFDWYL26W-QZmy/images/console/api-keys.png?fit=max\&auto=format\&n=CAdFDWYL26W-QZmy\&q=85\&s=61bca7a86bedf14cabeaa45362b52d12) > [accordion] How do I rotate my key? > > Revoke the current one, then generate a new one. Both buttons are on the **API Keys** screen. > > Because there is one active key per account, rotation is a break: the old key stops working the moment you revoke it. Have the new key ready to deploy before you press it, and if the key lives in a hosted environment, remember it is usually stored as a secret rather than in the code. > [accordion] How do I authenticate a request? > > Put the key in the `Authorization` header, on its own: > > ```bash theme={null} > curl "https://api.dexpaprika.com/networks/ethereum/pools/search" \ > -H "Authorization: api_YOUR_KEY_HERE" > ``` > > The key is the entire `Authorization` header value, with nothing in front of it and nothing after it. This is easy to trip over, since almost every other API expects a scheme word first. If your HTTP client only offers a token field that prepends one for you, set a raw header instead. > [accordion] Where are my invoices? > > **Billing**, at the bottom of the page, with an export control for pulling them out. Until your first payment the section says so rather than sitting empty, so an empty list is not a sign that something failed. > > The same screen carries the rest of the money: your current plan with the period it runs for and the autoscaling switch. > > The dashboard shows the next billing cycle at a glance. If it reads no active subscription, you are on a free tier and there is nothing to invoice. > > ![Billing screen showing the current plan card with the monthly allowance, rate limit and billing period plus upgrade buttons, an autoscaling panel with an off switch and a spending-limit slider, three credit pack cards for 5M, 15M and 50M credits, and an invoices section with an export control.](https://mintcdn.com/coinpaprikaspzoo/CAdFDWYL26W-QZmy/images/console/billing.png?fit=max\&auto=format\&n=CAdFDWYL26W-QZmy\&q=85\&s=f69582a3a22fc6caa8ac0a6ad7ad1ea9) > [accordion] What is autoscaling? > > It is how you keep going past the monthly allowance on Dev and Pro. Leave the switch off and the allowance is a hard stop, exactly like a free tier. Turn it on and once the plan is spent, extra credits are bought automatically at \$20 per million, up to a spending limit you set on the same screen. You decide the ceiling once and then stop thinking about it. > > If your account already holds a credit pack, those credits sit alongside the plan allowance and drain with it, and Billing shows what is left. New packs are not on the [pricing page](https://dexpaprika.com/api/pricing); autoscaling is how you add credits now. > > Autoscaling is a paid-plan control. On a free tier it is visible but inactive. > [accordion] How do I know how much I have spent? > > The dashboard card **Usage this period** is the short answer: credits used against your monthly cap, with the percentage. **Usage** breaks it down over time and by endpoint, so you can see which call is doing the spending. > > One request costs one credit. Batch endpoints charge one credit per item, and each delivered streaming update costs one credit too. See [plan your credit usage](/knowledge-base/credit-usage) for how to size a workload before you build it. > [accordion] What happens when I run out of credits? > > On a free tier the cap is hard: the API answers `402` and the body names the next step for your tier. Nothing is charged, and the allowance refills continuously as usage older than 30 days ages out, so there is no date to wait for and the body carries no `resets_at`. > > On Pro you can let it keep going. The dashboard calls this **autoscaling**: with it off the cap behaves like the free tier, with it on the overage is charged per additional block up to the monthly spend limit you set. See [error handling](/knowledge-base/error-handling) for the difference between a `402` and a `429`, which is worth getting right in code: a `429` is a per-minute rate limit and is worth retrying, a `402` is the monthly allowance and retrying will not help. > [accordion] How do I connect Claude, Cursor or Cline? > > **MCP & AI Setup** generates the configuration with your key already filled in, for Claude Code, Claude Desktop and any client that takes a JSON config. > > The hosted server speaks two transports. Streamable HTTP, which is what current clients use: > > ``` > https://mcp.dexpaprika.com/streamable-http > ``` > > and SSE, for older clients: > > ``` > https://mcp.dexpaprika.com/sse > ``` > > Authentication is the same `Authorization` header as REST. Full setup per client is in [the hosted MCP guide](/ai-integration/hosted-mcp-server). > > ![PLACEHOLDER. MCP and AI Setup screen with a TL;DR panel showing the server URL and Authorization header, then three cards side by side: a terminal command for Claude Code, a one-click install button for Claude Desktop, and a JSON config block for Cursor, Cline and other clients.](https://mintcdn.com/coinpaprikaspzoo/xiu5hHVWoV7jjHxO/images/console/mcp-setup.png?fit=max\&auto=format\&n=xiu5hHVWoV7jjHxO\&q=85\&s=e53c2efe3832aa97594f8cdc61764ffd) > [accordion] Do I need an account to try the API? > > No. Keyless requests work at 10,000 credits per rolling 30 days per IP, with no signup and no card. Registering a free key raises that to 100,000 and lifts the streaming restriction from the [showcase list](/streaming/showcase-streams) to any token we index. # Plan your credit usage Source: https://docs.dexpaprika.com/knowledge-base/credit-usage Work out what your workload actually costs before you commit to a plan. Real measured update rates, four worked cost models, and the point where streaming stops costing less than polling. An HTTP call is a request; what it spends is a credit. One request costs one credit, batch endpoints cost one credit per item, and every update delivered over a stream costs one credit. This page turns that rule into numbers you can plan against, so you can answer "will 5M credits a month cover me?" before you pay for anything. If you only read one section, read [stream or poll](#stream-or-poll). Streaming does not automatically cost less, and on a fast-moving asset it is dramatically more expensive. ## The allowances | Tier | Credit allowance | Requests per minute | | - | - | - | | Free, no key | 10,000 per IP, rolling 30 days | 15 | | Free, registered key | 100,000, rolling 30 days | 30 | | Dev | 500,000 per billing month, then \$20 per additional 1M | 120 | | Pro | 5,000,000 per billing month, then \$20 per additional 1M | 500 | | Enterprise | Agreed per contract | Agreed per contract | Full detail on the [rate limits page](/knowledge-base/rate-limits). Plans are on [pricing](https://dexpaprika.com/api/pricing). The free allowances are a rolling 30-day window, not a calendar month, so the figures below are consumption rates rather than budgets that refill on the 1st. A heavy month keeps its weight for 30 days; see [how the allowance refills](/knowledge-base/rate-limits#how-the-allowance-refills). ## What a stream actually costs Streams are pushed only when a value changes, so cost tracks the asset's update rate, not the number of connections you hold open. That rate varies enormously. ### What sets the update rate Prices are derived from swaps, so **an update happens when a swap moves the price**. Two things bound that: * **Swap activity.** The dominant factor, and in practice the binding one. A heavily traded asset produces a steady stream of price-moving swaps; a thinly traded one produces almost none. * **The recompute cadence.** Our pricing pipeline recomputes on a sub-second cycle, which sets an upper bound. No asset streams faster than that, and almost none get close. Fast blocks alone do not mean a fast stream. A chain can produce blocks quickly and still yield few updates, because with little trading there are no swaps to move the price. The gap is larger than most people expect, but it is not proportional to raw activity, and that catches people out. On 15 September `/networks` reported about **31.3M transactions on Solana against 18,500 on Cronos**, a ratio near 1,700 to 1. The price streams for those two chains differed by a factor of **13**. Trading activity sets the direction, not the multiple, because prices are recomputed on a cadence rather than once per swap. So the mental model that holds is **you pay for how actively the asset trades**, not for how long you stay connected, and you should not scale an estimate off transaction counts. These are real measurements, taken 2026-09-15 from two 7 minute samples of `/sse/prices` on the keyless tier, eight assets streaming concurrently and then a quieter six. Credits per 30 days is the measured rate times 43,200. Treat them as the right order of magnitude rather than a guarantee, since trading activity changes hour to hour: | Asset | Updates per minute | Credits per 30 days | Share of Pro (5M credits) | | - | - | - | - | | WBNB (bsc) | 56.4 | 2,436,480 | 49% | | SOL (solana) | 52.0 | 2,246,400 | 45% | | WETH (base) | 31.3 | 1,352,160 | 27% | | WETH (optimism) | 22.7 | 980,640 | 20% | | WAVAX (avalanche) | 20.4 | 881,280 | 18% | | WETH (arbitrum) | 20.3 | 876,960 | 18% | | WPOL (polygon) | 14.7 | 635,040 | 13% | | WETH (ethereum) | 5.6 | 241,920 | 5% | | WCRO (cronos) | 4.0 | 172,800 | 3% | | WETH (linea) | 1.1 | 47,520 | 1% | | WFTM (fantom) | 0.0 | 0 | 0% | Two things fall out of this table immediately. **A single busy asset can dominate a plan.** One continuous WBNB subscription is roughly 2.4M credits over 30 days, about half of everything Pro includes. Two such assets and you are out. Note that the busiest asset measured was on BNB Chain rather than Solana, so do not assume the chain you think of as the fastest is the one that will cost you most. **The free tiers are not built for continuous streaming of a busy asset.** At 56 updates a minute, WBNB exhausts the 10,000 keyless allowance in about **3 hours**, and the 100,000 registered allowance in **about 30 hours**. A quiet asset is a different story entirely: WETH on Linea at 1.1 a minute runs about **6 days** keyless and roughly two months on a registered key, and WFTM delivered nothing at all in seven minutes, which costs exactly nothing. The range across eleven wrapped natives was 0 to 56 updates a minute, so the asset you pick matters more than any other decision on this page. > [!NOTE] > > The connection caps are separate from your credit allowance: 25 subscriptions per connection, and 10 concurrent streams keyless (per IP) or on a free key, 30 on Dev, 100 on Pro. Those limit concurrency, not spend. ## Stream or poll The honest answer: **streaming saves you credits only when you would otherwise poll faster than the asset changes.** Streaming's real benefit is latency and freshness, not cost. Polling costs exactly what you choose: | Poll interval | Credits per asset per 30 days | | - | - | | Every 1 second | 2,592,000 | | Every 10 seconds | 259,200 | | Every 60 seconds | 43,200 | | Every 5 minutes | 8,640 | Now compare against the measured rates. The crossover is simply whether the asset's update rate is above or below your poll rate: * **WBNB at 56.4 updates a minute.** Streaming costs 2,436,480 credits. Polling once a minute costs 43,200. Polling is **56 times less**, at the price of being up to 60 seconds stale. * **WETH on ethereum at 5.6 a minute.** Streaming costs 241,920 credits. Polling every 10 seconds costs 259,200. Close to break even, with streaming slightly ahead on both cost and freshness. * **WETH on linea at 1.1 a minute.** Streaming costs 47,520 credits. Polling every 10 seconds costs 259,200. **Streaming costs about 5 times less** and is fresher. The rule of thumb: * If you need sub second freshness, stream. Nothing else gets you there, and the cost is the cost. * If a minute of staleness is acceptable and the asset is busy, poll. It costs far less. * If the asset is quiet, stream. You pay almost nothing and get instant updates. ## Four worked models ### 1. Price ticker on 10 assets A dashboard streaming 10 mixed assets, say 3 busy and 7 quiet, averaging about 15 updates a minute each: ``` 10 assets x 15 updates/min x 60 x 24 x 30 = 6,480,000 credits/month ``` That is over Pro's 5M. Options: drop to the 5 assets users actually watch, or poll the quiet ones and stream only the busy ones. ### 2. Portfolio refresh, 50 tokens, every 5 minutes Batch endpoints cut latency and per-minute request pressure, not credits: each token still bills as one credit. ``` 50 tokens x 288 refreshes/day x 30 = 432,000 credits/month ``` That is more than four times a registered free key's 100,000, so this shape needs Pro, or a far slower refresh. Every 10 minutes is 216,000 and every 15 minutes is 144,000, both still over; every 30 minutes is 72,000 and fits. Cache the static half (names, decimals, pool pairs) either way, since it costs nothing extra to keep. ### 3. Drain detection on 25 pools Reserve streams emit per block in which reserves change, which is far less often than prices tick. Assume about 4 updates a minute per pool: ``` 25 pools x 4 updates/min x 60 x 24 x 30 = 4,320,000 credits/month ``` Fits Pro with headroom. This is the workload streaming is genuinely built for: you cannot poll your way to catching a one block drain. ### 4. Backfill plus live Size these separately. A one off historical pull is a fixed cost: ``` 500 pools x 365 daily candles / 1,000 per request = ~500 requests, 500 credits, once ``` Then add the steady state streaming figure from above. Backfill is almost never the expensive half. ## Cutting real time spend without losing freshness * **Subscribe to fewer, higher signal assets.** Cost scales with what you watch, not with connections. Ten idle assets on one connection still bill for every update. * **Split "must be live" from "can be stale."** Stream the price your UI shows in real time; cache names, decimals, pool pairs and completed candles. Completed OHLCV candles never change. * **Filter server side.** `liquidity_usd_min` and the other threshold filters keep pages small so you pull fewer rows overall. * **Poll the boring ones.** A stablecoin pinned to \$1.00 does not need a live stream. * **Disconnect when nobody is watching.** A dashboard nobody has open still bills for every update it receives. ## Check your own numbers Usage is visible in [console.dexpaprika.com](https://console.dexpaprika.com), and `GET /usage` returns the same figures for an authenticated key. Both count credits. The reliable way to size a workload is to measure it: subscribe to exactly what you intend to run, leave it for ten minutes, and multiply. The table above was produced this way, and a ten minute sample of your own assets will beat any estimate on this page. ## Which plan do I need? Take your total from the models above, then: * **Under 10,000 credits per rolling 30 days:** the free tier, no key needed to start. * **10,000 to 100,000:** register a free key. * **100,000 to 5M:** [Pro](https://dexpaprika.com/api/pricing), \$99 a month. Pro calls a different host with a key; read [upgrading to Pro](/api-pro/upgrading) before you migrate your client. * **Over 5M:** Pro plus \$20 per additional 1M, or talk to us about Enterprise on the [Pro API page](/api-pro/introduction) if streaming volume is the driver, since Enterprise limits are set to the workload. If the number lands just over a tier boundary, revisit the list above before upgrading. Dropping three idle assets from a ticker usually costs less than the next plan. ## FAQs > [accordion] Does a streaming update really cost the same as a REST call? > > Yes. One request costs one credit, and each update delivered over a stream costs one credit. Connections themselves are free; what you pay for is updates delivered. > [accordion] Does streaming cost less than polling? > > Only if the asset updates less often than you would poll. On a busy asset like SOL, streaming can cost 50 times more than polling once a minute. On a quiet asset it costs a fraction. Stream for freshness, poll for thrift. > [accordion] Does batching save me credits? > > No. Batch endpoints collapse several round trips into one HTTP call, which cuts latency, connection overhead and pressure on the per-minute request limit, but each token still bills as one credit. Ten tokens cost ten credits either way. > [accordion] Do idle connections cost anything? > > No. Updates are pushed only when a value changes, so an idle market costs nothing. The cost is entirely a function of how often what you subscribed to moves. # Error handling and troubleshooting Source: https://docs.dexpaprika.com/knowledge-base/error-handling Complete guide to DexPaprika API error codes, common issues, and troubleshooting steps for REST API and Streaming API. ## REST API errors All REST API errors return a JSON object with a `message` field (and sometimes an `error` field). Here's every status code you can encounter: ### 200 Success Normal response. Parse the JSON body. One important edge case: **batch pricing** (`GET /networks/{network}/multi/prices`) returns HTTP 200 with an empty array `[]` when none of the requested tokens have pricing data. This is not an error. It means the tokens were processed but none had prices. *** ### 400 Bad Request The request was malformed or contained invalid parameters. `param` names the offending parameter, and where there is a fixed set the message lists the accepted values: ```json theme={null} { "error": "invalid_param", "message": "invalid query parameters: order_by (must be one of [volume_usd_24h volume_usd_7d volume_usd_30d liquidity_usd txns_24h created_at price_usd price_change_percentage_24h price_change_percentage_6h price_change_percentage_48h price_change_percentage_1h price_change_percentage_5m])", "param": "order_by" } ``` REST errors carry `error`, a stable code to branch on (`invalid_param` here), and a human `message`. Match on `error` in code, since message text can change. A required parameter that is absent has its own code, `missing_param`, with `param` naming it: ```json theme={null} {"error": "missing_param", "message": "invalid query param: start (is required)", "param": "start"} ``` From 23 November 2026, a parameter name the endpoint does not accept answers `400` with `unknown_param`. `allowed` lists the names the endpoint takes, and `violations` lists every name that was refused: ```json theme={null} {"error":"unknown_param","message":"invalid query parameters: limit (unknown parameter)","param":"limit","allowed":["query"],"violations":[{"in":"query","param":"limit","error":"unknown_param"}]} ``` A name in the wrong case, such as `INTERVAL`, answers `wrong_case_param` with the right name in `expected`. The same name sent twice, such as `chains=ethereum&chains=base`, answers `repeated_param`: send one `chains=ethereum,base` instead. Until 23 November these requests return `200` and the parameter is ignored. **Common causes:** * Invalid `order_by` on `/networks/{network}/pools/search`. The accepted values are `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_48h`, `price_change_percentage_24h`, `price_change_percentage_6h`, `price_change_percentage_1h` and `price_change_percentage_5m`. The older `volume_usd` spelling is rejected * Invalid `order_by` on `/networks/{network}/tokens/search`, which takes a **different** list: `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `price_change_percentage_24h`, `created_at` and `fdv_usd` * Sorting tokens by price. Do not read `price_usd` out of the token 400 body and retry with it. That value appears in the message, and `order_by=price_usd` on either token search path answers with a second `400`. Ordering tokens by raw price is not supported. Sort by `volume_usd_24h` or `liquidity_usd` instead and read `price_usd` off the rows you get back. The eight values listed above are the ones that actually return `200` * Sorting tokens by a pool-only price change window. The 48h, 6h, 1h and 5m windows exist on pool search only, so passing one as `order_by` to either token search endpoint returns a `400` * Using an unknown parameter **name**, a name in the wrong case, or the same name twice. From 23 November 2026 these answer `400` with `unknown_param`, `wrong_case_param` or `repeated_param`, as shown above. Until then an unknown name is dropped, so `sort_by=` or `volume_24h_min=` returns 200 with default ordering and no filter applied * Invalid `interval` value for OHLCV (must be one of: `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h`) * Batch pricing with more than 10 tokens * Batch pricing with zero tokens (empty `tokens` parameter) * Invalid UNIX timestamp format in filter parameters * Missing required parameters, such as `start` for OHLCV, `tokens` for batch pricing or `indicator` for indicators. These answer `missing_param` rather than `invalid_param` **What to do:** Check the parameter values against the [API reference](/api-reference/introduction) or [common patterns](/knowledge-base/common-patterns). *** ### 404 Not Found The requested resource doesn't exist. `resource` says what was missing: ```json theme={null} {"error": "not_found", "message": "pool not found", "resource": "pool"} ``` An unknown network is its own code, so you can tell a wrong chain ID from a wrong address: ```json theme={null} {"error": "unsupported_network", "message": "unsupported network", "param": "network"} ``` **Common causes:** * Invalid network ID (e.g., `eth` instead of `ethereum`, `sol` instead of `solana`) * Token address doesn't exist on that network * Pool address doesn't exist on that network * Typo in the URL path **What to do:** 1. Verify the network ID by checking `GET /networks` 2. Use `GET /search?query={name}` to find the correct network and address 3. Check that the address format matches the chain (e.g., `0x...` for EVM chains, base58 for Solana) *** ### 410 Gone The endpoint has been permanently removed. The body names its own replacement: ```json theme={null} {"code": 410, "message": "endpoint removed", "replacement": "/networks/:network/pools/search"} ``` **Currently applies to (all return `410 Gone`):** * `GET /pools`: use `GET /pools/search` instead. * `GET /networks/{network}/pools`: use `GET /networks/{network}/pools/search` instead. * `GET /networks/{network}/pools/filter`: use `GET /networks/{network}/pools/search` instead. * `GET /networks/{network}/dexes/{dex}/pools`: use `GET /networks/{network}/pools/search?dex_name={dex}` instead. * `GET /networks/{network}/tokens/{token_address}/pools`: use `GET /networks/{network}/pools/search?token_address={token_address}` instead. * `GET /networks/{network}/tokens/filter`: use `GET /networks/{network}/tokens/search` instead. * `GET /networks/{network}/tokens/top`: use `GET /networks/{network}/tokens/search` instead. The whole route is removed in each case, not just the specific network, DEX, or token. A nonsense DEX slug on `/networks/{network}/dexes/{dex}/pools` returns the same 410, not a 404, which is how you tell a removed endpoint from a bad identifier. *** ### 401 Unauthorized The `Authorization` header is missing, or its value is not a valid key. **The key goes in the header on its own**, with no scheme word in front of it. This is the single most common cause of a 401 here, because almost every other API expects the opposite. ```bash theme={null} # correct curl -H "Authorization: api_YOUR_KEY" "https://api-pro.dexpaprika.com/networks" # none of these work curl -H "Authorization: ApiKey api_YOUR_KEY" ... curl -H "Authorization: Token api_YOUR_KEY" ... curl -H "Authorization: Basic api_YOUR_KEY" ... ``` Send the key on its own. A request carrying a scheme word in front of it is not the documented form, and on the Pro host it is indistinguishable from a wrong key. **What you see can differ by host**, which is why this is harder to diagnose than it should be. `api-pro.dexpaprika.com` sits behind an edge rule that can reject a request before it reaches the API, answering **HTTP 403 with an HTML page** rather than the JSON error above. If you get an HTML body from an API that otherwise always answers JSON, check the header format and the base URL first, before you start regenerating the key. **What to do:** send the key as the entire header value, starting with `api_`. If you are using an SDK or an HTTP client that prepends a scheme word for you, which many do when you fill in a token field, set a raw header instead. A key that is correct but sent to the wrong base URL returns [403](#403-forbidden-wrong-host), not 401. If you have just upgraded and this is your first call to `api-pro.dexpaprika.com`, start from [upgrading to Pro](/api-pro/upgrading): the host needs an `Authorization` header carrying your key on every request, including the root path. *** ### 402 Payment Required Your credit allowance is exhausted. This is not a rate limit, and retrying does not help. On free tiers the allowance refills gradually, an hour at a time, as usage ages out of a rolling 30-day window; on Pro it returns at the start of the next billing period, or when you add credits. The body is structured and names the next step for your tier: ```json theme={null} { "error": "payment_required", "tier": "keyless", "message": "Credit limit for the last 30 days reached for unauthenticated use. Register for a free API key to get more credits/month.", "credits": { "limit": 10000, "used": 10000, "remaining": 0 } } ``` There is no `resets_at` here. Keyless and free credits age out of a rolling 30-day window continuously, so there is no moment the counter returns to zero; Dev and Pro 402s carry the field, holding the end of the billing period. A 402 deliberately carries no `Retry-After` header either, which is how you tell it apart from a 429 in code. **What to do:** * Keyless and over 10,000: [register a free API key](https://console.dexpaprika.com) for 100,000 credits per rolling 30 days, no card * On a free key and over 100,000: move to [Dev or Pro](https://dexpaprika.com/api/pricing) for 500,000 or 5,000,000 per billing period * On Dev or Pro: turn on autoscaling in [console.dexpaprika.com](https://console.dexpaprika.com), which adds credits at \$20 per additional 1,000,000 up to the spending limit you set, and track what you have spent there * Either way, size the workload first with [plan your credit usage](/knowledge-base/credit-usage) *** ### 403 Forbidden (wrong host) Your free key is valid, but it reached a host that serves paid plans only: free keys are served on `api.dexpaprika.com`, paid keys on `api-pro.dexpaprika.com`. Endpoints, paths and parameters are identical on both hosts; only the base URL changes. ```json theme={null} { "error": "wrong_host", "tier": "free", "message": "This API key is on the free plan, but this host serves paid plans only. Send your requests to https://api.dexpaprika.com instead - endpoints, paths and parameters are identical, and your free monthly credits apply there. Update the base URL in your client and retry, or upgrade to a paid plan to use this host.", "links": { "api": "https://api.dexpaprika.com", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10" } } ``` **What to do:** update the base URL in your client and retry. Nothing is wrong with the key or the plan. [Upgrading to Pro](/api-pro/upgrading) has the full host and header mapping, and a one-line `/usage` check that confirms a paid key is set up correctly. *** ### 403 Forbidden (paid-only endpoint) The endpoint is limited to paid plans. Pool transactions over REST, token OHLCV, `/sse/transactions` and `/sse/ohlcv` answer this to keyless callers and to free keys, regardless of remaining credits. The body is the `plan_required` envelope: ```json theme={null} { "error": "plan_required", "tier": "keyless", "required_tier": "dev", "message": "this endpoint requires a Dev or Pro plan", "links": { "register": "https://console.dexpaprika.com", "pricing": "https://dexpaprika.com/api/pricing", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10" } } ``` * `tier` is the plan the request was served as: `keyless` or `free`. * `required_tier` is the lowest plan that unlocks the endpoint (`dev` here). * `links.register` appears for keyless callers; a free key gets `links.upgrade` instead, when configured. OHLCV requests outside the plan's window use the same `plan_required` envelope with one extra field, `param`, naming the query parameter that broke the limit (`interval`, `start`, `end` or `count_back`), and a `message` naming the plan that lifts it. Examples on [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). **What to do:** do not retry. Use a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com` (REST) or `streaming-pro.dexpaprika.com` (SSE). Plans are on [pricing](https://dexpaprika.com/api/pricing); the list of gated endpoints is on the [rate limits page](/knowledge-base/rate-limits#paid-only-endpoints). *** ### 429 Too Many Requests Per-minute request rate exceeded. This is separate from the credit allowance, which returns 402 instead. A 429 carries a `Retry-After` header giving the seconds to wait. **Free tier limit:** 15 requests a minute without a key, 30 with a [free key](https://console.dexpaprika.com), against an allowance of 10,000 credits per rolling 30 days without a key (100,000 with a free key). Pro allows 500 requests a minute against 5,000,000 credits. **What to do:** * Retry after the number of seconds in `Retry-After` * Cache responses for data that changes rarely (network lists, DEX lists) * Use batch pricing instead of individual token requests. It does not reduce credits, but it does reduce HTTP calls, which is what the per-minute limit counts * Use the streaming API for live prices instead of polling * Consider the [Pro API](/api-pro/introduction) for 500 requests a minute *** ### 500 Internal Server Error Something went wrong on our side. **What to do:** Retry with exponential backoff (wait 1s, then 2s, then 4s, etc.). If the error persists, check our [Discord](https://discord.gg/DhJge5TUGM) for status updates or contact support. *** ## Streaming API errors The streaming API at `https://streaming.dexpaprika.com` can fail in two ways: HTTP errors before the stream starts, or SSE error events during an active stream. ### HTTP errors (before stream starts) | Status | Meaning | | - | - | | 200 | Connected successfully, streaming | | 403 | `{"error":"plan_required"}` on `/sse/transactions` or `/sse/ohlcv` without a paid key. A keyless stream outside the [showcase assets](/streaming/showcase-streams), or on reserves, gets `{"error":"preview_only"}` instead | | 400 | Bad parameters, unsupported chain, token not found, or one invalid asset in a batch. Body looks like `{"message": "asset not found: ethereum/0xdead... (not found)"}` | | 429 | Stream limit exceeded. Most often your plan's concurrent-stream cap (10 keyless per IP, 10 on a free key, 30 on Dev, 100 on Pro). Keyless, for example: `{"error":"rate_limited","tier":"keyless","message":"Concurrent stream limit reached for your plan. Close an open stream before starting another."}`, plus `links`. Close a stream first. The per-route rate limit and the global stream slot pool also return 429 | **The 400 behavior is strict:** In a POST request with multiple tokens, if even one token is invalid, the entire request fails. Validate all tokens via the REST API before streaming them. ### SSE errors (during active stream) If something goes wrong during an active stream, the error arrives as an SSE event: ``` event: error data: {"message": "..."} ``` **What to do:** Close the connection and reconnect with exponential backoff. *** ## Pagination gotchas Two styles are in play, and mixing them up is the most common migration bug. **Cursor-based**, which covers every search endpoint (`/networks/{network}/pools/search`, `/pools/search`, `/networks/{network}/tokens/search`, `/tokens/search`): read `has_next_page` and pass `next_cursor` back as `cursor`. There is no `page` parameter and no `page_info` object. Passing `page` here does nothing: unknown query parameters are dropped silently and you get a plausible-looking first page back every time. Paging needs an API key: a keyless request that sends `cursor` gets `403` with `"error": "plan_required"`, `"required_tier": "free"` and `"param": "cursor"`. A free key pages without limit, so treat that `403` as a missing key, not a reason to retry. **Page-based**, which is now only `GET /networks/{network}/dexes` and `GET /networks/{network}/pools/{pool_address}/transactions`: `page=1` returns the first page and `page=0` is silently treated as `page=1`. Maximum page size is 100 items (via `limit` parameter) in both styles. Transaction pagination is limited to 100 pages; for deeper history use the `cursor` parameter there too. *** ## Common mistakes and fixes > [accordion] Getting empty results from pool search > > **Symptom:** `GET /networks/{network}/pools/search` returns `{"results": [], "has_next_page": false}` > > **Cause:** Filters are too strict (for example a high `volume_usd_24h_min` on a quiet network), or a very small `limit`. > > **Fix:** Loosen the filters, or use `limit=10` or higher. Note the response wraps rows in `results` and pages with `next_cursor`, not `page_info`. > [accordion] Search returns no results for a known token > > **Symptom:** `GET /search?query=USDC` returns empty arrays. > > **Cause:** Search is best-effort and may not match very common/generic terms well. It searches across tokens, pools, and DEXes. > > **Fix:** Try more specific queries (e.g., the token address), or use the token endpoint directly if you know the network and address. > [accordion] OHLCV returns empty array > > **Symptom:** OHLCV request returns `[]`. > > **Cause:** The `start` date might be before the pool existed, or the pool may have very low activity in the requested period. > > **Fix:** Check the pool's `created_at` field to ensure your date range is valid. Try a broader interval (e.g., `24h` instead of `1h`). > [accordion] Migrating from the removed pool list/filter endpoints > > **Symptom:** Code that used `/pools`, `/networks/{network}/pools`, or `/networks/{network}/pools/filter` now returns `410 Gone`. > > **Cause:** Those endpoints were removed. The replacement is `GET /networks/{network}/pools/search` (single network) or `GET /pools/search` (across networks). > > **Fix:** Repoint to `*/search` and update params and response handling: `volume_24h_min` becomes `volume_usd_24h_min`, `sort_by` becomes `order_by`, `sort_dir` becomes `sort`, and `page` becomes cursor-based (`has_next_page` + `next_cursor`). The response wraps rows in `results`; each row uses `id` (pool address), `volume_usd_24h`, and `transactions_24h`. See the [pool filtering tutorial](/tutorials/pool-filtering). > [accordion] Migrating from the removed DEX pools endpoint > > **Symptom:** Code that used `/networks/{network}/dexes/{dex}/pools` now returns `410 Gone`. > > **Cause:** The endpoint was removed. The DEX moved out of the path and into the `dex_name` filter on pool search. > > **Fix:** Call `GET /networks/{network}/pools/search?dex_name={dex}`. `dex_name` takes the DEX id, the `dex_id` field from `GET /networks/{network}/dexes`, matched case-insensitively. That is what the old path segment held, so it is the value already in your code. Passing that response's `dex_name` field instead, a display name like `Uniswap V3`, returns HTTP 200 with an empty `results` array rather than an error, so an empty page here usually means a display name went in where an id belonged. > > ```bash theme={null} > # before > curl "https://api.dexpaprika.com/networks/ethereum/dexes/curve/pools?order_by=volume_usd&sort=desc&limit=10" > > # after > curl "https://api.dexpaprika.com/networks/ethereum/pools/search?dex_name=curve&order_by=volume_usd_24h&sort=desc&limit=10" > ``` > > Three response changes bite here. Rows come back under `results`, not `pools`. Pagination is `has_next_page` + `next_cursor` instead of `page` + `page_info`. And the 24h volume field is `volume_usd_24h`, with no bare `volume_usd` on the row; passing the old `order_by=volume_usd` is rejected with a `400` naming the accepted values. > [accordion] Streaming connection drops immediately > > **Symptom:** Streaming connection returns 400 instantly. > > **Cause:** One or more assets in the request are invalid (wrong chain ID, non-existent token address). > > **Fix:** Validate every token via the REST API before adding it to a streaming request. In a POST batch, all assets must be valid. One bad asset cancels the entire stream. ### FAQs > [accordion] Does DexPaprika return rate limit headers? > > Not the draft standard `RateLimit-*` family. Every response does carry `X-Api-Plan`, naming the plan the request was evaluated against. For counts, call `GET /usage` or open [console.dexpaprika.com](https://console.dexpaprika.com). See [response headers](/knowledge-base/response-headers). > [accordion] What happens after a rate limit reset? > > The per-minute rate frees up within the next minute; after a 429, wait the `Retry-After` seconds and retry. Credits come back differently per tier: on Dev and Pro the whole allowance returns at `resets_at`, the end of the billing period, and on the free tiers it returns continuously as usage older than 30 days ages out, which is why their 402 carries no such field. > [accordion] Are there different limits per endpoint? > > No. Every endpoint costs one credit per request, with no per-endpoint weights or compute units. The one wrinkle is batch endpoints, which charge one credit per item in the batch. # Network IDs, addresses, and case sensitivity Source: https://docs.dexpaprika.com/knowledge-base/identifiers How to canonicalize network IDs, token addresses, pool addresses, and DEX identifiers when calling the DexPaprika API. Mixed-case inputs return 404 on REST; the MCP layer normalizes. ## Why this matters When you build code that interpolates user input into API paths, the smallest case mismatch returns a 404 with no helpful explanation. The fix is one line, but you have to know about it. This page documents which identifiers are case-sensitive, what the canonical form looks like, and what happens at the wire level if you get it wrong. *** ## Network IDs **Canonical form:** lowercase, underscore-separated. Examples: `ethereum`, `solana`, `base`, `arbitrum`, `bsc`, `polygon`, `optimism`. **What the REST API does with non-canonical input:** ```bash theme={null} curl -o /dev/null -w "%{http_code}\n" "https://api.dexpaprika.com/networks/ETH/pools/search?limit=1" # 404 curl -o /dev/null -w "%{http_code}\n" "https://api.dexpaprika.com/networks/ethereum/pools/search?limit=1" # 200 ``` `ETH` returns 404. `Ethereum`, `eth`, `Solana` all return 404. Network IDs are strict lowercase canonical at the REST layer. **What the MCP layer does with non-canonical input:** The DexPaprika MCP normalizes common synonyms (`eth` → `ethereum`, `sol` → `solana`, `arb` → `arbitrum`, etc.) before calling the REST API. If you are calling the API through the MCP, mixed case and common abbreviations work. If you are calling REST directly, you need to canonicalize yourself. **Recommended pattern:** always call `GET /networks` once at startup and cache the `id` values. Treat any user-supplied network name as untrusted and map it through your cached list before constructing the URL. ```bash theme={null} curl -s "https://api.dexpaprika.com/networks" | jq '.[].id' ``` Returns the authoritative list of canonical IDs. *** ## Token and pool addresses **EVM chains** (Ethereum, BSC, Base, Arbitrum, Polygon, Optimism, Avalanche, and similar): lowercase hex, `0x` prefix, 40 hex characters. ``` 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 ← canonical (lowercase) 0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 ← EIP-55 checksum, not what the API returns ``` The API normalizes checksum addresses internally, so both spellings work for input. The response always uses lowercase. If your code does string comparison between an address from the API and an address from another source (e.g., a wallet, a block explorer, a contract event), lowercase both sides before comparing. **Solana**: base58-encoded, case-sensitive. There is no concept of "lowercase Solana address." Pass it through exactly as you received it. ``` So11111111111111111111111111111111111111112 ← wrapped SOL, canonical case ``` **Sui, Aptos**: 0x-prefixed hex, similar to EVM. Lowercase canonical. **TON**: friendly format (base64url) is case-sensitive. Raw format is hex. Use whichever the explorer shows. *** ## DEX identifiers **Canonical form:** lowercase, underscore-separated. ``` uniswap_v3 raydium pancakeswap_v3 curve_finance balancer_v2 ``` DEX IDs are returned by `GET /networks/{network}/dexes` and passed to the `dex_name` filter on `GET /networks/{network}/pools/search`. The old `GET /networks/{network}/dexes/{dex}/pools` path took the id as a path segment; it was removed and returns `410 Gone`. `dex_name` is the one identifier that is not case-strict. It resolves the id case-insensitively, so `dex_name=curve`, `dex_name=Curve` and `dex_name=CURVE` all return the same rows. It resolves only the id. The DEX list returns `dex_id` and `dex_name` on every row, and despite the matching parameter name it is `dex_id` you pass. Feeding it the `dex_name` field, a display name like `Uniswap V3`, returns HTTP 200 with an empty `results` array rather than an error. The `dex_id` form is also what the removed path segment held, so it is the value already sitting in most existing code. **One catch:** some commit messages and changelog entries refer to DEXes by their on-chain name (e.g., "CronosV3"), but the public API slug is different (e.g., `vvs_v3` on Cronos). Always use the slug returned by the API, never the marketing name. ```bash theme={null} # Get the authoritative slug list for any chain: curl -s "https://api.dexpaprika.com/networks/cronos/dexes" | jq '.dexes[].dex_id' ``` *** ## Quick reference ``` Network ID: lowercase, snake_case ethereum, solana, base EVM address: lowercase hex, 0x-prefix 0xa0b8...eb48 Solana address: base58, case-sensitive So111...1112 DEX ID: lowercase, snake_case uniswap_v3 Pool address: same rules as token (per chain) ``` If you get a 404 and the path looks right at a glance, the first thing to check is case on the network ID and DEX ID. The second thing to check is whether you accidentally URL-encoded part of the path. For other 404 causes, see [Error handling](/knowledge-base/error-handling). # Joining token data across chains Source: https://docs.dexpaprika.com/knowledge-base/joining-across-chains How to safely aggregate token data across multiple chains. Use (chain, address) tuples as the join key, never the symbol. Bridge variants share symbols but have different addresses. ## The silent-merge problem If you query DexPaprika for "USDC" across several chains and aggregate by symbol, you will silently merge bridge variants into native USDC. The numbers you compute will be wrong. The API will not warn you. Your dashboard will say "USDC volume: \$X billion" and that number will be a quiet lie. This page explains why, and what to do instead. *** ## Why symbol is not a safe key A token's `symbol` is metadata. There is no global registry that prevents two different smart contracts from claiming the same symbol. In practice this happens constantly with stablecoins and major tokens, because every cross-chain bridge issues its own representation under the same human-readable name. Concrete example. Search for "USDC": ```bash theme={null} curl -s "https://api.dexpaprika.com/search?query=USDC" | jq '.tokens[] | {chain, id, symbol}' | head -30 ``` A real slice of the response today: ``` chain=ethereum id=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 symbol=USDC chain=solana id=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v symbol=USDC chain=base id=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 symbol=USDC chain=bsc id=0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d symbol=USDC chain=arbitrum id=0xaf88d065e77c8cc2239327c5edb3a432268e5831 symbol=USDC chain=avalanche id=0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e symbol=USDC ``` Six different contracts. Six different `id` (address) values. One shared `symbol`. If you sum `volume_usd` across these by symbol, you produce a number that includes Avalanche-bridged USDC on Avalanche DEXes, Solana-native USDC on Solana DEXes, and Ethereum-native USDC on Ethereum DEXes, all treated as if they were one token. They are not. They are six tokens that happen to share branding. The same trap exists for `WETH`, `WBTC`, `USDT`, `DAI`, and most other tokens that have been bridged to multiple chains. *** ## The safe pattern: `(chain, address)` tuple The only stable global identifier for a token is the combination of the chain it lives on and the contract address on that chain. Every DexPaprika response gives you both fields. Use both. **Pseudocode:** ```python theme={null} # Wrong: totals = defaultdict(float) for token in all_tokens: totals[token["symbol"]] += token["volume_usd"] # Right: totals = defaultdict(float) for token in all_tokens: key = (token["chain"], token["id"].lower()) totals[key] += token["volume_usd"] ``` The `(chain, address)` tuple is unique per token contract globally. There is no overlap. Lowercasing the address (for EVM chains) protects against checksum-vs-lowercase comparison bugs. See [Identifiers](/knowledge-base/identifiers) for the case rules per chain. *** ## When you really do want a cross-chain aggregate Sometimes the bridge-merged number is the one you want. "How much USDC trading happens globally" is a reasonable question. Just make the merge explicit and intentional, not accidental. **Pattern:** maintain your own mapping of "this address on this chain is part of the same logical token as that address on the other chain." Bridge tokens are a graph, not a set. The graph changes whenever a new chain integration ships. Sources for that mapping: * The bridge's own canonical token list (Wormhole, Stargate, LayerZero, Across, Hop, etc.) * A symbology service that does this work for you (CoinGecko, CoinMarketCap, our sister product CoinPaprika) * Manual curation for the handful of tokens you actually care about What you do not do is aggregate by symbol and assume the result is meaningful. *** ## Searching across chains When you start from a token name and don't know the chains it lives on, use `GET /search`: ```bash theme={null} curl -s "https://api.dexpaprika.com/search?query=jupiter" | jq '.tokens[] | {chain, id, name, symbol}' ``` The response is grouped by token (not by chain), and each entry includes the chain it lives on. From there you have your `(chain, address)` pair for any follow-up calls. For details on what fields the search endpoint returns, see [Common patterns -> Pattern 1](/knowledge-base/common-patterns). *** ## Checklist Before you ship code that aggregates token data across chains: 1. Confirm your join key is `(chain, address)`, not `symbol`. 2. Lowercase the address for EVM chains before comparing or hashing. 3. If you intentionally collapse bridge variants, document the mapping somewhere a teammate will find. 4. Write a unit test with at least two USDC addresses on different chains, asserting they do not collapse unless you explicitly want them to. # Rate limits and best practices Source: https://docs.dexpaprika.com/knowledge-base/rate-limits DexPaprika API rate limits, pagination rules, caching strategies, and performance optimization tips for building efficient applications. ## Rate limits | Tier | Credit allowance | Requests per minute | Notes | | - | - | - | - | | **Free (no key)** | 10,000 per IP, rolling 30 days | 15 / min | No API key needed to start | | **Free (registered key)** | 100,000, rolling 30 days | 30 / min | [Free API key](https://console.dexpaprika.com), no card | | **Dev** | 500,000 per billing month | 120 / min | $30 a month. $20 per additional 1M. Served from [api-pro.dexpaprika.com](/api-pro/introduction), with a key | | **Pro** | 5,000,000 per billing month | 500 / min | \$20 per additional 1M. Served from [api-pro.dexpaprika.com](/api-pro/introduction), with a key | | **Enterprise** | Agreed per contract | Agreed per contract | Streaming unmetered | Free tiers, keyed or keyless, call `api.dexpaprika.com`. Dev, Pro and Enterprise call `api-pro.dexpaprika.com` and must send the key in the `Authorization` header; [upgrading to Pro](/api-pro/upgrading) is the whole change. When you exceed the per-minute rate, requests return HTTP 429; retry after a short pause. When the credit allowance runs out, requests return HTTP 402, and retrying will not help. ### How the allowance refills The tiers refill differently, and the difference changes how you pace heavy work. **Free tiers use a rolling 30-day window.** What counts is your usage over the last 30 days, and the window advances an hour at a time. There is no first-of-the-month reset to wait for: credits come back 30 days after you spent them, to the hour. A burst today therefore constrains you for the next 30 days rather than until the calendar turns over. With a key, `period_started_at` on `GET /usage` shows where your window currently begins. **Pro and Enterprise reset on the billing period**, anchored to the subscription date, so the whole allowance returns at once. The practical difference is backfills. Under a calendar month you could spend the allowance and wait for the 1st. Under a rolling window a large one-off pull keeps its weight for a full 30 days, so either spread heavy historical work across days or size it against Pro. ### Requests and credits An HTTP call is a **request**. What it spends is a **credit**. One request costs one credit, with no compute units and no per-endpoint weights: a light call and a heavy call cost the same. Credits are the customer-facing unit, and they are what [console.dexpaprika.com](https://console.dexpaprika.com), invoices and the [pricing page](https://dexpaprika.com/api/pricing) count. Two places the distinction matters. The per-minute limit counts requests, so 15 per minute means 15 HTTP calls per minute. Batch endpoints charge one credit per item, so one HTTP call for 10 tokens is 1 request and 10 credits. > [!NOTE] > > Need more headroom? [Pro](/api-pro/introduction) raises the monthly allowance to 5M credits with per-1M overage, and Enterprise is custom. Plans and checkout are on [pricing](https://dexpaprika.com/api/pricing). ## OHLCV limits by plan The pool OHLCV endpoint (`GET /networks/{network}/pools/{pool_address}/ohlcv`) caps how far back you can query and how fine the candles can be. The cap depends on your plan: | Plan | Candle intervals | History depth | | - | - | - | | **Free (no key)** | `1h`, `6h`, `12h`, `24h` | last 24 hours | | **Free (registered key)** | `10m` and longer | last 7 days | | **Dev** | all (`1m` to `24h`) | last 30 days | | **Pro** | all | unlimited | | **Enterprise** | all | unlimited | How the history cap is applied: * `start` is required and must fall inside the window; `start=-24h` selects the last 24 hours, which every plan may query. `end`, when given, must fall inside it too. * `count_back` counts candles back from `end`, so `count_back` × `interval` must fit inside the window as well. * If `start` is inside the window but the range reaches before it, the request succeeds and the start is moved up to the edge of the window. You get a `403` only when the whole range lies before the window. A request outside the plan's limits returns **HTTP 403** with the `plan_required` envelope. `param` names the parameter that broke the limit, `required_tier` the lowest plan that lifts it, and `message` says the same in words. A free key asking for a month of history: ```json theme={null} { "error": "plan_required", "tier": "free", "required_tier": "dev", "param": "start", "message": "OHLCV history beyond the last 7 days requires a Dev plan (30 days) or a Pro plan (unlimited)", "links": {"pricing": "https://dexpaprika.com/api/pricing", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10"} } ``` A keyless request for `interval=1m`: ```json theme={null} { "error": "plan_required", "tier": "keyless", "required_tier": "free", "param": "interval", "message": "OHLCV intervals below 1h require an API key (free key: 10m and up, Dev and Pro plans: all intervals)", "links": {"register": "https://console.dexpaprika.com", "pricing": "https://dexpaprika.com/api/pricing", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10"} } ``` [Token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token) (`GET /networks/{network}/tokens/{token_address}/ohlcv`) needs a paid plan. Keyless requests and free keys get `403` with `"error": "plan_required"` and no `param`, because the whole endpoint is gated (see [paid-only endpoints](#paid-only-endpoints)); Dev and above follow the Dev, Pro and Enterprise rows of the table above. [Pool indicators](/api-reference/pools/get-a-technical-indicator-for-a-pool) (`GET /networks/{network}/pools/{pool_address}/indicators`) are computed from pool OHLCV candles and follow the same table, for all five indicators, with the same `403` bodies. Without `interval`, a keyless request defaults to `1h` rather than `24h`, since a daily candle does not fit its 24-hour window. [Token indicators](/api-reference/tokens/get-a-technical-indicator-for-a-token) need a paid plan, like token OHLCV. The interval check runs first: a free key asking for `interval=1m` over a month gets the interval message, not the history one. A `403` is not retryable; fix the parameters or upgrade the plan. *** ## Paid-only endpoints A few endpoints are not available to keyless callers or free keys at all. They need a Dev, Pro or Enterprise key, on the paid hosts (`api-pro.dexpaprika.com` for REST, `streaming-pro.dexpaprika.com` for SSE): | Endpoint | Free (no key) | Free (registered key) | Dev / Pro / Enterprise | | - | - | - | - | | `GET /networks/{network}/pools/{pool_address}/transactions` | `403` | `403` | full access | | `GET /sse/transactions` and `POST /sse/transactions` | `403` | `403` | full access | | `GET /networks/{network}/tokens/{token_address}/ohlcv` ([token OHLCV](/api-reference/tokens/get-ohlcv-data-for-a-token)) | `403` | `403` | full access, within the Dev / Pro history window | | `GET /networks/{network}/tokens/{token_address}/indicators` ([token indicators](/api-reference/tokens/get-a-technical-indicator-for-a-token)) | `403` | `403` | full access, within the Dev / Pro history window | | `GET /sse/ohlcv` | `403` | `403` | full access | The refusal is the `plan_required` envelope without a `param`, returned before any data is read, so it costs no credits. `tier` is `keyless` or `free`; `required_tier` is `dev`: ```json theme={null} { "error": "plan_required", "tier": "keyless", "required_tier": "dev", "message": "this endpoint requires a Dev or Pro plan", "links": { "register": "https://console.dexpaprika.com", "pricing": "https://dexpaprika.com/api/pricing", "docs": "https://docs.dexpaprika.com/", "coupon": "https://dexpaprika.com/api/pricing?coupon=START10" } } ``` Details of every field are in [error handling](/knowledge-base/error-handling#403-forbidden-paid-only-endpoint). Every other REST endpoint answers on the free tier (subject to the credit and per-minute limits above), `/sse/reserves` opens with a free key, and `/sse/prices` streams keyless on the [showcase assets](/streaming/showcase-streams) and on any token with a key. *** ## Search freshness Keyless requests and free keys see new pools and tokens in search an hour after they are created. On `GET /networks/{network}/pools/search`, `GET /pools/search`, `GET /networks/{network}/tokens/search` and `GET /tokens/search`, rows created in the last 60 minutes are left out for those two tiers; everything older comes back as before. | Tier | Newest pool or token in search results | | - | - | | **Free (no key)** | Created at least an hour ago | | **Free (registered key)** | Created at least an hour ago | | **Dev / Pro / Enterprise** | As soon as it is indexed | The request still succeeds. Sorting by `created_at` returns the newest rows older than an hour, and a creation window shorter than an hour, such as `created_after=-10m`, returns `200` with an empty `results` array. On a free tier an empty array from a short window says nothing about whether pools were created in it. To see new pools as they are indexed, call `api-pro.dexpaprika.com` with a Dev, Pro or Enterprise key: ```bash theme={null} curl -H "Authorization: YOUR_API_KEY" "https://api-pro.dexpaprika.com/networks/solana/pools/search?order_by=created_at&sort=desc&created_after=-10m" ``` Plans and prices are on [pricing](https://dexpaprika.com/api/pricing). The response does not mark the cutoff: there is no header for it, and `query` echoes the filters you sent, not the hour. A `created_before` later than an hour ago has no effect on these tiers. A token's pools and a DEX's pools come from `/networks/{network}/pools/search` with a token or DEX filter, so they follow the same delay. `/search` and the pool and token detail endpoints are unchanged: a pool or token you already know the address of answers at any age. *** ## Pagination rules The search endpoints page with a cursor. `GET /networks/{network}/dexes` and `GET /networks/{network}/pools/{pool_address}/transactions` are the two that still page with numbers. | Rule | Value | | - | - | | **Cursor endpoints** | All `*/search` paths: read `has_next_page`, send `next_cursor` back as `cursor` | | **Keyless paging** | First page only on `*/search` paths. A keyless request with `cursor` gets `403` `plan_required` with `"param": "cursor"`; any API key, free included, pages without limit | | **First page** | `page=1` (1-indexed), on the two page-based endpoints only | | **Page 0 behavior** | Silently treated as page 1 | | **Max items per page** | 100 (via `limit` parameter) | | **Default items per page** | 50 on the `*/search` paths; varies on the two page-based endpoints | | **Transaction pages** | Max 100 pages; use `cursor` for deeper history | Without an API key, search answers the first page: up to 100 rows with `limit=100`. To read further, send the same request with a free key from the [console](https://console.dexpaprika.com). A keyless request that carries `cursor` is refused with the `plan_required` envelope before any data is read, so it costs no credits: ```json theme={null} { "error": "plan_required", "tier": "keyless", "required_tier": "free", "param": "cursor", "message": "Search results beyond the first page require an API key (free key: all pages). Create one in under a minute at https://console.dexpaprika.com" } ``` *** ## Reduce API calls ### Use batch pricing Instead of making one request per token: ``` GET /networks/ethereum/tokens/0xc02a.../ → 1 request, 1 credit GET /networks/ethereum/tokens/0xa0b8.../ → 1 request, 1 credit GET /networks/ethereum/tokens/0x6b17.../ → 1 request, 1 credit = 3 requests, 3 credits ``` Use batch pricing for up to 10 tokens at once (it needs an API key; a free key is enough): ``` GET /networks/ethereum/multi/prices?tokens=0xc02a...,0xa0b8...,0x6b17... = 1 request, billed as 3 credits (one per token) ``` Batching collapses three round-trips into one HTTP call, which cuts latency, connection overhead and pressure on the per-minute request limit. It does not cut your credit spend: each token in the batch bills as one credit, so 10 tokens cost 10 credits whether you fetch them one at a time or together. Batch for speed and for headroom against the per-minute limit, not to save credits. ### Use streaming for real-time data > [!TIP] > > Sizing a workload before you pick a plan? [Plan your credit usage](/knowledge-base/credit-usage) has measured update rates, four worked cost models, and the point where streaming stops costing less than polling. If you need live prices, don't poll the REST API in a loop. Open one streaming connection instead: ```bash theme={null} # Polling (bad): 60 requests/minute for 1 token while true; do curl ...; sleep 1; done # Streaming (good): 1 connection, updates pushed only when the price moves curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02a..." ``` A single POST `/sse/prices` connection accepts up to **25 assets**. Concurrent SSE streams are capped per plan: 10 keyless (counted per IP), 10 on a free key, 30 on Dev and 100 on Pro (counted per account, from any IP). The next stream over the cap returns `429` with `"error":"rate_limited"` and a message starting `Concurrent stream limit reached`; close an open stream before starting another. Streaming is billed the same way as REST: each update delivered over the stream costs one credit. Because updates are pushed only when a swap moves the price, an idle market costs nothing, but a fast-moving one draws on your credit allowance much as polling would. Budget for the update rate of what you subscribe to, not the number of connections. ### Cache static data Some data changes rarely and can be cached: | Data | Cache for | | - | - | | Network list (`/networks`) | 24 hours | | DEX list (`/networks/{n}/dexes`) | 1 hour | | Token metadata (name, symbol, decimals) | 24 hours | | Pool token pair info | 24 hours | | OHLCV historical data (completed candles) | Forever (completed candles don't change) | Data that changes frequently and should be fetched fresh: * Token prices * Pool volumes and transaction counts * Recent transactions * Current OHLCV candle (incomplete) ### Request only what you need * Use `limit` to control page size. Do not fetch 100 items if you need 5 * Use `order_by` and `sort` to get the most relevant results first * Use the filter endpoint for targeted queries instead of fetching all pools and filtering client-side *** ## Handle errors gracefully ### Implement exponential backoff When requests fail, don't retry immediately in a tight loop: ```python theme={null} import time import requests def fetch_with_backoff(url, max_retries=3): for attempt in range(max_retries): response = requests.get(url) if response.status_code == 200: return response.json() if response.status_code == 429: wait = 2 ** attempt # 1s, 2s, 4s time.sleep(wait) continue if response.status_code >= 500: wait = 2 ** attempt time.sleep(wait) continue # 400, 404, 410 -- don't retry, fix the request response.raise_for_status() raise Exception("Max retries exceeded") ``` ### Don't retry client errors * **400**: fix the request parameters * **404**: verify the network ID and addresses * **410**: use the replacement endpoint Only retry on **429** (rate limit) and **500** (server error). *** ## Streaming best practices ### Validate before streaming The streaming API rejects the entire request if any asset is invalid. Always verify tokens exist via REST first: ```python theme={null} # Validate each token before streaming for token in tokens: resp = requests.get(f"https://api.dexpaprika.com/networks/{token['chain']}/tokens/{token['address']}") if resp.status_code != 200: tokens.remove(token) # Remove invalid tokens ``` ### Use batched POST for multiple tokens Instead of opening multiple GET connections: ``` # Bad: 3 connections for 3 tokens GET /sse/prices?method=token_price&chain=ethereum&address=0xaaa... GET /sse/prices?method=token_price&chain=ethereum&address=0xbbb... GET /sse/prices?method=token_price&chain=ethereum&address=0xccc... ``` Use one POST connection: ```bash theme={null} # Good: 1 connection for up to 25 tokens POST /sse/prices [ {"chain": "ethereum", "address": "0xaaa...", "method": "token_price"}, {"chain": "ethereum", "address": "0xbbb...", "method": "token_price"}, {"chain": "ethereum", "address": "0xccc...", "method": "token_price"} ] ``` ### Reconnect with backoff Streaming connections can drop (network issues, server restarts). Always implement auto-reconnection: ```python theme={null} import time def stream_with_reconnect(url, payload, max_backoff=60): backoff = 1 while True: try: resp = requests.post(url, json=payload, stream=True, headers={"Accept": "text/event-stream"}) if resp.status_code != 200: raise Exception(f"HTTP {resp.status_code}") backoff = 1 # Reset on successful connection for line in resp.iter_lines(): if line and line.startswith(b'data:'): process_event(line) except Exception as e: print(f"Disconnected: {e}. Reconnecting in {backoff}s...") time.sleep(backoff) backoff = min(backoff * 2, max_backoff) ``` ### Parse prices as decimals The streaming `p` field is a string, not a number. Use decimal parsing to avoid floating-point precision issues: ```python theme={null} from decimal import Decimal price = Decimal(data['p']) # Not float(data['p']) ``` *** ## Production checklist > [accordion] Before going to production > > * [ ] Cache network and DEX lists > * [ ] Use batch pricing where possible > * [ ] Use streaming instead of polling for live prices > * [ ] Implement exponential backoff for retries > * [ ] Handle all HTTP status codes (200, 400, 404, 410, 429, 500) > * [ ] Parse streaming prices as decimals, not floats > * [ ] Validate tokens before adding to streaming connections > * [ ] Monitor credit spend in [console.dexpaprika.com](https://console.dexpaprika.com) against your tier's allowance (streaming updates included) > * [ ] Consider [Pro](/api-pro/introduction) if approaching your allowance, and budget time for the base URL and header change it needs ### FAQs > [accordion] Is there a per-minute rate limit? > > Yes. The free tier allows 15 requests a minute without a key and 30 with a [free key](https://console.dexpaprika.com), and Pro allows 500, alongside the credit allowance. Exceeding the per-minute rate returns HTTP 429; retry after a short pause. > [accordion] What is the difference between a request and a credit? > > A request is one HTTP call. A credit is what it spends. One request costs one credit on every plan, with no compute units or per-endpoint multipliers, so the two numbers match except on batch endpoints, where one request charges one credit per item. > [accordion] Do streaming updates count toward my credits? > > Yes. Each price update delivered over an SSE stream costs one credit, the same as a REST call. Updates are pushed only when a swap moves the price, so an idle subscription costs nothing, but an active one draws on your credit allowance. > [accordion] Can I increase the free tier limit? > > Registering for a free API key raises the keyless 10,000 credits to 100,000. Both are measured over a rolling 30 days, not a calendar month. Beyond that, [Pro](/api-pro/introduction) includes 5,000,000 credits a month on the billing period, with per-1M overage. > [accordion] Can I page through search results without a key? > > No. Without a key, search returns the first page, up to 100 rows. Paging with `cursor` needs an API key, and a free key pages without limit. Keyless access is meant for quick tests; a free key also raises your credit allowance. > [accordion] Why does the OHLCV endpoint return 403? > > Your plan's OHLCV window or candle size was exceeded. Without a key you get 1h+ candles over the last 24 hours; a free key gets 10m+ candles over 7 days; Dev gets every interval over 30 days; Pro and Enterprise have no cap. The 403 message says which plan lifts the limit. # Response headers, caching, and CORS Source: https://docs.dexpaprika.com/knowledge-base/response-headers How DexPaprika sets cache-control, what stale-if-error means for your client, current CORS limitations, and the response headers you can rely on. ## Why this matters The DexPaprika REST API sits behind Cloudflare with caching enabled. The behavior is generally invisible if you are a server-side consumer making fresh requests, but a few headers change what your client should do when the origin is briefly unavailable, and the CORS story is incomplete enough to bite browser-side code. This page documents the headers you will see today. *** ## Cache-Control Every successful GET returns a `Cache-Control` header that looks like this: ``` cache-control: public, max-age=60, s-maxage=60, stale-while-revalidate=10, stale-if-error=600 ``` Breaking down what each directive means for your client: | Directive | Meaning | | - | - | | `public` | The response may be cached by shared caches (CDN, proxies). | | `max-age=60` | Your client may serve from its own cache for 60 seconds before revalidating. | | `s-maxage=60` | Shared caches may serve from cache for 60 seconds. | | `stale-while-revalidate=10` | After max-age expires, caches may serve stale for 10 more seconds while fetching a fresh copy in the background. | | `stale-if-error=600` | If revalidation fails, caches may keep serving the stale copy for up to 600 seconds (10 minutes) instead of failing the request. | The practical effect of `stale-if-error=600` is that a brief origin outage does not break your client. If the API is unreachable, your CDN (or a properly configured HTTP cache library) returns the last-good response with `Age: ` indicating staleness. The data is not real-time during the outage, but your application keeps working. **For agents and SDK consumers:** most HTTP client libraries do not honor `stale-if-error` by default. If your application needs the resilience this directive promises, use a cache layer that implements it (e.g., a CDN in front of your service, or libraries like `cachecontrol` for Python, `node-cache-control` for Node.js). **For LLM tool calls:** the MCP layer does not currently cache between calls, so `stale-if-error` does not protect MCP-driven flows. The underlying REST cache still helps because Cloudflare serves the stale copy upstream of the MCP. *** ## Cf-Cache-Status A Cloudflare-specific header that tells you whether your request hit the CDN cache: ``` cf-cache-status: HIT ← served from CDN cache cf-cache-status: MISS ← served from origin cf-cache-status: BYPASS ← cache intentionally skipped cf-cache-status: DYNAMIC ← cache not applicable (e.g., 4xx, 5xx, OPTIONS) ``` This is informational. You do not need to act on it. It is useful when debugging stale data: if you see `HIT` and the data looks old, the cache is doing its job and the response is up to `max-age` seconds out of date. *** ## Age, Last-Modified `Age` is the number of seconds since the cached response was generated. `Last-Modified` is the absolute timestamp of the underlying resource (when the API determined the snapshot). ``` age: 13 last-modified: Wed, 13 May 2026 13:18:11 GMT ``` If you need to tell your user how fresh the price data is, `Age` is the most direct signal: the data is at most `Age + max-age` seconds old. *** ## CORS The DexPaprika REST API currently has **limited CORS support**. Server-side code works without any special handling. Browser-side code that calls the API directly will fail the preflight check. What the API returns today: ``` # OPTIONS preflight: HTTP/2 204 allow: OPTIONS, GET vary: Origin, accept-encoding # Simple GET with Origin header: HTTP/2 200 cache-control: public, max-age=60, ... vary: Origin, accept-encoding ``` What is **missing** for browser fetches to work: * `Access-Control-Allow-Origin` * `Access-Control-Allow-Methods` * `Access-Control-Allow-Headers` Without these, browsers reject the response even though the network call succeeds. Browser code on your own site needs one of these instead: 1. **Server-side proxy.** Run a small worker (Cloudflare Workers, Vercel Edge, Deno Deploy) that fetches from `api.dexpaprika.com` and re-serves with the right CORS headers to your frontend. 2. **DexPaprika MCP.** Connect through `mcp.dexpaprika.com` from an agent runtime that handles the CORS layer for you. 3. **Static export.** If your data refreshes infrequently, fetch at build time and serve as static JSON. For real-time browser dashboards, options 1 and 2 are the practical paths. *** ## X-Api-Plan Every response carries the plan the request was evaluated against: ``` x-api-plan: keyless ``` A keyless request returns `keyless`. A request authenticated with a key returns that key's plan: `free` for a free API key, `dev`, `pro` or `enterprise` for a paid one. The same value is returned in the body of `GET /usage`, alongside credit counts when the request is authenticated on `api-pro.dexpaprika.com`. Use it to confirm a key is actually being applied: if you set an `Authorization` header and still see `keyless`, the key is not reaching the billing gate. Called on `api-pro.dexpaprika.com` with no `Authorization` header at all, that host answers `403` with an HTML block page rather than JSON; see [upgrading to Pro](/api-pro/upgrading). *** ## X-Credits-\* and RateLimit-\* Every response also reports where you stand against your allowances: ``` x-credits-limit: 10000 x-credits-remaining: 5316 x-credits-reset: 0 ratelimit-limit: 10 ratelimit-remaining: 7 ratelimit-reset: 27 ``` `x-credits-limit` and `x-credits-remaining` are your credit allowance and what is left of it. `x-credits-reset` is `0` on keyless and free keys, which count over a rolling 30-day window with no reset moment; on Dev and Pro it holds the end of the billing period. The `ratelimit-*` trio follows the IETF draft (`ratelimit-reset` is seconds until the window rolls). For pacing, treat a `429` and its `Retry-After` as authoritative rather than the value of `ratelimit-limit` on a `200`. The allowances themselves are on [Rate limits](/knowledge-base/rate-limits). *** ## h-hap You will see this header on every response: ``` h-hap: 01 ``` It is an internal infrastructure marker. You can ignore it. Future versions of the API may remove it without notice. *** ## Headers not present (today) Some headers you might expect from a mature API are not currently emitted: * **`Deprecation` (RFC 9745)** and **`Sunset` (RFC 8594)**: not set. When DexPaprika deprecates an endpoint or field in the future, these will appear with the relevant dates. Until then, deprecation status is documented in the API reference and in the [changelog](/changelog/changelog), not in headers. * **`ETag` / `If-None-Match`**: not set. Use `Last-Modified` if you need to track resource freshness. *** ## Quick reference ``` cache-control: public, max-age=60, ..., stale-if-error=600 cf-cache-status: HIT | MISS | BYPASS | DYNAMIC x-api-plan: keyless | free | dev | pro | enterprise x-credits-*: limit | remaining | reset ratelimit-*: limit | remaining | reset age: last-modified: vary: Origin, Accept-Encoding ``` All response headers are lowercase per HTTP/2 convention. If you parse them from a library that returns header names verbatim, accept both `Cache-Control` and `cache-control`. Some intermediaries normalize, others do not. For error responses (4xx, 5xx), most cache-related headers are absent and `cf-cache-status: DYNAMIC` is set. The error envelopes themselves are documented in [Error handling](/knowledge-base/error-handling). # Skill Source: https://docs.dexpaprika.com/skill Query on-chain DEX data and stream real-time crypto prices using DexPaprika -- token prices, liquidity pools, OHLCV history, swap transactions, advanced pool filtering, and live price streaming via SSE across 33+ blockchains. Use this skill whenever the user wants to fetch crypto token prices, look up pool or DEX data, get historical candlestick data, find new pools, filter pools by volume/transactions/age, stream live prices, build real-time dashboards, or build anything that needs on-chain DEX data. Also use when the user mentions DexPaprika, dexpaprika, streaming crypto prices, or SSE price feeds. REST docs: https://docs.dexpaprika.com -- Streaming docs: https://docs.dexpaprika.com/streaming/introduction # DexPaprika API Free API for on-chain DEX data and real-time price streaming. 33+ blockchains, 25M+ tokens, 27M+ pools. No API key, no authentication. | Service | Base URL | Purpose | | - | - | - | | REST API | `https://api.dexpaprika.com` | Token data, pools, OHLCV, transactions, search | | Streaming API | `https://streaming.dexpaprika.com` | Real-time price updates via SSE (\~1s intervals). [Full docs](https://docs.dexpaprika.com/streaming/introduction) | | CLI | `curl -sSL .../install.sh \| sh` | Terminal tool wrapping the full API. Install: `curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh \| sh` | All examples use curl, but any HTTP client works. The CLI (`dexpaprika-cli`) wraps every endpoint into simple commands with `--output json --raw` for scripting. REST responses are JSON. Streaming responses are Server-Sent Events. *** ## Core concepts **Network IDs** are lowercase chain identifiers: `ethereum`, `solana`, `bsc`, `arbitrum`, `base`, `polygon`, `optimism`, `avalanche`, etc. Get the full list from `GET /networks`. **Token addresses** are the on-chain contract addresses (e.g., `0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` for WETH on Ethereum, `So11111111111111111111111111111111111111112` for SOL on Solana). **Pool addresses** are the on-chain liquidity pool contract addresses. Find them via token pools or network pools endpoints. If you don't know the network or address for a token, use search first. *** ## Endpoints ### Search (start here when you don't have addresses) ``` GET /search?query={query} ``` Search tokens, pools, and DEXes by name, symbol, or address. Case-insensitive. Use this to resolve "what's the ETH price" into the actual network + address you need. **Example:** Find Jupiter token ```bash theme={null} curl "https://api.dexpaprika.com/search?query=jupiter" ``` *** ### Token price and details ``` GET /networks/{network}/tokens/{token_address} ``` Returns name, symbol, chain, decimals, USD price, fully diluted valuation, liquidity, and volume/transaction stats at multiple time windows (24h, 6h, 1h, 30m, 15m, 5m). **The price is at** `response.summary.price_usd` **Example:** Get SOL price ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" ``` Extract just the price: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112" | jq '.summary.price_usd' ``` *** ### Batch token prices ``` GET /networks/{network}/multi/prices?tokens={addr1},{addr2},{addr3} ``` Fetch USD prices for multiple tokens in one request. Comma-separated addresses, max 10 per request. Unknown or unpriced tokens are silently omitted from the response. **Example:** WETH + USDC on Ethereum ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ``` Response is an array of `{id, chain, price_usd}` objects. Order is not guaranteed. *** ### Top pools on a network ``` GET /networks/{network}/pools?page={1}&limit={10}&order_by={volume_usd}&sort={desc} ``` List top liquidity pools. Pages are 1-indexed, max 100 per page. Order by: `volume_usd`, `price_usd`, `transactions`, `last_price_change_usd_24h`, `created_at`. **Example:** Top 5 Ethereum pools by volume ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools?limit=5&order_by=volume_usd&sort=desc" ``` *** ### Advanced pool filtering (new) ``` GET /networks/{network}/pools/filter ``` Filter pools with range queries on volume, transactions, and creation date. This is the endpoint to use for building pool screeners, finding high-volume pools, or discovering recently created pools that meet specific criteria. **Parameters:** | Parameter | Type | Description | | - | - | - | | `page` | integer | Page number, **1-indexed** (default: 1) | | `limit` | integer | Items per page, 1-100 (default: 50) | | `volume_24h_min` | number | Min 24h volume in USD | | `volume_24h_max` | number | Max 24h volume in USD | | `txns_24h_min` | integer | Min transactions in last 24h | | `created_after` | integer | UNIX timestamp -- only pools created after this | | `created_before` | integer | UNIX timestamp -- only pools created before this | | `sort_by` | string | `volume_24h` (default), `txns_24h`, `created_at` | | `sort_dir` | string | `asc` or `desc` (default: `desc`) | Note: `volume_7d_min`, `volume_30d_min`, `liquidity_usd_min`, `liquidity_usd_max` exist in the spec but are not functional yet -- they return empty results. All filters combine with AND logic. The response includes `page_info` with `total_items` and `total_pages`. **Example:** High-volume Ethereum pools (>\$100k daily volume) ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/filter?volume_24h_min=100000&sort_by=volume_24h&sort_dir=desc" ``` **Example:** Recently created Solana pools with activity ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/filter?created_after=1709251200&txns_24h_min=50&sort_by=created_at&sort_dir=desc" ``` *** ### Pool details ``` GET /networks/{network}/pools/{pool_address}?inversed={false} ``` Returns liquidity, reserves, pricing, token pair info, and DEX metadata for a specific pool. Set `inversed=true` to flip the price ratio (token1/token0 instead of token0/token1). *** ### Pool OHLCV (historical candlesticks) ``` GET /networks/{network}/pools/{pool_address}/ohlcv?start={timestamp}&interval={24h}&limit={30} ``` Historical price candlestick data. `start` is required (ISO 8601 or UNIX timestamp). Optional `end` (max 1 year from start). **Intervals:** `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` **Max data points:** 366 per request **Example:** Last 30 days of daily candles for a pool ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=2025-01-01&interval=24h&limit=30" ``` *** ### Pool transactions ``` GET /networks/{network}/pools/{pool_address}/transactions?page={1}&limit={20} ``` Recent swaps, liquidity adds, and removes. Reverse chronological order. Pages 1-indexed, max 100 pages. For deep pagination, use `cursor` parameter (transaction ID) instead of page numbers. Each transaction includes: token amounts (`amount_0`, `amount_1`), volumes (`volume_0`, `volume_1`), USD prices (`price_0_usd`, `price_1_usd`), token symbols, sender/recipient, and timestamps. *** ### Pools for a token ``` GET /networks/{network}/tokens/{token_address}/pools?order_by={volume_usd}&sort={desc}&limit={10} ``` Find all pools containing a specific token. Optional: add `address` parameter to filter to pools paired with a second specific token. Add `reorder=true` to make the queried token the primary token in all metrics. *** ### DEXes on a network ``` GET /networks/{network}/dexes ``` List all DEXes on a network with their identifiers. Use the `dex` id to filter pools: ``` GET /networks/{network}/dexes/{dex}/pools ``` *** ### Networks ``` GET /networks ``` Returns all supported blockchain networks with their IDs. Use these IDs in all other endpoints. *** ### Platform stats ``` GET /stats ``` High-level counts: total networks, DEXes, pools, and tokens. Useful for health checks. *** ## Streaming API -- Real-time prices via SSE Stream live token prices with \~1 second update intervals. Uses Server-Sent Events (SSE) -- works with any HTTP client that supports streaming. For full streaming docs, guides, and code examples see: [https://docs.dexpaprika.com/streaming/introduction](https://docs.dexpaprika.com/streaming/introduction) **Base URL:** `https://streaming.dexpaprika.com` (no landing page -- only the `/stream` paths below work) ### Stream a single token (GET) ```bash theme={null} curl -N "https://streaming.dexpaprika.com/stream?method=t_p&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ``` ### Stream multiple tokens (POST) -- recommended for 2+ tokens Send a JSON array of assets. Single connection, up to 2,000 tokens. ```bash theme={null} curl -N -X POST "https://streaming.dexpaprika.com/stream" \ -H "Accept: text/event-stream" \ -H "Content-Type: application/json" \ -d '[ {"chain": "solana", "address": "So11111111111111111111111111111111111111112", "method": "t_p"}, {"chain": "ethereum", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "method": "t_p"} ]' ``` Each asset object requires `chain` (network ID), `address` (token contract), and `method` (always `t_p` for token price). ### SSE event format ``` data: {"a":"0xc02a...","c":"ethereum","p":"2739.79","t":1769778188,"t_p":1769778187} event: t_p ``` | Field | Meaning | | - | - | | `a` | Token address | | `c` | Chain ID | | `p` | Price in USD (string for precision -- parse as decimal) | | `t` | Server send timestamp (UNIX seconds) | | `t_p` | Price event timestamp (UNIX seconds) | Use `now() - t` for network latency, `now() - t_p` for total price data latency. ### Python streaming example ```python theme={null} import requests, json assets = [ {"chain": "ethereum", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "method": "t_p"}, {"chain": "solana", "address": "So11111111111111111111111111111111111111112", "method": "t_p"} ] r = requests.post("https://streaming.dexpaprika.com/stream", headers={"Accept": "text/event-stream", "Content-Type": "application/json"}, json=assets, stream=True) for line in r.iter_lines(): if line and line.startswith(b'data:'): data = json.loads(line[5:]) print(f"{data['c']} {data['a']}: ${data['p']}") ``` ### Streaming constraints * **Max 2,000 assets** per POST request * **All assets must be valid** -- one invalid asset cancels the entire stream with HTTP 400 * **Global stream limit:** 10,000 concurrent streams per server * Validate assets via REST `/search` before streaming * Use multiple smaller requests (100-500 each) rather than one massive request for better load distribution * Reconnect with exponential backoff on disconnect ### Streaming errors | Status | Meaning | | - | - | | 200 | Connected, streaming | | 400 | Bad params, unsupported chain, asset not found, or one invalid asset in batch | | 429 | Global stream limit exceeded -- retry with backoff | Errors during an active stream arrive as SSE events: `event: error` + `data: {"message": "..."}`. Handle both HTTP errors (before stream starts) and SSE errors (during streaming). *** ## Constraints and limits ### REST API * **Rate limit:** 10,000 requests per day * **Batch prices:** max 10 tokens per request * **Pagination:** max 100 items per page * **OHLCV:** max 366 data points per request, max 1 year range * **Transactions:** max 100 pages of pagination * **Pagination:** all endpoints are 1-indexed (page=0 is silently treated as page=1) ### Streaming API * **Max assets per request:** 2,000 * **Global concurrent streams:** 10,000 per server * **All assets must be valid** or entire stream is cancelled *** ## Error handling | Status | Meaning | What to do | | - | - | - | | 200 | Success | Parse JSON response | | 400 | Bad request (invalid params, too many tokens, bad sort field) | Check parameter values and constraints above | | 404 | Network, token, or pool not found | Verify the network ID and address; use /search to find correct values | | 410 | Endpoint deprecated (old /pools) | Use `/networks/{network}/pools` instead | | 429 | Rate limit exceeded | Back off and retry; consider caching responses | | 500 | Server error | Retry with backoff | When a batch price request contains only invalid tokens, you get HTTP 200 with an empty array -- not an error. *** ## Common workflows ### "What's the price of X?" 1. `GET /search?query=X` to find the network and token address 2. `GET /networks/{network}/tokens/{address}` to get price at `.summary.price_usd` ### "Show me the top pools on Ethereum" 1. `GET /networks/ethereum/pools?limit=10&order_by=volume_usd&sort=desc` ### "Find new pools with high volume" 1. `GET /networks/{network}/pools/filter?created_after={unix_timestamp}&volume_24h_min=50000&sort_by=created_at&sort_dir=desc` ### "Get historical price data for a token" 1. Find the token's pools via `GET /networks/{network}/tokens/{address}/pools?order_by=volume_usd&sort=desc&limit=1` (the highest-volume pool is the best source) 2. `GET /networks/{network}/pools/{pool_address}/ohlcv?start={date}&interval=24h&limit=30` ### "Compare prices of multiple tokens" 1. `GET /networks/{network}/multi/prices?tokens={addr1},{addr2},{addr3}` ### "Stream live price updates for a token" 1. `GET https://streaming.dexpaprika.com/stream?method=t_p&chain={network}&address={token_address}` ### "Build a real-time dashboard tracking multiple tokens" 1. Validate tokens exist via REST: `GET /search?query={name}` or `GET /networks/{network}/tokens/{address}` 2. `POST https://streaming.dexpaprika.com/stream` with JSON array of `{chain, address, method: "t_p"}` objects 3. Parse SSE events, read price from `p` field (string -- parse as decimal for precision) ### "Monitor a token's price with alerts" 1. Stream the token via GET or POST to `streaming.dexpaprika.com` 2. Compare each incoming `p` value against your threshold 3. Reconnect with exponential backoff on disconnect *** ## What this skill does NOT cover * **CoinPaprika centralized exchange data** -- that's a different API (`api.coinpaprika.com`) * **Trading or swapping** -- DexPaprika is read-only; it does not execute trades *** ## Full documentation * [REST API reference](https://docs.dexpaprika.com/api-reference/introduction) * [Streaming API docs](https://docs.dexpaprika.com/streaming/introduction) * [Tutorials](https://docs.dexpaprika.com/tutorials/tutorial_intro) # Detect Liquidity Drains in Real Time Source: https://docs.dexpaprika.com/streaming/guides/detect-liquidity-drains Build a rug-pull detector that alerts the block liquidity leaves a DEX pool. Free API key, no node, no log decoding, no getReserves polling. ~70 lines. To detect a liquidity drain (a rug pull, an LP exit, a liquidity migration) programmatically, subscribe to a pool's reserves over SSE and alert when the pool's **net USD reserve change in a single block** exceeds a threshold. A good starting bar: more than $10,000 *and* more than 20% of the pool. Swaps can't trigger this signal, because a swap moves one token up and the other down and nets to roughly zero. Only liquidity actually entering or leaving a pool moves the net total. A detector built this way caught a fresh Base pool losing **97.3% of its liquidity ($67k) in one block\*\*, the night it was first switched on. This guide builds that detector in about 70 lines of JavaScript or Python, watching pools on three chains over one connection. No node, no event-log decoding, no `getReserves` polling loop. The reserves feed needs an API key. A [free one](https://console.dexpaprika.com) takes a minute and no card, and the examples below assume you have set it as `DEXPAPRIKA_API_KEY`. > [card] [Production example: LiquidityRadar](https://github.com/coinpaprika/liquidity-radar) > > **The full open-source version of what you'll build here.** A zero-dependency engine, a clone-and-run CLI, and a deployable Cloudflare Worker with a public status page, webhook alerts, and flood protection. Fork it and point it at your own pools. [View source →](https://github.com/coinpaprika/liquidity-radar) ## How detection works Every block in which a subscribed pool's reserves change, the stream emits a `pool_reserves` event with USD values already computed, including `total_delta_usd`, the signed dollar change of the whole pool in that block. That one field is the entire trick: | What happened on-chain | `total_delta_usd` | Why | | - | - | - | | Swap (any size) | ≈ \$0 | One token's reserve goes up, the other goes down. The dollar values cancel. | | Liquidity added | Strongly positive | Both tokens' reserves rise together. | | Liquidity removed / **drained** | Strongly negative | Both tokens' reserves fall together. Nothing cancels it. | A real capture of a $45,930 swap in the USDC/WETH 0.05% pool: one leg `+$46,015`, the other `-\$45,930`, net `total_delta_usd: 84.37\`. The same pool's biggest one-block *liquidity* moves run six figures with nothing on the other side. A drain cannot disguise itself as trading volume. > [!WARNING] > > **Big numbers arrive as strings.** The raw token amounts (`reserve`, `delta`) and `block` are JSON strings, because they exceed JavaScript's `Number.MAX_SAFE_INTEGER`. Parse them with `BigInt` if you need them. For drain detection you don't: the USD fields (`total_reserve_usd`, `total_delta_usd`, `reserve_usd`, `delta_usd`) are regular numbers, pre-computed server-side. ## Step 1: Watch a pool's reserves live The reserves feed needs the key you set above. This streams real reserve changes for the largest USDC/WETH pool on Ethereum, one event per block in which its reserves changed: ```bash theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming.dexpaprika.com/sse/reserves?method=pool_reserves&chain=ethereum&address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" ``` ```text Live capture from production theme={null} event: pool_reserves request_id: 0 data: {"chain":"ethereum","pool_id":"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","block":"25286203","previous_block":"25286202","tokens":[{"token_id":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","reserve":"19397067871705","delta":"46015585500","price_usd":0.9999897960291432,"reserve_usd":19396869.94,"delta_usd":46015.11},{"token_id":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","reserve":"39923043997983135635229","delta":"-28370314221473922862","price_usd":1618.97,"reserve_usd":64634288.92,"delta_usd":-45930.74}],"total_reserve_usd":84031158.86,"total_delta_usd":84.37,"timestamp":1781084332,"block_timestamp":1781084327} ``` The fields the detector cares about: * `total_reserve_usd`: the pool's current total liquidity in USD * `total_delta_usd`: the signed USD change this block (the swap above nets to `84.37`, which is noise) * `block`: where it happened, for receipts > [!TIP] > > To follow a **token across every pool it trades in**, use `method=token_reserves` with a token address instead. Those events are one-sided by nature (a large buy also drops reserves), so reserve the word "drain" for pool-mode alerts. ## Step 2: The detector Watch up to **25 pools on a single connection** by POSTing a JSON array. Events route back via `request_id`, the index of the subscription in your array. Mixing chains in one connection works. The detection rule, two thresholds that scale together: * `|total_delta_usd| ≥ MIN_USD`, which ignores dust * `|total_delta_usd| / reserve_before ≥ MIN_PCT`, which ignores moves the pool barely feels On a $50M blue-chip pool, 20% means an eight-figure event. On a $100k day-old memecoin pool, a \$20k pull trips it. Same two numbers, self-scaling. ```javascript drain-detector.mjs theme={null} // drain-detector.mjs: alert when a pool loses a big share of its liquidity // in one block. Node 18+, no dependencies. Needs DEXPAPRIKA_API_KEY. const POOLS = [ { chain: "ethereum", address: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", label: "USDC/WETH 0.05%" }, { chain: "base", address: "0xb2cc224c1c9fee385f8ad6a55b4d94e92359dc59", label: "WETH/USDC (Aerodrome)" }, { chain: "solana", address: "8sjV1AqBFvFuADBCQHhotaRq5DFFYSjjg1jMyVWMqXvZ", label: "USDT/USDC (Orca)" }, ]; const MIN_USD = 10_000; // ignore moves smaller than this const MIN_PCT = 0.2; // ...and smaller than this share of the pool async function watch() { const res = await fetch("https://streaming.dexpaprika.com/sse/reserves", { method: "POST", // The key is the entire Authorization value, with no scheme word in front of it. headers: { "content-type": "application/json", authorization: process.env.DEXPAPRIKA_API_KEY, }, body: JSON.stringify(POOLS.map(({ chain, address }) => ({ chain, address, method: "pool_reserves" }))), }); if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`); let buffer = ""; for await (const chunk of res.body.pipeThrough(new TextDecoderStream())) { buffer += chunk; const frames = buffer.split("\n\n"); buffer = frames.pop(); // keep the partial frame for the next chunk for (const frame of frames) { const event = frame.match(/^event: (.*)$/m)?.[1]; const id = frame.match(/^request_id: (.*)$/m)?.[1]; const data = frame.match(/^data: (.*)$/m)?.[1]; if (!data) continue; if (event === "error") throw new Error(JSON.parse(data).message); if (event !== "pool_reserves") continue; // skip pings and warnings const update = JSON.parse(data); const delta = update.total_delta_usd; const before = update.total_reserve_usd - delta; // reserve before this block const pct = before > 0 ? delta / before : 0; // A swap moves one token up and the other down, so total_delta_usd nets // to ~0. Only liquidity entering or leaving the pool moves the total. if (Math.abs(delta) < MIN_USD || Math.abs(pct) < MIN_PCT) continue; const pool = POOLS[Number(id)] ?? { label: update.pool_id }; const verb = delta < 0 ? "DRAIN" : "ADD"; console.log( `${verb} ${pool.label} on ${update.chain}: ` + `${delta < 0 ? "-" : "+"}$${Math.abs(delta).toLocaleString("en-US", { maximumFractionDigits: 0 })} ` + `(${(pct * 100).toFixed(1)}% of the pool) at block ${update.block}`, ); } } } while (true) { try { console.log("connecting…"); await watch(); } catch (err) { console.error(String(err)); } await new Promise((r) => setTimeout(r, 5000)); // simple retry; see the production guide } ``` ```python drain_detector.py theme={null} # drain_detector.py: alert when a pool loses a big share of its liquidity # in one block. Python 3.8+, `pip install requests`. Needs DEXPAPRIKA_API_KEY. import json import os import time import requests POOLS = [ {"chain": "ethereum", "address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "label": "USDC/WETH 0.05%"}, {"chain": "base", "address": "0xb2cc224c1c9fee385f8ad6a55b4d94e92359dc59", "label": "WETH/USDC (Aerodrome)"}, {"chain": "solana", "address": "8sjV1AqBFvFuADBCQHhotaRq5DFFYSjjg1jMyVWMqXvZ", "label": "USDT/USDC (Orca)"}, ] MIN_USD = 10_000 # ignore moves smaller than this MIN_PCT = 0.20 # ...and smaller than this share of the pool def watch(): response = requests.post( "https://streaming.dexpaprika.com/sse/reserves", # The key is the entire Authorization value, with no scheme word in front of it. headers={"Authorization": os.environ["DEXPAPRIKA_API_KEY"]}, json=[{"chain": p["chain"], "address": p["address"], "method": "pool_reserves"} for p in POOLS], stream=True, timeout=60, ) response.raise_for_status() event_type, request_id = None, None for raw_line in response.iter_lines(decode_unicode=True): line = raw_line or "" if line.startswith("event: "): event_type = line[7:] elif line.startswith("request_id: "): request_id = line[12:] elif line.startswith("data: "): if event_type == "error": raise RuntimeError(json.loads(line[6:])["message"]) if event_type != "pool_reserves": # skip pings and warnings continue update = json.loads(line[6:]) delta = update["total_delta_usd"] before = update["total_reserve_usd"] - delta # reserve before this block pct = delta / before if before > 0 else 0 # A swap moves one token up and the other down, so total_delta_usd # nets to ~0. Only liquidity entering or leaving moves the total. if abs(delta) < MIN_USD or abs(pct) < MIN_PCT: continue pool = POOLS[int(request_id)] if request_id and request_id.isdigit() else {"label": update["pool_id"]} verb = "DRAIN" if delta < 0 else "ADD" print( f"{verb} {pool['label']} on {update['chain']}: " f"{'-' if delta < 0 else '+'}${abs(delta):,.0f} " f"({pct * 100:.1f}% of the pool) at block {update['block']}" ) while True: try: print("connecting…") watch() except Exception as err: # noqa: BLE001, simple retry; see the production guide print(err) time.sleep(5) ``` Run it (`node drain-detector.mjs` / `python drain_detector.py`). At the default thresholds, alerts are rare by design. A 20% single-block move on a real pool is an event. Output from a live run with thresholds lowered for demonstration: ```text Live run (thresholds lowered to show output) theme={null} connecting… ADD WETH/USDC (Aerodrome) on base: +$429,397 (5.3% of the pool) at block 47239458 DRAIN WETH/USDC (Aerodrome) on base: -$329,331 (-3.8% of the pool) at block 47239459 DRAIN WETH/USDC (Aerodrome) on base: -$100,020 (-1.2% of the pool) at block 47239465 ADD WETH/USDC (Aerodrome) on base: +$97,078 (1.2% of the pool) at block 47239466 ``` That add/drain oscillation is real and worth understanding. The thresholds section explains it. ## Step 3: Tune the thresholds > [accordion] Why 20%? Because liquidity bots churn below it > > Major pools host [JIT (just-in-time) liquidity](https://dexpaprika.com/glossary/jit-liquidity-just-in-time-liquidity) bots that add and remove six-figure positions around individual swaps. We've measured them moving ±4% of an \$8M pool *every block*, which is exactly the oscillation in the sample output above. Liquidity genuinely moves, so a detector genuinely fires; it's just market plumbing, not an exit. A 20% bar clears that churn with a 5x margin. If you watch pools with heavy JIT activity and want a lower bar, net the deltas over a few consecutive blocks: JIT cycles cancel out, drains don't. > [accordion] Watching fresh, small pools (where rugs actually happen) > > For day-old pools in the $20k to $500k range, the defaults already work: a [rug pull](https://dexpaprika.com/glossary/rug-pull) on a $70k pool is a ~$70k negative delta at \~100% of the pool. If you want earlier partial-exit signals, drop `MIN_USD` to \~\$5k and keep `MIN_PCT` at 20%. On small pools the percentage gate does the real work. > [accordion] Finding pools worth watching > > The REST pool search endpoint finds rug-candidates programmatically: pools created in the last week with real activity: > > ```bash theme={null} > curl "https://api.dexpaprika.com/networks/base/pools/search?created_after=-7d&txns_24h_min=50&volume_usd_24h_min=10000&order_by=created_at&sort=desc&limit=25" > ``` > > Feed the resulting pool IDs straight into `POOLS`. One connection covers 25 of them. ## Step 4: Route alerts anywhere Replace `console.log` with a webhook call and the detector becomes a bot. Discord, for example: ```javascript theme={null} await fetch(process.env.WEBHOOK_URL, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ content: alertText }), }); ``` Before pointing this at a channel people read, add flood protection: deduplicate on `pool_id + block`, hold a per-pool cooldown, and cap sends per hour, because a multi-block drain fires once per block otherwise. [LiquidityRadar](https://github.com/coinpaprika/liquidity-radar) implements that gate, plus reconnection with backoff, a persistent status page, and one-command Cloudflare deployment, if you'd rather fork than build. ## Limits and errors worth knowing * **25 subscriptions per POST connection, 10 concurrent streams on a free key** (30 on Dev, 100 on Pro). Chunk bigger watchlists across connections. * **One invalid entry rejects the whole multiplexed connection.** The stream sends an `error` event naming the bad asset (`"pool not found: …"`), then closes. Validate addresses before subscribing. * **`error` events are not all equal**: subscription problems (`asset not found`, `unsupported chain`) are permanent: fix the input, don't retry. Capacity problems (a `429` saying `Concurrent stream limit reached`) clear once a stream closes, so retry those with backoff. * A `ping` arrives every \~15s; if nothing arrives for 30s+, reconnect. See [error handling](/knowledge-base/error-handling) for the full catalog. ## FAQ > [accordion] Can a rug pull hide from this detector? > > Not by swapping: swaps net to \~zero in `total_delta_usd` regardless of size. An exit could in principle drip liquidity out in many small blocks below your thresholds, which is why percentage-of-pool matters more than absolute USD: 100 blocks of 1% exits still cross a 20% net threshold if you accumulate deltas over a window. > [accordion] Why SSE instead of polling getReserves or listening to Sync events? > > Polling misses everything between polls. A pool can drain in one block, and a 30-second loop finds out after the money is gone. Decoding `Sync`/`Mint`/`Burn` logs over a WebSocket node connection works but costs a node provider subscription and per-DEX decoding logic. The reserve stream pushes per-block deltas with USD values pre-computed, for every major DEX shape (Uniswap v2/v3/v4, Curve, Aerodrome, Raydium, Orca…), and without a line of per-DEX decoding of your own. > [accordion] Is this free? What's the catch? > > Free, but not keyless. The reserves feed needs an API key, so [register a free one](https://console.dexpaprika.com) first: it takes a minute and no card. Prices are the feed that streams without a key, on the [34 showcase assets](/streaming/showcase-streams). Beyond that the limits are the catch, and there are three: 25 subscriptions per connection, 10 concurrent streams per IP, and each update delivered costs one credit against your monthly allowance. That allowance is 100,000 credits per rolling 30 days with a free key, and 5M on [Pro at \$99 a month](https://dexpaprika.com/api/pricing). A quiet market costs almost nothing; a fast-moving pair draws down credits much like polling would. See [rate limits](/knowledge-base/rate-limits). > [accordion] Does it work on Solana / Base / my chain? > > The same code in this guide watches Ethereum, Base, and Solana on one connection. Any chain DexPaprika indexes works, see [networks](https://api.dexpaprika.com/networks). ## Next steps > [card] [Reserve Streaming Overview](/streaming/reserves-streaming) > > The full feature guide: both subscription methods, payload schemas, limits. > [card] [Streaming Quick Start](/streaming/tutorials/quick-start) > > Prices and reserves from zero in 10 minutes. > [card] [Multi-Pool API Reference](/streaming/subscribe-to-multiple-reserves-streaming) > > The POST /sse/reserves endpoint in full detail. > [card] [LiquidityRadar on GitHub](https://github.com/coinpaprika/liquidity-radar) > > The production version: deployable worker, status page, alert gate. *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. # Production-Grade Reserve Streaming Source: https://docs.dexpaprika.com/streaming/guides/production-reserve-streaming Run /sse/reserves 24/7 without losing data or hammering the API: reconnection that actually works, missed-block detection, error classification, and multiplexing at scale. Running a reserve stream in production comes down to five rules: trust events, not HTTP status codes; watch the heartbeat; know that state self-heals but ledgers don't; classify errors before retrying; and multiplex deliberately. This guide covers all five with tested code, drawn from running a 58-pool monitor against `/sse/reserves` around the clock. One lesson cost us a night of data: treating a transient "stream limit exceeded" error as fatal silenced 8 pools until morning. The patterns below exist so you don't repeat it. If you haven't streamed reserves before, start with the [drain detection guide](/streaming/guides/detect-liquidity-drains). This one assumes you have a working consumer and need it to survive real networks, real restarts, and real error states. > [!NOTE] > > Both programs read `DEXPAPRIKA_API_KEY` from the environment. The reserves feed needs a key, and a [free one](https://console.dexpaprika.com) takes a minute and no card. Leave it unset and both stop before the first connect with a line telling you what is missing, rather than reconnecting against a feed that will never open for them. ## The five rules | Rule | Why it exists | | - | - | | Reset backoff only after a parsed event | Proxies can return HTTP 200 and close instantly. Resetting on 200 turns backoff into a 1-second hammer. | | Treat 30s of silence as a dead connection | Pings arrive every \~15s. A socket can die without an error ever surfacing. | | State self-heals, ledgers don't | Every event carries absolute reserves. After a gap you're current again, but the per-block change log has a hole. Detect it with `previous_block`. | | Classify errors before retrying | "Pool not found" never fixes itself. "Stream limit exceeded" always does. Retrying the first wastes a connection slot forever; abandoning the second loses a working subscription. | | Multiplex deliberately | 25 subscriptions per connection, 10 concurrent streams on a free key (30 on Dev, 100 on Pro), and one invalid entry rejects the whole batch. | ## Rule 1: Trust events, not status codes A reconnect loop usually looks like: connect, reset backoff, consume, on failure wait and retry with doubled delay. The subtle bug is *where* the backoff resets. If it resets when the HTTP response arrives, any failure mode that returns `200 OK` and then closes (load balancer deploys, buffering proxies, overload shedding) defeats the exponential entirely: every cycle reconnects at the floor delay, forever, from every client you've shipped. Reset backoff only after the first parsed SSE frame. A `ping` counts; it proves the stream actually streams. ```javascript theme={null} let sawEvent = false; for await (const frame of frames) { sawEvent = true; // proof the stream works, not just HTTP 200 // ... handle the frame } // in the outer loop: if (sawEvent) backoff = 1_000; backoff = Math.min(backoff * 2, 30_000); await sleep(backoff + Math.random() * 1_000); // jitter spreads reconnect storms ``` ## Rule 2: Watch the heartbeat The server sends a `ping` every \~15 seconds. If nothing (events or pings) arrives for 30 seconds, assume the socket is dead even though no error fired, and reconnect. In JavaScript that's a small watchdog timer that aborts the fetch. In Python, `requests` gives you this for free: set the read timeout to 30 seconds and the staleness check becomes an exception your retry loop already handles. ```python theme={null} response = requests.post(url, json=subs, stream=True, timeout=(10, 30)) # 10s to connect, and any 30s silence raises ReadTimeout: your reconnect path ``` ## Rule 3: State self-heals, ledgers don't This is the property that makes reserve streaming forgiving in production. Every `pool_reserves` event carries **absolute values**: `total_reserve_usd` is the pool's liquidity right now, not a cumulative sum you must maintain. Disconnect for ten minutes, reconnect, and your first event makes your state current again. There is nothing to resync and no REST snapshot to fetch. What does *not* self-heal is the change log. If you aggregate deltas over time (net flow over a window, cumulative volume of liquidity changes), the blocks you missed are holes in that ledger. The stream gives you exactly what you need to know when that happened: each event's `previous_block` names the last block in which the pool's reserves changed. If it doesn't match the `block` of the previous event you received, you missed something. ```javascript theme={null} const lastBlock = new Map(); function checkContinuity(idx, update) { const prev = lastBlock.get(idx); if (prev !== undefined && update.previous_block !== prev) { // a hole in the ledger: reset windowed aggregations for this subscription resetWindows(idx); } lastBlock.set(idx, update.block); } ``` > [!NOTE] > > `previous_block` chains event to event, not block to block. Pools only emit > when reserves change, so consecutive events can legitimately be many chain > blocks apart while `previous_block` still matches perfectly. A mismatch > means missed *events*, not quiet markets. If you need the missed changes themselves, the [pool transactions endpoint](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) backfills the gap from REST on a Dev, Pro or Enterprise plan. ## Rule 4: Classify errors before retrying Two error channels exist, and both carry a mix of permanent and transient conditions. **Before the stream starts**, a bad request gets an HTTP error with a JSON body. **Mid-stream**, the server sends an `error` event and closes the connection. Either way, read the message and split: | Error | Channel | Class | Correct response | | - | - | - | - | | `unsupported chain: …` | HTTP 400 or `error` event | Permanent | Fix the subscription. Retrying can never succeed. | | `pool not found: …` / `asset not found` | HTTP 400 or `error` event | Permanent | Same. The message names the bad entry. | | `too many subscriptions` | HTTP 400 | Permanent | Your batch exceeds 25. Chunk it. | | `Concurrent stream limit reached` | HTTP 429, `"error":"rate_limited"` | Transient | Close a stream, or back off and retry. A slot will free up. | | 5xx, network failures, timeouts | HTTP / socket | Transient | Back off and retry. | A practical classifier needs one line: ```javascript theme={null} const isRetryable = (message) => /limit|rate|too many|capacity|timeout|temporar/i.test(message); ``` Getting this wrong in either direction hurts. Retrying a permanent error burns one of your 10 connection slots on a request that can never succeed. Treating a transient error as permanent is how we lost 8 pools for a night: the limit cleared within minutes, but the code had already given up. > [!WARNING] > > **One invalid entry rejects the whole multiplexed connection.** The server > sends a single `error` event naming the bad asset, then closes, and your > other 24 subscriptions go down with it. Validate addresses against the > [REST API](/api-reference/pools/get-a-pool-on-a-network) before > subscribing, and treat "not found" errors as a signal to drop the named > entry and resubscribe the rest. ## Rule 5: Multiplex deliberately The limits: **25 subscriptions per POST connection, 10 concurrent streams per IP**. That's 250 pools from one machine, if you chunk correctly. Those caps bound concurrency, not spend: every event delivered costs one credit, and 250 pools streaming around the clock runs well past the 5M credits a month [Pro includes](https://dexpaprika.com/api/pricing), so size the workload before you scale the chunks. * Route events to subscriptions with `request_id`: it's the index of the entry in your POSTed array. * Keep a fallback route on `(chain, pool_id/token_id)` for defensive code; both fields are in every payload. * Chunk watchlists into groups of 25 and run one consumer loop per chunk. Let chunks fail independently: a permanent error in one chunk shouldn't stop the other nine. * Mixing chains and both methods (`pool_reserves`, `token_reserves`) in one connection works fine. ## The full client Both versions implement all five rules and were run against production as written. Bad-address handling verified live: the client exits with the server's message instead of looping. ```javascript resilient-stream.mjs theme={null} // resilient-stream.mjs: production-grade reserve streaming. Node 18+, no deps. // Reconnects with real backoff, detects missed blocks, classifies errors, // and watches its own heartbeat. // // The reserves feed needs an API key. Checked here rather than left to the // server: an unset variable travels as the literal string "undefined" and comes // back as a key-verification failure, which reads like a key that went bad. const KEY = process.env.DEXPAPRIKA_API_KEY; if (!KEY) { console.error("set DEXPAPRIKA_API_KEY, free key at https://console.dexpaprika.com"); process.exit(1); } const SUBSCRIPTIONS = [ { chain: "base", address: "0xb2cc224c1c9fee385f8ad6a55b4d94e92359dc59", method: "pool_reserves" }, { chain: "solana", address: "8sjV1AqBFvFuADBCQHhotaRq5DFFYSjjg1jMyVWMqXvZ", method: "pool_reserves" }, ]; const STALE_MS = 30_000; // two missed pings = reconnect const MAX_BACKOFF_MS = 30_000; // Capacity errors clear on their own; subscription errors never will. function isRetryable(message) { return /limit|rate|too many|capacity|timeout|temporar/i.test(message); } const lastBlock = new Map(); // subscription index -> last seen block function handleEvent(idx, update) { // Absolute state: total_reserve_usd is the pool's liquidity NOW, so state // self-heals after any gap. Only the per-block ledger can have holes. const prev = lastBlock.get(idx); if (prev !== undefined && update.previous_block !== prev) { console.warn( `[gap] sub ${idx}: missed blocks ${prev} -> ${update.previous_block}. ` + "Reset any delta-window aggregation for this subscription.", ); } lastBlock.set(idx, update.block); console.log( `sub ${idx} block ${update.block}: $${Math.round(update.total_reserve_usd).toLocaleString("en-US")} ` + `(${update.total_delta_usd >= 0 ? "+" : "-"}$${Math.abs(update.total_delta_usd).toFixed(2)})`, ); } async function connectOnce(signal) { const res = await fetch("https://streaming.dexpaprika.com/sse/reserves", { method: "POST", // The key is the whole Authorization value, with no scheme word in front of it. headers: { "content-type": "application/json", authorization: KEY }, body: JSON.stringify(SUBSCRIPTIONS), signal, }); if (!res.ok) { const body = await res.text(); // 4xx other than 408/429 means the request itself is wrong: do not retry. const fatal = res.status >= 400 && res.status < 500 && ![408, 429].includes(res.status); throw Object.assign(new Error(`${res.status}: ${body}`), { fatal }); } let sawEvent = false; let lastActivity = Date.now(); const controller = new AbortController(); signal.addEventListener("abort", () => controller.abort(), { once: true }); const watchdog = setInterval(() => { if (Date.now() - lastActivity > STALE_MS) { console.warn("[watchdog] no events or pings for 30s, forcing reconnect"); controller.abort(); // tears down the fetch, the outer loop reconnects } }, 5_000); try { let buffer = ""; for await (const chunk of res.body.pipeThrough(new TextDecoderStream())) { lastActivity = Date.now(); buffer += chunk; const frames = buffer.split("\n\n"); buffer = frames.pop(); for (const frame of frames) { const event = frame.match(/^event: (.*)$/m)?.[1]; const id = frame.match(/^request_id: (.*)$/m)?.[1]; const data = frame.match(/^data: (.*)$/m)?.[1]; if (!data) continue; sawEvent = true; // proof the stream works, not just HTTP 200 if (event === "error") { const message = JSON.parse(data).message ?? data; throw Object.assign(new Error(message), { fatal: !isRetryable(message) }); } if (event === "warning") { console.warn(`[server] ${JSON.parse(data).message ?? data}`); continue; } if (event === "ping") continue; // counts as activity, nothing else if (event === "pool_reserves" || event === "token_reserves") { handleEvent(Number(id), JSON.parse(data)); } } } } finally { clearInterval(watchdog); } return sawEvent; } let backoff = 1_000; while (true) { const session = new AbortController(); try { console.log("connecting…"); const healthy = await connectOnce(session.signal); if (healthy) backoff = 1_000; // reset only after a proven-working stream } catch (err) { if (err.fatal) { console.error(`fatal, fix the subscription list: ${err.message}`); process.exit(1); } console.error(`transient: ${err.message}`); } await new Promise((r) => setTimeout(r, backoff + Math.random() * 1_000)); // jitter backoff = Math.min(backoff * 2, MAX_BACKOFF_MS); } ``` ```python resilient_stream.py theme={null} # resilient_stream.py: production-grade reserve streaming. Python 3.8+, # `pip install requests`. Reconnects with real backoff, detects missed # blocks, classifies errors, and uses the read timeout as a staleness watchdog. import json import os import random import re import sys import time import requests # The reserves feed needs an API key. Read with .get and checked here, so a # missing one prints the instruction instead of a KeyError traceback. KEY = os.environ.get("DEXPAPRIKA_API_KEY") if not KEY: sys.exit("set DEXPAPRIKA_API_KEY, free key at https://console.dexpaprika.com") SUBSCRIPTIONS = [ {"chain": "base", "address": "0xb2cc224c1c9fee385f8ad6a55b4d94e92359dc59", "method": "pool_reserves"}, {"chain": "solana", "address": "8sjV1AqBFvFuADBCQHhotaRq5DFFYSjjg1jMyVWMqXvZ", "method": "pool_reserves"}, ] STALE_SECONDS = 30 # two missed pings = the read timeout forces a reconnect MAX_BACKOFF = 30.0 last_block = {} # subscription index -> last seen block def is_retryable(message: str) -> bool: # Capacity errors clear on their own; subscription errors never will. return bool(re.search(r"limit|rate|too many|capacity|timeout|temporar", message, re.I)) class FatalStreamError(Exception): pass def handle_event(idx: int, update: dict) -> None: # Absolute state: total_reserve_usd is the pool's liquidity NOW, so state # self-heals after any gap. Only the per-block ledger can have holes. prev = last_block.get(idx) if prev is not None and update["previous_block"] != prev: print( f"[gap] sub {idx}: missed blocks {prev} -> {update['previous_block']}. " "Reset any delta-window aggregation for this subscription." ) last_block[idx] = update["block"] delta = update["total_delta_usd"] print( f"sub {idx} block {update['block']}: " f"${update['total_reserve_usd']:,.0f} ({'+' if delta >= 0 else '-'}${abs(delta):.2f})" ) def connect_once() -> bool: response = requests.post( "https://streaming.dexpaprika.com/sse/reserves", json=SUBSCRIPTIONS, # The key is the whole Authorization value, with no scheme word in front of it. headers={"Authorization": KEY}, stream=True, # read timeout doubles as the staleness watchdog: pings arrive every # ~15s, so 30s of silence raises and the outer loop reconnects timeout=(10, STALE_SECONDS), ) if not response.ok: fatal = 400 <= response.status_code < 500 and response.status_code not in (408, 429) message = f"{response.status_code}: {response.text[:200]}" if fatal: raise FatalStreamError(message) raise RuntimeError(message) saw_event = False event_type, request_id = None, None for raw_line in response.iter_lines(decode_unicode=True): line = raw_line or "" if line.startswith("event: "): event_type = line[7:] elif line.startswith("request_id: "): request_id = line[12:] elif line.startswith("data: "): saw_event = True # proof the stream works, not just HTTP 200 if event_type == "error": message = json.loads(line[6:]).get("message", line[6:]) if is_retryable(message): raise RuntimeError(message) raise FatalStreamError(message) if event_type == "warning": print(f"[server] {json.loads(line[6:]).get('message', '')}") elif event_type in ("pool_reserves", "token_reserves"): handle_event(int(request_id or -1), json.loads(line[6:])) # pings count as activity (they reset the read timeout) and need # no handling of their own return saw_event backoff = 1.0 while True: try: print("connecting…") if connect_once(): backoff = 1.0 # reset only after a proven-working stream except FatalStreamError as err: print(f"fatal, fix the subscription list: {err}") sys.exit(1) except Exception as err: # noqa: BLE001, includes the staleness timeout print(f"transient: {err}") time.sleep(backoff + random.random()) # jitter backoff = min(backoff * 2, MAX_BACKOFF) ``` > [!WARNING] > > **Big numbers arrive as strings.** The raw amounts (`reserve`, `delta`) and > `block` are JSON strings because they exceed `Number.MAX_SAFE_INTEGER`. Use > `BigInt` (or Python's native ints, which handle them automatically) if you > work with raw amounts. The USD fields are regular floats, computed > server-side, and are all you need for most monitoring. ## Don't alert on plumbing If your production consumer feeds alerts, remember that liquidity moves for boring reasons too. JIT liquidity bots on major pools add and remove six-figure positions around single swaps; we've measured ±4% of an \$8M pool every block. Threshold accordingly, or net deltas over a window so the add/remove cycles cancel. The [drain detection guide](/streaming/guides/detect-liquidity-drains) covers thresholds that survive this. ## Monitor the monitor A streaming consumer that silently stops is worse than one that crashes. The minimum viable health surface, all derivable from this guide's client: * **Last event age**: if `lastActivity` is older than a minute, something is wrong even if the process is alive. * **Per-chunk status**: which subscriptions are live, which died fatally and why (keep the server's error message; it names the bad entry). * **Gap count**: how many ledger holes you've detected since start. * **Credit spend**: a busy watchlist bills one credit per delivered event and can work through a monthly allowance quickly. Per-key usage is in [console.dexpaprika.com](https://console.dexpaprika.com). For a worked example, [LiquidityRadar](https://github.com/coinpaprika/liquidity-radar) (open source) runs this exact stack as a Cloudflare Worker with a public status page showing event freshness, per-subscription failures, and every alert it gated. ## FAQ > [accordion] Do I need to resync from REST after a disconnect? > > Not for state. Every event carries absolute reserve values, so your first event after reconnecting makes you current. You only need REST backfill if you maintain a gapless per-block ledger; detect the holes by comparing each event's previous_block to the last block you saw. > [accordion] Is there Last-Event-ID resume support? > > No. The stream has no replay; a reconnect starts fresh from the next change. That's why the absolute-values property matters: it makes resume-from-now safe for state tracking. > [accordion] How many pools can one machine watch? > > 250 on a free key: 25 subscriptions per POST connection, 10 concurrent streams. The stream cap belongs to your plan, not to a machine, so more machines do not raise it; Dev allows 30 streams (750 pools) and Pro 100 (2,500). > [accordion] What happens to my other subscriptions when one entry is invalid? > > The whole connection is rejected with one error event naming the bad asset. Drop that entry and resubscribe the rest. Validating addresses against REST before subscribing avoids the round trip. ## Next steps > [card] [Detect Liquidity Drains](/streaming/guides/detect-liquidity-drains) > > The detection logic this guide keeps alive: thresholds, JIT noise, alerts. > [card] [Reserve Streaming Overview](/streaming/reserves-streaming) > > Payload schemas, both subscription methods, limits. > [card] [Error Handling Reference](/knowledge-base/error-handling) > > The complete error catalog for REST and streaming. > [card] [LiquidityRadar on GitHub](https://github.com/coinpaprika/liquidity-radar) > > All five rules as a deployable, open-source Cloudflare Worker. *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. # React & Next.js Integration Source: https://docs.dexpaprika.com/streaming/guides/react-integration Build real-time price components for React and Next.js applications with TypeScript support > [card] [Production example: live streaming dashboard](https://dexpaprika.com/streaming/solana) > > **See React integration in production!** Our live dashboard is built with React, TypeScript, and uses the patterns described in this guide. Streams 6 cryptocurrencies using POST /sse/prices with custom hooks, real-time UI updates, and proper error handling. Open the dashboard and inspect the Network tab to see SSE in action! [View Source →](https://dexpaprika.com/streaming/solana) > [!WARNING] > > Browsers block calls to `streaming.dexpaprika.com` from other sites, because the stream doesn't send CORS headers to them. The dashboard above works because it runs on dexpaprika.com. In your app, open the stream from your backend (a Next.js route handler, a Cloudflare Worker) and point the hooks below at that route. See [Response headers and CORS](/knowledge-base/response-headers#cors). ## Integration overview Learn how to integrate DexPaprika's streaming API into React and Next.js applications with: * Custom React hooks for streaming * TypeScript support * Server-side rendering considerations * Production-ready error handling *** ## Finding token addresses Before streaming, you need token addresses. Use the REST API: > [card] Search Tokens > > Use the [Search API](/api-reference/search/search-for-tokens-pools-and-dexes) to find tokens by name or symbol > [card] Get Networks > > Use the [Networks API](/api-reference/networks/get-a-list-of-available-blockchain-networks) to get supported chains ```bash theme={null} # Search for USDC tokens curl "https://api.dexpaprika.com/search?query=USDC" # Get all supported networks curl "https://api.dexpaprika.com/networks" ``` *** ## Quick example ```tsx React Hook theme={null} import { useEffect, useState } from 'react'; function useCryptoPrice(chain: string, address: string) { const [price, setPrice] = useState(null); const [status, setStatus] = useState<'connecting' | 'connected' | 'error'>('connecting'); useEffect(() => { const url = new URL('https://streaming.dexpaprika.com/sse/prices'); url.searchParams.set('method', 'token_price'); url.searchParams.set('chain', chain); url.searchParams.set('address', address); const eventSource = new EventSource(url.toString()); eventSource.onopen = () => setStatus('connected'); eventSource.addEventListener('token_price', (event) => { const data = JSON.parse(event.data); setPrice(parseFloat(data.price)); }); eventSource.onerror = () => setStatus('error'); return () => eventSource.close(); }, [chain, address]); return { price, status }; } // Usage function PriceDisplay() { const { price, status } = useCryptoPrice('ethereum', '0xc02aa...'); return (
{status === 'connected' && price && ( ${price.toFixed(2)} )}
); } ``` ```tsx Next.js Component theme={null} 'use client'; // For Next.js 13+ App Router import { useEffect, useState } from 'react'; export default function LivePrice({ chain, address }: { chain: string; address: string }) { const [price, setPrice] = useState(null); const [isClient, setIsClient] = useState(false); useEffect(() => { setIsClient(true); // Ensure client-side only }, []); useEffect(() => { if (!isClient) return; const url = new URL('https://streaming.dexpaprika.com/sse/prices'); url.searchParams.set('method', 'token_price'); url.searchParams.set('chain', chain); url.searchParams.set('address', address); const eventSource = new EventSource(url.toString()); eventSource.addEventListener('token_price', (event) => { const data = JSON.parse(event.data); setPrice(parseFloat(data.price)); }); return () => eventSource.close(); }, [isClient, chain, address]); if (!isClient) return Loading...; return ${price?.toFixed(2) ?? '--'}; } ``` *** ## Complete implementation ### 1. Install dependencies ```bash theme={null} npm install --save-dev @types/react ``` ### 2. Create the streaming hook Create `hooks/useCryptoStream.ts`: **View complete hook implementation** ```typescript theme={null} import { useEffect, useRef, useState, useCallback } from 'react'; interface PriceData { address: string; chain: string; price: string; // USD price, kept as string for precision timestamp: number; // unix seconds, server send time timestamp_price: number; // unix seconds, observation time token_price: number; // alias of timestamp_price } interface StreamOptions { chain: string; address: string; onPrice?: (price: number) => void; reconnect?: boolean; reconnectDelay?: number; maxReconnectAttempts?: number; } interface StreamState { price: number | null; status: 'idle' | 'connecting' | 'connected' | 'error' | 'disconnected'; error: Error | null; lastUpdate: Date | null; } export function useCryptoStream({ chain, address, onPrice, reconnect = true, reconnectDelay = 1000, maxReconnectAttempts = 5, }: StreamOptions): StreamState & { reconnect: () => void; disconnect: () => void } { const [state, setState] = useState({ price: null, status: 'idle', error: null, lastUpdate: null, }); const eventSourceRef = useRef(null); const reconnectAttemptsRef = useRef(0); const reconnectTimeoutRef = useRef(); const connect = useCallback(() => { // Clean up any existing connection if (eventSourceRef.current) { eventSourceRef.current.close(); } setState(prev => ({ ...prev, status: 'connecting', error: null })); const url = new URL('https://streaming.dexpaprika.com/sse/prices'); url.searchParams.set('method', 'token_price'); url.searchParams.set('chain', chain); url.searchParams.set('address', address); const eventSource = new EventSource(url.toString()); eventSourceRef.current = eventSource; eventSource.onopen = () => { setState(prev => ({ ...prev, status: 'connected' })); reconnectAttemptsRef.current = 0; }; eventSource.addEventListener('token_price', (event: MessageEvent) => { try { const data: PriceData = JSON.parse(event.data); const price = parseFloat(data.price); setState(prev => ({ ...prev, price, lastUpdate: new Date(data.timestamp * 1000), })); onPrice?.(price); } catch (error) { console.error('Failed to parse price data:', error); } }); // Server may push deprecation notices and similar non-fatal signals. eventSource.addEventListener('warning', (event: MessageEvent) => { try { const { message } = JSON.parse(event.data); console.warn('[stream warning]', message); } catch { // ignore malformed warning payloads } }); eventSource.onerror = () => { setState(prev => ({ ...prev, status: 'error', error: new Error('Connection lost'), })); eventSource.close(); eventSourceRef.current = null; // Handle reconnection if (reconnect && reconnectAttemptsRef.current < maxReconnectAttempts) { reconnectAttemptsRef.current++; const delay = reconnectDelay * Math.pow(2, reconnectAttemptsRef.current - 1); setState(prev => ({ ...prev, status: 'disconnected', error: new Error(`Reconnecting in ${delay/1000}s... (attempt ${reconnectAttemptsRef.current}/${maxReconnectAttempts})`), })); reconnectTimeoutRef.current = setTimeout(connect, delay); } }; }, [chain, address, onPrice, reconnect, reconnectDelay, maxReconnectAttempts]); const disconnect = useCallback(() => { if (reconnectTimeoutRef.current) { clearTimeout(reconnectTimeoutRef.current); } if (eventSourceRef.current) { eventSourceRef.current.close(); eventSourceRef.current = null; } setState({ price: null, status: 'disconnected', error: null, lastUpdate: null, }); reconnectAttemptsRef.current = 0; }, []); useEffect(() => { connect(); return disconnect; }, [connect, disconnect]); return { ...state, reconnect: connect, disconnect, }; } ``` ### 3. Create price display component Create `components/CryptoPriceDisplay.tsx`: **View complete component** ```tsx theme={null} import React from 'react'; import { useCryptoStream } from '../hooks/useCryptoStream'; interface PriceDisplayProps { chain: string; address: string; symbol: string; decimals?: number; className?: string; } export function CryptoPriceDisplay({ chain, address, symbol, decimals = 2, className = '', }: PriceDisplayProps) { const [previousPrice, setPreviousPrice] = React.useState(null); const { price, status, error, lastUpdate, reconnect } = useCryptoStream({ chain, address, onPrice: (newPrice) => { setPreviousPrice(price); }, }); const priceChange = previousPrice ? ((price ?? 0) - previousPrice) / previousPrice * 100 : 0; const isUp = priceChange > 0; const isDown = priceChange < 0; return (
{symbol} {status}
{price !== null ? ( <>
${price.toFixed(decimals)} {isUp && ' ↑'} {isDown && ' ↓'}
{priceChange !== 0 && (
{priceChange > 0 ? '+' : ''}{priceChange.toFixed(2)}%
)} ) : (
{status === 'connecting' ? 'Connecting...' : '$---.--'}
)}
{error && (
{error.message} {status === 'error' && ( )}
)} {lastUpdate && (
Last update: {lastUpdate.toLocaleTimeString()}
)}
); } ``` ### 4. Multi-asset streaming For streaming multiple assets, create `hooks/useMultiCryptoStream.ts`: **View multi-asset streaming hook** ```typescript theme={null} import { useEffect, useRef, useState, useCallback } from 'react'; interface Asset { chain: string; address: string; method: 'token_price'; } interface PriceUpdate { chain: string; address: string; price: number; timestamp: Date; } interface MultiStreamOptions { assets: Asset[]; onUpdate?: (update: PriceUpdate) => void; reconnect?: boolean; } export function useMultiCryptoStream({ assets, onUpdate, reconnect = true, }: MultiStreamOptions) { const [prices, setPrices] = useState>(new Map()); const [status, setStatus] = useState<'connecting' | 'connected' | 'error'>('connecting'); const abortControllerRef = useRef(); const connect = useCallback(async () => { // Abort any existing connection abortControllerRef.current?.abort(); abortControllerRef.current = new AbortController(); setStatus('connecting'); try { const response = await fetch('https://streaming.dexpaprika.com/sse/prices', { method: 'POST', headers: { 'Accept': 'text/event-stream', 'Content-Type': 'application/json', }, body: JSON.stringify(assets), signal: abortControllerRef.current.signal, }); if (!response.ok) { throw new Error(`HTTP ${response.status}`); } setStatus('connected'); const decoder = new TextDecoder(); let buffer = ''; // for-await over the response body handles gzip/chunked encodings // transparently in Node and modern browsers. for await (const chunk of response.body as any) { buffer += decoder.decode(chunk, { stream: true }); const messages = buffer.split('\n\n'); buffer = messages.pop() ?? ''; for (const message of messages) { const lines = message.split('\n'); const eventLine = lines.find(l => l.startsWith('event:')); const dataLine = lines.find(l => l.startsWith('data:')); if (!dataLine) continue; const eventType = eventLine ? eventLine.slice(6).trim() : 'message'; if (eventType !== 'token_price') continue; // skip ping/warning/etc try { const parsed = JSON.parse(dataLine.slice(5).trim()); const update: PriceUpdate = { chain: parsed.chain, address: parsed.address, price: parseFloat(parsed.price), timestamp: new Date(parsed.timestamp * 1000), }; setPrices(prev => { const next = new Map(prev); next.set(`${update.chain}:${update.address}`, update); return next; }); onUpdate?.(update); } catch (error) { console.error('Parse error:', error); } } } } catch (error: any) { if (error.name !== 'AbortError') { console.error('Stream error:', error); setStatus('error'); if (reconnect) { setTimeout(connect, 5000); } } } }, [assets, onUpdate, reconnect]); useEffect(() => { connect(); return () => { abortControllerRef.current?.abort(); }; }, [connect]); return { prices: Array.from(prices.values()), status }; } ``` *** ## Next.js specific considerations ### App Router (Next.js 13+) For Next.js App Router, ensure streaming components are client-side: ```tsx theme={null} // app/components/LivePrices.tsx 'use client'; import { CryptoPriceDisplay } from './CryptoPriceDisplay'; export default function LivePrices() { return (
); } ``` ### Pages Router For traditional Pages Router, handle SSR properly: ```tsx theme={null} // pages/prices.tsx import dynamic from 'next/dynamic'; const LivePrices = dynamic(() => import('../components/LivePrices'), { ssr: false, // Disable SSR for streaming components loading: () =>

Loading prices...

, }); export default function PricesPage() { return (

Live Crypto Prices

); } ``` *** ## Advanced patterns ### 1. Context provider for global streaming ```tsx theme={null} // contexts/CryptoStreamContext.tsx import React, { createContext, useContext } from 'react'; import { useMultiCryptoStream } from '../hooks/useMultiCryptoStream'; const CryptoStreamContext = createContext | null>(null); export function CryptoStreamProvider({ children }: { children: React.ReactNode }) { const streamData = useMultiCryptoStream({ assets: [ { chain: 'ethereum', address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', method: 'token_price' }, { chain: 'solana', address: 'So11111111111111111111111111111111111111112', method: 'token_price' }, // Add more assets as needed ], }); return ( {children} ); } export function useCryptoStreamContext() { const context = useContext(CryptoStreamContext); if (!context) { throw new Error('useCryptoStreamContext must be used within CryptoStreamProvider'); } return context; } ``` ### 2. Optimistic UI updates ```tsx theme={null} function OptimisticPriceDisplay({ chain, address }: Props) { const [displayPrice, setDisplayPrice] = useState(null); const [isStale, setIsStale] = useState(false); const { price, lastUpdate } = useCryptoStream({ chain, address, onPrice: (newPrice) => { setDisplayPrice(newPrice); setIsStale(false); }, }); useEffect(() => { // Mark as stale if no update for 5 seconds const timer = setTimeout(() => setIsStale(true), 5000); return () => clearTimeout(timer); }, [lastUpdate]); return (
${displayPrice?.toFixed(2) ?? '---'} {isStale && Stale}
); } ``` ### 3. Performance optimization with React.memo ```tsx theme={null} const PriceCell = React.memo(({ price, symbol }: { price: number; symbol: string }) => { return (
{symbol} ${price.toFixed(2)}
); }, (prevProps, nextProps) => { // Only re-render if price changes by more than 0.01% return Math.abs(prevProps.price - nextProps.price) / prevProps.price < 0.0001; }); ``` *** ## Testing ### Unit testing with Jest **View test implementation** ```typescript theme={null} // __tests__/useCryptoStream.test.ts import { renderHook, act } from '@testing-library/react-hooks'; import { useCryptoStream } from '../hooks/useCryptoStream'; // Mock EventSource global.EventSource = jest.fn(() => ({ addEventListener: jest.fn(), close: jest.fn(), onopen: jest.fn(), onerror: jest.fn(), })) as any; describe('useCryptoStream', () => { it('should connect on mount', () => { const { result } = renderHook(() => useCryptoStream({ chain: 'ethereum', address: '0xtest', }) ); expect(result.current.status).toBe('connecting'); }); it('should update price on event', () => { const { result } = renderHook(() => useCryptoStream({ chain: 'ethereum', address: '0xtest', }) ); act(() => { // Simulate price update const event = new MessageEvent('token_price', { data: JSON.stringify({ address: '0xtest', chain: 'ethereum', price: '1234.56', timestamp: Math.floor(Date.now() / 1000), timestamp_price: Math.floor(Date.now() / 1000), token_price: Math.floor(Date.now() / 1000), }), }); // Trigger event handler const eventSource = (global.EventSource as jest.Mock).mock.results[0].value; eventSource.addEventListener.mock.calls[0][1](event); }); expect(result.current.price).toBe(1234.56); }); }); ``` *** ## Production checklist > [accordion] Error Boundaries > > Wrap streaming components in error boundaries to handle failures gracefully: > > ```tsx theme={null} > import { ErrorBoundary } from 'react-error-boundary'; > > Price unavailable}> > > > ``` > [accordion] Memory Leaks > > Always clean up EventSource connections and timeouts: > > ```tsx theme={null} > useEffect(() => { > const eventSource = new EventSource(url); > > // Cleanup function > return () => { > eventSource.close(); > clearTimeout(reconnectTimeout); > }; > }, []); > ``` > [accordion] Network Monitoring > > Monitor connection status and alert on failures: > > ```tsx theme={null} > useEffect(() => { > if (status === 'error') { > // Send to error tracking service > Sentry.captureException(new Error('Stream connection failed')); > } > }, [status]); > ``` > [accordion] Bundle Size > > Consider lazy loading streaming components: > > ```tsx theme={null} > const LivePrices = lazy(() => import('./LivePrices')); > ``` *** ## Get support > [card] [Discord Community](https://discord.gg/DhJge5TUGM) > > Get help from other React developers. > [card] [Email Support](mailto:support@coinpaprika.com) > > Report bugs or request features. # Real-time DEX streaming API: live token prices via SSE Source: https://docs.dexpaprika.com/streaming/introduction Stream live DEX token prices, pool reserves and swap transactions over Server-Sent Events (SSE). Prices stream with no API key on 34 showcase assets; a free key opens prices and reserves on any token; transactions and candles are paid-plan feeds. > [!NOTE] > > **Looking for the full API spec?** Jump to the [Streaming Reference](/streaming/stream-real-time-data-for-a-single-asset) tab for every endpoint, parameter, response schema, and a live API playground. > [card] [See the Streaming API in action](https://dexpaprika.com/streaming/solana) > > **Live Demo:** Watch our interactive dashboard stream real-time prices for 6 cryptocurrencies across Ethereum, Solana, and BSC. See connection status, latency metrics, and live updates in action. [Open Live Dashboard →](https://dexpaprika.com/streaming/solana) ## Overview DexPaprika's Streaming API delivers four real-time feeds via Server-Sent Events (SSE): live token prices, live pool reserve updates, live swap transactions and sealed token candles. Updates are pushed the moment a swap settles on-chain, with no polling. Prices stream **without an API key** on the [34 showcase assets](/streaming/showcase-streams), one flagship token per chain, except Arc. Reserves need a key, and a [free one](https://console.dexpaprika.com) opens prices and reserves on every token we index. Swap transactions and token candles are paid-plan feeds (Dev, Pro, Enterprise) on `streaming-pro.dexpaprika.com`; see [transactions streaming](/streaming/transactions-streaming) and [OHLCV streaming](/streaming/ohlcv-streaming). Registration takes a minute and needs no card. > [!NOTE] > > Every example on this page uses `streaming.dexpaprika.com`, the keyless and free-key host. > Paid plans connect to `https://streaming-pro.dexpaprika.com` with the key in the > `Authorization` header. Swap the base URL the same way you swap the REST one; see > [upgrading to Pro](/api-pro/upgrading). > [card] Prices, with no key > > Stream prices on the 34 showcase assets with no signup. A [free key](https://console.dexpaprika.com) opens prices on any token and the reserves feed, and raises the allowance to 100,000 credits. Transactions and candles need a paid plan. > [card] Pushed on price moves > > A price event is pushed when a swap moves the price, so the rate tracks trading activity. Reserve events land for each block in which a subscribed pool's reserves changed. > [card] SSE Protocol > > Standard Server-Sent Events for easy integration with any modern platform. > [card] Multi-Chain Support > > Stream tokens and pools from Ethereum, Solana, BSC, Arbitrum, Base, and more networks. ### Four feeds, one transport > [card] Token Prices (/sse/prices) > > USD price updates per token, pushed when a swap moves the price. Measured rates run from about 1 to about 52 updates a minute depending on the asset; see [plan your credit usage](/knowledge-base/credit-usage). Use this for tickers, portfolios, price-alert systems, and dashboards. > [card] [Pool Reserves (/sse/reserves)](/streaming/reserves-streaming) > > Block-level pool reserve deltas, USD-denominated, for any DEX pool or any token. Use this for liquidity monitoring, TVL dashboards, slippage estimation, and MEV/arbitrage detection. **[Learn more →](/streaming/reserves-streaming)** > [card] [Transactions (/sse/transactions)](/streaming/transactions-streaming) > > Individual swaps on one pool, or on every pool a token sits in, pushed as they settle. Use this for trade feeds, whale alerts and per-venue analytics. Dev, Pro and Enterprise plans. **[Learn more →](/streaming/transactions-streaming)** > [card] [Token OHLCV (/sse/ohlcv)](/streaming/ohlcv-streaming) > > Sealed token candles at 1s, 5s or 60s, resumable with `Last-Event-ID`. Paid plans only. Use this for charts and signal engines without building candles from swaps. **[Learn more →](/streaming/ohlcv-streaming)** *** ## Why use streaming? ### Streaming vs traditional polling > [tab] SSE Streaming (Recommended) > > ```javascript theme={null} > // Efficient: Server pushes updates only when prices change > const url = 'https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; > const eventSource = new EventSource(url); > > eventSource.addEventListener('token_price', (event) => { > const data = JSON.parse(event.data); > updatePrice(data.price); > }); > ``` > > **Benefits:** > > * Single persistent connection > * Updates pushed immediately when available > * Minimal bandwidth usage > * Nothing to poll, so no per-minute request limit to manage. Each update delivered still costs one credit, so budget for the update rate of what you subscribe to. See [rate limits](/knowledge-base/rate-limits) and [plan your credit usage](/knowledge-base/credit-usage) for measured rates and worked costs. > [tab] Polling (Not Recommended) > > ```javascript theme={null} > // Inefficient: Constant requests even when prices don't change > setInterval(async () => { > const response = await fetch('https://api.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'); > const data = await response.json(); > updatePrice(data.summary.price_usd); > }, 1000); // 86,400 requests per day per asset! > ``` > > **Drawbacks:** > > * High server load from repeated requests > * Wasted bandwidth when prices don't change > * Potential rate limiting issues > * Higher latency for updates *** ## Use cases ### What you can build > [card] [Trading Dashboards](https://dexpaprika.com/streaming/solana) > > Display live prices, volume, and market metrics with sub-second latency. **[See live example →](https://dexpaprika.com/streaming/solana)** > [card] Portfolio Trackers > > Show real-time portfolio values and P\&L as prices fluctuate. > [card] Price Alert Systems > > Trigger instant notifications when prices hit target levels. > [card] DEX Aggregators > > Compare prices across chains for arbitrage opportunities. > [card] Market Tickers > > Create live price tickers and widgets for websites. > [card] Analytics Platforms > > Stream data into time-series databases for real-time analytics. *** ## Available endpoints Each feed has a single-asset GET form and a multi-asset POST form: ### Token price streams (`/sse/prices`) > [card] [GET /sse/prices](/streaming/stream-real-time-data-for-a-single-asset) > > Stream one token's price per connection. Pass `method`, `chain`, and `address` as query params. > [card] [POST /sse/prices](/streaming/subscribe-to-multiple-assets-streaming) > > Stream multiple tokens (up to 25 per connection) by posting a JSON array of `{chain, address, method}` entries. ### Pool reserve streams (`/sse/reserves`) > [card] [GET /sse/reserves](/streaming/stream-real-time-reserves-for-a-single-asset) > > Stream reserve updates for a single pool (`method=pool_reserves`) or a single token across every pool it sits in (`method=token_reserves`). > [card] [POST /sse/reserves](/streaming/subscribe-to-multiple-reserves-streaming) > > Subscribe to up to 25 pools or tokens in one connection. Mix `pool_reserves` and `token_reserves` entries freely. ### Quick comparison | Feature | GET (Single) | POST (Multi) | | - | - | - | | **Subscriptions per request** | 1 | Up to 25 | | **Best for** | Individual asset/pool tracking | Portfolios, dashboards, multi-pool monitoring | | **Setup complexity** | Minimal | Moderate | | **Load distribution** | Per connection | Automatic balancing | For workloads larger than 25 subscriptions, open multiple parallel POST streams. *** ## Quick start ### 1. Choose your method > [tab] Single Asset (Simple) > > Stream Ethereum WETH price: > > ```bash theme={null} > curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" > ``` > [tab] Multiple Assets (Advanced) > > Stream SOL and WETH prices: > > ```bash theme={null} > curl -X POST "https://streaming.dexpaprika.com/sse/prices" \ > -H "Accept: text/event-stream" \ > -H "Content-Type: application/json" \ > -d '[ > {"chain": "solana", "address": "So11111111111111111111111111111111111111112", "method": "token_price"}, > {"chain": "ethereum", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "method": "token_price"} > ]' > ``` ### 2. Parse the response Each price update arrives as a JSON event. The default method `token_price` returns full field names: ```json theme={null} { "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chain": "ethereum", "price": "2257.973351845954", "timestamp": 1778846475, "timestamp_price": 1778846474, "token_price": 1778846474 } ``` The legacy `t_p` method emits a compact shape with single-letter keys (`a`, `c`, `p`, `t`, `t_p`). It is **deprecated** and kept only for backward compatibility. ### 3. Handle in your application ```javascript Browser theme={null} const eventSource = new EventSource(url); eventSource.addEventListener('token_price', (event) => { const price = JSON.parse(event.data); console.log(`${price.chain} ${price.address}: $${price.price}`); }); // Optional: surface deprecation notices the server may push eventSource.addEventListener('warning', (event) => { const { message } = JSON.parse(event.data); console.warn('[stream warning]', message); }); eventSource.onerror = () => { // Reconnect logic eventSource.close(); setTimeout(connectStream, 1000); }; ``` ```python Python theme={null} # pip install httpx httpx-sse import json import httpx from httpx_sse import connect_sse url = "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" # No read timeout: a quiet token can go a while between updates. with httpx.Client(timeout=httpx.Timeout(10.0, read=None)) as client: with connect_sse(client, "GET", url) as event_source: event_source.response.raise_for_status() for sse in event_source.iter_sse(): if sse.event == "token_price": data = json.loads(sse.data) print(f"{data['chain']} {data['address']}: ${data['price']}") ``` ```go Go theme={null} package main import ( "bufio" "encoding/json" "fmt" "io" "log" "net/http" "strings" ) type priceEvent struct { Address string `json:"address"` Chain string `json:"chain"` Price string `json:"price"` } func main() { url := "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { log.Fatal(err) } req.Header.Set("Accept", "text/event-stream") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { body, _ := io.ReadAll(resp.Body) log.Fatalf("%s: %s", resp.Status, body) } // Collect the lines of one SSE message until the blank line that ends it, // then dispatch. The server may send event: before or after data:. event, data := "message", "" scanner := bufio.NewScanner(resp.Body) for scanner.Scan() { line := scanner.Text() switch { case line == "": if event == "token_price" && data != "" { var p priceEvent if err := json.Unmarshal([]byte(data), &p); err == nil { fmt.Printf("%s %s: $%s\n", p.Chain, p.Address, p.Price) } } event, data = "message", "" case strings.HasPrefix(line, "event:"): event = strings.TrimSpace(line[len("event:"):]) case strings.HasPrefix(line, "data:"): if data != "" { data += "\n" } data += strings.TrimPrefix(line[len("data:"):], " ") } } if err := scanner.Err(); err != nil { log.Fatal(err) } } ``` ```typescript TypeScript theme={null} interface PriceEvent { address: string; chain: string; price: string; timestamp: number; timestamp_price: number; } const stream = new EventSource(url); stream.addEventListener('token_price', (event: MessageEvent) => { const price: PriceEvent = JSON.parse(event.data); updatePrice(price); }); ``` > [!NOTE] > > In a web app, run the stream through your own backend and point `url` at it. Browsers block calls to `streaming.dexpaprika.com` from other sites; see [Response headers and CORS](/knowledge-base/response-headers#cors). *** ## Architecture overview ```mermaid theme={null} graph LR A[Your App] -->|SSE Connection| B[Streaming API] B --> C[Load Balancer] C --> D1[Server 1] C --> D2[Server 2] C --> D3[Server N] D1 --> E[Price Feeds] D2 --> E D3 --> E E --> F[Blockchain RPCs] ``` ### Key features * **Automatic Load Balancing**: Requests distributed across multiple servers * **Persistent Connections**: Single connection maintained for entire session * **Efficient Updates**: Only sends data when prices actually change * **Global Infrastructure**: Low-latency servers in multiple regions *** ## Limits & quotas Service limits enforced by the streaming gateway: | Limit | Value | Notes | | - | - | - | | Concurrent SSE streams | **10** keyless (per IP) or on a free key, **30** on Dev, **100** on Pro | Exceeding returns `429 Too Many Requests` with `"error":"rate_limited"` and a message starting `Concurrent stream limit reached` | | Subscriptions per POST connection | **25** | `POST /sse/prices` rejects with `{"message":"too many assets, max 25 allowed"}`. `POST /sse/reserves` rejects with `{"message":"too many subscriptions"}` | | Ping interval | **15 seconds** | A `ping` event is pushed periodically to keep the connection open | | Credit cost | **1 credit per update delivered** | Connections are free. Only delivered events are charged, against 10,000 credits per rolling 30 days keyless, 100,000 with a free key, or 5M on [Pro](https://dexpaprika.com/api/pricing). See [plan your credit usage](/knowledge-base/credit-usage) | ### Event types you may receive | Event | When | Payload | | - | - | - | | `token_price` | New price observation for a subscribed token | `{address, chain, price, timestamp, timestamp_price}` | | `pool_reserves` | Pool reserves changed on the latest indexed block | `{chain, pool_id, block, previous_block, tokens[], total_reserve_usd, total_delta_usd}` | | `token_reserves` | A token's aggregate reserves changed (across all its pools) | `{chain, token_id, reserve, delta, block, price_usd, reserve_usd, delta_usd, updated_at}` | | `ping` | Every \~15s while idle | `{"time": }` | | `warning` | Deprecation notices or other non-fatal signals | `{"message": "..."}` | | `error` | Stream-terminating error (e.g. invalid asset) | `{"message": "..."}` | | `t_p` | **Deprecated.** Legacy compact price shape (`{a, c, p, t, t_p}`). Use `token_price` instead. | | > [!TIP] > > Parsers should skip events whose `event:` field is not in the allow-list they care about. The set may grow over time (e.g. new `warning` event was added in May 2026), so an unrecognised event must never crash your handler. *** ## Best practices > [accordion] Connection Management > > * Implement automatic reconnection with exponential backoff > * Handle both network errors and SSE error events > * Monitor connection health with heartbeat timeouts > [accordion] Error Handling > > * Validate all assets before streaming (invalid assets cancel entire stream) > * Parse both HTTP errors and SSE error events > * Log errors for debugging but don't expose sensitive data > [accordion] Performance Optimization > > * Use POST method for multiple assets (better than multiple GETs) > * Split large requests across multiple smaller streams > * Parse price strings carefully to maintain precision > [accordion] Production Deployment > > * Implement proper logging and monitoring > * Set up alerts for connection drops > * Use connection pooling for multiple streams > * Consider WebSocket bridges for incompatible clients *** ## Supported networks Stream tokens from multiple blockchain networks. Use the [Networks API](/api-reference/networks/get-a-list-of-available-blockchain-networks) to get the full list of supported networks: ```bash theme={null} curl https://api.dexpaprika.com/networks ``` Popular networks include: * Ethereum (`ethereum`) * Solana (`solana`) * Binance Smart Chain (`bsc`) * Arbitrum (`arbitrum`) * Polygon (`polygon`) * Base (`base`) * Avalanche (`avalanche`) > [!NOTE] > > The `chain` parameter in streaming requests must use the exact `id` value from the [Networks endpoint](/api-reference/networks/get-a-list-of-available-blockchain-networks). *** ## Finding token addresses Before streaming prices, you need the correct token address for your chosen network. Use these REST API endpoints: ### Search for tokens Use the [Search API](/api-reference/search/search-for-tokens-pools-and-dexes) to find tokens by name or symbol: ```bash theme={null} curl "https://api.dexpaprika.com/search?query=USDC" ``` ### Find a token's pools List pools for a specific token using [pool search](/tutorials/pool-filtering) with the `token_address` filter (per-network search only; the cross-network `/pools/search` does not take it): ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?token_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ``` ### Validate before streaming Use the [Token Prices API](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) to verify your token exists before streaming. This call needs an API key; a free key is enough: ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ``` > [!TIP] > > Always verify the token address matches the network you're streaming from. The same token may have different addresses on different chains. > [!WARNING] > > The streaming API will return a `400 Asset not found` error if the token doesn't exist on the specified network. Validate tokens using the REST API first to avoid stream failures. *** ## Next steps > [card] [Reserves Streaming](/streaming/reserves-streaming) > > The deep dive on `/sse/reserves`: what gets pushed when reserves move, the two subscription methods, annotated wire example, use cases for LPs, MEV builders, and analytics teams. > [card] [Quick Start Tutorial](/streaming/tutorials/quick-start) > > Build your first streaming application in 5 minutes. Covers both prices and reserves. > [card] [Live dashboard demo](https://dexpaprika.com/streaming/solana) > > Interactive streaming demo. Pick a chain, pick tokens, watch the SSE events flow in real time. > [card] [React Integration](/streaming/guides/react-integration) > > Build streaming components for React and Next.js applications. *** ## Get support > [card] [Discord Community](https://discord.gg/DhJge5TUGM) > > Join our Discord for real-time support and discussions. > [card] [Email Support](mailto:support@coinpaprika.com) > > Contact our team for technical assistance. # Real-Time Token OHLCV Candle Streaming Source: https://docs.dexpaprika.com/streaming/ohlcv-streaming Stream sealed token candles over SSE at 1s, 5s or 60s, resume a dropped connection with Last-Event-ID, and backfill the last 15 minutes. All 35 chains. Paid plans only. One token, one interval, one candle pushed the moment its bucket closes. Open, high, low, close, average, USD volume and a swap count arrive already aggregated, so a chart stays current without you keeping a tick buffer of your own. This feed also remembers. A dropped connection resumes where it left off, and a fresh one can start with the last fifteen minutes already on screen. This page is the working reference: how a candle is built, how to subscribe, what resume and backfill really do, what it costs, and the four behaviours that will surprise you. Parameters and schemas are at [GET /sse/ohlcv](/streaming/stream-real-time-ohlcv-for-a-single-asset). > [!WARNING] > > **This feed needs a paid plan, and a free key does not open it.** Dev, Pro and Enterprise keys are all accepted. Every other stream either runs keyless or opens with a free key. This one answers `403` with `"error": "plan_required"` and `"required_tier": "dev"` to anything less (the `message` reads `this endpoint requires a Dev or Pro plan`), on a connection you expected to stay open; full body in [error handling](/knowledge-base/error-handling#403-forbidden-paid-only-endpoint). The [transactions feed](/streaming/transactions-streaming) sits behind the same gate. > > A paid plan also means a different host: `streaming-pro.dexpaprika.com`, never `streaming.`. Plans are on [pricing](https://dexpaprika.com/api/pricing), the migration is in [upgrading to Pro](/api-pro/upgrading), and your key lives in [console.dexpaprika.com](https://console.dexpaprika.com). ## How a candle is built Worth reading before the cost section, because these rules are the cost. A bucket opens when the first swap in that interval touches the token, and it collects every swap until the interval ends. Shortly after it ends the bucket is sealed and sent. | Interval | Bucket | Sealed after | Accepts late swaps for | | - | - | - | - | | `1s` | 1 second | 1 second | 2 minutes | | `5s` | 5 seconds | 2 seconds | 5 minutes | | `60s` | 1 minute | 3 seconds | 10 minutes | Three consequences follow, and each one shows up in real consumers. **A quiet interval produces nothing at all.** No swap means no bucket, and no bucket means no event. A token that trades twice a minute sends two candles a minute on the `1s` stream, not sixty. You are never charged for silence. **A candle can be sent more than once.** When a swap arrives after its bucket was already sealed, within the late window above, the bucket is recomputed and republished under **the same `timestamp`** with updated values. This is correct behaviour on chains that deliver blocks out of order, and it means your store must be keyed on `timestamp` and overwrite. A consumer that appends will draw the same minute twice. **`interval` is a cost lever before it is a resolution choice.** The same token on `1s` and on `60s` delivers the same trades; only the bucketing differs. See [what it costs](#what-it-costs). All **35 chains we index stream candles**, with no separate coverage list to check. The set matches [GET /networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) exactly. ## Subscribe `Authorization` carries the key as the **entire** header value, with no scheme word in front of it. ```bash Live candles theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/ohlcv?method=token_ohlcv&chain=ethereum&address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&interval=60s" ``` ```bash With the last 5 minutes first theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/ohlcv?method=token_ohlcv&chain=ethereum&address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&interval=60s&since=$(( $(date +%s) - 300 ))" ``` ```bash Sample 20 events and stop theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/ohlcv?method=token_ohlcv&chain=solana&address=So11111111111111111111111111111111111111112&interval=1s&limit=20" ``` `method` is `token_ohlcv` and `address` is a token address. `interval` defaults to `1s`, which is the most expensive choice, so set it deliberately. `request_id` is echoed on every event if you send one. One subscription per connection here, unlike prices, reserves and transactions, which take up to 25 in a POST body. Watching ten tokens means ten connections, and your plan's concurrent-stream cap is the ceiling: **30** on Dev, **100** on Pro. ## What an event looks like ``` event: token_ohlcv id: 1789461600 data: {"chain":"ethereum","token_id":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","interval":"60s","timestamp":"2026-09-15T08:40:00Z","open":0.9998,"high":1.0003,"low":0.9996,"close":1.0001,"avg":1.0000,"volume_usd":15230.50,"txns":12} ``` | Field | Type | Meaning | | - | - | - | | `chain` | string | Network id | | `token_id` | string | Token address, as you passed it | | `interval` | string | `1s`, `5s` or `60s`, echoing your subscription | | `timestamp` | string | ISO 8601, UTC, the **start** of the bucket. This is the identity of the candle | | `open`, `close` | number | First and last sample price in USD, ordered by block time rather than arrival | | `high`, `low` | number | Extremes in USD over the bucket | | `avg` | number | Mean of the price samples. **Not volume weighted**, see below | | `volume_usd` | number | Total USD volume in the bucket | | `txns` | integer | Number of swaps in the bucket | The `id:` line is the candle's `timestamp` as unix seconds. Browsers track it automatically and replay it as `Last-Event-ID` on reconnect, which is what makes resume work with no code on your side. > [!NOTE] > > **`avg` is an unweighted mean.** It averages the price samples in the bucket, so a hundred-dollar swap and a hundred-thousand-dollar swap move it by the same amount. When you want a volume weighted figure, derive it from `volume_usd` and the underlying trades on [the transactions feed](/streaming/transactions-streaming) instead of reading `avg`. ## Resume and backfill Two parameters put history in front of the live tail, and they behave differently on the edge cases. | | `since` (query) | `Last-Event-ID` (header) | | - | - | - | | Value | Unix seconds | Unix seconds, normally the last `id:` you saw | | Older than 15 minutes | `400`, the request is refused | **Clamped silently** to 15 minutes ago | | In the future | `400` | Ignored, you get live updates only | | Unparseable | `400` | Ignored, you get live updates only | | Precedence | Wins | Used only when `since` is absent | The two-column split is deliberate. `since` is something you wrote, so a mistake is worth an error. `Last-Event-ID` is sent by a browser after an outage of unknown length, and an outage longer than the window should still reconnect rather than fail. Three things to plan around: **The boundary is inclusive.** Resuming at the last `id:` you saw redelivers that candle. Harmless if you overwrite by `timestamp`, which the republish rule already requires; pass `since` one second later if you would rather not pay for it. **Backfill counts toward `limit`.** `limit` caps total events, history included, so `since=<5 minutes ago>&limit=10` can close the connection on backfill alone and never reach a live candle. **Fifteen minutes is the whole memory.** Anything older is a REST query, not a stream parameter. Sizing a longer history belongs in [plan your credit usage](/knowledge-base/credit-usage). ## What it costs [Each delivered event costs one credit](/knowledge-base/credit-usage). Heartbeats, warnings and error frames are free, so an idle connection costs nothing. Because a candle needs at least one swap, your bill is bounded twice over: ``` candles per hour <= min( 3600 / interval_seconds , swaps per hour ) ``` The left term is the ceiling you are buying into: | Interval | Ceiling per minute | Ceiling per 30 days | | - | - | - | | `1s` | 60 | 2,592,000 | | `5s` | 12 | 518,400 | | `60s` | 1 | 43,200 | A continuously trading major asset approaches the left term, so **one `1s` subscription is the single most expensive thing in the streaming API**, sixty times a `60s` subscription on the same token for the same trades. A long-tail token never gets near it, and the right term governs: forty swaps an hour is forty candles an hour on any interval. Republished candles are billed again, so a chain with frequent late blocks costs slightly more than the ceiling arithmetic suggests. > [!TIP] > > Measure before you commit. `&limit=100` on your real token and interval, timed, gives you the rate; the rate gives you the month. It takes a minute and beats any estimate on this page. Your included credits and the overage rate are on [pricing](https://dexpaprika.com/api/pricing), and usage is in [console.dexpaprika.com](https://console.dexpaprika.com). ## Error codes These arrive as an HTTP status with a JSON body, before the stream opens. | Status | Body | Cause | Fix | | - | - | - | - | | `403` | `{"message":"this endpoint requires a Pro plan"}` | Keyless or a free key. Dev, Pro and Enterprise keys pass | [Upgrade](https://dexpaprika.com/api/pricing), then move to `streaming-pro.` | | `403` | Cloudflare HTML block page | On a `-pro` host, no `Authorization` header, or a value that is not a DexPaprika key | Send the key itself. A missing or malformed header is stopped at the edge and never reaches the API | | `401` | `{"message":"api key verification has failed"}` | Key present and rejected | Check for a truncated paste | | `400` | `{"message":"invalid query parameters: interval (must be one of 1s, 5s, 60s)"}` | Unsupported interval | Only those three exist | | `400` | `{"message":"invalid query parameters: method (is required)"}` | Missing `method` | Send `method=token_ohlcv` | | `400` | `{"message":"unsupported chain: X (is not supported)"}` | Unknown `chain` | Use an id from [GET /networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) | | `400` | `{"message":"invalid query parameters: since (must be within the last 15 minutes)"}` | Backfill too far back | Clamp your own value, or drop it and use `Last-Event-ID` | | `404` | `{"message":"token not found: ethereum/0x..."}` | Address not indexed on that chain | Check the address, and that it matches the chain | | `429` | `"error":"rate_limited"`, message `Concurrent stream limit reached for your plan.` | More concurrent streams than your plan allows: 30 on Dev, 100 on Pro | Close idle connections | > [!NOTE] > > **`403` twice means two different things.** A JSON body is our API telling you the plan is wrong. An unbranded Cloudflare page means the request never reached us: on a `-pro` host the edge only forwards requests whose `Authorization` value is a DexPaprika key, so the usual cause is an unset environment variable leaving the header empty. Recovery is immediate on the next request with a correct header. ## In-stream events Once the stream is open, HTTP status no longer applies. Branch on the event name. | Event | Billed | Meaning | | - | - | - | | `token_ohlcv` | yes | A sealed candle, live or backfilled | | `ping` | no | Heartbeat, `{"time":}`, every 15 seconds | | `warning` | no | Non-fatal notice, the connection stays open | | `error` | no | Terminal failure, sent immediately before close | A handler that parses every `data:` line will try to read `{"time":1789461612}` as a candle. ## Good practices **Key your store on `timestamp` and overwrite.** This is the one rule that separates a correct consumer from a plausible one, because republished candles and an inclusive resume boundary both deliver a timestamp you already hold. **Trust the heartbeat, not the socket.** A dead TCP connection looks exactly like a quiet token, and on this feed a quiet token is the normal state. Pings arrive every 15 seconds; treat 45 seconds of silence as a disconnect. **Let the `id:` line do the resuming.** With `EventSource` you get it for free. Writing your own client, record the last `id:` and send it back as `Last-Event-ID`, rather than computing a `since` and having to handle the stricter validation yourself. **Reconnect with backoff and jitter.** A retry storm turns one rate limit into a persistent one. Start at a second, double to a minute. **Pick the widest interval the product can live with.** Sixty seconds of resolution for one sixtieth of the spend is the largest saving available on this endpoint, and most charts cannot render faster than the eye anyway. **Treat the feed as a live tail.** Fifteen minutes is all it remembers. Anything longer lives in your own store, written as candles arrive. ## A working consumer Handles resume, the republish rule, the heartbeat and backoff. ```js theme={null} // candle-tail.mjs: Node 18+, no dependencies. Needs DEXPAPRIKA_API_KEY. const KEY = process.env.DEXPAPRIKA_API_KEY; const CHAIN = "ethereum"; const TOKEN = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; const INTERVAL = "60s"; // 1s costs 60x this for the same trades // Candles are keyed by timestamp and OVERWRITTEN, never appended: a late swap // republishes a sealed candle under the same timestamp with new values, and // resuming redelivers the candle at the resume point. const candles = new Map(); let lastEventId = null; let lastBeat = Date.now(); async function tail() { const url = new URL("https://streaming-pro.dexpaprika.com/sse/ohlcv"); url.searchParams.set("method", "token_ohlcv"); url.searchParams.set("chain", CHAIN); url.searchParams.set("address", TOKEN); url.searchParams.set("interval", INTERVAL); const headers = { // The key is the whole Authorization value, with no scheme word in front of it. authorization: KEY, accept: "text/event-stream", }; // Older than 15 minutes is clamped rather than refused, so this is always safe // to send. The same value as `since` would be a 400. if (lastEventId) headers["last-event-id"] = lastEventId; const res = await fetch(url, { headers }); if (!res.ok) { // 403 = plan or missing header, 401 = key rejected, 400 = bad parameters. // None of them get better by retrying unchanged. throw new Error(`${res.status} ${await res.text()}`); } const decoder = new TextDecoder(); let buffer = ""; for await (const chunk of res.body) { buffer += decoder.decode(chunk, { stream: true }); const frames = buffer.split("\n\n"); buffer = frames.pop() ?? ""; for (const frame of frames) { const name = frame.match(/^event: (.+)$/m)?.[1]; const data = frame.match(/^data: (.+)$/m)?.[1]; const id = frame.match(/^id: (.+)$/m)?.[1]; if (!name || !data) continue; if (name === "ping") { lastBeat = Date.now(); continue; } if (name === "warning") { console.warn("[warning]", data); continue; } if (name === "error") { throw new Error(`stream error: ${data}`); } if (name !== "token_ohlcv") continue; const c = JSON.parse(data); const known = candles.has(c.timestamp); candles.set(c.timestamp, c); // overwrite, do not append if (id) lastEventId = id; console.log( `${known ? "revised" : "sealed "} ${c.timestamp} ` + `o ${c.open} h ${c.high} l ${c.low} c ${c.close} ` + `$${c.volume_usd.toFixed(2)} in ${c.txns} swaps`, ); } } } // Pings every 15s, so 45s of silence means the socket is gone. A token with no // trades is silent too, which is exactly why the heartbeat is the liveness test. setInterval(() => { if (Date.now() - lastBeat > 45_000) { console.error("no heartbeat, exiting for the supervisor to restart"); process.exit(1); } }, 5_000); let delay = 1_000; for (;;) { try { await tail(); delay = 1_000; } catch (err) { console.error(String(err)); if (/^4(0[0134])/.test(String(err))) process.exit(1); // fix the request, do not retry await new Promise((r) => setTimeout(r, delay + Math.random() * 500)); delay = Math.min(delay * 2, 60_000); } } ``` ## FAQs > [accordion] Can I stream candles without a paid plan? > > No. `/sse/ohlcv` answers `403` to keyless callers and to free keys alike, and so does `/sse/transactions`. Any paid key opens both: Dev, Pro or Enterprise. Token prices and pool reserves have keyless or free-key paths; see [streaming overview](/streaming/introduction). > [accordion] Why did I receive the same candle twice? > > Two reasons, both expected. A swap that lands after its bucket was sealed causes the candle to be recomputed and republished under the same `timestamp`. Separately, resuming with `Last-Event-ID` or `since` is inclusive of that second, so the candle at the resume point is redelivered. Key your store on `timestamp` and overwrite. > [accordion] How far back can the stream backfill? > > Fifteen minutes. `since` older than that is refused with a `400`; a `Last-Event-ID` older than that is clamped to the window rather than refused, so a client returning from a long outage still reconnects. Longer history is a REST query. > [accordion] Does a 1s stream really cost sixty times a 60s stream? > > Up to. Both carry the same trades, so the multiplier only reaches sixty on a token that trades in every single second. On a quieter token the candle count is bounded by the number of swaps instead, and the two intervals converge. [Plan your credit usage](/knowledge-base/credit-usage) works through the arithmetic. > [accordion] Which chains stream candles? > > All 35 that DexPaprika indexes. The set matches [GET /networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) exactly, so there is no separate coverage list to check. ## Where to go next > [card] [Endpoint reference](/streaming/stream-real-time-ohlcv-for-a-single-asset) > > Every parameter, schema and event type. > [card] [Plan your credit usage](/knowledge-base/credit-usage) > > What a continuous stream costs, with worked models. > [card] [Upgrading to Pro](/api-pro/upgrading) > > Moving a client to the paid hosts, and the one check that confirms it worked. > [card] [Swap transactions](/streaming/transactions-streaming) > > The individual trades these candles are built from. # Real-Time Pool Reserves Streaming Source: https://docs.dexpaprika.com/streaming/reserves-streaming Subscribe to block-by-block, USD-denominated liquidity changes for any DEX pool or any token, pushed over Server-Sent Events. DexPaprika streams parsed pool reserves over Server-Sent Events. Every time a swap or liquidity change lands in a pool you subscribed to, you receive a `pool_reserves` or `token_reserves` event (named after your subscription method) containing the current reserve and delta for each token in the pool, the current USD price, the USD value of the change, and the block number. No polling. No log decoding. No competitor offers this as a push feed. > [card] The DexPaprika differentiator > > **DexPaprika streams parsed pool reserves as push events.** For every block in which a subscribed pool's reserves changed, for every token in it: current reserve, delta since the previous block, current USD price, USD value of the change. No polling. No log decoding. No DEX-specific contract integrations. Just connect and consume. ## What you get Every time a swap, add-liquidity, or remove-liquidity transaction lands in a pool you subscribed to, DexPaprika emits a `pool_reserves` event (or `token_reserves` for token subscriptions) containing: * The **chain** and **pool** the change happened in * The **block number** the change was observed in * For **each token** in the pool: * Current reserve (raw on-chain integer) * Delta since the previous block (raw on-chain integer) * Current USD price * Current reserve value in USD * USD value of this block's delta * **Total reserve value of the pool in USD** * **Total USD delta** across all tokens this block That last value, `total_delta_usd`, tells you in one number how much liquidity moved through the pool this block. Positive means net inflow, negative means net outflow. No reduction, no aggregation, no waiting. *** ## Why this is unique Real-time pool reserves are easy to describe and hard to ship. Every other approach in the market makes you do most of the work. ### How competitors handle this today > [accordion] Subgraphs (The Graph) > > Subgraphs index DEX events into queryable schemas, and are most commonly consumed as **polling GraphQL queries**. Push subscriptions exist in some gateway configurations but aren't the default consumption pattern most teams build against. Latency in the typical setup is bounded below by your poll interval. For 1,000 pools and 1-second polling that is 60,000 requests per minute, every minute, forever. > [accordion] Raw block streams (Alchemy, Infura, QuickNode) > > These providers stream **raw blockchain events**. You receive a `Sync(uint112, uint112)` log for Uniswap V2, a `Swap(...)` log with internal balance math for Uniswap V3, an entirely different shape for Curve, Balancer, Solana DEXes. To turn that into "pool X now has Y USDC and Z WETH" you write a contract-by-contract decoder, maintain it across forks, handle reorgs, and reconcile reserve state from emitted deltas. That is tens of thousands of lines of code per DEX integration before you ever see a single USD-denominated reserve value. > [accordion] Price-only streams (Birdeye, others) > > A handful of providers offer token-price websockets. They push "USDC is $1.00" in real time. To our knowledge, they don't surface pool-level reserve dynamics as push events: you can see that USDC's price moved, but not that pool X just shed $4M in WETH liquidity this block. > [accordion] DEX aggregators' own APIs (1inch, 0x, etc.) > > Aggregator APIs are quote-driven, not stream-driven. You request a swap quote, you get pool depth as a side effect. You cannot subscribe. > [accordion] On-chain analytics platforms (Dune, Defillama) > > These are query-and-dashboard platforms. Their freshness is measured in minutes. Real-time is not the product. ### How DexPaprika handles it We do the contract decoding, the cross-DEX reserve reconciliation, the price attachment, and the USD denomination on our side. You get a single SSE stream. The events look the same whether the underlying pool is Uniswap V2, V3, V4, Curve, Balancer, Aerodrome, Raydium, or Orca. | Provider | Reserves push events | Block-level granularity | USD-denominated deltas | Multi-DEX abstraction | Zero log decoding | | - | - | - | - | - | - | | **DexPaprika Streaming** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | | Subgraphs (The Graph) | No (poll) | Yes | Sometimes | Per-subgraph | No | | Alchemy / Infura / QuickNode | Raw logs only | Yes | No | No | No | | Birdeye | Token prices only | Token-level | No | N/A | N/A | | Dune / Defillama | No (dashboards) | Minute-scale | Yes | Yes | Yes | | GeckoTerminal | No | N/A | N/A | N/A | N/A | | Bitquery | GraphQL subscriptions on raw events | Yes | Limited | Limited | Partial | DexPaprika is the only row that says yes across all five. *** ## The two subscription methods The `/sse/reserves` endpoint accepts two `method` values. Pick the one that matches what you are actually trying to monitor. > [card] pool_reserves > > Subscribe to **one specific pool**. You receive an event every time a swap or liquidity change lands in that pool's smart contract. Use this when you care about a particular pair on a particular DEX (a Uniswap V3 USDC/WETH pool, a Curve 3pool position, a Raydium AMM you provide liquidity to). > [card] token_reserves > > Subscribe to **one specific token**. You receive an event every time **any pool containing that token** sees a reserve change. Use this when you care about a token's entire on-chain ecosystem at once: total liquidity across all pools, where volume is concentrated, where it's draining. ### When to pick which **Pick `pool_reserves` if you are**: an LP watching your specific position, an arbitrage bot focused on a single venue, a slippage estimator for a particular trade route, a Uniswap V4 hook integrator. **Pick `token_reserves` if you are**: a treasury monitoring a stablecoin you issue, a token issuer watching liquidity migration across venues, an analytics platform aggregating TVL per token, a risk system watching for sudden drains anywhere a token trades. You can run both subscriptions on the same connection. A multi-asset POST stream can mix `pool_reserves` and `token_reserves` entries freely. *** ## What an event looks like Live capture from the production stream: ```json theme={null} { "chain": "ethereum", "pool_id": "0xe0554a476a092703abdb3ef35c80e0d76d32939f", "block": "25098911", "tokens": [ { "token_id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "reserve": "1897184450989", "delta": "-4915987385", "price_usd": 1.0000070290769338, "reserve_usd": 1897197.78, "delta_usd": -4916.02 }, { "token_id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "reserve": "1575557282142409643389", "delta": "2180365462384895407", "price_usd": 2255.21, "reserve_usd": 3553216.99, "delta_usd": 4917.19 } ], "total_reserve_usd": 5450414.77, "total_delta_usd": 1.16 } event: pool_reserves ``` Reading this top to bottom: * The change happened **on Ethereum, in pool `0xe055...939f`** (Uniswap V3 USDC/WETH), at **block 25098911**. Note that `block`, `reserve`, and `delta` arrive as JSON strings (precision-safe encoding for values that exceed `Number.MAX_SAFE_INTEGER`). * **Token 0 is USDC.** Its reserve dropped by **4,915,987,385 raw units** this block. USDC has 6 decimals, so that is **−\$4,916**. * **Token 1 is WETH.** Its reserve rose by **2,180,365,462,384,895,407 raw units**. WETH has 18 decimals, so that is **+2.18 WETH**, which at current $2,255 ETH equals **+$4,917\*\*. * **Net dollar delta for the pool this block: \~\$1.16.** Which is what `total_delta_usd` says. What you just witnessed is a swap: someone bought \$4,916 worth of WETH with USDC. You can see it block-by-block, without reading a single contract event log. *** ## Use cases by audience The same feature, three different reasons to care. ### For DeFi power users If you provide liquidity, trade, or hold positions on DEXes, reserves streaming changes what you can know about your own money. > [card] Real-time impermanent loss > > Watch your LP position's IL accrue block by block. Every `pool_reserves` event for your pool gives you the new constant-product or concentrated-liquidity state. Plug it into an IL calculator and your dashboard tells you what you are losing right now, not what you lost an hour ago. > [card] Slippage estimation before you swap > > Get the exact reserves of the pool you are about to trade through, as of the current block. Compute expected slippage against the actual current state. Decide whether to route, split, or wait. > [card] Liquidity migration alerts > > Watch a token's entire pool ecosystem (`method=token_reserves`). When a major LP yanks liquidity from venue A and adds to venue B, you see both events within seconds. > [card] Rug-pull early warning > > Sudden, large, one-sided reserve drains on a small pool. Exactly the signal you want before everyone else notices. Wire `total_delta_usd < -threshold` into a webhook and you have it. ### For quant, MEV, and arbitrage builders You need fresh, deterministic, low-latency pool state across many venues. Polling-based APIs do not work for you. Raw log streams force you to be your own DEX integration team. > [card] Block-level granularity > > Every event carries the `block` it was observed in. Two events with the same `block` happened in the same block. Two events with different `block` values are strictly ordered. You can reconstruct per-block pool state without ambiguity. > [card] Cross-DEX uniformity > > Uniswap V2, V3, V4, Curve, Balancer, Aerodrome, Raydium, Orca, PancakeSwap, SushiSwap. They all emit the same `pool_reserves` shape. One parser, one schema, one mental model. The contract-by-contract decoding lives on our side. > [card] USD-denominated deltas, pre-attached > > `price_usd` is attached to every token's reserve at observation time. `delta_usd` tells you the dollar value of this block's change. You do not maintain your own price feed to compute it. > [card] Production-grade throughput > > The streaming infrastructure is built for high concurrency. Production load testing has demonstrated comfortable headroom under hundreds of simultaneous connections, with linear throughput scaling under realistic workloads. ### For analytics and dashboard builders You build the products people open in the morning to see what is happening on-chain. Your users expect numbers that are accurate to the block, not to the minute. > [card] Real-time TVL > > Sum `total_reserve_usd` across all pools you track. The number is current to the block. No background ETL job. No "data is fresh as of 2 minutes ago" disclaimer. > [card] Real-time DEX volume attribution > > Aggregate `abs(total_delta_usd)` per pool, per DEX, per chain, over your time window of choice. You get DEX volume as a live stream, not a delayed batch. > [card] Pool depth heatmaps > > Maintain a per-pool reserves snapshot in memory, updated by every event. Render heatmaps that update live as liquidity moves across pools, chains, and DEXes. > [card] Bridge flow visibility > > When a bridge contract sits as a counterparty in a pool, its reserve changes show you cross-chain flows the moment they settle on the destination chain. No "is the bridge healthy" guessing. *** ## Get started Three runnable examples. Each connects to the live production stream. The reserves feed needs an API key: a [free one](https://console.dexpaprika.com) takes a minute, needs no card, and opens every token we index. Before you leave one running, size the cost with [plan your credit usage](/knowledge-base/credit-usage). ### A single pool with cURL Subscribe to a Uniswap V3 USDC/WETH pool on Ethereum. ```bash theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming.dexpaprika.com/sse/reserves?method=pool_reserves&chain=ethereum&address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" ``` You will see events arrive each time someone trades through this pool: ``` data: {"chain":"ethereum","pool_id":"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","block":"25098912","tokens":[...],"total_reserve_usd":5042113.41,"total_delta_usd":-128.44} event: pool_reserves ``` Use `Ctrl-C` to disconnect. ### A whole token's ecosystem with Python Follow USDC's reserves across every Ethereum pool that holds it. Each `token_reserves` event is one token-wide total, sent when a swap or liquidity change moves it, so there is no `pool_id` in it. ```python theme={null} # pip install httpx httpx-sse import json import os import httpx from httpx_sse import connect_sse url = "https://streaming.dexpaprika.com/sse/reserves" params = { "method": "token_reserves", "chain": "ethereum", "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", # USDC } # The key is the whole Authorization value, with no scheme word in front of it. headers = {"Authorization": os.environ["DEXPAPRIKA_API_KEY"]} # No read timeout: the stream stays open between events. with httpx.Client(timeout=httpx.Timeout(10.0, read=None)) as client: with connect_sse(client, "GET", url, params=params, headers=headers) as event_source: event_source.response.raise_for_status() for sse in event_source.iter_sse(): if sse.event != "token_reserves": continue event = json.loads(sse.data) print(f"block {event['block']} reserve {event['reserve_usd']:,.0f} USD delta {event['delta_usd']:+,.2f} USD") ``` Sample output: ``` block 26406175 reserve 2,994,316,611 USD delta -48,126.86 USD ... ``` Each line is USDC's reserve summed over its Ethereum pools after a change, and the size of that change. For one pool's tokens use `method=pool_reserves` with the pool address. ### Multiple assets at once with JavaScript A POST stream that mixes one specific pool and one whole token. Single connection, both feeds. ```javascript theme={null} async function subscribe() { const response = await fetch("https://streaming.dexpaprika.com/sse/reserves", { method: "POST", headers: { "Accept": "text/event-stream", "Content-Type": "application/json", // The key is the whole Authorization value, with no scheme word in front of it. "Authorization": process.env.DEXPAPRIKA_API_KEY, }, body: JSON.stringify([ { chain: "ethereum", address: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", method: "pool_reserves", }, { chain: "ethereum", address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", method: "token_reserves", }, ]), }); const decoder = new TextDecoder(); let buffer = ""; for await (const chunk of response.body) { buffer += decoder.decode(chunk, { stream: true }); // SSE messages are separated by a blank line. const messages = buffer.split("\n\n"); buffer = messages.pop() ?? ""; for (const message of messages) { const lines = message.split("\n"); const eventLine = lines.find((l) => l.startsWith("event:")); const dataLine = lines.find((l) => l.startsWith("data:")); if (!dataLine) continue; // These event types may arrive: `pool_reserves` / `token_reserves`, `ping`, `warning`, `error`. // Filter for the one we care about; unrecognised events should be no-ops. const eventType = eventLine ? eventLine.slice(6).trim() : "message"; if (eventType !== "pool_reserves" && eventType !== "token_reserves") continue; const payload = JSON.parse(dataLine.slice(5).trim()); handleReserveUpdate(eventType, payload); } } } // pool_reserves carries the pool and its tokens; token_reserves is one flat // record for the token, with no pool_id. function handleReserveUpdate(eventType, event) { if (eventType === "pool_reserves") { console.log(`pool ${event.pool_id} block ${event.block} Δ ${event.total_delta_usd.toFixed(2)} USD`); } else { console.log(`token ${event.token_id} block ${event.block} Δ ${event.delta_usd.toFixed(2)} USD`); } } subscribe(); ``` Two notes on the JavaScript example: * The browser `EventSource` API does **not** support POST requests, so multi-asset subscriptions on the browser require `fetch` + `ReadableStream` like above. Single-asset GET subscriptions work with `EventSource` directly. * The `total_delta_usd`, `delta_usd`, `reserve_usd`, and `price_usd` fields are regular JavaScript numbers, safe for floating-point math. The raw `reserve`, `delta`, `block`, and `previous_block` fields arrive as JSON strings: the server encodes them that way because they routinely exceed `Number.MAX_SAFE_INTEGER`. Use `BigInt(reserve)` for exact arithmetic, or `Number(block)` if you just need to compare block heights and trust the value fits in a 53-bit float. *** ## Limits to know about | Limit | Value | Behaviour when exceeded | | - | - | - | | Pools/tokens per POST connection | **25** | `POST /sse/reserves` rejects the request with `{"message": "too many subscriptions"}` | | Concurrent SSE streams | **10** on a free key, **30** on Dev, **100** on Pro | The next connection returns `429 Too Many Requests` with `"error":"rate_limited"` and a message starting `Concurrent stream limit reached` | | Ping interval | **15 s** | A `ping` event arrives if no reserve activity has been pushed for that long. Use it as a connection-liveness signal | | Credit cost | **1 per event delivered** | The subscription and ping figures are the same on every plan; the stream cap and the allowance are not. 10,000 credits keyless, 100,000 with a free key, 5M on [Pro](https://dexpaprika.com/api/pricing) | The server may also push a `warning` event in-band (for example, when you connect to a deprecated path). Treat unknown event types as no-ops so new server-side additions never crash your handler. *** ## What's next > [card] [Streaming reference](/streaming/stream-real-time-reserves-for-a-single-asset) > > Schema, parameters, error codes for the GET and POST `/sse/reserves` endpoints. > [card] [Token price streaming](/streaming/introduction) > > DexPaprika also streams token prices over the same SSE transport. Use both together for full pool-state coverage. > [card] [Live dashboard demo](https://dexpaprika.com/streaming/solana) > > A working frontend that connects to the streaming API. Source-available, deployable, a good starting reference. > [card] [Discord community](https://discord.gg/DhJge5TUGM) > > The team is in Discord. Bring use cases, edge cases, and feature requests. # Showcase streams: the keyless token list Source: https://docs.dexpaprika.com/streaming/showcase-streams The one flagship asset per chain you can stream without an API key, with its contract address and a live demo for 34 of the 35 chains we index. Price streaming works without an API key, on a fixed list: one flagship asset on 34 of the 35 chains we index (Arc has none). These are the showcase streams. They exist so you can see real pushed prices before you sign up for anything. Streaming is four separate products, and only the first is open keyless: | Endpoint | What it pushes | Without a key | | - | - | - | | `/sse/prices` | USD price, pushed when a swap moves it | The 34 showcase assets below | | `/sse/transactions` | Individual swaps on a pool or token | Needs a [paid plan](/streaming/transactions-streaming) | | `/sse/reserves` | Pool reserves and their deltas | Needs a free key | | `/sse/ohlcv` | Sealed token candles at 1s, 5s or 60s | Needs a [paid plan](/streaming/ohlcv-streaming) | A free API key opens prices on any token we index and the reserves feed, up to 10 concurrent streams per account. Transactions and candles need a Dev, Pro or Enterprise key on `streaming-pro.dexpaprika.com`. Nothing else changes: the transport, the event shape and the delivery rate are the same either way. See [pricing](https://dexpaprika.com/api/pricing) for how streaming is metered. ## The list Every row links to a live stream for that chain, running in the browser with no key and no signup. Verified against the streaming gateway on 2026-08-06. | Network | Asset | Contract address | Live stream | | - | - | - | - | | Aptos | `APT` | `0xa` | [Watch APT on Aptos](https://dexpaprika.com/streaming/aptos) | | Arbitrum | `WETH` | `0x82af49447d8a07e3bd95bd0d56f35241523fbab1` | [Watch WETH on Arbitrum](https://dexpaprika.com/streaming/arbitrum) | | Avalanche | `WAVAX` | `0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7` | [Watch WAVAX on Avalanche](https://dexpaprika.com/streaming/avalanche) | | Base | `WETH` | `0x4200000000000000000000000000000000000006` | [Watch WETH on Base](https://dexpaprika.com/streaming/base) | | Berachain | `WBERA` | `0x6969696969696969696969696969696969696969` | [Watch WBERA on Berachain](https://dexpaprika.com/streaming/berachain) | | Binance Smart Chain | `WBNB` | `0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c` | [Watch WBNB on Binance Smart Chain](https://dexpaprika.com/streaming/bsc) | | BOB Network | `WETH` | `0x4200000000000000000000000000000000000006` | [Watch WETH on BOB Network](https://dexpaprika.com/streaming/bob_network) | | Celo | `CELO` | `0x471ece3750da237f93b8e339c536989b8978a438` | [Watch CELO on Celo](https://dexpaprika.com/streaming/celo) | | Cronos | `WCRO` | `0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23` | [Watch WCRO on Cronos](https://dexpaprika.com/streaming/cronos) | | Ethereum | `WETH` | `0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` | [Watch WETH on Ethereum](https://dexpaprika.com/streaming/ethereum) | | Fantom | `WFTM` | `0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83` | [Watch WFTM on Fantom](https://dexpaprika.com/streaming/fantom) | | Flow EVM | `WFLOW` | `0xd3bf53dac106a0290b0483ecbc89d40fcc961f3e` | [Watch WFLOW on Flow EVM](https://dexpaprika.com/streaming/flow_evm) | | HyperEVM | `WHYPE` | `0x5555555555555555555555555555555555555555` | [Watch WHYPE on HyperEVM](https://dexpaprika.com/streaming/hyperevm) | | Katana | `vbETH` | `0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62` | [Watch vbETH on Katana](https://dexpaprika.com/streaming/katana) | | Linea | `WETH` | `0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f` | [Watch WETH on Linea](https://dexpaprika.com/streaming/linea) | | Mantle | `WMNT` | `0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8` | [Watch WMNT on Mantle](https://dexpaprika.com/streaming/mantle) | | MegaETH | `WETH` | `0x4200000000000000000000000000000000000006` | [Watch WETH on MegaETH](https://dexpaprika.com/streaming/megaeth) | | Monad | `WMON` | `0x3bd359c1119da7da1d913d1c4d2b7c461115433a` | [Watch WMON on Monad](https://dexpaprika.com/streaming/monad) | | Optimism | `WETH` | `0x4200000000000000000000000000000000000006` | [Watch WETH on Optimism](https://dexpaprika.com/streaming/optimism) | | Plasma | `WXPL` | `0x6100e367285b01f48d07953803a2d8dca5d19873` | [Watch WXPL on Plasma](https://dexpaprika.com/streaming/plasma) | | Polygon | `WPOL` | `0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270` | [Watch WPOL on Polygon](https://dexpaprika.com/streaming/polygon) | | Robinhood Chain | `WETH` | `0x0bd7d308f8e1639fab988df18a8011f41eacad73` | [Watch WETH on Robinhood Chain](https://dexpaprika.com/streaming/robinhood) | | Ronin | `WRON` | `0xe514d9deb7966c8be0ca922de8a064264ea6bcd4` | [Watch WRON on Ronin](https://dexpaprika.com/streaming/ronin) | | Scroll | `WETH` | `0x5300000000000000000000000000000000000004` | [Watch WETH on Scroll](https://dexpaprika.com/streaming/scroll) | | Sei | `WSEI` | `0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7` | [Watch WSEI on Sei](https://dexpaprika.com/streaming/sei) | | Solana | `SOL` | `So11111111111111111111111111111111111111112` | [Watch SOL on Solana](https://dexpaprika.com/streaming/solana) | | Sonic | `wS` | `0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38` | [Watch wS on Sonic](https://dexpaprika.com/streaming/sonic) | | Sui | `SUI` | `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI` | [Watch SUI on Sui](https://dexpaprika.com/streaming/sui) | | Tempo | `pathUSD` | `0x20c0000000000000000000000000000000000000` | [Watch pathUSD on Tempo](https://dexpaprika.com/streaming/tempo) | | Ton | `TON` | `EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c` | [Watch TON on Ton](https://dexpaprika.com/streaming/ton) | | Tron | `WTRX` | `TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR` | [Watch WTRX on Tron](https://dexpaprika.com/streaming/tron) | | Unichain | `WETH` | `0x4200000000000000000000000000000000000006` | [Watch WETH on Unichain](https://dexpaprika.com/streaming/unichain) | | x Layer | `WOKB` | `0xe538905cf8410324e03a5a23c1c177a474d59b2b` | [Watch WOKB on x Layer](https://dexpaprika.com/streaming/x_layer) | | ZkSync | `WETH` | `0x5aea5775959fbc2557cc8789bc1bf90a239d9a91` | [Watch WETH on ZkSync](https://dexpaprika.com/streaming/zksync) | ## Subscribing to one Take the chain id and the contract address from the row you want. No key, no headers: ```bash theme={null} curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=solana&address=So11111111111111111111111111111111111111112" ``` Each `token_price` frame carries the asset, the chain and the current USD price. Updates are pushed when a swap moves the price, not on a fixed interval, so a heavily traded asset delivers tens of frames a minute while a quiet one can sit still for minutes. That is the market being quiet, not the connection being broken. ## Requesting an asset that is not on the list Without a key, a subscription is accepted only for the assets above. The POST path rejects the whole subscribe on the first asset outside the list rather than returning a partial result, so a batch that mixes listed and unlisted assets fails as a unit. Register a free key and the restriction disappears. > [card] [Stream any token](https://dexpaprika.com/api/pricing) > > A free API key takes you off this list: any token we index, up to 10 concurrent streams per account. No card. # Stream real-time prices for an asset Source: https://docs.dexpaprika.com/streaming/stream-real-time-data-for-a-single-asset streaming/api-streaming.yml GET /sse/prices Establishes an SSE stream for a single token's price using query parameters. **Emitted events:** `token_price` · `ping` · `warning` · `error` > [card] [Tutorial: Your first stream](/streaming/tutorials/quick-start) > > Live token prices over SSE in a few minutes, no key for the showcase tokens. # Stream real-time token OHLCV candles for paid plans Source: https://docs.dexpaprika.com/streaming/stream-real-time-ohlcv-for-a-single-asset streaming/api-streaming.yml GET /sse/ohlcv Stream real time token candles over SSE for paid plans. Reconnect using Last-Event-ID or backfill with since. > [card] [Tutorial: Real-time token OHLCV candle streaming](/streaming/ohlcv-streaming) > > Live candles for a token, and how sealed candles are republished. # Stream real-time reserve updates for a single pool or token Source: https://docs.dexpaprika.com/streaming/stream-real-time-reserves-for-a-single-asset streaming/api-streaming.yml GET /sse/reserves Establishes an SSE stream for reserve updates on a specific pool or token using query string parameters. **Supported Channel Events:** - `pool_reserves`: Per-block reserve update for a pool. Schema matches `PoolReservesResponse`. - `token_reserves`: Aggregated reserve update across all pools for a token. Schema matches `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time pool reserves streaming](/streaming/reserves-streaming) > > Subscribe to reserve changes and keep a pool's liquidity current. # Stream real-time swap transactions for a single pool or token Source: https://docs.dexpaprika.com/streaming/stream-real-time-transactions-for-a-single-asset streaming/api-streaming.yml GET /sse/transactions **Paid plans only.** Available on Dev, Pro and Enterprise keys on `https://streaming-pro.dexpaprika.com`; keyless requests and free keys receive HTTP 403. Establishes an SSE stream for swap transactions on a specific pool or token using query string parameters. **Resume:** each swap event has an SSE `id`. Send the last one back as `Last-Event-ID` (browsers do this on reconnect), or pass `since`, to get missed swaps first (last 15 minutes, up to 100). **Supported Channel Events:** - `pool`: Swap transactions for a pool. Schema matches `TransactionResponse`. - `token`: Swap transactions involving a token. Schema matches `TransactionResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time swap transactions streaming](/streaming/transactions-streaming) > > Live swaps for a pool or token, including resuming after a disconnect. # Stream real-time prices for multiple assets Source: https://docs.dexpaprika.com/streaming/subscribe-to-multiple-assets-streaming post /sse/prices Establishes a multiplexed SSE stream for up to 25 token price subscriptions in a single connection. **Emitted events:** `token_price` · `ping` · `warning` · `error` > [card] [Tutorial: Your first stream](/streaming/tutorials/quick-start) > > Live token prices over SSE in a few minutes, no key for the showcase tokens. # Stream real-time reserve updates for multiple pools or tokens Source: https://docs.dexpaprika.com/streaming/subscribe-to-multiple-reserves-streaming post /sse/reserves Establishes a multiplexed SSE stream for reserve updates across multiple pools or tokens within a single connection. **Stream Constraints:** Maximum payload array length is **25 subscriptions**. **Supported Channel Events:** - `pool_reserves`: Per-block reserve update for a pool. Schema matches `PoolReservesResponse`. - `token_reserves`: Aggregated reserve update for a token. Schema matches `TokenReservesResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time pool reserves streaming](/streaming/reserves-streaming) > > Subscribe to reserve changes and keep a pool's liquidity current. # Stream real-time swap transactions for multiple pools or tokens Source: https://docs.dexpaprika.com/streaming/subscribe-to-multiple-transactions-streaming post /sse/transactions **Paid plans only.** Available on Dev, Pro and Enterprise keys on `https://streaming-pro.dexpaprika.com`; keyless requests and free keys receive HTTP 403. Establishes a multiplexed SSE stream for swap transactions across multiple pools or tokens within a single connection. **Stream Constraints:** Maximum payload array length is **25 subscriptions**. **Resume:** same as GET. One `since` or `Last-Event-ID` covers all subscriptions. Missed swaps are capped at 500 per connection. When subscriptions span several chains, swaps from other chains than the one in `Last-Event-ID` may be sent again; dedupe by `id`. **Supported Channel Events:** - `pool`: Swap transactions for a pool. Schema matches `TransactionResponse`. - `token`: Swap transactions involving a token. Schema matches `TransactionResponse`. - `ping`: Infrastructure keep-alive payload (`PingEvent`). - `warning`: System warning notifications (`WarningEvent`). - `error`: Stream-level operational exceptions (`ErrorEvent`). > [card] [Tutorial: Real-time swap transactions streaming](/streaming/transactions-streaming) > > Live swaps for a pool or token, including resuming after a disconnect. # Real-Time Swap Transactions Streaming Source: https://docs.dexpaprika.com/streaming/transactions-streaming Stream individual DEX swaps over SSE with USD amounts already attached. Per-pool or per-token, 35 chains, no log decoding and no node. Paid plans only. Every swap on a pool, pushed the moment it settles, with both legs priced in USD before it reaches you. No node, no `Swap` event decoding, no ABI per DEX. This page is the working reference: how to subscribe, what each field means, what the error codes are, the three things that will trip you up, and what it costs. Endpoint reference is at [GET /sse/transactions](/streaming/stream-real-time-transactions-for-a-single-asset) and [POST /sse/transactions](/streaming/subscribe-to-multiple-transactions-streaming). > [!WARNING] > > **This feed needs a paid plan, and a free key does not open it.** Dev, Pro and Enterprise keys are all accepted, on `streaming-pro.dexpaprika.com`. Keyless requests and free keys answer `403` with `"error": "plan_required"` and `"required_tier": "dev"` (the `message` reads `this endpoint requires a Dev or Pro plan`), on a connection you expected to stay open; full body in the error table below. Reserves still open with a free key and prices stream keyless on the showcase assets; transactions and candles are the two paid feeds. > > Plans are on [pricing](https://dexpaprika.com/api/pricing), the host and header changes are in [upgrading to Pro](/api-pro/upgrading), and your key lives in [console.dexpaprika.com](https://console.dexpaprika.com). ## Before anything else: pick your method carefully Two methods, and the difference between them is three orders of magnitude in cost. | `method` | Subscribes to | Measured rate | | - | - | - | | `pool` | one pool | **93 events/min** on Orca SOL/USDC | | `token` | *every pool the token trades in* | **19,326 events/min** on SOL, across 531 pools | Both figures were measured on 2026-08-21 in the same hour. `token` on a major asset is 208 times the traffic of a single pool, because a major asset is in thousands of pools. Since [each delivered event costs one credit](/knowledge-base/credit-usage), that rate is your bill: | Subscription | Credits/min | Dev's 500,000 lasts | Pro's 5,000,000 lasts | | - | - | - | - | | `pool` on SOL/USDC | 93 | 3.7 days | 37 days | | `token` on SOL | 19,326 | **26 minutes** | **4 hours 19 min** | > [!WARNING] > > `method: "token"` on a top-20 asset will exhaust a Dev plan's month in under half an hour. Use it for long-tail tokens that trade in a handful of pools, or when you genuinely need cross-pool coverage and have budgeted for it. For one venue, use `pool`. ## Subscribe Both forms need `Authorization` carrying a paid-plan key as the **entire** header value, with no scheme word in front of it, and they live on `streaming-pro.dexpaprika.com` only; see [upgrading to Pro](/api-pro/upgrading). ```bash GET, one subscription theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/transactions?method=pool&chain=solana&address=Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" ``` ```bash POST, up to 25 theme={null} curl -N -X POST "https://streaming-pro.dexpaprika.com/sse/transactions" \ -H "Authorization: $DEXPAPRIKA_API_KEY" \ -H "Accept: text/event-stream" \ -H "Content-Type: application/json" \ -d '[ {"chain":"solana","address":"Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE","method":"pool","request_id":1}, {"chain":"ethereum","address":"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","method":"pool","request_id":2} ]' ``` `request_id` is echoed on every event so you can tell subscriptions apart on a multiplexed connection. It is optional and defaults to the array index, which is fine until you reorder the array. Set it explicitly. Add `?limit=N` to close the connection after N events. It is the cheapest way to sample a feed before you commit to it. ## What an event looks like A real capture from the Orca SOL/USDC pool: ``` event: pool request_id: 1 data: {"chain":"solana","pool_id":"Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE","block_number":"440660176","block_timestamp":"2026-08-21T09:49:04Z","tx_hash":"xdEpqxQp4Pp1NNceoaiqkSrc7EYn5zQGNNsobBdsu1au9EiE88TX3GQ1iY1hxsJjkpMq9ufqLd5irVthJSddmPQ","sender":"9TiD2JbKz7tphbs1LzjFR7HbXhVfeRW2vhWVisKqwme","recipient":"AdphhurSRH4euoAasqypvoJLbD8XpuztVSzg2nqmPxcx","token_0":"So11111111111111111111111111111111111111112","token_1":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","amount_0":4841787021,"amount_1":-445711274,"amount_0_usd":445.8084604429579,"amount_1_usd":445.4707026504548,"price_0_usd":92.07519011253054,"price_1_usd":0.9994602529404603,"volume_usd":225.2765305105} ``` The event name is the method: `pool` or `token`. | Field | Type | Meaning | | - | - | - | | `chain` | string | Network id | | `pool_id` | string | The pool the swap happened in. On `method: "token"` this varies per event | | `block_number` | **string** | Block or slot height | | `block_timestamp` | string | ISO 8601, UTC | | `tx_hash` | string | Transaction signature or hash | | `sender` | string | Address that sent the input token. Often a router, not the trader | | `recipient` | string | Address that received the output | | `token_0`, `token_1` | string | Contract addresses. **See the ordering pitfall below** | | `amount_0`, `amount_1` | **number** | Raw, signed, not decimal-adjusted. **See the precision pitfall below** | | `amount_0_usd`, `amount_1_usd` | number | Each leg's USD value at the block | | `price_0_usd`, `price_1_usd` | number | Per-token USD price at the block | | `volume_usd` | number | Roughly half the notional. **See the volume pitfall below** | **Direction is not a field.** Derive it from the sign of `amount_0`: negative means `token_0` left the pool, so the trader bought it. In the event above `amount_0` is positive, so SOL went in and USDC came out: a sell. **There are no symbols and no decimals.** REST rows carry `token_0_symbol`; stream events do not. If you need "1.13 WETH" rather than a raw integer, fetch decimals once from [the pool endpoint](/api-reference/pools/get-a-pool-on-a-network) and cache them. The `_usd` fields are already computed, so most consumers never need the raw amounts at all. ## Three pitfalls These are the ones that cost real time. Each was measured, not inferred. ### 1. `token_0` is not the same token in REST and in the stream Same pool, same minute, on Ethereum: ``` STREAM token_0 = 0xa0b8…eb48 (USDC) price_0_usd = 1.00 REST token_0 = 0xc02a…6cc2 (WETH) price_0_usd = 2398.24 ``` Both surfaces are internally consistent, so nothing looks wrong. If you join stream events to REST rows by position, you read WETH amounts as USDC and price them at a dollar. It does not reproduce everywhere. On Solana and on Base the two agree. The stream follows the pool's on-chain ordering; REST puts the major token first; they coincide only when those happen to match, which they do on Base (`0x4200…` sorts below `0x8335…`) and on Solana, and do not on Ethereum (`0xa0b8…` sorts below `0xc02a…`). > [!WARNING] > > **Resolve tokens by address, never by index.** Do not assume `_0` means the same thing across two DexPaprika surfaces, and do not verify this on Solana only: the bug hides there. ### 2. Raw amounts arrive as JSON numbers, and JavaScript will round them `amount_0` and `amount_1` are JSON numbers, not strings. For an 18-decimal token they exceed `Number.MAX_SAFE_INTEGER` routinely: ```js theme={null} JSON.parse('{"amount_1":32267156849925919299}').amount_1 // 32267156849925920000 <- 701 wei gone, silently ``` The [reserves feed](/streaming/reserves-streaming) sends `reserve`, `delta` and `block` as strings precisely to avoid this. The transactions feed does not. This also hides on Solana. Nine-decimal SOL and six-decimal USDC keep raw amounts small: across 93 captured Solana events the largest absolute amount was 90,504,206,102, four orders of magnitude below the limit. Test on an 18-decimal EVM token or you will not see it. If you need exact raw amounts, parse with a big-integer-aware reader rather than `JSON.parse`, or work from the `_usd` fields, which are ordinary floats and safe. `block_number` is already a string for the same reason. Use `Number()` on it only for comparisons, never for arithmetic you care about. ### 3. `volume_usd` is about half the notional Measured across both chains, `volume_usd` sits at 0.4999 to 0.5057 of each leg's USD value: ``` amount_0_usd = 445.81 amount_1_usd = 445.47 volume_usd = 225.28 ``` The ratio is stable within a pool and differs slightly between pools, so treat it as "one side of the trade" rather than a formula. The practical consequence: do not sum `volume_usd` and compare it against a REST 24h volume figure without checking the convention, or you will be out by a factor of two. When you want the size of a trade, `amount_0_usd` and `amount_1_usd` are unambiguous. ## Error codes Every one of these was produced against the live endpoint. They arrive as an HTTP status with a JSON body, before the stream opens. | Status | Body | Cause | Fix | | - | - | - | - | | `403` | `{"error":"plan_required","tier":"keyless","required_tier":"dev","message":"this endpoint requires a Dev or Pro plan","links":{...}}` | No key (`tier` is `free` on a free key). This feed is paid-only | Use a Dev, Pro or Enterprise key; see [pricing](https://dexpaprika.com/api/pricing) | | `403` | `{"error":"wrong_host",...}` | A paid key sent to `streaming.dexpaprika.com` | Connect to `streaming-pro.dexpaprika.com` | | `401` | `{"message":"api key verification has failed"}` | Key present and rejected | Check for a truncated paste. `ApiKey` or `Token` in front of the key also causes this | | `400` | `{"message":"unsupported chain: X (is not supported)"}` | Unknown `chain` | Use an id from [GET /networks](/api-reference/networks/get-a-list-of-available-blockchain-networks) | | `400` | `{"message":"no valid subscriptions: subscriptions (all provided assets were not found)"}` | Address not indexed on that chain | Check the address, and that it matches the chain | | `400` | `{"message":"invalid subscription: Method (must be one of [pool token])"}` | Bad `method` | Only `pool` and `token` exist here | | `400` | `{"message":"at least one subscription is required: subscriptions (is empty)"}` | `[]` body | Send at least one subscription | | `400` | `{"message":"too many subscriptions: subscriptions (max 25 allowed)"}` | More than 25 entries | Split across connections, within your plan's concurrent-stream cap | | `400` | `{"message":"Bad Request"}` | Body is not a JSON array | POST takes an array, even for one subscription | > [!NOTE] > > **`403` and `401` mean different things and the difference is useful.** `403` is "this plan or host cannot open the feed": no key, a free key, or a paid key on the wrong host. `401` is "you sent a key and it was rejected". Branch on them: the first needs a plan or a base URL change, the second needs a look at the header. ## In-stream events Once the stream is open, HTTP status no longer applies. Watch the event name: | Event | Meaning | | - | - | | `pool` / `token` | A swap. Which name you get matches the `method` you asked for | | `ping` | Heartbeat, `{"time":}`, **every 15 seconds**, measured | | `warning` | A non-fatal notice about one subscription. The connection stays open | | `error` | A stream-level failure | Filter on the event name. A handler that parses every `data:` line will try to read `{"time":1787305761}` as a swap. ## Resume after a disconnect Every swap event carries an SSE `id:` line. Hand it back and the stream replays what you missed before it continues live, on the same connection. There are two ways in: * **`Last-Event-ID` header**, set to the last `id:` you received. `EventSource` sends it by itself on reconnect; a hand-written client has to record the id and send it. * **`since` query parameter**, in Unix seconds, for "everything since this time". It must be within the last 15 minutes. Older values answer `400` with `{"error":"invalid_param","message":"invalid query parameters: since (must be within the last 15 minutes)","param":"since"}`. ```bash theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/transactions?method=pool&chain=ethereum&address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640&since=$(( $(date +%s) - 600 ))" ``` Four things we measured that the reference does not spell out: **The replay starts with the swap you named.** Resuming from an id sends that same swap again (same `tx_hash`), then the ones after it. Deduplicate, which you need anyway. **The replay is capped, and the cap drops the oldest swaps.** A `GET` replays up to 100 swaps, a `POST` up to 500 across all its subscriptions. When more were missed, you get the most recent ones: a `since` 14 minutes back on WETH returned exactly 100 swaps covering only the last two minutes. Fill the hole from [REST transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) if you need every swap. **`limit` counts replayed swaps.** With `limit=2` and a `since`, the connection closes after two replayed swaps, before anything live arrives. **An id the server does not recognise is not an error.** The connection opens with `200`, so a stale or mangled id fails quietly. Keep `since` as the fallback when you know how long you were away. On a `method=token` subscription the replay reads only the token's largest pools, so swaps in its small pools during the outage are not replayed. The live tail covers every pool. One `since` or `Last-Event-ID` covers every subscription on a `POST`. With subscriptions on several chains, swaps from chains other than the one in your `Last-Event-ID` may be sent again, which deduplication also covers. ## Good practices **Trust the heartbeat, not the socket.** A TCP connection that has silently died looks identical to a quiet pool. Pings arrive every 15 seconds; if you have seen nothing for 45, reconnect. Do not use "no swaps" as a liveness signal, because on a slow pool that is the normal state. **Reconnect with backoff, and never in a tight loop.** A retry storm turns one rate limit into a persistent one. Start at a second, double up to a minute, and add jitter so a fleet does not resynchronise. **Multiplex deliberately.** 25 subscriptions per connection, and the plan caps concurrent connections: 30 on Dev, 100 on Pro, so 750 or 2,500 subscriptions is the ceiling. Group by how you will process the data, not by chain: `request_id` is what routes an event, and it is per subscription. **Deduplicate on `tx_hash` plus `pool_id`.** A reconnect can redeliver the block you were in the middle of. One swap that touches two subscribed pools also arrives twice, once per `request_id`, which is correct but is not what a naive counter expects. **Size the cost before you leave it running.** Use `?limit=100` and time it. A hundred events tells you the rate, the rate tells you the monthly bill, and both take a minute to find out. [Plan your credit usage](/knowledge-base/credit-usage) works through the arithmetic. **Persist what you need at write time.** The feed replays at most the last 15 minutes. For anything older, and for a gap the replay cap leaves, use [the REST transactions endpoint](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages). ## A working consumer Handles the event names, the heartbeat, reconnection with resume, and the two pitfalls that bite in JavaScript. ```js theme={null} // swap-tail.mjs: Node 18+, no dependencies. Needs DEXPAPRIKA_API_KEY from a paid plan. const KEY = process.env.DEXPAPRIKA_API_KEY; const SUBS = [ { chain: "solana", address: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE", method: "pool", request_id: 1 }, ]; // Tokens are resolved by ADDRESS, never by index: _0 is not the same token // across REST and streaming for some EVM pools. const WATCH = { So11111111111111111111111111111111111111112: "SOL", EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: "USDC", }; const seen = new Set(); let lastBeat = Date.now(); let lastId = null; // last SSE id seen, sent back on reconnect to replay what was missed async function tail() { const res = await fetch("https://streaming-pro.dexpaprika.com/sse/transactions", { method: "POST", // The key is the whole Authorization value, with no scheme word in front of it. headers: { authorization: KEY, accept: "text/event-stream", "content-type": "application/json", ...(lastId ? { "last-event-id": lastId } : {}), }, body: JSON.stringify(SUBS), }); if (!res.ok) { // 403 = no paid plan or wrong host, 401 = key rejected, 400 = the subscription is wrong. // Only the last one is worth retrying after a change. throw new Error(`${res.status} ${await res.text()}`); } const decoder = new TextDecoder(); let buffer = ""; for await (const chunk of res.body) { buffer += decoder.decode(chunk, { stream: true }); const frames = buffer.split("\n\n"); buffer = frames.pop() ?? ""; for (const frame of frames) { const name = frame.match(/^event: (.+)$/m)?.[1]; const data = frame.match(/^data: (.+)$/m)?.[1]; if (!name || !data) continue; if (name === "ping") { lastBeat = Date.now(); continue; } if (name === "warning") { console.warn("[warning]", data); continue; } if (name === "error") { throw new Error(`stream error: ${data}`); } if (name !== "pool" && name !== "token") continue; const s = JSON.parse(data); lastId = frame.match(/^id: (.+)$/m)?.[1] ?? lastId; // A resume replays the swap you last saw, and one swap can match two subscriptions. const id = `${s.tx_hash}:${s.pool_id}`; if (seen.has(id)) continue; seen.add(id); // amount_0/amount_1 are raw JSON numbers and lose precision above // 2^53 on 18-decimal tokens. The _usd fields are ordinary floats. const sold = s.amount_0 > 0 ? WATCH[s.token_0] : WATCH[s.token_1]; const bought = s.amount_0 > 0 ? WATCH[s.token_1] : WATCH[s.token_0]; const size = Math.abs(s.amount_0 > 0 ? s.amount_0_usd : s.amount_1_usd); console.log( `${s.block_timestamp} ${sold} -> ${bought} $${size.toFixed(2)} ${s.tx_hash.slice(0, 12)}`, ); } } } // Watchdog: pings every 15s, so 45s of silence means the socket is gone, // not that the pool is quiet. setInterval(() => { if (Date.now() - lastBeat > 45_000) { console.error("no heartbeat, exiting for the supervisor to restart"); process.exit(1); } }, 5_000); let delay = 1_000; for (;;) { try { await tail(); delay = 1_000; } catch (err) { console.error(String(err)); if (/^4(0[013])/.test(String(err))) process.exit(1); // fix the request, do not retry await new Promise((r) => setTimeout(r, delay + Math.random() * 500)); delay = Math.min(delay * 2, 60_000); } } ``` ## Where to go next > [card] [Endpoint reference](/streaming/stream-real-time-transactions-for-a-single-asset) > > Parameters, schemas and every event type. > [card] [Plan your credit usage](/knowledge-base/credit-usage) > > What a continuous stream costs, with worked models. > [card] [Production streaming](/streaming/guides/production-reserve-streaming) > > Reconnection, missed blocks and error classification. Written for reserves, applies here. > [card] [Pool reserves](/streaming/reserves-streaming) > > Liquidity movement per block. Opens with a free key. # Quick Start: Your First Stream Source: https://docs.dexpaprika.com/streaming/tutorials/quick-start Stream live token prices and pool reserves in under 10 minutes. Prices need no API key on 34 showcase assets; reserves need a free key that takes a minute to get. > [!NOTE] > > **See it in action:** Check out our [Live Streaming Dashboard](https://dexpaprika.com/streaming/solana) to see real-time updates flow across multiple chains before you build your own. ## Tutorial overview In this tutorial, you'll learn how to: * Connect to the DexPaprika streaming API * Receive real-time **token price** updates * Receive real-time **pool reserve** updates (the DexPaprika differentiator) * Handle connection errors gracefully * Build a simple live display **Time to complete**: 5 to 10 minutes **Prerequisites**: Basic JavaScript or Python knowledge *** ## Step 1: Choose your asset For this tutorial, we'll stream the price of Ethereum (WETH). ### Finding token addresses Use the REST API to find token addresses: 1. **Search by name or symbol** using the [Search Endpoint](/api-reference/search/search-for-tokens-pools-and-dexes): ```bash theme={null} curl "https://api.dexpaprika.com/search?query=WETH" ``` 2. **Get network list** using the [Networks Endpoint](/api-reference/networks/get-a-list-of-available-blockchain-networks): ```bash theme={null} curl "https://api.dexpaprika.com/networks" ``` ### Common token addresses Or use these verified addresses for popular tokens: > [tab] Ethereum > > ``` > Chain: ethereum > WETH: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 > USDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 > ``` > [tab] Solana > > ``` > Chain: solana > SOL: So11111111111111111111111111111111111111112 > USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v > ``` > [tab] BSC > > ``` > Chain: bsc > BNB: 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c > USDT: 0x55d398326f99059ff775485246999027b3197955 > ``` *** ## Step 2: Test with curl First, verify the stream works with a simple cURL command: ```bash theme={null} curl -N "https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&limit=3" ``` Live capture from production, three events back-to-back: ``` data: {"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","chain":"ethereum","price":"2255.213769366838","timestamp":1778847591,"timestamp_price":1778847590,"token_price":1778847590} event: token_price data: {"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","chain":"ethereum","price":"2255.5995720362835","timestamp":1778847592,"timestamp_price":1778847592,"token_price":1778847592} event: token_price data: {"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","chain":"ethereum","price":"2255.5995720362835","timestamp":1778847593,"timestamp_price":1778847593,"token_price":1778847593} event: token_price ``` > [!TIP] > > The `limit=3` parameter closes the stream after three events, perfect for smoke tests. Drop it for a continuous feed. > [!NOTE] > > Both orderings of `event:` and `data:` lines within a single SSE message are valid per the [SSE specification](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events), and the server has used both during rollout. Only the blank-line boundary between messages is significant. `EventSource` handles either order natively. Custom parsers should buffer one message at a time and dispatch on the parsed event type, not on field order. *** ## Step 3: JavaScript implementation Here's how to connect to the streaming API using JavaScript: ```javascript theme={null} // Connect to streaming API const url = new URL('https://streaming.dexpaprika.com/sse/prices'); url.searchParams.set('method', 'token_price'); url.searchParams.set('chain', 'ethereum'); url.searchParams.set('address', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'); const eventSource = new EventSource(url.toString()); // Handle price updates eventSource.addEventListener('token_price', (event) => { const data = JSON.parse(event.data); const price = parseFloat(data.price); console.log(`WETH Price: $${price.toFixed(2)}`); }); // Surface server-side notices (deprecations, etc.) eventSource.addEventListener('warning', (event) => { const { message } = JSON.parse(event.data); console.warn('[stream warning]', message); }); // Handle errors with reconnection eventSource.onerror = () => { console.log('Connection lost, reconnecting...'); eventSource.close(); // Implement reconnection logic here }; ``` > [!NOTE] > > **Live example:** See this code in action in our [Interactive Streaming Dashboard](https://dexpaprika.com/streaming/solana) - watch 6 tokens stream live across Ethereum, Solana, and BSC with real-time updates, connection status, and latency monitoring. *** ## Step 4: Customize your stream ### Stream different tokens Modify the URL parameters to stream another asset. Without a key these have to be [showcase assets](/streaming/showcase-streams), one flagship token per chain; a [free key](https://console.dexpaprika.com) lifts that to any token we index. ```javascript theme={null} // WAVAX on Avalanche url.searchParams.set('chain', 'avalanche'); url.searchParams.set('address', '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'); // SOL on Solana url.searchParams.set('chain', 'solana'); url.searchParams.set('address', 'So11111111111111111111111111111111111111112'); // BNB on BSC url.searchParams.set('chain', 'bsc'); url.searchParams.set('address', '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'); ``` ### Add multiple assets To stream multiple assets, switch to the POST method: **View implementation** ```javascript theme={null} async function streamMultipleAssets() { const assets = [ { chain: 'ethereum', address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', method: 'token_price' }, { chain: 'solana', address: 'So11111111111111111111111111111111111111112', method: 'token_price' } ]; const response = await fetch('https://streaming.dexpaprika.com/sse/prices', { method: 'POST', headers: { 'Accept': 'text/event-stream', 'Content-Type': 'application/json' }, body: JSON.stringify(assets) }); const decoder = new TextDecoder(); let buffer = ''; for await (const chunk of response.body) { buffer += decoder.decode(chunk, { stream: true }); const messages = buffer.split('\n\n'); buffer = messages.pop() ?? ''; for (const message of messages) { const lines = message.split('\n'); const eventLine = lines.find(l => l.startsWith('event:')); const dataLine = lines.find(l => l.startsWith('data:')); if (!dataLine) continue; const eventType = eventLine ? eventLine.slice(6).trim() : 'message'; if (eventType !== 'token_price') continue; // skip ping/warning/etc const update = JSON.parse(dataLine.slice(5).trim()); console.log(`${update.chain} ${update.address}: $${parseFloat(update.price).toFixed(4)}`); } } } ``` Pass up to 25 entries per connection. `POST /sse/prices` rejects larger arrays with `{"message":"too many assets, max 25 allowed"}` (the sibling `POST /sse/reserves` endpoint uses different wording: `"too many subscriptions"`). Open additional connections in parallel if you need more, up to your plan's concurrent-stream cap: **10** keyless (per IP) or on a free key, 30 on Dev, 100 on Pro. *** ## Understanding the code ### Key components > [accordion] EventSource API > > The `EventSource` API is the browser's built-in way to handle SSE: > > ```javascript theme={null} > const eventSource = new EventSource(url); > eventSource.addEventListener('token_price', handler); > ``` > > It automatically handles: > > * Persistent connections > * Automatic reconnection > * Event parsing > [accordion] Error Handling > > The `onerror` callback handles disconnections: > > ```javascript theme={null} > eventSource.onerror = () => { > // Implement exponential backoff > const delay = baseDelay * Math.pow(2, attempts); > setTimeout(reconnect, delay); > }; > ``` > [accordion] Price Updates > > Each `token_price` event contains: > > ```javascript theme={null} > { > "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", > "chain": "ethereum", > "price": "2255.5995720362835", // USD, string to preserve precision > "timestamp": 1778847592, // server send time (unix) > "timestamp_price": 1778847592, // price observation time > "token_price": 1778847592 // alias of timestamp_price > } > ``` > > The legacy `t_p` method emits a compact `{a, c, p, t, t_p}` shape and is **deprecated**. > [accordion] Other event types > > Beyond `token_price`, `pool_reserves`, and `token_reserves`, the server may push: > > * `ping` every \~15s (keep-alive). Payload: `{"time": }`. > * `warning` for non-fatal notices, including deprecation messages. Payload: `{"message": "..."}`. > * `error` for stream-terminating problems (invalid asset, etc.). > > Always filter on the `event:` line. Treat unknown event names as no-ops so future server-side additions cannot break your handler. *** ## Now stream pool reserves Token prices are useful. Block-level pool reserves are the killer feature. > [!NOTE] > > **This half needs a key.** Everything above runs keyless on the [34 showcase assets](/streaming/showcase-streams). Reserves do not: without a key they answer `403` with `{"error":"preview_only"}`. > > A [free key](https://console.dexpaprika.com) takes a minute, needs no card, and opens prices and reserves on every token we index. Set it as `DEXPAPRIKA_API_KEY` and the examples below work as written. > > The key is the entire `Authorization` value, with no scheme word in front of it. Instead of `/sse/prices`, point at `/sse/reserves` and pick one of two methods: * `method=pool_reserves`: subscribe to a specific pool. You receive events when that pool's reserves change. * `method=token_reserves`: subscribe to a specific token. You receive events for every pool the token sits in. ### Try it with curl Subscribe to a Uniswap V3 USDC/WETH pool on Ethereum: ```bash theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming.dexpaprika.com/sse/reserves?method=pool_reserves&chain=ethereum&address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" ``` Each `pool_reserves` event tells you the pool, the block it was observed in, both tokens' raw reserves, the block's delta, current USD prices, and the dollar value of the change. A live capture from production (block 25,100,507): ``` data: {"chain":"ethereum","pool_id":"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","block":"25100507","tokens":[{"token_id":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","reserve":"70835095690418","delta":"12018780248","price_usd":1.0000312133558542,"reserve_usd":70837306.69,"delta_usd":12019.15},{"token_id":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","reserve":"14194377792871748830512","delta":"-5325593173019115725","price_usd":2255.213769366838,"reserve_usd":32011356.24,"delta_usd":-12010.35}],"total_reserve_usd":102848662.93,"total_delta_usd":8.80} event: pool_reserves ``` That is a single swap: \~$12,019 of USDC came in, ~$12,010 of WETH went out, net dollar delta to the pool was +\$8.80 (the trader paid the trading fee). The whole picture, in one event, no log decoding required. > [!NOTE] > > The `reserve`, `delta`, `block`, and `previous_block` fields all arrive as JSON strings (note the quotes in the example above). The server encodes them that way because they routinely exceed `Number.MAX_SAFE_INTEGER`: the WETH `delta` above is a 19-digit integer. Use `BigInt(reserve)` for exact arithmetic, or `Number(block)` when you just want a quick block-height comparison. The pre-computed USD fields (`reserve_usd`, `delta_usd`, `total_reserve_usd`, `total_delta_usd`) and `price_usd` are regular JSON numbers, safe for floating-point math. ### Same thing in JavaScript ```javascript theme={null} async function subscribeReserves() { const url = new URL("https://streaming.dexpaprika.com/sse/reserves"); url.searchParams.set("method", "pool_reserves"); url.searchParams.set("chain", "ethereum"); url.searchParams.set("address", "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"); const response = await fetch(url.toString(), { headers: { Accept: "text/event-stream", Authorization: process.env.DEXPAPRIKA_API_KEY, }, }); const decoder = new TextDecoder(); let buffer = ""; // Async-iterate the response body. This pattern handles gzip/transfer encodings // transparently in both Node and modern browsers, and never blocks on partial // chunks the way `getReader().read()` can. for await (const chunk of response.body) { buffer += decoder.decode(chunk, { stream: true }); // SSE messages are separated by a blank line. const messages = buffer.split("\n\n"); buffer = messages.pop() ?? ""; for (const message of messages) { const lines = message.split("\n"); const eventLine = lines.find((l) => l.startsWith("event:")); const dataLine = lines.find((l) => l.startsWith("data:")); if (!dataLine) continue; // The stream emits: `pool_reserves` (or `token_reserves`), `ping`, `warning`, `error`. // Filter for the one we care about so keep-alives and notices // never reach the reserve handler. const eventType = eventLine ? eventLine.slice(6).trim() : "message"; if (eventType !== "pool_reserves" && eventType !== "token_reserves") continue; const update = JSON.parse(dataLine.slice(5).trim()); console.log(`block ${update.block} pool delta ${update.total_delta_usd.toFixed(2)} USD`); } } } subscribeReserves(); ``` > [!TIP] > > Want the deep dive on what reserves streaming unlocks (impermanent loss tracking, MEV detection, real-time TVL, slippage estimation)? See the [Reserves Streaming page](/streaming/reserves-streaming) for the annotated wire example and use cases broken out by audience. *** ## Implementation notes ### Browser support * EventSource API works in all modern browsers * For direct browser connections, you'll need to handle CORS (use a backend proxy) * No issues when streaming from server-side (Node.js, Python, etc.) ### Best practices * Implement exponential backoff for reconnection * Handle both connection errors and SSE error events * Parse prices as floats to maintain precision * Close connections properly on page unload *** ## See it live > [card] [Live streaming dashboard](https://dexpaprika.com/streaming/solana) > > **Try the API without writing code.** The interactive streaming demo lets you pick a chain, pick tokens (or paste a custom contract address), and watch SSE events flow in real time. You can also copy the generated subscription payload to use in your own code. > > **What you'll see:** > > * Real-time price updates, sub-second latency > * Multi-chain support (switch chains in the UI) > * Connection status, latency, and update counts > * The exact JSON the server pushes, line by line *** ## Next steps Congratulations! You've built your first streaming application. Here's what to explore next: > [card] [Reserves Streaming Deep Dive](/streaming/reserves-streaming) > > What block-level reserve updates contain, both subscription methods, annotated wire example, and use cases for LPs, MEV builders, and analytics teams. > [card] [React Integration](/streaming/guides/react-integration) > > Build streaming components for React and Next.js applications. > [card] [Stream Multiple Assets](/streaming/subscribe-to-multiple-assets-streaming) > > The POST /sse/prices endpoint for multi-token price subscriptions. > [card] [Subscribe to Multiple Reserves](/streaming/subscribe-to-multiple-reserves-streaming) > > The POST /sse/reserves endpoint for multi-pool and multi-token subscriptions. *** ## Get help > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Get help from our community. > [card] [API Reference](/streaming/introduction) > > Read the complete API documentation. # All DexPaprika tools, SDKs and integrations Source: https://docs.dexpaprika.com/tools/all-tools Every official DexPaprika tool in one place: MCP servers, SDKs for TypeScript, Python, Go and PHP, the Rust CLI, the n8n node, the LangChain package, the Claude plugin, and agent skills. Install commands for each. Everything official we ship for DexPaprika, with the install command for each. All of it reads the same API, across every chain, DEX, pool and token on the [coverage page](/coverage). > [!NOTE] > > Version numbers are deliberately not listed here, because they go stale faster than a docs page does. Each link goes to the canonical registry, which always shows the current release. ## Which one do I want? | If you want to | Use | | - | - | | Give an AI agent live DEX data | [Hosted MCP server](#hosted-mcp-server) | | Write code in TS, Python, Go or PHP | [SDKs](#sdks) | | Query from a terminal or a shell script | [CLI](#cli) | | Build a no-code automation | [n8n community node](#n8n) | | Build a Python agent chain | [LangChain package](#langchain) | | Work in Claude Code | [Claude plugin](#claude-plugin) or [agent skills](#agent-skills) | | Stream prices or reserves live | [Streaming API](#streaming) | | Call the API directly | [REST API reference](/api-reference/introduction) | ## MCP servers Two ways to connect an AI agent. Both expose the same data; the hosted server needs no install. ### Hosted MCP server Nothing to install. Point any MCP client at the URL: ```json theme={null} { "mcpServers": { "dexpaprika": { "url": "https://mcp.dexpaprika.com/sse" } } } ``` Streamable HTTP is also available at `https://mcp.dexpaprika.com/streamable-http`. See the [hosted MCP server guide](/ai-integration/hosted-mcp-server), the [full tools reference](/ai-integration/mcp-tools), and the [client setup pages](/ai-integration/mcp-clients) for Cursor, VS Code, Codex and others. ### Self-hosted MCP server Runs locally over stdio, published on npm as [`dexpaprika-mcp`](https://www.npmjs.com/package/dexpaprika-mcp): ```bash theme={null} npx dexpaprika-mcp ``` Setup and the tool list are on the [MCP server page](/ai-integration/mcp). The self-hosted build exposes the read tools; the hosted server adds feedback submission. ## SDKs | Language | Package | Install | | - | - | - | | TypeScript | [`dexpaprika-sdk`](https://www.npmjs.com/package/dexpaprika-sdk) | `npm install dexpaprika-sdk` | | Python | [`dexpaprika-sdk`](https://pypi.org/project/dexpaprika-sdk/) | `pip install dexpaprika-sdk` | | Go | [`dexpaprika-sdk-go`](https://github.com/coinpaprika/dexpaprika-sdk-go) | `go get github.com/coinpaprika/dexpaprika-sdk-go` | | PHP | [`coinpaprika/dexpaprika-sdk`](https://packagist.org/packages/coinpaprika/dexpaprika-sdk) | `composer require coinpaprika/dexpaprika-sdk` | Quickstarts: [TypeScript](/get-started/sdk-ts), [Go](/get-started/sdk-go), [Python](/get-started/sdk-python), [PHP](/get-started/sdk-php). ## CLI A Rust CLI with real-time SSE streaming built in, on [crates.io](https://crates.io/crates/dexpaprika-cli): ```bash theme={null} cargo install dexpaprika-cli ``` See the [CLI tutorial](/tutorials/cli) for commands and output formats. ## Agent and automation integrations ### n8n The [`n8n-nodes-dexpaprika`](https://www.npmjs.com/package/n8n-nodes-dexpaprika) community node gives you typed Token, Pool and Network operations, and works as an AI Agent tool. On self-hosted n8n, go to **Settings > Community Nodes > Install** and enter: ``` n8n-nodes-dexpaprika ``` Full setup, plus the no-install route using n8n's built-in MCP Client Tool, is on the [n8n page](/ai-integration/n8n). ### LangChain [`langchain-dexpaprika`](https://pypi.org/project/langchain-dexpaprika/) provides ready-made tools and a toolkit: ```bash theme={null} pip install langchain-dexpaprika ``` See the [LangChain page](/ai-integration/langchain). For CrewAI and the Vercel AI SDK, both of which consume the hosted MCP server directly, see [CrewAI](/ai-integration/crewai) and [Vercel AI SDK](/ai-integration/vercel-ai-sdk). ### Claude plugin Adds the MCP server, a DeFi data analyst agent, and four analysis skills to Claude Code: ``` /plugin marketplace add coinpaprika/claude-marketplace /plugin install dexpaprika@coinpaprika-plugins ``` Walkthrough on the [Claude Code plugin guide](/ai-integration/claude-code-plugin-guide). ### Agent skills Portable skills that teach any agent the endpoints and response shapes, from [coinpaprika/skills](https://github.com/coinpaprika/skills): ```bash theme={null} npx skills add github.com/coinpaprika/skills/ ``` Skills do not auto-update: the installed copy is a snapshot, so re-run the command to refresh it. Details on the [skills page](/ai-integration/skills). ### Agent landing page [agents.dexpaprika.com](https://agents.dexpaprika.com) is a single markdown-first page written for agents to read directly, with the endpoint list and streaming quickstart. The raw skill file is at [dexpaprika.com/agents/skill.md](https://dexpaprika.com/agents/skill.md). ## Streaming Server-sent events for live token prices and pool reserves at `streaming.dexpaprika.com`. Start with the [streaming introduction](/streaming/introduction) and the [quick start](/streaming/tutorials/quick-start). > [!NOTE] > > Each update delivered over a stream costs one credit, the same as a REST call. Because updates are pushed only when a swap moves the price, budget for the update rate of what you subscribe to rather than the number of connections. See [rate limits](/knowledge-base/rate-limits) and [plan your credit usage](/knowledge-base/credit-usage). ## Where else you can find us DexPaprika's MCP server is listed in the [official MCP registry](https://registry.modelcontextprotocol.io) as `com.dexpaprika/dexpaprika`, on [Glama](https://glama.ai/mcp/servers/coinpaprika/dexpaprika-mcp), and on [Smithery](https://smithery.ai/servers/coinpaprika/dexpaprika). ## Getting started No API key is needed to start: 10,000 credits per rolling 30 days keyless. A [free registered key](https://console.dexpaprika.com) raises that to 100,000 and doubles the rate from 15 requests a minute to 30, and Pro reaches 5,000,000 credits at 500 a minute. See [rate limits](/knowledge-base/rate-limits) and the [Pro API](/api-pro/introduction). # Coverage checker Source: https://docs.dexpaprika.com/tools/coverage-checker Use this tool to quickly verify whether an asset exists in DexPaprika’s dataset. Enter a contract address, token name, or ticker symbol; we’ll search our coverage and show the closest matches. > [!TIP] > > See also: [Networks](/api-reference/networks/get-a-list-of-available-blockchain-networks), > [Liquidity pool endpoint](/api-reference/pools/get-a-pool-on-a-network), > [Token data](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) ### FAQs > [accordion] How do I use the results? > > Copy the token or pool address and pass it to the corresponding REST endpoints along with the network. > [accordion] Are lookups rate-limited? > > Yes, by the same limits as any other call: 15 requests a minute against 10,000 credits per rolling 30 days keyless, or 30 a minute against 100,000 with a [free key](https://console.dexpaprika.com). See [rate limits](/knowledge-base/rate-limits). > [accordion] Can I filter by network? > > Yes. Provide the `network` when calling token/pool endpoints. ### Next steps > [card] [Query a liquidity pool](/api-reference/pools/get-a-pool-on-a-network) > > Get pool reserves and metrics > [card] [List pool transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) > > Fetch swaps/adds/removes # Feed an AI trading agent with technical indicators Source: https://docs.dexpaprika.com/tutorials/agent-trading-signals Give an AI agent RSI, MACD and Bollinger Bands for a watchlist of DEX pools as a compact JSON state, computed by the DexPaprika API, and let it decide buy, sell or hold. Runs without a key; a free key opens a week of history. ## What you'll build A paper-trading agent that wakes once an hour, reads RSI, MACD and Bollinger Bands for three DEX pools straight from the API, and asks a language model to decide buy, sell or hold for each, next to a plain rule-based baseline. The idea is the one behind live model-trading benchmarks such as [Alpha Arena by Nof1](https://www.nof1.ai): hand the model a compact set of ready signals per market and let it spend its reasoning on the decision rather than on arithmetic. The [indicator endpoints](/tutorials/technical-indicators) compute those signals on the server from the same candles as [pool OHLCV](/tutorials/retrieve-historical-data), so the agent's numbers match the chart you would check by hand. This is for paper trading and research. Indicators describe the past; nothing here is financial advice. *** ## What the agent sees For each pool, one line of JSON per hour: ```json theme={null} {"pool": "SOL/USDC, Orca", "network": "solana", "candle": "2026-10-13T11:00:00Z", "close": 106.168135, "rsi_14": 39.5, "macd_histogram": 0.055981, "macd_cross": null, "bbands_percent_b": 0.31, "bbands_width_pct": 4.99} ``` | Field | From | How to read it | | - | - | - | | `rsi_14` | `indicator=rsi` | Over 70 is commonly read as overbought, under 30 as oversold | | `macd_histogram`, `macd_cross` | `indicator=macd` | `macd_cross` is `up` or `down` when the histogram changed sign on the last candle, which means MACD crossed its signal line | | `bbands_percent_b` | `indicator=bbands` and the candle's close | 0 at the lower band, 1 at the upper; below 0 or above 1 is outside the bands | | `bbands_width_pct` | `indicator=bbands` | Band width as a share of the middle band. Narrow bands often come before a large move | | `close` | [pool OHLCV](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) | The close of the same candle the indicators end on | About 220 characters per pool. The 24 hourly candles behind it are about 4,600 characters of JSON for the same pool, a week of them seven times that, and the model would still have to do the maths. *** ## Run it ```bash theme={null} pip install requests anthropic export DEXPAPRIKA_API_KEY=your_free_key # optional, see below export ANTHROPIC_API_KEY=your_anthropic_key # optional, without it only the rules run python agent.py ``` ```python theme={null} import json import os import time import requests API = "https://api.dexpaprika.com" KEY = os.environ.get("DEXPAPRIKA_API_KEY") # a free key from console.dexpaprika.com HEADERS = {"Authorization": KEY} if KEY else {} START = "-7d" if KEY else "-24h" # the history window of each plan INTERVAL = "1h" WATCHLIST = [ ("ethereum", "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "WETH/USDC, Uniswap v3"), ("solana", "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE", "SOL/USDC, Orca"), ("base", "0x6c561b446416e1a00e8e93e221854d6ea4171372", "WETH/USDC, Uniswap v3"), ] def get(path, **params): for _ in range(5): r = requests.get(f"{API}{path}", params=params, headers=HEADERS, timeout=30) if r.status_code == 429: time.sleep(int(r.headers.get("Retry-After", "5")) + 1) continue r.raise_for_status() return r.json() r.raise_for_status() def indicator(network, pool, name): path = f"/networks/{network}/pools/{pool}/indicators" return get(path, indicator=name, interval=INTERVAL, start=START)["data"] def snapshot(network, pool, label): rsi = indicator(network, pool, "rsi")[-1] prev, macd = indicator(network, pool, "macd")[-2:] bands = indicator(network, pool, "bbands")[-1] # The close of the same candle the indicators end on. candles = get(f"/networks/{network}/pools/{pool}/ohlcv", start=START, interval=INTERVAL, limit=1000) close = next(c["close"] for c in candles if c["time_open"] == bands["timestamp"]) cross = None if prev["histogram"] < 0 <= macd["histogram"]: cross = "up" elif prev["histogram"] > 0 >= macd["histogram"]: cross = "down" width = bands["upper"] - bands["lower"] return { "pool": label, "network": network, "candle": bands["timestamp"], "close": round(close, 6), "rsi_14": round(rsi["value"], 1), "macd_histogram": round(macd["histogram"], 6), "macd_cross": cross, "bbands_percent_b": round((close - bands["lower"]) / width, 2), "bbands_width_pct": round(width / bands["middle"] * 100, 2), } def rules(s): """A plain baseline to compare the model against.""" if s["rsi_14"] < 30 and s["bbands_percent_b"] < 0.05: return "buy" if s["rsi_14"] > 70 and s["bbands_percent_b"] > 0.95: return "sell" if s["macd_cross"] == "up" and s["rsi_14"] < 60: return "buy" if s["macd_cross"] == "down" and s["rsi_14"] > 40: return "sell" return "hold" SYSTEM = """You are a paper-trading agent. For each pool in the JSON you get, decide buy, sell or hold for the next hour, using only the fields given. rsi_14: RSI(14), over 70 is commonly read as overbought, under 30 as oversold. macd_histogram: MACD minus its signal line. macd_cross is "up" or "down" when it changed sign on the last candle. bbands_percent_b: 0 at the lower Bollinger Band, 1 at the upper. bbands_width_pct: band width as a percentage of the middle band; narrow bands often come before a large move. Answer with a JSON array only, one object per pool: [{"pool": "...", "network": "...", "action": "buy|sell|hold", "confidence": 0.0, "reason": "one sentence"}]""" def model(states): import anthropic # pip install anthropic; reads ANTHROPIC_API_KEY reply = anthropic.Anthropic().messages.create( model="claude-sonnet-5", max_tokens=1024, system=SYSTEM, messages=[{"role": "user", "content": json.dumps(states)}], ) return json.loads(reply.content[0].text) def cycle(use_model): states = [snapshot(*p) for p in WATCHLIST] for s in states: print(json.dumps(s)) print(f" rules: {rules(s)}") if use_model: for d in model(states): print(f" model, {d['pool']} on {d['network']}: {d['action']} " f"({d['confidence']:.2f}) {d['reason']}") if __name__ == "__main__": use_model = "ANTHROPIC_API_KEY" in os.environ while True: cycle(use_model) # Wake a minute after the next hourly candle closes. time.sleep(3600 - time.time() % 3600 + 60) ``` One cycle without any key, measured on 13 October 2026: ``` {"pool": "WETH/USDC, Uniswap v3", "network": "ethereum", "candle": "2026-10-13T11:00:00Z", "close": 2499.423072, "rsi_14": 46.7, "macd_histogram": 1.852675, "macd_cross": null, "bbands_percent_b": 0.5, "bbands_width_pct": 4.66} rules: hold {"pool": "SOL/USDC, Orca", "network": "solana", "candle": "2026-10-13T11:00:00Z", "close": 106.168135, "rsi_14": 39.5, "macd_histogram": 0.055981, "macd_cross": null, "bbands_percent_b": 0.31, "bbands_width_pct": 4.99} rules: hold {"pool": "WETH/USDC, Uniswap v3", "network": "base", "candle": "2026-10-13T11:00:00Z", "close": 2498.5663, "rsi_14": 46.7, "macd_histogram": 1.899912, "macd_cross": null, "bbands_percent_b": 0.5, "bbands_width_pct": 4.64} rules: hold ``` Each cycle is four requests per pool, three indicators and one OHLCV call, so twelve for this watchlist and 288 a day. The script waits out a `429` for the seconds in `Retry-After`. Check how that fits your plan on [rate limits](/knowledge-base/rate-limits). The model step uses the Anthropic SDK as an example. Any model that returns JSON works: keep the system prompt, send the states, parse the answer. *** ## Why a free key matters here Without a key, pool indicators cover the last 24 hours at `1h` and up. That is enough for the script to run, and every field above gets a value, but RSI, EMA and MACD are smoothed: each value carries weight from the candles before it, and 24 hourly candles are too few for RSI(14) to settle. The [technical indicators tutorial](/tutorials/technical-indicators#four-things-that-will-surprise-you) shows the same candle's RSI moving from 52.47 to 61.18 as the history behind it grows. A [free key](https://console.dexpaprika.com) opens the last 7 days at `10m` and up. The script switches `START` to `-7d` when `DEXPAPRIKA_API_KEY` is set, which gives RSI(14) on hourly candles more than ten periods of warm-up. The key goes in the `Authorization` header on its own, and free keys stay on `api.dexpaprika.com`. *** ## Where the free tier ends | You want | Plan | | - | - | | `1m` or `5m` candles, for an agent that trades on minutes | Dev | | More than 7 days of history, to backtest the agent | Dev (30 days), Pro or Enterprise (no limit) | | One USD series per token across every pool it trades in, through [token indicators](/api-reference/tokens/get-a-technical-indicator-for-a-token) | Dev, Pro or Enterprise | Paid keys call `https://api-pro.dexpaprika.com`. Plans are on [pricing](https://dexpaprika.com/api/pricing). *** ## Make it yours * **Change the watchlist.** Find pools with [pool search](/tutorials/pool-filtering) or a token's pools with [token pools](/tutorials/token-pools), and paste the network and address. * **Add an indicator.** `indicator=ema` or `indicator=vwap` returns `value`. Send only that indicator's parameters: `period` for rsi, ema, bbands and vwap; `fast_period`, `slow_period` and `signal_period` for macd; `std_dev` for bbands. Any other parameter is refused with `400`. * **Keep a log.** Store each state with the model's decision and the next candle's close. That log is what tells you whether the model beats the rules. *** ## Where to go next * [Technical indicators](/tutorials/technical-indicators): every indicator, parameter and error * Indicators reference for [pools](/api-reference/pools/get-a-technical-indicator-for-a-pool) and [tokens](/api-reference/tokens/get-a-technical-indicator-for-a-token) * [Rate limits](/knowledge-base/rate-limits): limits by plan * [Pricing](https://dexpaprika.com/api/pricing) and [console.dexpaprika.com](https://console.dexpaprika.com): plans and your key # Batch Token Prices Efficiently Source: https://docs.dexpaprika.com/tutorials/batch-token-prices Fetch prices for up to 10 tokens in one call with the multi-asset endpoint, stay under the per-minute request limit, and understand why batching does not reduce credit spend. ## Tutorial overview Efficiently fetch real-time prices for up to 10 tokens in a single API request using the DexPaprika **multi-asset endpoint**. This guide shows you why batching matters and how to implement it effectively. > [!NOTE] > > The multi-asset endpoint needs an API key, and a free key is enough. The examples read it from the `DEXPAPRIKA_API_KEY` environment variable. Without a key the endpoint answers `403` with `"error": "plan_required"`. The key is free: create one at [console.dexpaprika.com](https://console.dexpaprika.com). > [!NOTE] > > The multi-asset endpoint is optimized for efficiency. Learn why batching is critical for sustainable API usage and how to structure your requests. *** ## Why batch requests? The math behind it ### Single request vs. batching Let's say you need to monitor prices for **50 tokens** on Ethereum. **Scenario 1: individual requests** ``` 50 tokens × 1 request per token = 50 API calls ``` **Scenario 2: using the multi-asset endpoint** ``` 50 tokens ÷ 10 tokens per batch = 5 API calls ``` **Result: 90% fewer HTTP calls.** The credit cost is unchanged: 50 tokens cost 50 credits either way, because batch endpoints bill one credit per item. ### Real-world impact | Use case | Tokens to monitor | Individual HTTP calls | Batched HTTP calls | Reduction in HTTP calls | | - | - | - | - | - | | Portfolio tracker | 20 tokens | 20 calls | 2 calls | 90% | | DeFi aggregator | 100 tokens | 100 calls | 10 calls | 90% | | Trading bot (30s updates) | 50 tokens/day | \~2,880 calls/day | \~288 calls/day | 90% | | Real-time dashboard | 35 tokens | 35 calls | 4 calls | 88.6% | > [!TIP] > > **The key insight:** the multi-asset endpoint cuts your HTTP call count by up to **90%**, which is what the per-minute rate limit counts. It does not cut credits, which is what the monthly allowance counts. Batch for latency and for per-minute headroom, and size your monthly plan on the number of tokens, not the number of calls. *** ## Understanding rate limits > [!NOTE] > > Two limits apply, and batching only helps with one of them. The **per-minute request limit** counts HTTP calls: 15 a minute keyless, 30 with a [free key](https://console.dexpaprika.com), [500 on Pro](https://dexpaprika.com/api/pricing). Batching cuts HTTP calls, so it buys you real headroom there. The **monthly credit allowance** counts items: a batch of 10 tokens costs 10 credits, exactly what 10 separate calls would cost. See [rate limits](/knowledge-base/rate-limits). By batching requests: * **Reduce server load** by opening fewer HTTP connections * **Improve latency** with a single network round-trip for multiple tokens * **Stay under the per-minute limit**: 5 calls instead of 50 is 5 against your per-minute budget * **Scale comfortably** and monitor hundreds of tokens without piling up connections *** ## Step 1: Understanding the endpoint The multi-asset pricing endpoint accepts: * **Network** (path parameter): e.g., `ethereum`, `solana`, `base` * **Tokens** (query parameter): Comma-separated list of up to 10 token addresses * **Constraint:** Maximum 10 tokens per request, 2000 character limit ```bash theme={null} GET /networks/{network}/multi/prices?tokens={token1},{token2},...,{token10} ``` *** ## Step 2: Simple batch request Fetch prices for 3 tokens on Ethereum in a single request: ```bash theme={null} curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdac17f958d2ee523a2206206994597c13d831ec7,0x6b175474e89094c44da98b954eedeac495271d0f" | jq ``` Response: ```json Response [expandable] theme={null} [ { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chain": "ethereum", "price_usd": 4400.57 }, { "id": "0xdac17f958d2ee523a2206206994597c13d831ec7", "chain": "ethereum", "price_usd": 1.0003 }, { "id": "0x6b175474e89094c44da98b954eedeac495271d0f", "chain": "ethereum", "price_usd": 1.0001 } ] ``` > [!NOTE] > > Duplicate input addresses may produce duplicate entries in the response. Dedupe client-side if required. *** ## Step 3: Batching larger token lists in Node.js If you need to monitor more than 10 tokens, split them into chunks: ```javascript theme={null} const https = require('https'); const tokenAddresses = [ "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC "0x2260fac5e5542a773aa44fbcff9fafb9a190d659", // WBTC "0x7fc66500c84a76ad7e9c93437e434122a1b63cad", // AAVE "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", // UNI "0x6982508145454ce325ddbe47a25d4ec3d2311933", // PEPE "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", // bbb (example) "0xcccccccccccccccccccccccccccccccccccccccc", // ccc (example) "0xdddddddddddddddddddddddddddddddddddddddd", // ddd (example) "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // eee (example) ]; // Split into chunks of 10 function chunkArray(arr, size) { const chunks = []; for (let i = 0; i < arr.length; i += size) { chunks.push(arr.slice(i, i + size)); } return chunks; } async function fetchPricesInBatches(network, tokens) { const chunks = chunkArray(tokens, 10); const allPrices = []; for (const chunk of chunks) { const tokensParam = chunk.join(','); const url = `https://api.dexpaprika.com/networks/${network}/multi/prices?tokens=${tokensParam}`; try { const prices = await new Promise((resolve, reject) => { https.get(url, { headers: { Authorization: process.env.DEXPAPRIKA_API_KEY } }, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { resolve(JSON.parse(data)); }); }).on('error', reject); }); allPrices.push(...prices); console.log(`Fetched batch: ${chunk.length} tokens`); } catch (error) { console.error(`Error fetching batch:`, error); } } return allPrices; } // Usage (async () => { const prices = await fetchPricesInBatches('ethereum', tokenAddresses); console.log(`\nTotal tokens with prices: ${prices.length}`); prices.forEach(token => { console.log(`${token.id}: $${token.price_usd}`); }); })(); ``` ### Axios variant (node.js) ```javascript theme={null} import axios from 'axios'; async function fetchBatch(network, addresses) { const tokensParam = addresses.join(','); const url = `https://api.dexpaprika.com/networks/${network}/multi/prices`; const { data } = await axios.get(url, { params: { tokens: tokensParam }, headers: { Authorization: process.env.DEXPAPRIKA_API_KEY }, timeout: 5000, }); return data; // [{ id, chain, price_usd }, ...] } ``` > [!NOTE] > > **Key Observation:** 12 tokens require only 2 API calls instead of 12! This is an **83% reduction** in network requests. *** ## Step 4: Python implementation with real-time monitoring Build a simple price monitor that updates every 30 seconds: ```python theme={null} import os import requests import time from typing import List, Dict class TokenPriceMonitor: def __init__(self, network: str = 'ethereum'): self.network = network self.base_url = f"https://api.dexpaprika.com/networks/{network}/multi/prices" self.batch_size = 10 self.prices_cache = {} def chunk_tokens(self, tokens: List[str]) -> List[List[str]]: """Split tokens into batches of max 10""" return [tokens[i:i + self.batch_size] for i in range(0, len(tokens), self.batch_size)] def fetch_prices(self, tokens: List[str]) -> Dict[str, float]: """Fetch prices for multiple tokens in batches""" batches = self.chunk_tokens(tokens) results = {} for batch in batches: tokens_param = ','.join(batch) try: response = requests.get( self.base_url, params={'tokens': tokens_param}, headers={'Authorization': os.environ['DEXPAPRIKA_API_KEY']}, timeout=5 ) response.raise_for_status() data = response.json() for token in data: results[token['id']] = token['price_usd'] except requests.RequestException as e: print(f"Error fetching batch: {e}") # Optional: basic backoff before next batch to avoid tight retry loops time.sleep(1) return results def monitor_prices(self, tokens: List[str], interval: int = 30): """Continuously monitor token prices""" print(f"Monitoring {len(tokens)} tokens on {self.network}") print(f"Total API calls per update: {len(self.chunk_tokens(tokens))}") try: while True: prices = self.fetch_prices(tokens) print(f"\n[{time.strftime('%Y-%m-%d %H:%M:%S')}] Updated {len(prices)} tokens") for token, price in list(prices.items())[:5]: print(f" {token}: ${price:.6f}") if len(prices) > 5: print(f" ... and {len(prices) - 5} more tokens") time.sleep(interval) except KeyboardInterrupt: print("\nMonitoring stopped.") # Example usage if __name__ == "__main__": monitor = TokenPriceMonitor(network='ethereum') tokens_to_watch = [ "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH "0xdac17f958d2ee523a2206206994597c13d831ec7", # USDT "0x6b175474e89094c44da98b954eedeac495271d0f", # DAI "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", # USDC "0x2260fac5e5542a773aa44fbcff9fafb9a190d659", # WBTC ] monitor.monitor_prices(tokens_to_watch) ``` *** ## Step 5: Error handling & edge cases ### Handling Invalid or Unpriced Tokens Some tokens may not have prices. The endpoint returns only valid tokens: ```bash theme={null} # Request with some invalid tokens curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdeaddeaddeaddeaddeaddeaddeaddeaddaddadd" | jq ``` Response (only the priced token is returned): ```json theme={null} [ { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chain": "ethereum", "price_usd": 4400.57 } ] ``` ### Edge-case requests ```bash theme={null} # 0 tokens (expect 400) curl -s -o /dev/stderr -w "%{http_code}\n" -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices" # 11 tokens (expect 400) curl -s -o /dev/stderr -w "%{http_code}\n" -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xA,0xB" ``` > [!TIP] > > **Best Practice:** Always validate the response. Check that the number of returned tokens matches your expectations. Handle missing tokens gracefully in your application. *** ## Step 6: Comparison: Single vs. batch requests ### Request 100 tokens for a dashboard **Without batching:** ```bash theme={null} for token in "${token_addresses[@]}"; do curl -X GET "https://api.dexpaprika.com/networks/ethereum/tokens/$token" done # Result: 100 API calls ``` **With batching:** ```bash theme={null} # Call 1 curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=token1,token2,...,token10" # Call 2 curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=token11,token12,...,token20" # ... Continue for remaining batches ... # Result: 10 API calls ``` **Impact:** * **90% fewer HTTP calls**, so 90% less pressure on the per-minute limit * **10x faster execution** (a single network round-trip per batch against 100 individual calls) * **Lower latency** for your users * **Same credit cost.** 100 tokens is 100 credits whichever way you fetch them *** ## Performance metrics **Benchmark: Fetching prices for 50 tokens on Ethereum** | Metric | Single requests | Batched (5 calls) | | - | - | - | | HTTP calls | 50 | 5 | | Credits spent | 50 | 50 | | Total Network Round-trips | 50 | 5 | | Estimated Time (assuming 100ms/call) | 5,000ms | 500ms | | Bandwidth Used | \~50KB | \~5KB | | Server Load | High | Low | > [!TIP] > > **Result:** batching gives **10x faster responses** and cuts server load and bandwidth by 90%. Credit spend is unchanged. *** ## Next steps > [card] [API Reference](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) > > Explore the complete multi-asset endpoint documentation. > [card] [Fetch Single Token Prices](/tutorials/fetch-token-price) > > Learn how to fetch detailed data for individual tokens. *** ## Best practices summary 1. **Always batch.** Use the multi-asset endpoint instead of individual calls 2. **Chunk large lists.** Split more than 10 tokens into multiple batches (max 10 per call) 3. **Validate responses.** Not all requested tokens may have prices, so handle missing data 4. **Cache results.** Store prices and update on a schedule instead of on every request 5. **Handle errors gracefully.** Network timeouts and invalid tokens are normal, so retry with backoff 6. **Monitor performance.** Track API call counts to measure your optimization improvements *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. ### FAQs > [accordion] What's the maximum number of tokens per request? > > 10 tokens per request. Requests with more than 10 tokens will return HTTP 400. > [accordion] What about duplicate token addresses? > > Duplicate inputs may yield duplicate entries in the response. Dedupe client-side if needed. > [accordion] What happens if a token doesn't have a price? > > Tokens without prices are silently omitted from the response. Only priced tokens are returned. > [accordion] Is the order of results guaranteed? > > No. The response order is not guaranteed to match your input order. Use the `id` field to identify each token. > [accordion] Can I batch requests from multiple networks? > > No. Each batch must be for a single network. Use separate calls for different networks. > [accordion] How often should I update prices? > > It depends on your use case. For dashboards, every 30-60 seconds is common. For trading bots, every 1-5 seconds. Batching enables frequent updates without excessive API calls. > [accordion] Do I still need individual token endpoint? > > Yes. The single token endpoint (`GET /networks/{network}/tokens/{token_address}`) provides detailed metadata like liquidity, volume, and holdings. Use it for deep analysis; use multi-asset for just prices. > [accordion] Can I pass 0 tokens? > > No. At least one valid token is required. The endpoint returns HTTP 400 if the tokens list is empty. # Check your plan and credit usage Source: https://docs.dexpaprika.com/tutorials/check-credit-usage Call GET /usage to see which plan a request runs on and, with a paid key, the credits used and left in the billing period. Warn before you run out, with a short Python check. `GET /usage` answers two questions: which plan your request is actually running on, and, for a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`, how many credits the account has used and has left in the current billing period. With a paid key: ```bash theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api-pro.dexpaprika.com/usage" ``` ```json theme={null} { "plan": "pro", "email": "you@example.com", "requests_used": 633, "requests_left": 4999367, "period_started_at": "2026-09-24T09:44:17Z", "period_ends_at": "2026-10-24T09:44:17Z" } ``` It is never served from cache, so it reflects the key and host of the call you just made. That makes it the quickest way to confirm a new key is set up right. *** ## Which plan you need `/usage` answers on every plan, but only a paid key on the paid host gets the credit figures. | Caller | Host | Response | | - | - | - | | No key | `api.dexpaprika.com` | `{"plan": "keyless"}` | | Free key | `api.dexpaprika.com` | The plan only | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | Plan, account email, credits used and left, period dates | Without a key: ```bash theme={null} curl -s "https://api.dexpaprika.com/usage" ``` ```json theme={null} {"plan": "keyless"} ``` On a free key, [console.dexpaprika.com](https://console.dexpaprika.com) shows your usage against the allowance. Allowances for every plan are on [pricing](https://dexpaprika.com/api/pricing). *** ## The fields | Field | Meaning | | - | - | | `plan` | The plan this request was evaluated against: `keyless`, `free`, `dev`, `pro` or `enterprise` | | `email` | The account the key belongs to | | `requests_used` | Credits used in the current billing period, across all of the account's keys | | `requests_left` | Credits left in the period, including purchased packs and overage already charged | | `period_started_at`, `period_ends_at` | The billing period the figures belong to | Responses that are not served from cache carry the same value in the `x-api-plan` header. *** ## Warn before you run out, in Python This script prints the plan and, where the figures are available, how much of the period's credits are gone, and exits with an error above a threshold. Run it from cron or a CI job. One request: ```python theme={null} import os import sys import requests # No key: leave both variables unset. Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} WARN_AT = 0.8 # share of the period's credits r = requests.get(f"{API}/usage", headers=HEADERS, timeout=30) r.raise_for_status() usage = r.json() print(f"plan: {usage['plan']}") if "requests_left" not in usage: print("No credit figures on this plan and host; see console.dexpaprika.com") sys.exit(0) used, left = usage["requests_used"], usage["requests_left"] share = used / (used + left) print(f"{used:,} credits used, {left:,} left ({share:.1%}), period ends {usage['period_ends_at']}") if share >= WARN_AT: sys.exit(f"Over {WARN_AT:.0%} of this period's credits are used") ``` Without a key: ```text theme={null} plan: keyless No credit figures on this plan and host; see console.dexpaprika.com ``` With a Pro key: ```text theme={null} plan: pro 680 credits used, 4,999,320 left (0.0%), period ends 2026-10-24T09:44:17Z ``` *** ## Things to know **No numbers? Check the host.** If `/usage` returns only a plan while you expected credit figures, make sure the call goes to `api-pro.dexpaprika.com`, where paid keys belong. [Upgrading to Pro](/api-pro/upgrading) has the full mapping. **Treat the figures as a gauge.** Two calls a second apart can return slightly different `requests_used`, and the number can briefly step back. Compare readings minutes apart, not consecutive calls. **Watch the trend, not only the total.** A share of credits used means more next to the share of the period gone. Half the credits used halfway through the period is on pace; half used in the first week is not. [Plan your credit usage](/knowledge-base/credit-usage) shows what common workloads cost. **What happens at zero depends on the plan.** Free tiers stop with `402`. On Dev and Pro, autoscaling in the console decides whether you stop or keep going at the overage rate; see [the console](/knowledge-base/console). *** ## Where to go next * [Credit planning](/knowledge-base/credit-usage): what a workload costs before you build it * [Rate limits](/knowledge-base/rate-limits) and [response headers](/knowledge-base/response-headers) * [Usage reference](/api-reference/utils/get-your-plan-and-current-period-credit-usage) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # DexPaprika CLI: DEX data from your terminal Source: https://docs.dexpaprika.com/tutorials/cli Install the DexPaprika CLI with one command. Query token prices, pool data, OHLCV history, transactions, and stream live prices from your terminal. Supports macOS, Linux, and Windows. ## What is the DexPaprika CLI? A fast, standalone command-line tool for querying on-chain DEX data. Written in Rust. Covers the entire DexPaprika API: token prices, pools, OHLCV, transactions, search, pool filtering, and real-time price streaming via SSE. No API key needed to start. No dependencies. One binary. **Source:** [github.com/coinpaprika/dexpaprika-cli](https://github.com/coinpaprika/dexpaprika-cli) *** ## Install ### One-line install (macOS, Linux) ```bash theme={null} curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` Downloads the latest release binary for your platform and puts it in `~/.local/bin`. You can override the install path: ```bash theme={null} DEXPAPRIKA_INSTALL_DIR=/usr/local/bin curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` ### Download from GitHub Pre-built binaries for every platform are on the [releases page](https://github.com/coinpaprika/dexpaprika-cli/releases): | Platform | Binary | | - | - | | macOS (Apple Silicon) | `dexpaprika-cli-{version}-darwin-aarch64.tar.gz` | | macOS (Intel) | `dexpaprika-cli-{version}-darwin-x86_64.tar.gz` | | Linux (x86_64) | `dexpaprika-cli-{version}-linux-x86_64.tar.gz` | | Linux (ARM64) | `dexpaprika-cli-{version}-linux-aarch64.tar.gz` | | Windows (x86_64) | `dexpaprika-cli-{version}-windows-x86_64.zip` | ### Build from source Requires [Rust](https://rustup.rs/): ```bash theme={null} cargo install --git https://github.com/coinpaprika/dexpaprika-cli ``` ### Verify installation ```bash theme={null} dexpaprika-cli status ``` You should see a health check response confirming the API is reachable. *** ## Commands Every DexPaprika REST API endpoint has a matching CLI command: | Command | What it does | Example | | - | - | - | | `stats` | Ecosystem overview (total networks, pools, tokens) | `dexpaprika-cli stats` | | `networks` | List all supported chains | `dexpaprika-cli networks` | | `dexes` | DEXes on a network | `dexpaprika-cli dexes ethereum` | | `pools` | Top pools on a network | `dexpaprika-cli pools ethereum --limit 5` | | `pool` | Single pool details | `dexpaprika-cli pool ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640` | | `dex-pools` | Pools on a specific DEX | `dexpaprika-cli dex-pools ethereum uniswap_v3` | | `transactions` | Recent swaps for a pool. Dev or Pro key on the paid host | `dexpaprika-cli transactions ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640` | | `pool-ohlcv` | Historical OHLCV candles | `dexpaprika-cli pool-ohlcv ethereum 0x88e6... --start $(date -u +%F) --interval 1h` | | `pool-indicator` | RSI, EMA, MACD, Bollinger Bands or VWAP for a pool. CLI 0.10.0+ | `dexpaprika-cli pool-indicator ethereum 0x88e6... --indicator rsi --interval 1h` | | `token` | Token price and details | `dexpaprika-cli token ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` | | `token-pools` | All pools containing a token | `dexpaprika-cli token-pools ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` | | `token-indicator` | The same indicators for a token across all its pools. Dev or Pro key on the paid host, CLI 0.10.0+ | `dexpaprika-cli token-indicator ethereum 0xc02a... --indicator rsi --interval 1h` | | `prices` | Batch token prices (up to 10) | `dexpaprika-cli prices ethereum --tokens 0xc02a...,0xdac1...` | | `search` | Search tokens, pools, DEXes | `dexpaprika-cli search uniswap` | | `stream` | Real-time SSE price stream | `dexpaprika-cli stream ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` | | `status` | API health check | `dexpaprika-cli status` | | `attribution` | License attribution snippets | `dexpaprika-cli attribution` | | `onboard` | Quick start walkthrough | `dexpaprika-cli onboard` | | `shell` | Interactive REPL mode | `dexpaprika-cli shell` | > [!NOTE] > > `dex-pools` reads pool search with a `dex_name` filter. The REST path it used to call, > `GET /networks/{network}/dexes/{dex}/pools`, was removed and returns `410 Gone`, so an older > build of the CLI fails on that command until you upgrade. The command name and arguments are > unchanged; in `--raw` JSON the rows arrive under `results` with `has_next_page` and > `next_cursor`, and the 24h volume field is `volume_usd_24h`. *** ## Output formats The CLI outputs tables by default. Switch to JSON for scripting and piping: ```bash theme={null} # Table output (default, human-readable) dexpaprika-cli pools ethereum # JSON with metadata wrapper dexpaprika-cli --output json pools ethereum # Raw JSON (no _meta wrapper, for piping to jq) dexpaprika-cli --output json --raw pools ethereum ``` Pipe raw JSON into `jq` for filtering: ```bash theme={null} dexpaprika-cli --output json --raw token ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 | jq '.summary.price_usd' ``` *** ## Examples ### Get a token price ```bash theme={null} dexpaprika-cli token solana So11111111111111111111111111111111111111112 ``` ### Search for a token you don't know the address of ```bash theme={null} dexpaprika-cli search jupiter ``` ### List top pools by volume ```bash theme={null} dexpaprika-cli pools ethereum --limit 10 ``` ### Get OHLCV history for a pool Without a key, OHLCV reaches back 24 hours at `1h` and up, so start from today (UTC). A free key reaches 7 days at `10m` and longer; see [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). ```bash theme={null} dexpaprika-cli pool-ohlcv ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --start "$(date -u +%F)" --interval 1h ``` ### Get a technical indicator for a pool `pool-indicator` returns RSI, EMA, MACD, Bollinger Bands or VWAP computed from the pool's candles, on every plan with the same interval and history limits as `pool-ohlcv`. `--indicator` is required; pass only the parameters the chosen indicator uses (`--period`; `--fast-period`, `--slow-period` and `--signal-period` for macd; `--std-dev` for bbands), because one that belongs to another indicator is refused with a `400`. Needs CLI 0.10.0 or later. ```bash theme={null} dexpaprika-cli pool-indicator ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --indicator rsi --interval 1h --start -24h dexpaprika-cli pool-indicator ethereum 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 --indicator macd --interval 1h ``` `token-indicator` takes the same flags for a token across all its pools and needs a Dev or Pro key on the paid host. See the [technical indicators tutorial](/tutorials/technical-indicators). ### Stream live prices ```bash theme={null} # Single token -- streams until you hit Ctrl+C dexpaprika-cli stream ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 # Stop after 50 price updates dexpaprika-cli stream ethereum 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --limit 50 # Multiple tokens from a JSON watchlist file dexpaprika-cli stream --tokens watchlist.json --limit 100 ``` ### Interactive REPL ```bash theme={null} dexpaprika-cli shell ``` Opens an interactive session where you can run commands without typing `dexpaprika-cli` each time. ### Batch prices for a portfolio ```bash theme={null} dexpaprika-cli prices ethereum --tokens 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x6b175474e89094c44da98b954eedeac495271d0f ``` *** ## Use with AI agents AI agents running in terminals (Claude Code, Aider, etc.) can install and use the CLI as a tool. The one-liner install works in any shell: ```bash theme={null} curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh ``` Once installed, agents can call `dexpaprika-cli` directly with `--output json --raw` for machine-readable output. This is useful when: * The agent doesn't have MCP support * You want the agent to script data pipelines * You need to pipe output into other tools (`jq`, `csvkit`, scripts) * You're running headless or in CI/CD **Example agent workflow:** ```bash theme={null} # Agent searches for a token dexpaprika-cli --output json --raw search "pepe" | jq '.tokens[0]' # Agent gets the price dexpaprika-cli --output json --raw token ethereum 0x6982508145454ce325ddbe47a25d4ec3d2311933 | jq '.summary.price_usd' # Agent finds the top pool dexpaprika-cli --output json --raw token-pools ethereum 0x6982508145454ce325ddbe47a25d4ec3d2311933 | jq '.[0]' ``` *** ## Troubleshooting > [accordion] Command not found after install > > The installer puts the binary in `~/.local/bin`. If that's not in your PATH, add it: > > ```bash theme={null} > export PATH="$HOME/.local/bin:$PATH" > ``` > > Add that line to your `~/.bashrc`, `~/.zshrc`, or `~/.profile` to make it permanent. > [accordion] Permission denied during install > > The installer tries `~/.local/bin` first (no sudo needed). If it falls back to `/usr/local/bin`, it will ask for sudo. You can also set a custom directory: > > ```bash theme={null} > DEXPAPRIKA_INSTALL_DIR=~/bin curl -sSL https://raw.githubusercontent.com/coinpaprika/dexpaprika-cli/main/install.sh | sh > ``` > [accordion] No data returned for a token > > Check the network ID (must be lowercase: `ethereum`, not `Ethereum`) and verify the token address. Use `dexpaprika-cli search ` to find the correct network and address. > [accordion] Streaming disconnects > > SSE streams can drop due to network issues. The `stream` command will show an error. Restart it and the CLI handles reconnection. For production use, wrap it in a script with retry logic. *** ## Next steps > [card] [REST API Reference](/api-reference/introduction) > > Full endpoint documentation with interactive playground > [card] [Streaming API](/streaming/introduction) > > Real-time price streaming docs > [card] [Common Patterns](/knowledge-base/common-patterns) > > Standard API workflows > [card] [Vibe Coding with AI](/ai-integration/vibe-coding-with-ai) > > Build projects with AI + DexPaprika ### FAQs > [accordion] Do I need an API key? > > No. Without one the CLI calls the API keyless, metered per IP against the keyless allowance. A [free key from the console](https://console.dexpaprika.com/dashboard) raises the allowance and opens 7 days of OHLCV at `10m` and longer. Store it with `dexpaprika-cli config set-key `, pass `--api-key ` on a single command, or set `DEXPAPRIKA_API_KEY`; `dexpaprika-cli config show` tells you which key is in use. On Dev, Pro or Enterprise, point the CLI at the paid host with `--base-url https://api-pro.dexpaprika.com` or `DEXPAPRIKA_API_BASE_URL` (0.9.0 and later); `transactions` and `token-ohlcv` need it. See [upgrading to Pro](/api-pro/upgrading). > [accordion] What are the rate limits? > > Same as the REST API: 10,000 credits per rolling 30 days without a key at 15 requests a minute, 100,000 with a [free key](https://console.dexpaprika.com) at 30 requests a minute. Each CLI command makes one API call. `stream` opens a single long-lived SSE connection, and each price update it delivers costs one credit, the same as a REST call. A stream left running all month can outgrow the free allowance, so see [Pro pricing](https://dexpaprika.com/api/pricing) if you need 5,000,000 credits at 500 requests a minute. > [accordion] Does the CLI support the filter endpoint? > > The filter endpoint can be accessed via the REST API directly. Check the [pool filtering tutorial](/tutorials/pool-filtering) for examples. > [accordion] Can I use the CLI on Windows? > > Yes. Download the Windows binary from the [releases page](https://github.com/coinpaprika/dexpaprika-cli/releases). The install script works on macOS and Linux only. # Build a crypto price alert bot Source: https://docs.dexpaprika.com/tutorials/crypto-alert-bot Learn how to create a real-time cryptocurrency price alert system using DexPaprika API and Telegram [YouTube video player](https://www.youtube.com/embed/ndiHJL_7k_A?si=UvKMOvOzW33rzKYn) > [!NOTE] > > The DexPaprika API provides reliable data access. If you find any issues or have suggestions for improvement, please [contact us](mailto:support@coinpaprika.com). ## Overview This tutorial guides you through building a **real-time cryptocurrency price alert system** that monitors prices using the **DexPaprika API** and sends notifications to your Telegram when price thresholds are met. Perfect for traders and developers who want to stay updated on market movements without constant manual checking. > [!TIP] > > The complete code for this tutorial is available on [GitHub](https://github.com/coinpaprika/tutorials/tree/main/crypto-alert-bot). *** ## Features * Track any cryptocurrency available on DexPaprika API * Set custom price thresholds for buy/sell opportunities * Get instant alerts when prices go above or below your targets * Configure check intervals to match your trading strategy * Receive notifications directly on Telegram *** ## Prerequisites * Node.js (v14 or higher) * npm (Node Package Manager) * A Telegram account * A Telegram Bot (created using BotFather) *** ## Step 1: Create your Telegram bot 1. Open Telegram and search for "BotFather" (@BotFather) 2. Start a chat and send the command `/newbot` 3. Follow the instructions to create your bot 4. Save the **bot token** BotFather provides you ![Telegram BotFather conversation](https://i.imgur.com/sgoAOoV.png) *** ## Step 2: Get your Telegram chat ID 1. Start a conversation with your new bot 2. Send any message to your bot 3. Visit this URL in your browser (replace with your actual token): ```bash theme={null} https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates ``` 4. Find the `"chat":{"id":XXXXXXXXX,` value in the response - this is your **chat ID** *** ## Step 3: Set up the project 1. Clone the repository or set up a new project: ```bash theme={null} git clone https://github.com/coinpaprika/tutorials/tree/main/crypto-alert-bot # OR mkdir crypto-alert-bot cd crypto-alert-bot npm init -y ``` 2. Install required dependencies: ```bash theme={null} npm install axios dotenv node-telegram-bot-api ``` 3. Create the following files in your project directory: * `.env` (configuration file) * `index.js` (main application) *** ## Step 4: Configure your settings Create a `.env` file in the project directory with the following parameters: ``` # Telegram Bot Token (Get this from BotFather on Telegram) TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here # Telegram Chat ID (The chat where alerts will be sent) TELEGRAM_CHAT_ID=your_telegram_chat_id_here # Cryptocurrency to track (token address) CRYPTO_TOKEN_ID=So11111111111111111111111111111111111111112 CRYPTO_NETWORK=solana # Price threshold for alert (in USD) TARGET_PRICE=135 # Alert type: "above" or "below" - to trigger when price goes above or below target ALERT_TYPE=above # How often to check price (in minutes) CHECK_INTERVAL=1 ``` > [!NOTE] > > Make sure to replace placeholder values with your actual configuration details. *** ## Step 5: Create the alert bot Create an `index.js` file with the following code: ```javascript expandable [expandable] theme={null} require('dotenv').config(); const axios = require('axios'); const TelegramBot = require('node-telegram-bot-api'); // Configuration from .env file const TELEGRAM_BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN; const TELEGRAM_CHAT_ID = process.env.TELEGRAM_CHAT_ID; const CRYPTO_TOKEN_ID = process.env.CRYPTO_TOKEN_ID; const CRYPTO_NETWORK = process.env.CRYPTO_NETWORK; const TARGET_PRICE = parseFloat(process.env.TARGET_PRICE); const ALERT_TYPE = process.env.ALERT_TYPE.toLowerCase(); const CHECK_INTERVAL = parseInt(process.env.CHECK_INTERVAL) * 60 * 1000; // Convert minutes to milliseconds // Initialize Telegram Bot const bot = new TelegramBot(TELEGRAM_BOT_TOKEN); // Validate configuration if (!TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID || !CRYPTO_TOKEN_ID || !CRYPTO_NETWORK || isNaN(TARGET_PRICE) || !ALERT_TYPE || isNaN(CHECK_INTERVAL)) { console.error('Invalid configuration. Please check your .env file.'); process.exit(1); } // Send startup message bot.sendMessage(TELEGRAM_CHAT_ID, `Crypto alert bot started\n\n` + `Monitoring: ${CRYPTO_TOKEN_ID} on ${CRYPTO_NETWORK}\n` + `Alert when price goes ${ALERT_TYPE} $${TARGET_PRICE}\n` + `Checking every ${CHECK_INTERVAL / 60000} minute(s)` ); // Variables to track alert state let alertSent = false; let lastPrice = 0; // Main function to check price and send alerts async function checkPrice() { try { // Fetch current price from DexPaprika API const response = await axios.get( `https://api.dexpaprika.com/networks/${CRYPTO_NETWORK}/tokens/${CRYPTO_TOKEN_ID}` ); // Extract price from response const currentPrice = response.data.summary.price_usd; lastPrice = currentPrice; console.log(`Current price of ${CRYPTO_TOKEN_ID}: $${currentPrice}`); // Check if alert condition is met let shouldAlert = false; if (ALERT_TYPE === 'above' && currentPrice > TARGET_PRICE) { shouldAlert = true; } else if (ALERT_TYPE === 'below' && currentPrice < TARGET_PRICE) { shouldAlert = true; } // Send alert if condition is met and no alert was sent before if (shouldAlert && !alertSent) { const message = `PRICE ALERT\n\n` + `${response.data.name} (${response.data.symbol})\n` + `Current Price: $${currentPrice}\n` + `Target: ${ALERT_TYPE} $${TARGET_PRICE}\n\n` + `Condition met.`; bot.sendMessage(TELEGRAM_CHAT_ID, message); alertSent = true; console.log('Alert sent!'); } // Reset alert flag if price goes back on the other side of the threshold if ((ALERT_TYPE === 'above' && currentPrice < TARGET_PRICE) || (ALERT_TYPE === 'below' && currentPrice > TARGET_PRICE)) { alertSent = false; } } catch (error) { console.error('Error checking price:', error.message); // Send error notification if API fails if (error.response) { bot.sendMessage(TELEGRAM_CHAT_ID, `Error checking price: ${error.response.status} - ${error.response.statusText}`); } else { bot.sendMessage(TELEGRAM_CHAT_ID, `Error checking price: ${error.message}`); } } } // Run the price check immediately checkPrice(); // Then set up interval to check regularly setInterval(checkPrice, CHECK_INTERVAL); console.log(`Bot is running. Checking ${CRYPTO_TOKEN_ID} every ${CHECK_INTERVAL / 60000} minute(s).`); ``` *** ## Step 6: Finding the right token address Need to track a different token? Use DexPaprika API to find its address: 1. List available networks: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/networks" | jq ``` 2. Search for your token: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/search?query=YOUR_TOKEN_NAME" | jq ``` *** ## Step 7: Running the bot 1. Start the bot: ```bash theme={null} node index.js ``` 2. You'll receive a confirmation message on Telegram. 3. The bot will check prices at your specified interval 4. When your price condition is met, you'll get an alert ![Telegram alert notification](https://i.imgur.com/1s64s7V.png) *** ## Running as a background service ### On Linux/Mac: ```bash theme={null} npm install -g pm2 pm2 start index.js --name crypto-alert pm2 save ``` ### On Windows: ```bash theme={null} npm install -g forever forever start index.js ``` *** ## How it works 1. The application connects to DexPaprika API to retrieve real-time token prices 2. It compares the current price against your target threshold 3. When the condition is met, it sends an immediate alert via the Telegram Bot API 4. The process repeats based on your configured check interval *** ## Troubleshooting * Not receiving messages? Double-check your bot token and chat ID * Ensure your network/token combination is valid in DexPaprika * Check console output for any error messages *** ## Next steps > [card] Add multiple alerts > > Extend the code to monitor multiple tokens or set different thresholds. > [card] Create a web dashboard > > Build a visual interface to manage your alerts and view price history. ### FAQs > [accordion] Which price does the bot check? > > It reads `summary.price_usd` from the token details endpoint for the specified `network` and `token_address`. > [accordion] How often should I poll? > > Start with 1 to 5 minutes depending on volatility. A one-minute poll is about 43,000 requests over 30 days and a two-minute poll about 21,600; neither fits the 10,000 keyless allowance. Either register a [free key](https://console.dexpaprika.com) for 100,000 or poll every five minutes, which is about 8,640 and stays keyless. You can watch the running total in the [DexPaprika console](https://console.dexpaprika.com). > [accordion] How do I find the right token address? > > Use the Search endpoint or list networks first, then fetch the token by address to verify. > [accordion] Can I alert on liquidity or volume instead? > > Yes. Query pool details (or transactions, on a Dev or Pro plan) and set thresholds on `liquidity_usd` or recent `volume_usd`. > [!TIP] > > **Share Your Extensions!** Built something cool by extending this tutorial? We'd love to see it! > Share your work on our [Discord](https://discord.gg/DhJge5TUGM) - your tutorial might be featured on our website. > Ideas to try: smart trend alerts, multi-token tracking, or historical data analysis. *** ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. # Fetching token prices Source: https://docs.dexpaprika.com/tutorials/fetch-token-price Learn how to retrieve the price of any token using DexPaprika API with simple curl commands. ## Tutorial overview Fetch real-time token prices from the DexPaprika DEX API using a `network` id and `token_address`. [YouTube video player](https://www.youtube.com/embed/UJIBbwwbpPI?si=L69InN1Xk87i8SJZ) > [!NOTE] > > The DexPaprika API provides reliable data access. If you find any issues or have suggestions for improvement, please [contact us](mailto:support@coinpaprika.com). ## Fetching token prices This tutorial will walk you through retrieving the **latest price of any token** using **DexPaprika API**. We will use simple `cURL` commands to interact with the API. > [!TIP] > > You can test the API directly in the documentation without writing any code. Visit the [API Reference](/api-reference/introduction) to try it out. *** ## Step 1: Get available networks To fetch token data, you need the **network ID**. Use this request to get a list of supported blockchain networks: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/networks" | jq ``` The response will include networks like **Solana, Base, Aptos, Ethereum**, etc. Choose the one you need. > [!NOTE] > > You can find the full list of supported networks in the [Networks API](/api-reference/networks/get-a-list-of-available-blockchain-networks). *** ## Step 2: Find a token address If you don't have a token address, you can search for it using the API: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/search?query=YOUR_INPUT" ``` Replace `YOUR_INPUT` with the actual phrase you're looking for. The response will return matching token & pools along with their addresses. *** ## Step 3: Fetch the token price Once you have the **network ID** and **token address**, use the following request to get the token's price: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/networks/{network}/tokens/{token_address}" ``` Replace: * `{network}` with the network (e.g., `solana`, `base`) * `{token_address}` with the address found in Step 2 The response will return data like this: ```json Response [expandable] theme={null} { "id": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", "name": "Jupiter", "symbol": "JUP", "chain": "solana", "decimals": 6, "total_supply": 9999979509174084, "description": "", "website": "", "explorer": "", "added_at": "2024-09-11T04:37:20Z", "summary": { "price_usd": 0.6863252359922881, "fdv": 6863238296.5519485244070243816004, "liquidity_usd": 25575125.4495078768612017, "24h": { "volume": 80207699.45778705, "volume_usd": 55796800.523819186, "sells": 106864, "buys": 57315, "txns": 164179 }, "6h": { "volume": 11540575.177305005, "volume_usd": 8037337.331943456, "sells": 17801, "buys": 9926, "txns": 27727 }, "1h": { "volume": 2766848.754695, "volume_usd": 1900837.0877990713, "sells": 3484, "buys": 2082, "txns": 5566 }, "30m": { "volume": 1394651.1182109998, "volume_usd": 954794.8829624434, "sells": 1907, "buys": 1198, "txns": 3105 }, "15m": { "volume": 373588.37757400004, "volume_usd": 255759.0367338767, "sells": 742, "buys": 316, "txns": 1058 }, "5m": { "volume": 109317.68508500002, "volume_usd": 74963.92390747965, "sells": 265, "buys": 86, "txns": 351 } }, "last_updated": "2025-02-26T13:11:25.858732857Z" } ``` *** ## Step 4: Extract only the price (single token) If you only need the **token price in USD**, you can filter the response using `jq`: ```bash theme={null} curl -X GET "https://api.dexpaprika.com/networks/{network}/tokens/{token_address}" | jq '.summary.price_usd' ``` This will return only the price: ```json theme={null} 0.6863252359922881 ``` *** ## Step 5: Fetch prices for multiple tokens (batch) If you need prices for multiple tokens at once on the same network, use the batch pricing endpoint. Unlike the steps above, it needs an API key; a free key is enough. The key is free: create one at [console.dexpaprika.com](https://console.dexpaprika.com). ```bash theme={null} curl -X GET -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/multi/prices?tokens=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdac17f958d2ee523a2206206994597c13d831ec7" | jq ``` Example response: ```json Response [expandable] theme={null} [ { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "chain": "ethereum", "price_usd": 4400.5697112921535 }, { "id": "0xdac17f958d2ee523a2206206994597c13d831ec7", "chain": "ethereum", "price_usd": 1.0002529851244053 } ] ``` Notes: * Provide a comma-separated list in a single `tokens` parameter. * Unknown or unpriced tokens are omitted from the array. * Order is not guaranteed. * You can pass up to 10 tokens per request; more than 10 returns HTTP 400. > [!TIP] > > Explore the full endpoint docs: [Get batched token prices on a network](/api-reference/tokens/get-batched-prices-for-multiple-tokens-on-a-network) *** ## Next steps > [card] [Quick API reference](/api-reference/introduction) > > Jump straight into the API documentation and start making requests within minutes. > [card] [More tutorials](/tutorials/tutorial_intro) > > Learn more ways to integrate DexPaprika into your applications. ## Get support > [card] [Join Discord](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve. ### FAQs > [accordion] What do I need to fetch a token price? > > The `network` id (e.g., `solana`, `ethereum`) and the on-chain `token_address`. > [accordion] What is the price currency? > > `summary.price_usd` returns USD. Other quote currencies may be added later; USD is the canonical quote. > [accordion] How accurate are prices on low-liquidity pools? > > Thin pools can be noisy; prefer higher-volume pools or the token’s main pool from the token response. > [accordion] Do I need an API key? > > Not to start. Keyless requests work at 10,000 credits per rolling 30 days per IP; a [free registered key](https://console.dexpaprika.com) raises that to 100,000. # Find new crypto pools and token launches Source: https://docs.dexpaprika.com/tutorials/find-new-pools Discover newly created liquidity pools across 35 blockchains. Perfect for finding new tokens, arbitrage opportunities, and emerging DeFi projects early. ## Tutorial overview Discover newly created liquidity pools by searching pools on each network sorted by `created_at`, with activity filters. > [!NOTE] > > Hitting any snags? We've got your back - [reach out](mailto:support@coinpaprika.com) and we'll help you get this working. > [!WARNING] > > On the free tiers, search leaves out pools created in the last hour: keyless requests and free keys see a pool once it is an hour old. Dev, Pro and Enterprise keys on `api-pro.dexpaprika.com` see it as soon as it is indexed. Every example below works on any plan, with that delay on the free tiers. Details: [search freshness](/knowledge-base/rate-limits#search-freshness). ## Why monitor new pools? New liquidity pools are where the action happens in DeFi. They signal new token launches, liquidity migrations, and fresh trading opportunities. Being first to spot them can be a serious advantage. **What you can catch early:** * **New token launches** before they hit major trackers * **Arbitrage opportunities** between pools * **Liquidity migrations** to better DEXes * **Emerging projects** before they explode > [!TIP] > > **TL;DR**: Jump to [Step 2](#step-2-get-newest-pools) if you want to start pulling new pools immediately. *** ## Step 1: Pick your networks First, see what blockchains you want to monitor using the [Networks API](/api-reference/networks/get-a-list-of-available-blockchain-networks): ```bash theme={null} curl "https://api.dexpaprika.com/networks" | jq '.[] | {id: .id, name: .display_name}' ``` *** ## Step 2: Get newest pools Here's the money shot - getting pools sorted by creation date using the pool search endpoint: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&limit=10&detailed=true" | jq ``` That request is keyless, so its newest pool is at least an hour old. With a Dev, Pro or Enterprise key, send the same query to `api-pro.dexpaprika.com` and pools from the last hour are included: ```bash theme={null} curl -H "Authorization: YOUR_API_KEY" "https://api-pro.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&limit=10&detailed=true" | jq ``` ### What these parameters do: | Parameter | Effect | Pro Tip | | - | - | - | | `order_by=created_at` | Sort by when pool was made | On the free tiers the newest row is at least an hour old | | `sort=desc` | Newest first | Use `asc` for historical analysis | | `limit=10` | How many pools back | Max is 100, but 10-20 is usually enough | | `cursor` | Pagination | Pass `next_cursor` from the previous response for deeper history. Needs an API key (a free key is enough) | | `detailed=true` | Include full token metadata (symbol, name) in each result | Add it whenever you display token symbols | ### What you get: ```json theme={null} { "results": [ { "id": "0x462229e7fc9e6cab0ebbd643cc6dfef2a5261ee9", "dex_name": "Uniswap V2", "created_at": "2025-06-09T09:28:35Z", "volume_usd_24h": 767.17, "transactions_24h": 5, "tokens": [ { "symbol": "🧸TEDDYS", "name": "🧸TeddySwap" }, { "symbol": "WETH", "name": "Wrapped Ether" } ] } ], "has_next_page": true, "next_cursor": "eyJvZmZzZXQiOjEwfQ==" } ``` > [!NOTE] > > To screen multiple networks in one call, use the global `GET /pools/search` with a `chains` filter, for example `chains=ethereum,base,solana`. **Red flags to watch for:** * Zero transactions after hours (might be a test pool) * Very low liquidity relative to volume (possible wash trading) *** ## Focus on specific DEXes Want to monitor just Uniswap or Raydium? First get the DEX list using the [Network DEXes API](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network): ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/dexes" | jq '.dexes[] | {id: .dex_id, name: .dex_name}' ``` Then pass that `dex_id` to the `dex_name` filter on [pool search](/api-reference/pools/advanced-pool-filtering-on-a-specific-network): ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?dex_name=uniswap_v3&order_by=created_at&sort=desc&limit=10&detailed=true" | jq '.results[] | {pool: .id, created: .created_at, tokens: [.tokens[].symbol]}' ``` > [!NOTE] > > The older `GET /networks/{network}/dexes/{dex}/pools` was removed and returns `410 Gone`. The DEX > is a query filter now. `dex_name` takes the `dex_id` from the list above, matched > case-insensitively; pass the `dex_name` display name instead and you get an empty `results` > array rather than an error. Rows come back under `results` instead of `pools`. *** ## Multi-chain monitoring Real pros monitor multiple chains simultaneously. Here's how: ### Ethereum ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&limit=5&detailed=true" | jq '.results[] | {chain: "ethereum", pool: .id, created: .created_at, volume: .volume_usd_24h, tokens: [.tokens[].symbol]}' ``` ### Solana ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/search?order_by=created_at&sort=desc&limit=5&detailed=true" | jq '.results[] | {chain: "solana", pool: .id, created: .created_at, volume: .volume_usd_24h, tokens: [.tokens[].symbol]}' ``` ### Base ```bash theme={null} curl "https://api.dexpaprika.com/networks/base/pools/search?order_by=created_at&sort=desc&limit=5&detailed=true" | jq '.results[] | {chain: "base", pool: .id, created: .created_at, volume: .volume_usd_24h, tokens: [.tokens[].symbol]}' ``` Or all three in one request: ```bash theme={null} curl "https://api.dexpaprika.com/pools/search?chains=ethereum,solana,base&order_by=created_at&sort=desc&limit=15" | jq '.results[] | {chain: .chain, pool: .id, created: .created_at, volume: .volume_usd_24h}' ``` **Pro tip**: Use different limits based on chain activity. Solana might need `limit=20` because of memecoin amounts, while Ethereum `limit=5` catches the important stuff. *** ## Smart filtering strategies ### Only high-activity pools Skip the dead pools - focus on ones with real trading: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&volume_usd_24h_min=1000&txns_24h_min=10&limit=50" | jq '.results[] | {id: .id, created: .created_at, volume: .volume_usd_24h, txns: .transactions_24h}' ``` ### Last 24 hours only Filter server-side by creation time to get super fresh pools: ```bash theme={null} # Pools created in the last 24 hours curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&created_after=-24h&limit=100" | jq '.results[] | {id: .id, age: .created_at, volume: .volume_usd_24h}' ``` On the free tiers this returns pools created between 24 hours and one hour ago. A window shorter than an hour, such as `created_after=-10m`, comes back empty there and needs a Dev key or higher. ### New token launches Look for pools where the tokens themselves are brand new: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&limit=20&detailed=true" | jq '.results[] | select(.tokens[] | .added_at > "2025-01-25T00:00:00Z") | {pool: .id, pool_age: .created_at, new_tokens: [.tokens[] | select(.added_at > "2025-01-25T00:00:00Z") | .symbol]}' ``` *** ## Production monitoring setup ### Simple monitoring script Here's a bash script that checks for new pools every 5 minutes: ```bash theme={null} #!/bin/bash # Monitor new pools across multiple chains CHAINS=("ethereum" "solana" "base") MIN_VOLUME=5000 while true; do echo "Checking for new pools at $(date)" for chain in "${CHAINS[@]}"; do echo "--- $chain ---" # Get new pools with decent volume curl -s "https://api.dexpaprika.com/networks/$chain/pools/search?order_by=created_at&sort=desc&volume_usd_24h_min=$MIN_VOLUME&limit=10&detailed=true" | \ jq '.results[] | { pool_id: .id, chain: "'$chain'", created: .created_at, volume: .volume_usd_24h, tokens: [.tokens[].symbol] }' done echo "Sleeping for 5 minutes..." sleep 300 done ``` ### Alert on high-volume new pools Catch the big moves automatically: ```bash theme={null} # Check for new pools with serious volume NEW_POOLS=$(curl -s "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&volume_usd_24h_min=50000&limit=20" | jq '.results[]') if [ -n "$NEW_POOLS" ]; then echo "HIGH VOLUME NEW POOL DETECTED" echo "$NEW_POOLS" # Add your notification here (Discord webhook, Slack, email, etc.) # curl -X POST "YOUR_DISCORD_WEBHOOK" -d "{\"content\": \"New high-volume pool: $NEW_POOLS\"}" fi ``` *** ## Troubleshooting common issues ### "No new pools found" On a free tier the newest result is at least an hour old, and a `created_after` window under an hour returns an empty `results` array (see [search freshness](/knowledge-base/rate-limits#search-freshness)). Otherwise, check if you're looking at the right timeframe: ```bash theme={null} # See when the last pool was created curl "https://api.dexpaprika.com/networks/ethereum/pools/search?order_by=created_at&sort=desc&limit=1" | jq '.results[0].created_at' ``` ### "Too much spam" Filter out low-quality pools with volume and transaction thresholds: ```bash theme={null} # More restrictive filtering curl "https://api.dexpaprika.com/networks/solana/pools/search?order_by=created_at&sort=desc&txns_24h_min=20&volume_usd_24h_min=5000&limit=50" | jq '.results[]' ``` To screen by token valuation (for example, only new tokens under a \$100M FDV), use the token search endpoint, which supports `fdv_usd_max`: ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/tokens/search?order_by=created_at&sort=desc&fdv_usd_max=100000000&limit=25" | jq '.results[] | {token: .address, fdv: .fdv_usd, volume: .volume_usd_24h}' ``` ### "Missing opportunities" You might need to check more frequently or cast a wider net: ```bash theme={null} # Check multiple DEXes on one chain for dex in uniswap_v3 uniswap_v2 sushiswap; do echo "=== $dex ===" curl -s "https://api.dexpaprika.com/networks/ethereum/pools/search?dex_name=$dex&order_by=created_at&sort=desc&limit=3&detailed=true" | jq '.results[0] | {dex: "'$dex'", created: .created_at, tokens: [.tokens[].symbol]}' done ``` *** ## What's next? > [card] [Historical Price Data](/tutorials/retrieve-historical-data) > > Analyze new pools with price history. > [card] [Pool Transactions](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) > > Monitor trading activity in real-time. > [card] [Pool Details API](/api-reference/pools/get-a-pool-on-a-network) > > Get comprehensive pool information and metadata. > [card] [Search API](/api-reference/search/search-for-tokens-pools-and-dexes) > > Find pools, tokens, and DEXes across all networks. ## Need help? > [card] [Developer Discord](https://discord.gg/DhJge5TUGM) > > Share strategies and get help from other builders. > [card] [Direct Support](mailto:support@coinpaprika.com) > > Stuck on something? We'll help you figure it out. ### FAQs > [accordion] How do I reliably detect new pools? > > Sort by `created_at` descending and set a reasonable `limit`. Poll periodically and de-duplicate by pool id. > [accordion] What filters reduce spam? > > Combine `volume_usd_24h_min` and `txns_24h_min` thresholds; optionally whitelist DEXes or networks. > [accordion] How can I monitor multiple chains efficiently? > > Use the global `GET /pools/search` with `chains=ethereum,base,solana`, or run parallel per-network requests and merge by a timestamp key. > [accordion] Can I alert on high-volume launches? > > Yes. Query newest pools and alert when `volume_usd_24h` exceeds your threshold. # List DEXes on a blockchain network Source: https://docs.dexpaprika.com/tutorials/list-dexes Get every decentralized exchange DexPaprika indexes on a chain, with 24h volume, swaps and active pools, then fetch the top pools of one DEX. Works without an API key. `GET /networks/{network}/dexes` returns every decentralized exchange DexPaprika indexes on one chain, with its 24h volume, swap count and number of active pools. The `dex_id` of each one is what you pass to [pool search](/tutorials/pool-filtering) to get that DEX's pools. No key is needed: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/solana/dexes" | jq '.dexes[0]' ``` ```json theme={null} { "chain": "solana", "dex_id": "manifest", "dex_name": "Manifest", "protocol": "manifest", "volume_usd_24h": 95109148.8246825, "txns_24h": 278929, "pools_count": 262 } ``` Take the `{network}` value from [the networks list](/tutorials/list-networks): `solana`, `ethereum`, `bsc` and so on. *** ## Which plan you need The endpoint works on every plan, with the same data. A key changes the limits and the host. | Caller | Host | Header | | - | - | - | | No key | `api.dexpaprika.com` | none | | Free key | `api.dexpaprika.com` | `Authorization: ` | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | `Authorization: ` | The key goes in `Authorization` on its own. Get one in [console.dexpaprika.com](https://console.dexpaprika.com) and compare limits on [pricing](https://dexpaprika.com/api/pricing). ```bash No key theme={null} curl -s "https://api.dexpaprika.com/networks/solana/dexes" | jq '.dexes | length' ``` ```bash Dev or Pro key theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/solana/dexes" | jq '.dexes | length' ``` *** ## What each DEX carries | Field | Meaning | | - | - | | `dex_id` | Stable id of the DEX on this chain. Pass it as `dex_name` to pool search | | `dex_name` | Display name, for your UI | | `protocol` | The protocol family. Several `dex_id`s can share one, for example `raydium` and `raydium_clmm` are both `raydium` | | `volume_usd_24h` | Trading volume on this DEX over the last 24 hours, in USD | | `txns_24h` | Swaps on this DEX over the last 24 hours | | `pools_count` | Pools on this DEX with recent trading activity | *** ## DEX market share and top pools in Python This script computes each DEX's share of the chain's 24h volume, then fetches the three busiest pools on the leader. Two requests: ```python theme={null} import os import requests # No key: leave both variables unset. Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} NETWORK = "solana" def get(path, **params): r = requests.get(f"{API}{path}", headers=HEADERS, params=params, timeout=30) r.raise_for_status() return r.json() dexes = get(f"/networks/{NETWORK}/dexes")["dexes"] total = sum(d["volume_usd_24h"] for d in dexes) dexes.sort(key=lambda d: d["volume_usd_24h"], reverse=True) print(f"{len(dexes)} DEXes on {NETWORK}, ${total:,.0f} traded in 24h") for d in dexes[:5]: print(f" {d['dex_name']:<18}{d['volume_usd_24h'] / total:>7.1%} {d['pools_count']:>6,} pools") leader = dexes[0] pools = get(f"/networks/{NETWORK}/pools/search", dex_name=leader["dex_id"], limit=3)["results"] print(f"\nBusiest pools on {leader['dex_name']}:") for p in pools: print(f" {p['id']} ${p['volume_usd_24h']:,.0f}") ``` ```text theme={null} 9 DEXes on solana, $2,547,595,293 traded in 24h PumpSwap 60.0% 15,747 pools Meteora DAAM V2 12.9% 10,939 pools Orca 8.9% 4,182 pools Meteora 4.8% 3,372 pools Pump.fun 4.3% 49,618 pools Busiest pools on PumpSwap: 6KCmCfW5GSf7nQ7hfk8ds2aTiZXUYLcKAsmH3ZLZW6p3 $85,447,575 FRvYyNTGzQRQfsbDZntcqQwHJpmHZKtMh7N85uDG1i4H $84,997,947 D3vzKTEJntE3wSu4QaPd79e2bnifnHggVDVewu1ukkAJ $84,636,334 ``` Output from 12 October 2026. Pool search returns pools by 24h volume, highest first, unless you set `order_by`. *** ## Things to know **One call returns the whole list.** The endpoint accepts `page` and `limit`, but every DEX on the chain comes back in the first response, so there is nothing to page through. `page=2` returns the same list again, so a loop over pages counts every DEX twice. **Sort it yourself.** The list is ordered by `dex_id`, not by volume. **Pass the `dex_id`, not the display name, to pool search.** `dex_name=raydium_clmm` works. The display name, `dex_name=Raydium CLMM`, returns an empty `results` array with no error, so an empty answer is worth a second look before you conclude the DEX has no pools. **Shares are relative to what is indexed.** The total in the script is the sum of the DEXes DexPaprika indexes on that chain. A DEX that is not indexed is not in the denominator. *** ## Where to go next * [Filter pools](/tutorials/pool-filtering): every filter pool search takes, `dex_name` included * [List networks](/tutorials/list-networks): the `{network}` values * [DEXes reference](/api-reference/dexes/get-a-list-of-available-dexes-on-a-network) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # List supported blockchain networks Source: https://docs.dexpaprika.com/tutorials/list-networks Get every blockchain DexPaprika indexes, with 24h DEX volume, transactions and active pools per chain, in one API call. Works without an API key. `GET /networks` returns every blockchain DexPaprika indexes in one response, with the chain's 24h DEX volume, transaction count and number of active pools. The `id` of each network is the value every other endpoint takes as `{network}`. No key is needed: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks" | jq '.[] | select(.id == "ethereum")' ``` ```json theme={null} { "display_name": "Ethereum", "id": "ethereum", "volume_usd_24h": 1558970336.9760473, "txns_24h": 396564, "pools_count": 9718 } ``` The whole list arrives at once, there is no paging. This page covers that call, the matching [`GET /stats`](/api-reference/utils/retrieve-high-level-asset-statistics) totals, and a short script that ranks chains by activity. *** ## Which plan you need Both endpoints work on every plan, with the same data. A key changes the limits and the host, not the response. | Caller | Host | Header | | - | - | - | | No key | `api.dexpaprika.com` | none | | Free key | `api.dexpaprika.com` | `Authorization: ` | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | `Authorization: ` | The key goes in `Authorization` on its own. Get one in [console.dexpaprika.com](https://console.dexpaprika.com) and compare limits on [pricing](https://dexpaprika.com/api/pricing). ```bash No key theme={null} curl -s "https://api.dexpaprika.com/networks" | jq 'length' ``` ```bash Dev or Pro key theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks" | jq 'length' ``` *** ## What each network carries | Field | Meaning | | - | - | | `id` | The network id to pass as `{network}` in every other path, for example `ethereum`, `solana`, `bsc` | | `display_name` | Human-readable name for your UI | | `volume_usd_24h` | DEX trading volume on the chain over the last 24 hours, in USD | | `txns_24h` | Swaps on the chain over the last 24 hours | | `pools_count` | Pools with recent trading activity on the chain | Use `id` in code and `display_name` on screen. Ids are lowercase slugs and do not always match the chain's marketing name, so look them up here rather than guessing: Binance Smart Chain is `bsc`. *** ## Coverage totals with /stats `GET /stats` returns four totals for the whole database: ```bash theme={null} curl -s "https://api.dexpaprika.com/stats" ``` ```json theme={null} {"chains": 36, "factories": 244, "pools": 43737979, "tokens": 39695382} ``` `pools` here counts every pool ever indexed, while `pools_count` on `/networks` counts the pools on a chain with recent activity. Both are correct, they answer different questions, so do not add up `pools_count` and expect the `/stats` figure. *** ## Rank chains by activity in Python `/networks` comes back in no particular order. This script sorts it by 24h volume and prints the five busiest chains, two requests in total: ```python theme={null} import os import requests # No key: leave both variables unset. Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} def get(path): r = requests.get(f"{API}{path}", headers=HEADERS, timeout=30) r.raise_for_status() return r.json() networks = get("/networks") stats = get("/stats") print(f"{len(networks)} networks, {stats['pools']:,} pools in the database") print(f"{'network':<12}{'24h volume (USD)':>20}{'24h swaps':>12}{'active pools':>14}") for n in sorted(networks, key=lambda n: n["volume_usd_24h"], reverse=True)[:5]: print(f"{n['id']:<12}{n['volume_usd_24h']:>20,.0f}{n['txns_24h']:>12,}{n['pools_count']:>14,}") ``` ```text theme={null} 36 networks, 43,739,236 pools in the database network 24h volume (USD) 24h swaps active pools solana 2,542,236,728 24,488,503 94,013 ethereum 1,558,970,337 396,564 9,718 bsc 1,171,743,743 3,718,095 22,393 base 927,396,344 1,587,603 14,815 robinhood 693,359,323 1,668,783 14,559 ``` Output from 12 October 2026. Your numbers will differ. *** ## Things to know **Sort it yourself.** The order of `/networks` is not by name or by volume, and it can change between calls. **Cache it.** The list changes when a chain is added or retired, which is rare. Responses carry `cache-control: max-age=60`, and fetching it once per process start is plenty. Every call costs one credit, see [credit usage](/knowledge-base/credit-usage). **Volume is DEX volume only.** `volume_usd_24h` sums swaps on the DEXes DexPaprika indexes on that chain. It is not the chain's total on-chain value transferred. *** ## Where to go next * [List DEXes on a network](/tutorials/list-dexes): the exchanges behind each chain's volume * [Networks reference](/api-reference/networks/get-a-list-of-available-blockchain-networks) and [stats reference](/api-reference/utils/retrieve-high-level-asset-statistics) * [Coverage checker](/tools/coverage-checker): look up a token or pool without code * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # Local crypto analytics with DuckDB Source: https://docs.dexpaprika.com/tutorials/local-analytics-with-duckdb Build a powerful, local crypto analytics database with DuckDB. This tutorial guides you through creating an ETL pipeline for Uniswap v3 data to run complex SQL queries instantly. ## Tutorial overview Create a local DuckDB analytics database from DEX pools and OHLCV for instant SQL over on-chain data. ## The local powerhouse: A core pattern for on-chain analysis Why make thousands of slow, rate-limited API calls when you can run complex SQL queries instantly on your own machine? This tutorial introduces the most effective pattern for crypto data analysis: creating a local, high-performance copy of a complete on-chain dataset. By fetching the data once, you unlock unlimited, high-speed analytical capabilities. > [!NOTE] > > Looking for other analytics solutions? Check out our full list of [API Tutorials](/tutorials/tutorial_intro) for more step-by-step guides. The free tier gives you the full endpoint surface, not a cut-down dataset. What it caps is OHLCV depth (24 hours of `1h`+ candles keyless, 7 days of `10m`+ candles with a free key; Dev gets 30 days, Pro unlimited), throughput (10,000 credits per rolling 30 days keyless at 15 requests a minute, 100,000 with a [free key](https://console.dexpaprika.com) at 30 a minute) and freshness (data is served with a delay of up to 60 seconds; [Pro is real time](https://dexpaprika.com/api/pricing)). Pulling once into DuckDB and querying locally is a good fit for that shape. ```mermaid theme={null} graph TD; subgraph "Step 1: Data Pipeline"; A["Run Python ETL Script"] --> B{"Fetches Pool & OHLCV Data"}; B --> C["DexPaprika API"]; C --> B; B --> D["Local DuckDB File
(uniswap_v3.db)"]; end subgraph "Step 2 & 3: Analysis"; D --> E{"Query the Database"}; E --> F["Option A:
Directly with SQL"]; E --> G["Option B:
AI Assistant via MCP"]; end ``` **The goal:** By the end of this guide, you will have a local `uniswap_v3.db` file containing all pools and their recent trading history from Uniswap v3 on Ethereum. You will be able to: 1. Run a robust, high-performance ETL script that pulls a complete dataset from the DexPaprika API. 2. Perform complex SQL queries against your local copy, where no API limit applies. 3. Understand a professional workflow for acquiring and analyzing on-chain data. **Why this is a foundational skill:** * **Eliminates Rate Limiting:** Instead of thousands of small, repetitive API calls, you perform one efficient batch download. * **Unlocks True Analytical Power:** Run complex joins, aggregations, and window functions that are impossible with a simple API. * **Creates a Foundation:** The skills you learn here can be applied to any data source, preparing you for more advanced, real-time analysis. > [card] [Step 1: ETL pipeline](#step-1-build-your-local-data-pipeline) > > Create a Python script to fetch complete Uniswap v3 pool and OHLCV data. > [card] [Step 2: Instant SQL analysis](#step-2-run-the-pipeline-and-query-with-sql) > > Populate your database and run complex SQL queries to find insights. > [card] [Step 3: AI-powered analysis with an MCP server](#step-3-ai-powered-analysis-with-an-mcp-server) > > Connect your database to an AI assistant for natural language queries. ### FAQs > [accordion] Why use DuckDB for crypto analytics? > > It’s an embedded analytics database: zero server setup, a very fast columnar engine, and a good fit for local SQL over large datasets. > [accordion] How big can the local DB get? > > Depends on pools and history length; tens of millions of rows are feasible on a laptop with DuckDB’s compression. > [accordion] How often should I refresh data? > > Append new OHLCV daily or hourly depending on your use case; the pipeline is designed for incremental runs. > [accordion] Can I join multiple networks or DEXes? > > Yes. Create separate tables per network/DEX and union them, or annotate rows with `network`/`dex` columns. *** ## Step 1: Build your local data pipeline First, let's create a Python script to act as our ETL (Extract, Transform, Load) pipeline. This script will fetch all pool data for **Uniswap v3 on Ethereum** and their recent trading history, then load it into a local DuckDB database file. It uses two endpoints: [pool search](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) with a `dex_name` filter to discover pools, and the [Pool OHLCV Data endpoint](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) to fetch historical price data. Create a new file named `build_uniswap_db.py`. > [!NOTE] > > This script needs a [free API key](https://console.dexpaprika.com). Without one, OHLCV reaches back only 24 hours at `1h` and up, and the script asks for six days of hourly candles. Export the key before running it; it goes in the `Authorization` header on its own. On Pro, point `API_BASE_URL` at `https://api-pro.dexpaprika.com`. Limits per plan: [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). > > ```bash theme={null} > export DEXPAPRIKA_API_KEY="your-key" > ``` ```python build_uniswap_db.py [expandable] theme={null} import duckdb import pandas as pd from datetime import datetime, timedelta import logging import os import asyncio import aiohttp from typing import List, Dict # --- Configuration --- API_BASE_URL = "https://api.dexpaprika.com" API_KEY = os.environ["DEXPAPRIKA_API_KEY"] # free key from console.dexpaprika.com NETWORK = "ethereum" DEX_ID = "uniswap_v3" HISTORY_DAYS = 6 # a free key reaches 7 days back; stay inside it DB_FILE = "dbs/uniswap_v3.db" INTERVAL = "1h" # 1-hour intervals OHLCV_API_LIMIT = 100 # Max records per API call TOP_POOLS_LIMIT = 500 # Focus on top 500 pools by volume CONCURRENT_REQUESTS = 3 # Number of concurrent API requests BATCH_SIZE = 15 # Number of pools to process in each batch # Setup logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') async def fetch_with_retry(session: aiohttp.ClientSession, url: str, params: Dict = None, retries=5, backoff_factor=1.0) -> Dict: """Generic async fetch function with exponential backoff.""" for attempt in range(retries): try: async with session.get(url, params=params, timeout=30) as response: response.raise_for_status() return await response.json() except (aiohttp.ClientError, asyncio.TimeoutError) as e: if attempt == retries - 1: logging.error(f"Final attempt failed for {url}: {e}") raise sleep_time = backoff_factor * (2 ** attempt) logging.warning(f"Request to {url} failed: {e}. Retrying in {sleep_time:.2f}s...") await asyncio.sleep(sleep_time) return {} async def get_top_dex_pools(session: aiohttp.ClientSession, network: str, dex_id: str) -> List[Dict]: """Fetches top pools for a given DEX, handling cursor pagination asynchronously.""" logging.info(f"Fetching top {TOP_POOLS_LIMIT} pools for {dex_id} on {network}...") all_pools = [] cursor = None while len(all_pools) < TOP_POOLS_LIMIT: # The DEX is a filter now: /networks/{network}/dexes/{dex}/pools was removed and returns 410. url = f"{API_BASE_URL}/networks/{network}/pools/search" # detailed=true is what puts name/symbol/decimals on results[].tokens[]; # the lean default only carries the token id. params = {"dex_name": dex_id, "limit": 100, "order_by": "volume_usd_24h", "sort": "desc", "detailed": "true"} if cursor: params["cursor"] = cursor try: data = await fetch_with_retry(session, url, params=params) pools = data.get('results', []) if not pools: break all_pools.extend(pools) logging.info(f"Fetched a page, got {len(pools)} pools. Total: {len(all_pools)}") if len(all_pools) >= TOP_POOLS_LIMIT: all_pools = all_pools[:TOP_POOLS_LIMIT] break if not data.get('has_next_page'): break cursor = data.get('next_cursor') await asyncio.sleep(0.5) # Be respectful to the API except Exception as e: logging.error(f"Error fetching a page of {dex_id} pools: {e}") break logging.info(f"Finished fetching pools. Total found: {len(all_pools)}") return all_pools async def get_pool_ohlcv(session: aiohttp.ClientSession, pool_address: str, pool_created_at: str, semaphore: asyncio.Semaphore) -> List[Dict]: """ Fetches 1-hour OHLCV data for a pool using an intelligent date range and dynamic windowing. """ async with semaphore: logging.info(f"Fetching OHLCV for pool {pool_address}...") final_end_time = datetime.utcnow() # Use the later of: pool creation date or the default history window start_time = final_end_time - timedelta(days=HISTORY_DAYS) if pool_created_at: try: pool_creation = datetime.strptime(pool_created_at, '%Y-%m-%dT%H:%M:%SZ') if pool_creation > start_time: start_time = pool_creation except (ValueError, TypeError): logging.warning(f"Could not parse creation date '{pool_created_at}', using default {HISTORY_DAYS} days.") all_ohlcv = [] current_start_time = start_time # Calculate how much time each API call can cover interval_hours = 1 # Based on "1h" interval time_delta_per_call = timedelta(hours=OHLCV_API_LIMIT * interval_hours) while current_start_time < final_end_time: batch_end_time = min(current_start_time + time_delta_per_call, final_end_time) url = f"{API_BASE_URL}/networks/{NETWORK}/pools/{pool_address}/ohlcv" params = { "start": current_start_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "end": batch_end_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "interval": INTERVAL, "limit": OHLCV_API_LIMIT } try: batch_data = await fetch_with_retry(session, url, params=params) if batch_data: for record in batch_data: record['network'] = NETWORK record['pool_address'] = pool_address avg_price = (record.get('open', 0) + record.get('close', 0)) / 2 record['volume_usd'] = record.get('volume', 0) * avg_price if avg_price > 0 else 0 all_ohlcv.extend(batch_data) except Exception as e: logging.warning(f"Could not fetch OHLCV batch for {pool_address}: {e}") current_start_time = batch_end_time await asyncio.sleep(0.75) # Small delay to be respectful logging.info(f"Successfully fetched {len(all_ohlcv)} OHLCV records for {pool_address}") return all_ohlcv async def main(): """Main ETL function to build the local DuckDB database.""" os.makedirs("dbs", exist_ok=True) async with aiohttp.ClientSession(headers={"Authorization": API_KEY}) as session: pools = await get_top_dex_pools(session, NETWORK, DEX_ID) all_ohlcv_data = [] semaphore = asyncio.Semaphore(CONCURRENT_REQUESTS) for i in range(0, len(pools), BATCH_SIZE): batch = pools[i:i+BATCH_SIZE] tasks = [get_pool_ohlcv(session, p.get('id'), p.get('created_at'), semaphore) for p in batch if p.get('id')] batch_num = (i // BATCH_SIZE) + 1 total_batches = (len(pools) + BATCH_SIZE - 1) // BATCH_SIZE logging.info(f"--- Processing batch {batch_num}/{total_batches} ---") results = await asyncio.gather(*tasks) for res in results: all_ohlcv_data.extend(res) if i + BATCH_SIZE < len(pools): logging.info(f"--- Finished batch {batch_num}, sleeping for 10 seconds ---") await asyncio.sleep(10) logging.info("ETL process finished. Loading data into DuckDB.") con = duckdb.connect(database=DB_FILE, read_only=False) if pools: for pool in pools: tokens = pool.get('tokens', []) pool['token0_symbol'] = tokens[0]['symbol'] if len(tokens) > 0 else None pool['token1_symbol'] = tokens[1]['symbol'] if len(tokens) > 1 else None pools_df = pd.DataFrame(pools) pools_df = pools_df[['id', 'dex_name', 'volume_usd_24h', 'created_at', 'token0_symbol', 'token1_symbol']] pools_df = pools_df.rename(columns={'id': 'address', 'volume_usd_24h': 'volume_24h_usd'}) con.execute("CREATE OR REPLACE TABLE pools AS SELECT * FROM pools_df") logging.info(f"Loaded {len(pools_df)} records into 'pools' table.") if all_ohlcv_data: ohlcv_df = pd.DataFrame(all_ohlcv_data) ohlcv_df['timestamp'] = pd.to_datetime(ohlcv_df['time_close']) ohlcv_df = ohlcv_df[['timestamp', 'network', 'pool_address', 'open', 'high', 'low', 'close', 'volume_usd']] con.execute("CREATE OR REPLACE TABLE pool_ohlcv AS SELECT * FROM ohlcv_df") logging.info(f"Loaded {len(ohlcv_df)} records into 'pool_ohlcv' table.") logging.info("Database build complete. Summary:") print(con.execute("SHOW TABLES").fetchdf()) print("\nPools Sample:") print(con.execute("SELECT * FROM pools LIMIT 5").fetchdf()) print("\nOHLCV Sample:") print(con.execute("SELECT * FROM pool_ohlcv ORDER BY timestamp DESC LIMIT 5").fetchdf()) con.close() if __name__ == "__main__": # Ensure you have the required libraries: # pip install requests pandas duckdb aiohttp asyncio.run(main()) ``` > [!NOTE] > > A simple, sequential script is great for learning, but real-world data fetching requires a more robust approach. Here is what we've used to make sure it runs reliably: > > * **Asynchronous Operations:** By using `asyncio` and `aiohttp`, the script can make many API requests concurrently instead of one by one. This means shorter time for completion. > * **Dynamic Windowing:** The `get_pool_ohlcv` function calculates how much data to request per API call so that it gets all the data for each pool. > * **Concurrency Control & Throttling:** An `asyncio.Semaphore`, combined with carefully tuned `BATCH_SIZE` and `asyncio.sleep()` calls, makes sure we don't hit the rate limit. > * **Resiliency:** The `fetch_with_retry` function automatically retries failed requests with an exponential backoff delay, making the pipeline resilient to temporary network issues. ### **Required libraries** Before running the script, make sure you have the necessary Python libraries installed. ```bash theme={null} pip install requests pandas duckdb aiohttp ``` *** ## Step 2: Run the pipeline and query with SQL Now, execute the script from your terminal. It will fetch all Uniswap v3 pool data from Ethereum and their recent trading history, then create a `uniswap_v3.db` file in a new `dbs` directory. This may take several minutes, but it will be significantly faster than a purely sequential script. ```bash theme={null} python build_uniswap_db.py ``` ### **Querying your new database** Once the script completes, you have a powerful local database at your fingertips. You can now use any SQL client that supports DuckDB, or Python itself, to perform instant, complex analysis. In step 3, we will connect the database to an AI assistant for natural language queries. If you want to query the database with a Python script, create a new file named `query_duckdb.py` and paste the following code into it. ```python query_duckdb.py [expandable] theme={null} import duckdb import pandas as pd import time # Connect to the DuckDB database file con = duckdb.connect(database='dbs/uniswap_v3.db', read_only=True) print("=== DuckDB Uniswap v3 Analytics ===\n") # --- Query 1: Database Summary --- print("--- 1. Database Summary ---") pool_count = con.execute("SELECT COUNT(*) FROM pools").fetchone()[0] ohlcv_count = con.execute("SELECT COUNT(*) FROM pool_ohlcv").fetchone()[0] print(f"Total Pools Loaded: {pool_count}") print(f"Total OHLCV Records: {ohlcv_count:,}\n") # --- Query 2: Top 10 Pools by 24h Volume --- print("--- 2. Top 10 Pools by 24h Volume ---") start_time = time.time() top_pools_df = con.execute(""" SELECT address, token0_symbol, token1_symbol, volume_24h_usd FROM pools ORDER BY volume_24h_usd DESC LIMIT 10 """).fetchdf() print(top_pools_df) print(f"Query executed in {time.time() - start_time:.4f} seconds\n") # --- Query 3: Peak Trading Hours --- print("--- 3. Peak Trading Hours (UTC) ---") start_time = time.time() hourly_volume_df = con.execute(""" SELECT EXTRACT(hour FROM timestamp) AS hour_of_day, SUM(volume_usd) AS total_volume_usd FROM pool_ohlcv WHERE volume_usd > 0 AND volume_usd < 1000000000 -- Defensive filter against outliers GROUP BY hour_of_day ORDER BY total_volume_usd DESC """).fetchdf() # Format the volume for better readability hourly_volume_df['total_volume_usd'] = hourly_volume_df['total_volume_usd'].map('${:,.2f}'.format) print(hourly_volume_df) print(f"Query executed in {time.time() - start_time:.4f} seconds\n") con.close() ``` Now, execute the script from your terminal: ```bash theme={null} python query_duckdb.py ``` *** ## Step 3: AI-powered analysis with an MCP server While you can use any SQL client to query your database, the real power comes from connecting it to an AI assistant. By using a Model Context Protocol (MCP) server, you can enable your assistant to directly query the `uniswap_v3.db` file you created. This allows you to ask for insights in plain English instead of writing SQL. For this, we will use `mcp-server-duckdb`, an open-source MCP server for DuckDB. ### **Install the DuckDB MCP server** You can install the server easily using `npx`: ```bash theme={null} npx -y @smithery/cli install mcp-server-duckdb --client claude ``` ### **Configure your AI assistant** Next, you need to tell your AI assistant how to run the server. Add the following to your `claude_desktop_config.json` file. > [!NOTE] > > If you see a "Server disconnected" error after restarting your AI assistant, it means the application cannot find the `uvx` or `npx` command. This happens because the application doesn't share the same `PATH` environment variable as your terminal. > > **To fix this, you must use the full, absolute path to the command.** > > 1. Find the absolute path by running `which uvx` or `which npx` in your terminal. > 2. Copy the output (e.g., `/Users/yourname/.local/bin/uvx` or `/opt/homebrew/bin/npx`). > 3. Use that full path as the `command` value in the JSON configuration below. The example below uses `uvx`, which is recommended. Make sure to replace `` with the actual absolute path to your project directory. ```json theme={null} { "mcpServers": { "duckdb-crypto": { "command": "/Users//.local/bin/uvx", "args": [ "mcp-server-duckdb", "--db-path", "/dbs/uniswap_v3.db", "--readonly" ] } } } ``` Now, when you start your AI assistant, it will have the tools to query your local Uniswap V3 database. You can ask it things like: * *"Using the duckdb-crypto tool, find the 5 pools with the highest 24-hour volume."* * *"What was the hourly volatility for the top pool yesterday?"* *** ## What you've built: From API calls to analytics powerhouse By completing this tutorial, you have successfully transitioned from being a passive data consumer to an active data analyst. You've replaced the slow, restrictive pattern of making individual API calls with a fast, powerful, and scalable local analytics workflow. **Key achievements:** * **Built a professional ETL pipeline:** You have a reusable, high-performance Python script that can create a comprehensive local database from any supported DEX and network. * **Unlocked high-speed SQL:** You can now perform complex analytical queries on a rich dataset in milliseconds, directly on your machine. * **Mastered a foundational workflow:** This "local-first" data strategy is a cornerstone of professional data analysis. It enables deeper exploration, from high-level market trends down to individual wallet behaviors. * **Created a Reusable Asset:** Your `uniswap_v3.db` file is a valuable, reusable asset for any future analysis, dashboarding, or AI integration project. When your project grows and you need to explore other data solutions, check out our full list of [API Tutorials](/tutorials/tutorial_intro) for more advanced guides. # Get liquidity pool data by address Source: https://docs.dexpaprika.com/tutorials/pool-details Read a DEX pool's price, liquidity, token reserves and buy and sell activity over six time windows from one DexPaprika call. Works without an API key. `GET /networks/{network}/pools/{pool_address}` returns everything DexPaprika knows about one pool: its two tokens, the reserves of each, total liquidity in USD, the latest price, and volume, swap counts and price change over the last 5 minutes, 15 minutes, 30 minutes, 1 hour, 6 hours and 24 hours. No key is needed: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" \ | jq '{dex_name, liquidity_usd, last_price, last_price_usd, "24h"}' ``` ```json theme={null} { "dex_name": "Uniswap V3", "liquidity_usd": 85921339.1832129, "last_price": 2530.0142189936414, "last_price_usd": 2530.833520213569, "24h": { "last_price_usd_change": 0.9594095356386423, "volume_usd": 35066642.89142325, "buy_usd": 17271020.509621277, "sell_usd": 17795622.38180197, "sells": 3021, "buys": 2865, "txns": 5886 } } ``` That is the USDC/WETH pool on Uniswap V3. If you only have a token, find its pools first with [token pools](/tutorials/token-pools), or look one up by name with [search](/tutorials/search). *** ## Which plan you need The endpoint works on every plan. A key changes the limits and the host. | Caller | Host | Header | | - | - | - | | No key | `api.dexpaprika.com` | none | | Free key | `api.dexpaprika.com` | `Authorization: ` | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | `Authorization: ` | The key goes in `Authorization` on its own. How fresh the data is also depends on the plan; see [pricing](https://dexpaprika.com/api/pricing) for the data delay of each one, and get a key in [console.dexpaprika.com](https://console.dexpaprika.com). ```bash No key theme={null} curl -s "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" \ | jq '.liquidity_usd' ``` ```bash Dev or Pro key theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" \ | jq '.liquidity_usd' ``` *** ## What the response carries | Field | Meaning | | - | - | | `dex_id`, `dex_name` | The DEX the pool lives on | | `tokens` | Both tokens, with `symbol`, `name`, `decimals` and more | | `base_token_id`, `quote_token_id` | Which token is priced in which | | `last_price` | Price of the base token in units of the quote token | | `last_price_usd` | Price of the base token in USD | | `token_reserves` | Each token's `reserve` in raw units and `reserve_usd` | | `liquidity_usd` | Total value locked in the pool, in USD | | `24h`, `6h`, `1h`, `30m`, `15m`, `5m` | Activity over that window: `volume_usd`, `buys`, `sells`, `txns`, `buy_usd`, `sell_usd` and `last_price_usd_change` | | `price_stats` | All-time high, `ath`, and its date | | `created_at`, `created_at_block_number` | When the pool was created | `last_price_usd_change` is a percentage: `0.96` means the price rose 0.96% over the window. `buys` and `sells` split the swaps by direction, and `buy_usd` plus `sell_usd` add up to `volume_usd`. ### Flip the price with `inversed` In the pool above the base token is WETH and the quote token is USDC, so `last_price` is about 2,530 USDC per WETH. Add `inversed=true` to price the other token instead: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640?inversed=true" \ | jq '{base_token_id, last_price, last_price_usd}' ``` ```json theme={null} { "base_token_id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "last_price": 0.000395433967369776, "last_price_usd": 1.000222277732714 } ``` Now USDC is the base token: 0.000395 WETH per USDC, about \$1. *** ## A pool summary in Python This script prints the pool's pair, price, reserves in whole tokens and its activity window by window, in one request: ```python theme={null} import os import requests # No key: leave both variables unset. Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} network = "ethereum" pool_address = "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" # USDC/WETH, Uniswap V3 r = requests.get(f"{API}/networks/{network}/pools/{pool_address}", headers=HEADERS, timeout=30) r.raise_for_status() pool = r.json() tokens = {t["id"]: t for t in pool["tokens"]} base = tokens[pool["base_token_id"]]["symbol"] quote = tokens[pool["quote_token_id"]]["symbol"] print(f"{base}/{quote} on {pool['dex_name']}, liquidity ${pool['liquidity_usd']:,.0f}") print(f"1 {base} = {pool['last_price']:,.2f} {quote} (${pool['last_price_usd']:,.2f})") for res in pool["token_reserves"]: t = tokens[res["token_id"]] amount = res["reserve"] / 10 ** t["decimals"] print(f" {t['symbol']:<6}{amount:>18,.2f} ${res['reserve_usd']:,.0f}") print(f"\n{'window':<8}{'volume (USD)':>16}{'swaps':>8}{'buys':>7}{'sells':>7}{'price':>9}") for window in ("5m", "15m", "30m", "1h", "6h", "24h"): w = pool[window] print(f"{window:<8}{w['volume_usd']:>16,.0f}{w['txns']:>8,}{w['buys']:>7,}{w['sells']:>7,}" f"{w['last_price_usd_change'] or 0:>+8.2f}%") ``` ```text theme={null} WETH/USDC on Uniswap V3, liquidity $85,908,668 1 WETH = 2,525.82 USDC ($2,526.58) USDC 63,148,115.42 $63,167,053 WETH 9,003.60 $22,748,314 window volume (USD) swaps buys sells price 5m 49,907 9 5 4 -0.01% 15m 197,137 46 26 20 -0.09% 30m 750,558 121 74 47 -0.33% 1h 2,228,820 326 173 153 -0.66% 6h 10,941,338 1,689 922 767 -1.50% 24h 35,207,639 5,917 2,887 3,030 +0.79% ``` Output from 12 October 2026. *** ## Things to know **`reserve` is in raw units.** Divide by `10 ** decimals` of that token, as the script does. USDC has 6 decimals and WETH 18, so the raw numbers are not comparable until you do. **Check which token is the base before you read `last_price`.** The base token is not always the one you think of as "the" token of the pool. Compare `base_token_id` with the address you care about, or set `inversed=true`. **Some fields can be `null`.** `fee` and the 24h `high_24h` and `low_24h` in `price_stats` were `null` for this pool. Treat any field you do not see above as optional in your code. **One request, one credit.** Polling a pool every few seconds adds up quickly; see [credit usage](/knowledge-base/credit-usage). For a live view, the [reserves stream](/streaming/reserves-streaming) pushes changes instead. *** ## Where to go next * [Pool OHLCV](/tutorials/retrieve-historical-data): price history for the same pool * [Pool transactions](/tutorials/pool-transactions): the individual swaps behind the counts, on Dev and up * [Pool reference](/api-reference/pools/get-a-pool-on-a-network) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # Filter and screen liquidity pools Source: https://docs.dexpaprika.com/tutorials/pool-filtering Use the DexPaprika pool search endpoint to find pools by volume, liquidity, transaction count, and creation date. Build pool screeners, find high-activity pools, and discover recently launched tokens. ## What you'll build A pool screener that finds liquidity pools matching specific criteria: volume thresholds, liquidity, transaction counts, and creation dates. This is useful for: * Finding high-activity pools on any network * Discovering newly created pools (early token launches) * Building automated pool monitoring pipelines * Filtering noise from low-activity pools > [!WARNING] > > This tutorial uses `GET /networks/{network}/pools/search`. It replaces the old `/networks/{network}/pools/filter`, `/networks/{network}/pools`, and `/pools` endpoints, which were removed and now return `410 Gone`. If you used the old endpoints, see the parameter changes below. *** ## The search endpoint ``` GET /networks/{network}/pools/search ``` Combine multiple filters with AND logic. Results are returned in a `results` array with cursor-based pagination. To search across several networks at once, use the global `GET /pools/search` with a `chains` parameter. ### Available parameters | Parameter | Type | Description | | - | - | - | | `volume_usd_24h_min` / `_max` | number | 24h volume in USD | | `volume_usd_7d_min` / `_max` | number | 7d volume in USD | | `volume_usd_30d_min` / `_max` | number | 30d volume in USD | | `liquidity_usd_min` / `_max` | number | Pool liquidity in USD | | `txns_24h_min` / `_max` | integer | Transactions in last 24h | | `price_usd_min` / `_max` | number | Pool price in USD | | `price_change_percentage_24h_min` / `_max` | number | 24h price change, percent | | `price_change_percentage_48h_min` / `_max` | number | 48h price change, percent | | `price_change_percentage_6h_min` / `_max` | number | 6h price change, percent | | `price_change_percentage_1h_min` / `_max` | number | 1h price change, percent | | `price_change_percentage_5m_min` / `_max` | number | 5m price change, percent | | `created_after` / `created_before` | string | Creation-time window: unix seconds or relative (`-24h`, `-7d`), RFC3339 or `YYYY-MM-DD`. Keyless and free keys do not see the last hour ([search freshness](/knowledge-base/rate-limits#search-freshness)) | | `dex_name` | string | Restrict to a single DEX | | `token_address` | string | Restrict to pools that contain this token (per-network search only) | | `order_by` | string | `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_48h`, `price_change_percentage_24h`, `price_change_percentage_6h`, `price_change_percentage_1h`, `price_change_percentage_5m` | | `sort` | string | `asc` or `desc` | | `limit` | integer | Items per page (default 50, maximum 100) | | `cursor` | string | Pass `next_cursor` from the previous response to page forward. Needs an API key (a free key pages without limit) | > [!NOTE] > > Parameter names migrated from the old filter endpoint: `volume_24h_min` is now `volume_usd_24h_min`, `sort_by` is now `order_by`, `sort_dir` is now `sort`, and `page` is replaced by `cursor`. The `volume_7d`, `volume_30d`, and `liquidity_usd` filters are now functional. > [!WARNING] > > The `token_address` filter works on the per-network `GET /networks/{network}/pools/search` only. The cross-network `GET /pools/search` does not take it: until 23 November 2026 a token filter without a network returns unfiltered results, and from that date it answers `400` (`unknown_param`). ### Price change windows Pool search covers five windows: 48h, 24h, 6h, 1h and 5m. Each one is both a filter pair and a sort field, so you can screen over the horizon you actually trade on instead of reading a 24h number and guessing what happened in the last few minutes. A percentage filter is a plain numeric bound, so the minus sign carries the direction. `price_change_percentage_1h_max=-20` means "down by at least 20 percent in the last hour", and `price_change_percentage_1h_min=50` means "up by at least 50 percent". There is no separate direction parameter. ```bash theme={null} # Ethereum pools that dropped 20 percent or more in the last hour curl "https://api.dexpaprika.com/networks/ethereum/pools/search?price_change_percentage_1h_max=-20&order_by=price_change_percentage_1h&sort=asc&limit=5" ``` > [!WARNING] > > Verify a percentage filter against an unfiltered baseline the first time you use one. Until 23 November 2026 an unknown parameter **name** is dropped, so a typo like `price_change_1h_max` still returns `200` with a full, unfiltered page of results; from that date it answers `400` with `unknown_param`. Compare the `price_change_percentage_1h` values you get back against a plain `?limit=5` call: unfiltered rows sit near zero, filtered rows respect the bound. > [!WARNING] > > Every window but 24h is pool-only. `GET /networks/{network}/tokens/search` rejects `order_by=price_change_percentage_48h`, `price_change_percentage_6h`, `price_change_percentage_1h` and `price_change_percentage_5m` with a `400`, and token rows carry none of those four fields, with or without `detailed=true`. The 24h window works on both: token search sorts by `price_change_percentage_24h` and filters on `price_change_percentage_24h_min` / `_max`. > > The pool-only **filters** behave worse than the sort fields on the token side. `price_change_percentage_6h_min` is not rejected there, it is dropped, so token search answers `200` with the same unfiltered page you would get without it. *** ## Example 1: High-volume pools on Ethereum Find Ethereum pools with over \$500,000 in daily volume: ```bash bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?volume_usd_24h_min=500000&order_by=volume_usd_24h&sort=desc&limit=5" ``` ```python python theme={null} import requests response = requests.get("https://api.dexpaprika.com/networks/ethereum/pools/search", params={ "volume_usd_24h_min": 500000, "order_by": "volume_usd_24h", "sort": "desc", "limit": 5 }) data = response.json() for pool in data["results"]: print(f" {pool['dex_name']} | {pool['id'][:16]}... | Vol: ${pool['volume_usd_24h']:,.0f} | Txns: {pool['transactions_24h']}") if data["has_next_page"]: print(f"Next page cursor: {data['next_cursor']}") ``` ```javascript javascript theme={null} const response = await fetch( "https://api.dexpaprika.com/networks/ethereum/pools/search?" + new URLSearchParams({ volume_usd_24h_min: 500000, order_by: "volume_usd_24h", sort: "desc", limit: 5 }) ); const data = await response.json(); data.results.forEach(pool => { console.log(` ${pool.dex_name} | ${pool.id.slice(0, 16)}... | Vol: $${pool.volume_usd_24h.toLocaleString()} | Txns: ${pool.transactions_24h}`); }); ``` ### Response format ```json theme={null} { "results": [ { "chain": "ethereum", "id": "0xf6e72db5454dd049d0788e411b06cfaf16853042", "dex_id": "makerdao", "dex_name": "MakerDAO", "volume_usd_24h": 1657645861.93, "volume_usd_7d": 9412300120.5, "liquidity_usd": 41250000.0, "transactions_24h": 4383, "price_usd": 1.0, "created_at": "2024-07-11T13:48:47Z", "tokens": [] } ], "has_next_page": true, "next_cursor": "eyJvZmZzZXQiOjV9", "query": {} } ``` > [!NOTE] > > Response field names: pool address is `id`, transaction count is `transactions_24h`, DEX is `dex_id` (slug) plus `dex_name` (label). Results are in a `results` array, and you page with `next_cursor` rather than page numbers. *** ## Example 2: Recently created pools with activity Find pools created in the last 7 days that have at least 50 transactions: ```bash bash theme={null} # -7d means "7 days before now"; no timestamp arithmetic needed curl "https://api.dexpaprika.com/networks/base/pools/search?created_after=-7d&txns_24h_min=50&order_by=created_at&sort=desc&limit=10" ``` ```python python theme={null} import requests response = requests.get("https://api.dexpaprika.com/networks/base/pools/search", params={ "created_after": "-7d", "txns_24h_min": 50, "order_by": "created_at", "sort": "desc", "limit": 10 }) data = response.json() for pool in data["results"]: print(f" Created: {pool['created_at']} | DEX: {pool['dex_name']} | Txns: {pool['transactions_24h']} | Vol: ${pool['volume_usd_24h']:,.0f}") ``` *** ## Example 3: Paginating through all results Page with the cursor returned in each response. Paging needs an API key: without one you get the first page, and a request with `cursor` returns `403` with `"param": "cursor"`. A [free key](https://console.dexpaprika.com) pages without limit, sent in the `Authorization` header: ```python theme={null} import os import requests HEADERS = {"Authorization": os.environ["DEXPAPRIKA_API_KEY"]} # a free key is enough all_pools = [] cursor = None while True: params = { "volume_usd_24h_min": 10000, "txns_24h_min": 20, "order_by": "volume_usd_24h", "sort": "desc", "limit": 100 } if cursor: params["cursor"] = cursor data = requests.get( "https://api.dexpaprika.com/networks/solana/pools/search", params=params, headers=HEADERS ).json() all_pools.extend(data["results"]) print(f"Collected {len(all_pools)} pools so far") if not data["has_next_page"]: break cursor = data["next_cursor"] print(f"Total pools matching criteria: {len(all_pools)}") ``` *** ## Example 4: Combining with pool details Search returns summary data. To get full pool details (token pair info, reserves, fees), make a follow-up request: ```python theme={null} import requests # Step 1: Find interesting pools response = requests.get("https://api.dexpaprika.com/networks/ethereum/pools/search", params={ "volume_usd_24h_min": 100000, "txns_24h_min": 500, "limit": 5 }) pools = response.json()["results"] # Step 2: Get full details for each pool for pool in pools: details = requests.get( f"https://api.dexpaprika.com/networks/{pool['chain']}/pools/{pool['id']}" ).json() tokens = details.get("tokens", []) pair = "/".join(t["symbol"] for t in tokens) if tokens else "Unknown" print(f"{pair} on {pool['dex_name']} -- Vol: ${pool['volume_usd_24h']:,.0f}") ``` *** ## Tips * **Start broad, then narrow:** Begin with just `volume_usd_24h_min` to see what matches, then add more filters. * **Use `created_after` for new token discovery:** Combine with `txns_24h_min` to find new pools that actually have trading activity. On the free tiers the window ends an hour ago; Dev and above see pools as they are indexed. * **Different networks, different thresholds:** A \$10k volume pool on Ethereum is tiny; on a smaller chain it might be significant. Adjust thresholds per network. * **Search across networks:** Use `GET /pools/search?chains=ethereum,base,solana` to screen multiple networks in one call. * **Filter by token:** Pass `token_address` on the per-network search to list only pools containing that token. This replaces the removed `/networks/{network}/tokens/{token_address}/pools` endpoint. The [token pools tutorial](/tutorials/token-pools) walks through it, paging and migration included. *** ## Next steps > [card] [Find New Pools](/tutorials/find-new-pools) > > More techniques for discovering new pools using the search endpoint > [card] [Pool Details](/api-reference/pools/get-a-pool-on-a-network) > > Get full details for any pool including token pairs and reserves > [card] [Common Patterns](/knowledge-base/common-patterns) > > Standard API workflows including search, pricing, and historical data > [card] [Pool Details API](/api-reference/pools/get-a-pool-on-a-network) > > Full pool details endpoint documentation ### FAQs > [accordion] What happened to the old /pools/filter endpoint? > > It was removed and now returns `410 Gone`, along with `/networks/{network}/pools` and the global `/pools`. Use `/networks/{network}/pools/search` (single network) or `/pools/search` (multiple networks) instead. > [accordion] Can I filter pools across multiple networks at once? > > Yes. Use the global `GET /pools/search` with a `chains` parameter, for example `chains=ethereum,base`. The per-network `GET /networks/{network}/pools/search` covers a single network. > [accordion] How does pagination work? > > Set `limit` and read `has_next_page` and `next_cursor` from the response. Pass `next_cursor` back as `cursor` to fetch the next page. There are no page numbers. Paging needs an API key: without one you get the first page, and a free key from the [console](https://console.dexpaprika.com) pages without limit. > [accordion] How do I find pools for a specific token? > > Pass `token_address` on the per-network search: `GET /networks/{network}/pools/search?token_address={address}`. This replaces the removed `/networks/{network}/tokens/{token_address}/pools` endpoint, which now returns `410 Gone`. The filter is per-network only; the cross-network `/pools/search` silently ignores it. One token per query: repeating the parameter does not act as a pair filter (the API uses only one of the values, not guaranteed by order), and the old second-token pair filter has no equivalent. > > The [token pools tutorial](/tutorials/token-pools) covers this end to end: the call, the response fields, paging, and the migration from the removed endpoint. # Get swap transactions for a DEX pool Source: https://docs.dexpaprika.com/tutorials/pool-transactions Read every swap in a DEX pool with amounts, prices in USD and wallet addresses, filter by time and page through history with a cursor. Needs a Dev, Pro or Enterprise key. `GET /networks/{network}/pools/{pool_address}/transactions` returns the swaps in one pool, newest first: who swapped, how much of each token moved, and both tokens' prices in USD at that moment. It needs a Dev, Pro or Enterprise key on `api-pro.dexpaprika.com`, sent as the whole `Authorization` header: ```bash theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?limit=1" ``` ```json theme={null} { "transactions": [ { "id": "0x2b2ba6fcebb2f35e5d013e4df800ba678fb32fb34864bc4ea5f3c3ddf958c758", "log_index": 563, "transaction_index": 242, "factory_id": "0x1f98431c8ad98523631ae4a59f267346ea31f984", "pool_id": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "chain": "ethereum", "sender": "0x60943cb06b76a24431659165c81a03c16f1c325c", "recipient": "0x60943cb06b76a24431659165c81a03c16f1c325c", "token_0": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token_0_symbol": "WETH", "token_1": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "token_1_symbol": "USDC", "amount_0": 179631240716562, "amount_1": -452733, "volume_0": 0.000179631240716562, "volume_1": 0.452733, "price_0": 2519.0829818795273, "price_1": 0.000396969852598458, "price_0_usd": 2520.270127087148, "price_1_usd": 1.0034780214669785, "created_at_block_number": 26177041, "created_at_block_hash": "0x4ab0e3a9de6b0035ba9d3cae5af2594274d2c8acac95c59b888002a1e30f9c98", "created_at": "2026-10-12T14:38:47Z", "canonical_chain": true } ], "page_info": { "limit": 1, "page": 1, "total_items": 49913, "total_pages": 49913 } } ``` That swap put 0.00018 WETH into the USDC/WETH pool on Uniswap V3 and took 0.45 USDC out. *** ## Which plan you need | Caller | What you get | | - | - | | No key or free key | `403` with `plan_required` | | Dev, Pro, Enterprise | Every swap, on `api-pro.dexpaprika.com` | Without a paid key the same call answers: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/transactions?limit=1" ``` ```json theme={null} { "error": "plan_required", "tier": "keyless", "message": "this endpoint requires a Dev or Pro plan", "required_tier": "dev", "links": { "coupon": "https://dexpaprika.com/api/pricing?coupon=START10", "docs": "https://docs.dexpaprika.com/", "pricing": "https://dexpaprika.com/api/pricing", "register": "https://console.dexpaprika.com" } } ``` Compare plans on [pricing](https://dexpaprika.com/api/pricing) and manage your key in [console.dexpaprika.com](https://console.dexpaprika.com). **On the free tier**, [pool details](/tutorials/pool-details) gives you the totals these swaps add up to: buys, sells, swap count and USD volume over 5m, 15m, 30m, 1h, 6h and 24h, with no key. *** ## Reading a swap | Field | Meaning | | - | - | | `id`, `log_index` | Transaction hash and the position of the swap event in its block. One transaction can hold several swaps, so the pair identifies a swap | | `sender`, `recipient` | Wallets or contracts on each side of the swap | | `token_0`, `token_1` and their `_symbol` | The pool's two tokens | | `amount_0`, `amount_1` | Signed raw amounts, from the pool's side: positive went into the pool, negative came out | | `volume_0`, `volume_1` | The same amounts without the sign, in whole tokens | | `price_0`, `price_1` | Each token's price in units of the other | | `price_0_usd`, `price_1_usd` | Each token's USD price at the time of the swap | | `created_at`, `created_at_block_number` | When the swap happened | **Which way did it go?** The token with a negative amount left the pool, so that is what the trader bought. In the example `amount_1` is negative: the trader sold WETH for USDC. The `buys` and `sells` that [pool details](/tutorials/pool-details) reports count swaps the same way, from the pool's base token: a buy takes the base token out of the pool. **What was it worth?** `volume_0 * price_0_usd`, or the same for token 1. *** ## Parameters | Parameter | What it does | | - | - | | `limit` | Swaps per response, 1 to 100, default 10 | | `page` | Page number from 1 to 100 | | `cursor` | Continue from a swap: pass `next_cursor` from the previous response | | `from`, `to` | Only swaps at or after `from` and at or before `to`: `-1h`, Unix seconds, RFC3339 or a date | `page` stops at 100: `page=101` answers `400`. To read further back, switch to `cursor`. A response to a `cursor` request carries `next_cursor` instead of `page_info`, and following it keeps going past where `page` stops. *** ## The last hour of swaps in Python This script reads every swap in the last hour, classifies each as a buy or a sell of the pool's base token, and lists the largest. One request for the pool, then one per 100 swaps: ```python theme={null} import os import requests # A Dev, Pro or Enterprise key. Free keys and keyless calls get 403. API = os.environ.get("DEXPAPRIKA_API", "https://api-pro.dexpaprika.com") HEADERS = {"Authorization": os.environ["DEXPAPRIKA_API_KEY"]} network = "ethereum" pool_address = "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" # USDC/WETH, Uniswap V3 def get(path, **params): r = requests.get(f"{API}{path}", headers=HEADERS, params=params, timeout=30) r.raise_for_status() return r.json() pool = get(f"/networks/{network}/pools/{pool_address}") base = pool["base_token_id"] swaps, page = [], 1 while True: data = get(f"/networks/{network}/pools/{pool_address}/transactions", **{"from": "-1h", "limit": 100, "page": page}) swaps += data["transactions"] if page >= data["page_info"]["total_pages"]: break page += 1 def side(tx): base_amount = tx["amount_0"] if tx["token_0"] == base else tx["amount_1"] return "buy" if base_amount < 0 else "sell" def usd(tx): return tx["volume_0"] * tx["price_0_usd"] buys = [tx for tx in swaps if side(tx) == "buy"] print(f"{len(swaps)} swaps in the last hour: {len(buys)} buys, {len(swaps) - len(buys)} sells") print(f"buy volume ${sum(map(usd, buys)):,.0f}, total ${sum(map(usd, swaps)):,.0f}\n") for tx in sorted(swaps, key=usd, reverse=True)[:3]: print(f"{tx['created_at']} {side(tx):<4} ${usd(tx):>12,.0f} {tx['sender']}") ``` ```text theme={null} 327 swaps in the last hour: 190 buys, 137 sells buy volume $1,469,755, total $2,685,555 2026-10-12T14:38:35Z buy $ 89,251 0x854abc33363a71781186d80c32ee092ce6a757ab 2026-10-12T14:23:59Z buy $ 74,105 0xbdb3ba9ffe392549e1f8658dd2630c141fdf47b6 2026-10-12T14:38:23Z buy $ 66,535 0x51c72848c68a965f66fa7a88855f9f7784502a7f ``` Output from 12 October 2026, on a Pro key. The counts match the `1h` window of [pool details](/tutorials/pool-details) for the same pool, give or take the swaps that landed between the two calls: pool details read 189 buys and 134 sells a minute earlier. *** ## Things to know **Use `next_cursor`, not the last `id`.** A `cursor` includes the swap it names. Passing the `id` of the last swap you already have returns that swap again as the first row; `next_cursor` points at the next one. **Raw amounts overflow JavaScript numbers.** `amount_0` and `amount_1` are integers in the token's smallest unit, and an 18-decimal token easily passes 2^53. `JSON.parse` rounds them silently. Use `volume_0` and `volume_1`, or a JSON parser that keeps big integers. **`total_pages` can be larger than you can reach.** It counts every matching swap, while `page` stops at 100. Bound the range with `from` and `to`, or walk it with `cursor`. **Each response costs one credit**, whatever the `limit`, so ask for 100 at a time. See [credit usage](/knowledge-base/credit-usage). **For a live feed, stream instead of polling.** The [transactions stream](/streaming/transactions-streaming) pushes each swap as it happens, on the same plans. *** ## Where to go next * [Pool details](/tutorials/pool-details): the windowed totals, on every plan * [Transactions stream](/streaming/transactions-streaming): the same swaps, live * [Pool transactions reference](/api-reference/pools/get-transactions-of-a-pool-on-a-network-paging-can-be-used-up-to-100-pages) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # Scalable time-series analytics with InfluxDB Source: https://docs.dexpaprika.com/tutorials/real-time-analytics-with-influxdb Harness InfluxDB, a best-in-class time-series database, to build a powerful crypto analytics pipeline that scales from real-time monitoring to large historical datasets. ## Tutorial overview Stream and analyze pool OHLCV in InfluxDB with hourly/minute intervals and live Grafana dashboards. ## From real-time monitoring to historical analysis While InfluxDB is a champion of real-time data, its power extends far beyond live dashboards. It provides a highly optimized engine for storing and querying massive time-series datasets, making it a perfect middle-ground between the local analytics of DuckDB and the enterprise scale of ClickHouse. > [!NOTE] > > Looking for other analytics solutions? Check out our full list of [API Tutorials](/tutorials/tutorial_intro) for more step-by-step guides. This tutorial will guide you through building a production-grade ETL pipeline to populate InfluxDB with a substantial historical dataset, enabling both high-performance queries and real-time visualization. ```mermaid theme={null} graph TD; subgraph "Step 1: Infrastructure"; A["Setup InfluxDB & Grafana
(Docker)"]; end subgraph "Step 2: Data Ingestion"; B["Run Python ETL script"]; C["DexPaprika API"]; D["InfluxDB Bucket
('crypto-data')"]; B --"Fetches 6 days of 1h data
for 500 pools"--> C; B --"Writes time-series data"--> D; end subgraph "Step 3 & 4: Analysis & Visualization"; E["Option A:
Programmatic queries
(Python)"]; F["Option B:
Live dashboards
(Grafana)"]; D --> E; D --> F; end A --> B; ``` **The goal:** By the end of this guide, you will have a scalable analytics pipeline that can: 1. Ingest 1-hour OHLCV data for the top 500 Uniswap v3 pools over a 14-day period. 2. Run complex time-series analysis using Python and the Flux language. 3. Visualize the data in a live-updating Grafana dashboard. > [card] [Step 1: Docker Setup](#step-1-setting-up-influxdb-and-grafana) > > Get InfluxDB and Grafana running in seconds with Docker. > [card] [Step 2: ETL Pipeline](#step-2-build-the-python-etl-pipeline) > > Create a robust data pipeline for ingesting large time-series datasets. > [card] [Step 3: Programmatic Analysis](#step-3-programmatic-analysis-with-python) > > Analyze your time-series data with InfluxDB's Python client. > [card] [Step 4: Live Dashboard](#step-4-visualizing-data-in-grafana) > > Build a real-time dashboard to monitor crypto pools. *** ## Step 1: Setting up InfluxDB and Grafana We'll use Docker Compose to spin up both services. First, create a new directory named `INFLUXDB` in your project root. Inside that directory, create a file named `docker-compose.yml` with the following content. ```yml INFLUXDB/docker-compose.yml theme={null} services: influxdb: image: influxdb:2.7 container_name: influxdb ports: - "8087:8086" volumes: - influxdb-data:/var/lib/influxdb2 environment: - DOCKER_INFLUXDB_INIT_MODE=setup - DOCKER_INFLUXDB_INIT_USERNAME=my-user - DOCKER_INFLUXDB_INIT_PASSWORD=my-password - DOCKER_INFLUXDB_INIT_ORG=my-org - DOCKER_INFLUXDB_INIT_BUCKET=crypto-data - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-token grafana: image: grafana/grafana:latest container_name: grafana ports: - "3000:3000" volumes: - grafana-data:/var/lib/grafana volumes: influxdb-data: grafana-data: ``` Run the following command from the root of the project to start the containers: ```bash theme={null} docker-compose -f INFLUXDB/docker-compose.yml up -d ``` Once running, you can access: * **InfluxDB UI:** `http://localhost:8087` * **Grafana UI:** `http://localhost:3000` (login with `admin`/`admin`) Use the token `my-super-secret-token` to connect to InfluxDB. > [!NOTE] > > We use port `8087` for InfluxDB to avoid potential conflicts with other services that might be using the default port `8086`. *** ## Step 2: Build the Python ETL pipeline Create a new file named `INFLUXDB/build_influxdb_db.py`. This script is built to be robust and efficient, capable of ingesting large volumes of time-series data from the DexPaprika API into your InfluxDB instance. It uses two endpoints: [pool search](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) with a `dex_name` filter to discover pools, and the [Pool OHLCV Data endpoint](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) to fetch historical price data. > [!NOTE] > > This script needs a [free API key](https://console.dexpaprika.com). Without one, OHLCV reaches back only 24 hours at `1h` and up, and the script asks for six days of hourly candles. Export the key before running it; it goes in the `Authorization` header on its own. On Pro, point `API_BASE_URL` at `https://api-pro.dexpaprika.com`. Limits per plan: [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). > > ```bash theme={null} > export DEXPAPRIKA_API_KEY="your-key" > ``` ```python INFLUXDB/build_influxdb_db.py [expandable] theme={null} import influxdb_client from influxdb_client.client.write_api import SYNCHRONOUS import requests from datetime import datetime, timedelta, timezone import time import logging import asyncio import aiohttp from typing import List, Dict import math import os # --- Configuration --- API_BASE_URL = "https://api.dexpaprika.com" API_KEY = os.environ["DEXPAPRIKA_API_KEY"] # free key from console.dexpaprika.com NETWORK = "ethereum" DEX_ID = "uniswap_v3" HISTORY_DAYS = 6 # a free key reaches 7 days back; stay inside it TOP_POOLS_LIMIT = 500 # Focus on top 500 pools by volume BATCH_SIZE = 15 # Process pools in smaller batches CONCURRENT_REQUESTS = 3 # Concurrent requests for API calls OHLCV_API_LIMIT = 100 # API limit for OHLCV requests INTERVAL = "1h" # 1-hour intervals # InfluxDB Configuration INFLUX_URL = "http://localhost:8087" INFLUX_TOKEN = "my-super-secret-token" INFLUX_ORG = "my-org" INFLUX_BUCKET = "crypto-data" # Setup logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') async def fetch_with_retry(session: aiohttp.ClientSession, url: str, params: Dict = None, retries=5, backoff_factor=1.0): """Generic async fetch function with exponential backoff.""" for attempt in range(retries): try: async with session.get(url, params=params, timeout=30) as response: response.raise_for_status() return await response.json() except (aiohttp.ClientError, asyncio.TimeoutError) as e: if attempt == retries - 1: logging.error(f"Final attempt failed for {url}: {e}") raise sleep_time = backoff_factor * (2 ** attempt) logging.warning(f"Request to {url} failed: {e}. Retrying in {sleep_time:.2f}s...") await asyncio.sleep(sleep_time) return {} class InfluxDBETL: def __init__(self): self.client = influxdb_client.InfluxDBClient(url=INFLUX_URL, token=INFLUX_TOKEN, org=INFLUX_ORG) self.write_api = self.client.write_api(write_options=SYNCHRONOUS) self.api_semaphore = asyncio.Semaphore(CONCURRENT_REQUESTS) self._ensure_bucket_exists() def _ensure_bucket_exists(self): """Checks if the bucket exists and creates it if not.""" logging.info(f"Ensuring bucket '{INFLUX_BUCKET}' exists...") buckets_api = self.client.buckets_api() bucket = buckets_api.find_bucket_by_name(INFLUX_BUCKET) if not bucket: logging.warning(f"Bucket '{INFLUX_BUCKET}' not found. Creating it...") buckets_api.create_bucket(bucket_name=INFLUX_BUCKET, org=INFLUX_ORG) logging.info(f"Bucket '{INFLUX_BUCKET}' created successfully.") else: logging.info(f"Bucket '{INFLUX_BUCKET}' already exists.") def clear_bucket_data(self): """Deletes all data from the 'ohlcv' measurement in the bucket.""" logging.info(f"Clearing existing data from measurement 'ohlcv' in bucket '{INFLUX_BUCKET}'...") try: delete_api = self.client.delete_api() start = "1970-01-01T00:00:00Z" stop = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ') delete_api.delete(start, stop, '_measurement="ohlcv"', bucket=INFLUX_BUCKET, org=INFLUX_ORG) logging.info("Existing data cleared successfully.") except Exception as e: logging.error(f"Could not clear data from bucket: {e}") async def fetch_top_pools(self) -> List[Dict]: """Fetch top pools by volume from the specified DEX, handling cursor pagination.""" logging.info(f"Fetching top {TOP_POOLS_LIMIT} pools for {DEX_ID} on {NETWORK}...") all_pools = [] cursor = None async with aiohttp.ClientSession(headers={"Authorization": API_KEY}) as session: while len(all_pools) < TOP_POOLS_LIMIT: # The DEX is a filter now: /networks/{network}/dexes/{dex}/pools was # removed and returns 410. detailed=true keeps name/symbol on tokens[]. url = f"{API_BASE_URL}/networks/{NETWORK}/pools/search" params = {"dex_name": DEX_ID, "limit": 100, "order_by": "volume_usd_24h", "sort": "desc", "detailed": "true"} if cursor: params["cursor"] = cursor try: data = await fetch_with_retry(session, url, params=params) pools = data.get('results', []) if not pools: break all_pools.extend(pools) logging.info(f"Fetched a page, got {len(pools)} pools. Total: {len(all_pools)}") if len(all_pools) >= TOP_POOLS_LIMIT: all_pools = all_pools[:TOP_POOLS_LIMIT] break if not data.get('has_next_page'): break cursor = data.get('next_cursor') await asyncio.sleep(0.5) # Be respectful to the API except Exception as e: logging.error(f"Error fetching a page of pools: {e}") break logging.info(f"Finished fetching pools. Total: {len(all_pools)}") return all_pools async def fetch_pool_ohlcv_paginated(self, session: aiohttp.ClientSession, pool_address: str) -> List[Dict]: """Fetch complete OHLCV data for a pool using intelligent, dynamic windowing.""" async with self.api_semaphore: final_end_time = datetime.now(timezone.utc) current_start_time = final_end_time - timedelta(days=HISTORY_DAYS) all_ohlcv = [] try: if 'h' in INTERVAL: interval_value = int(INTERVAL.replace('h', '')) time_delta_per_call = timedelta(hours=OHLCV_API_LIMIT * interval_value) elif 'm' in INTERVAL: interval_value = int(INTERVAL.replace('m', '')) time_delta_per_call = timedelta(minutes=OHLCV_API_LIMIT * interval_value) else: raise ValueError(f"Unsupported interval format: {INTERVAL}") except ValueError as e: logging.error(f"Invalid INTERVAL format: {e}. Defaulting to 1 hour.") time_delta_per_call = timedelta(hours=OHLCV_API_LIMIT * 1) total_expected_calls = math.ceil((final_end_time - current_start_time) / time_delta_per_call) if time_delta_per_call.total_seconds() > 0 else 0 call_count = 0 while current_start_time < final_end_time: call_count += 1 batch_end_time = min(current_start_time + time_delta_per_call, final_end_time) logging.info(f" [Pool {pool_address}] Fetching window {call_count}/{total_expected_calls}: {current_start_time.date()} to {batch_end_time.date()}") url = f"{API_BASE_URL}/networks/{NETWORK}/pools/{pool_address}/ohlcv" params = { "start": current_start_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "end": batch_end_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "interval": INTERVAL, "limit": OHLCV_API_LIMIT } try: batch_data = await fetch_with_retry(session, url, params=params) if batch_data: for record in batch_data: record['network'] = NETWORK record['pool_address'] = pool_address all_ohlcv.extend(batch_data) except Exception as e: logging.warning(f"Could not fetch OHLCV batch for {pool_address}: {e}") current_start_time = batch_end_time await asyncio.sleep(0.75) # Crucial delay to prevent rate-limiting logging.info(f"Pool {pool_address}: collected {len(all_ohlcv)} OHLCV records.") return all_ohlcv async def fetch_pool_ohlcv_batch(self, pool_addresses: List[str]) -> List[Dict]: """Fetch OHLCV data for multiple pools concurrently.""" logging.info(f"Fetching {INTERVAL} OHLCV for {len(pool_addresses)} pools...") all_ohlcv = [] async with aiohttp.ClientSession(headers={"Authorization": API_KEY}) as session: tasks = [self.fetch_pool_ohlcv_paginated(session, addr) for addr in pool_addresses] results = await asyncio.gather(*tasks, return_exceptions=True) for i, result in enumerate(results): if isinstance(result, list): all_ohlcv.extend(result) elif isinstance(result, Exception): logging.warning(f"OHLCV fetch failed for pool {pool_addresses[i]}: {result}") return all_ohlcv def load_ohlcv_data(self, ohlcv_data: List[Dict], pools_map: Dict): """Load OHLCV data into InfluxDB.""" if not ohlcv_data: logging.warning("No OHLCV data to load.") return points = [] for record in ohlcv_data: pool_id = record.get('pool_address') pair = pools_map.get(pool_id, "Unknown/Unknown") point = ( influxdb_client.Point("ohlcv") .tag("pool_id", pool_id) .tag("pair", pair) .field("open", float(record['open'])) .field("high", float(record['high'])) .field("low", float(record['low'])) .field("close", float(record['close'])) .field("volume", float(record.get('volume', 0))) .time(record['time_close']) ) points.append(point) if points: self.write_api.write(bucket=INFLUX_BUCKET, org=INFLUX_ORG, record=points) logging.info(f"Wrote {len(points)} data points to InfluxDB.") async def run_etl(self): """Run the complete ETL process.""" self.clear_bucket_data() logging.info(f"Starting InfluxDB ETL process for top {TOP_POOLS_LIMIT} pools...") pools = await self.fetch_top_pools() if pools: pools_map = { pool['id']: f"{pool['tokens'][0]['symbol']}/{pool['tokens'][1]['symbol']}" for pool in pools if len(pool.get('tokens', [])) >= 2 } pool_addresses = [pool['id'] for pool in pools if pool.get('id')] for i in range(0, len(pool_addresses), BATCH_SIZE): batch_addresses = pool_addresses[i:i + BATCH_SIZE] batch_num = (i // BATCH_SIZE) + 1 total_batches = (len(pool_addresses) + BATCH_SIZE - 1) // BATCH_SIZE logging.info(f"Processing OHLCV batch {batch_num}/{total_batches} ({len(batch_addresses)} pools)") ohlcv_data = await self.fetch_pool_ohlcv_batch(batch_addresses) self.load_ohlcv_data(ohlcv_data, pools_map) if i + BATCH_SIZE < len(pool_addresses): logging.info(f"--- Finished batch {batch_num}, sleeping for 10 seconds ---") await asyncio.sleep(10) logging.info("ETL process completed!") async def main(): etl = InfluxDBETL() await etl.run_etl() if __name__ == "__main__": # pip install influxdb-client aiohttp requests pandas asyncio.run(main()) ``` > [!NOTE] > > This script is built for performance and reliability, using several best practices common in data pipelines: > > * **Asynchronous operations:** By using `asyncio` and `aiohttp`, the script can make many API requests concurrently instead of one by one. > * **Dynamic windowing:** The `fetch_pool_ohlcv_paginated` function calculates how much data to request per API call to ensure complete history is fetched efficiently. > * **Concurrency control & throttling:** An `asyncio.Semaphore`, combined with carefully tuned `BATCH_SIZE` and `asyncio.sleep()` calls, keeps the script under the free tier's 15 requests a minute keyless, or 30 with a [free key](https://console.dexpaprika.com). [Pro raises that to 500 a minute](https://dexpaprika.com/api/pricing), which lets you shorten the sleeps and finish the backfill sooner. > * **Resiliency:** The `fetch_with_retry` function automatically retries failed requests with an exponential backoff delay. > * **Data Integrity:** The script automatically clears old data from the bucket before each run to ensure a clean, consistent dataset. ### Set up the Python environment Before running the ETL script, it's a critical best practice to create an isolated Python environment to manage dependencies. 1. **Create a virtual environment:** Open your terminal in the project root and run: ```bash theme={null} python3 -m venv venv ``` 2. **Activate the environment:** * On macOS and Linux: ```bash theme={null} source venv/bin/activate ``` * On Windows: ```bash theme={null} .\venv\Scripts\activate ``` Your terminal prompt should now be prefixed with `(venv)`, indicating that the virtual environment is active. 3. **Install required libraries:** Now, install the necessary Python packages inside the activated environment: ```bash theme={null} pip install influxdb-client aiohttp requests pandas ``` Run the script to start streaming data into your InfluxDB instance. This may take several minutes. ```bash theme={null} python INFLUXDB/build_influxdb_db.py ``` *** ## Step 3: Programmatic analysis with Python While the InfluxDB UI is great for exploration, the real power comes from programmatic access. The `influxdb-client` library for Python allows you to run complex Flux queries and integrate the data into other tools or scripts. We've created a `query_influxdb.py` script to demonstrate how to connect to your database and perform analysis on the hourly data. ```python INFLUXDB/query_influxdb.py [expandable] theme={null} import influxdb_client import pandas as pd # --- InfluxDB Configuration --- INFLUX_URL = "http://localhost:8087" INFLUX_TOKEN = "my-super-secret-token" INFLUX_ORG = "my-org" INFLUX_BUCKET = "crypto-data" def run_flux_query(client: influxdb_client.InfluxDBClient, query: str): """Helper function to execute a Flux query and return a pandas DataFrame.""" try: query_api = client.query_api() result = query_api.query_data_frame(query, org=INFLUX_ORG) if isinstance(result, list): # Handle multiple dataframes in result return pd.concat(result, ignore_index=True) if result else pd.DataFrame() return result except Exception as e: print(f"Error running query: {e}") return pd.DataFrame() def main(): """Connects to InfluxDB and runs sample analytics queries.""" client = influxdb_client.InfluxDBClient(url=INFLUX_URL, token=INFLUX_TOKEN, org=INFLUX_ORG) print("=== InfluxDB Python Analytics Demo ===\n") # --- Query 1: Find available trading pairs --- print("--- 1. Finding available trading pairs ---") list_pairs_query = f''' import "influxdata/influxdb/schema" schema.tagValues( bucket: "{INFLUX_BUCKET}", tag: "pair", start: -14d ) ''' pairs_df = run_flux_query(client, list_pairs_query) if not pairs_df.empty: available_pairs = pairs_df['_value'].tolist() print(f"Found {len(available_pairs)} pairs. Examples: {available_pairs[:5]}") # Use the first available pair for subsequent queries target_pair = available_pairs[0] else: print("No pairs found. Please run the ingestion script first.") print("Using 'WETH/USDC' as a placeholder for query examples.") target_pair = "WETH/USDC" # Fallback for demo print(f"\n--- Using pair '{target_pair}' for next queries ---\n") # --- Query 2: Get raw data for the target pool --- print(f"--- 2. Raw OHLCV data for {target_pair} ---") raw_data_query = f''' from(bucket: "{INFLUX_BUCKET}") |> range(start: -3d) // Limit to last 3 days for brevity |> filter(fn: (r) => r._measurement == "ohlcv") |> filter(fn: (r) => r.pair == "{target_pair}") |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") |> sort(columns: ["_time"], desc: true) |> limit(n: 10) ''' raw_df = run_flux_query(client, raw_data_query) print("Last 10 records:") if not raw_df.empty and all(c in raw_df.columns for c in ['_time', 'open', 'high', 'low', 'close', 'volume']): print(raw_df[['_time', 'open', 'high', 'low', 'close', 'volume']]) else: print("Could not retrieve raw data. Please check if the ingestion was successful.") print("\n") # --- Query 3: Calculate 12-hour moving average --- print(f"--- 3. 12-Hour moving average for {target_pair} close price ---") moving_avg_query = f''' from(bucket: "{INFLUX_BUCKET}") |> range(start: -14d) |> filter(fn: (r) => r._measurement == "ohlcv" and r._field == "close" and r.pair == "{target_pair}") |> timedMovingAverage(every: 1h, period: 12h) |> sort(columns: ["_time"], desc: true) |> limit(n: 10) ''' ma_df = run_flux_query(client, moving_avg_query) print("Last 10 moving average values:") if not ma_df.empty and all(c in ma_df.columns for c in ['_time', '_value']): print(ma_df[['_time', '_value']]) else: print("Could not retrieve moving average data.") if __name__ == "__main__": # Ensure you have the required libraries: # pip install influxdb-client pandas main() ``` Run the script to see how you can query your data with Python: ```bash theme={null} python INFLUXDB/query_influxdb.py ``` *** ## Step 4: Visualizing data in Grafana 1. Open Grafana at `http://localhost:3000`. 2. Go to **Connections** > **Add new connection** > **InfluxDB**. 3. Configure the connection: * **Name**: InfluxDB_Crypto * **Query Language**: Flux * **URL**: `http://influxdb:8086` (use the Docker service name) * Under **Auth**, toggle **Basic auth** off. * In the **Custom HTTP Headers** section, add a header: * **Header**: `Authorization` * **Value**: `Token my-super-secret-token` * Enter your InfluxDB **Organization** (`my-org`) and default **Bucket** (`crypto-data`). 4. Click **Save & Test**. You should see a "Bucket found" confirmation. 5. Now, let's create a dashboard. In the left-hand menu, click the **+** icon and select **Dashboard**. 6. Click on the **Add new panel** button. 7. In the new panel view, ensure your `InfluxDB_Crypto` data source is selected at the top. 8. Below the graph, you'll see a query editor. You can switch to the **Script editor** by clicking the pencil icon on the right. 9. Paste the following query into the editor. This query will plot the raw closing price for the `AAVE/USDC` trading pair. ```flux theme={null} from(bucket: "crypto-data") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._measurement == "ohlcv" and r._field == "close" and r.pair == "AAVE/USDC") |> sort(columns: ["_time"], desc: false) ``` > [!NOTE] > > **Troubleshooting Tip:** If you initially see "No data," there are two common reasons: > > 1. **Time Range:** Ensure the time picker at the top right is set to "Last 7 days" or wider, not a shorter period like "Last 6 hours." > 2. **Trading Pair:** The default `WETH/USDC` pair used in the original tutorial may not have been in the top 500 pools fetched by the script. The query above uses `AAVE/USDC`, which is more likely to be present. You can find other available pairs by running the `query_influxdb.py` script. 10. At the top right of the dashboard page, set the time range to **Last 7 days** to ensure you see all the historical data you ingested. 11. You should now see the data appear in the panel. You can give the panel a title (e.g., "AAVE/USDC Close Price") in the settings on the right. 12. Click **Apply** to save the panel to your dashboard. You can now add more panels for other queries. *** ## What you've built You now have a powerful, scalable analytics pipeline for time-series crypto data. You've combined a production-grade Python ETL script with the industry-standard tools for time-series data storage (InfluxDB) and visualization (Grafana). **Key achievements:** * **Built a production-ready ETL pipeline:** You have a reusable, high-performance Python script that can populate a time-series database from any supported DEX. * **Unlocked programmatic time-series analysis:** You can now perform complex analytical queries on large time-series datasets using Python and Flux. * **Mastered a scalable analytics workflow:** This pipeline provides a solid foundation for building live dashboards, conducting in-depth market research, and developing sophisticated monitoring or trading algorithms. * **Enabled live data visualization:** You've connected your database to Grafana, the leading open-source tool for observability and data visualization. ### FAQs > [accordion] Why choose InfluxDB over ClickHouse for this use case? > > InfluxDB excels at time-series ingestion and dashboards; it’s ideal for hourly/minute data with Grafana visualization. > [accordion] How much history should I store? > > Keep recent weeks/months for dashboards and archive older data elsewhere; adjust by bucket retention. > [accordion] What interval is best for the ETL? > > `1h` is a sensible default; lower to `15m/5m` for more granularity if needed. > [accordion] How do I keep the dashboard fresh? > > Schedule the ETL to append new windows, and set Grafana panels to auto-refresh. # Get token price history and OHLCV data Source: https://docs.dexpaprika.com/tutorials/retrieve-historical-data Get historical crypto price data (OHLCV) for any token across 35 blockchains. Perfect for building charts, backtesting strategies, and price analysis. ## Tutorial overview Pull historical OHLCV from a pool using `start`, `limit`, and `interval`, with tips for smoothing and inverted ratios. > [!NOTE] > > Having trouble with the API? We're here to help - [drop us a line](mailto:support@coinpaprika.com) and we'll get you sorted. ## Why you need historical price data? Building a crypto app? You'll likely need price charts, volatility analysis, or backtesting data. That's where OHLCV (Open, High, Low, Close, Volume) data comes in - it's the backbone of any serious crypto application. **Common use cases:** * **Price charts** in trading apps * **Backtesting** trading strategies * **Volatility analysis** for risk management * **Historical performance** dashboards * **Market research** and analytics > [!TIP] > > **Quick Start**: If you know your token already, jump to [Step 2](#step-2-get-price-history-data) to grab the data immediately. *** ## Step 1: Find your token's trading pool Here's the thing - on this endpoint historical data comes from one trading pool, not from the token as a whole. This makes sense because prices happen where people trade. > [!TIP] > > On a Dev or Pro plan you can skip this step. [Token OHLCV](/tutorials/token-ohlcv) returns USD candles for the token aggregated across every pool it trades in, so there is no pool to pick. ### Quick search (recommended) The fastest way to find what you need using the [Search API](/api-reference/search/search-for-tokens-pools-and-dexes): ```bash theme={null} curl "https://api.dexpaprika.com/search?query=USDC" | jq ``` **Pro tip**: Search returns tokens, pools, and exchanges. Look for pools with high volume - they'll have the most reliable price data. ### If you have the token address Skip the search and go straight to pools using [pool search](/tutorials/pool-filtering) with the `token_address` filter: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/search?token_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | jq ``` > [!NOTE] > > The `token_address` filter only works on the per-network `/networks/{network}/pools/search`. The cross-network `/pools/search` ignores it until 23 November 2026 and answers `400` (`unknown_param`) from that date. > [!NOTE] > > Always pick pools with decent volume (>\$10k daily). Low-volume pools can have weird price spikes that don't reflect real market conditions. *** ## Step 2: Get price history data Now for the good stuff. Here's how to pull historical OHLCV data using the [Pool OHLCV API](/api-reference/pools/get-ohlcv-data-for-a-pool-pair): ```bash theme={null} # Hourly candles for the last 24 hours, no key needed curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-24h&limit=24&interval=1h&inversed=true" | jq ``` How far back you can go and how fine the candles can be depends on your plan. Without a key you get `1h` and up over the last 24 hours, which `start=-24h` selects. A [free key](https://console.dexpaprika.com) opens 7 days at `10m` and longer, Dev 30 days at every interval, and Pro everything. The full table is in [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). With a free key, send it as the `Authorization` header on its own: ```bash theme={null} # Hourly candles for the last 7 days, free key curl -H "Authorization: $DEXPAPRIKA_API_KEY" "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-7d&limit=168&interval=1h&inversed=true" | jq ``` *(Using USDC/ETH pool on Ethereum as example in this tutorial)* ### What these parameters do: | Parameter | What It Does | Example | | - | - | - | | `start` | When to start collecting data, inside your plan's history window | `-24h` (relative to now), Unix timestamp, RFC 3339 or `YYYY-MM-DD` | | `limit` | How many data points (max 1000) | `24` for a day of hourly candles | | `interval` | Time between each point | `1h`, `6h`, `24h` without a key; `10m` and longer with a free key | | `end` | When to stop (optional), inside the same window | `-1h` (relative to now), Unix timestamp, RFC 3339 or `YYYY-MM-DD` | | `inversed` | Flip the price ratio | `true` for ETH/USDC → USDC/ETH | ### What you get back: ```json theme={null} [ { "time_open": "2025-01-30T00:00:00Z", "time_close": "2025-01-31T00:00:00Z", "open": 3115.1614508315265, "high": 3277.717757396331, "low": 3097.803416632386, "close": 3250.184016286268, "volume": 226403988 } ] ``` Each data point gives you everything you need for candlestick charts or analysis. *** ## Time intervals that actually matter Choose based on what you're building, within what your plan allows: **For Trading Apps:** * `1m`, `5m` - Real-time trading (Dev or Pro) * `1h`, `6h` - Swing trading * `24h` - Position trading **For Analytics Dashboards:** * `24h` - Daily summaries * Use daily data and aggregate for weekly/monthly views **For Research:** * `24h` over long date ranges: 30 days back on Dev, unlimited on Pro, up to 1000 candles per request *** ## Production tips that'll save you time ### Cache aggressively Historical data doesn't change - cache it locally: ```bash theme={null} # Check when pool was created to avoid requesting non-existent data curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" | jq '.created_at' ``` ### Handle data gaps Some pools have quiet periods. Here's how to deal with gaps: ```bash theme={null} # Filter out low-volume periods that might have unreliable prices curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-24h&limit=24&interval=1h&inversed=true" | jq '.[] | select(.volume > 1000)' ``` ### Multi-pool strategy For major tokens, cross-reference data from multiple pools: ```bash theme={null} # Get the top USDC pools to compare price consistency curl "https://api.dexpaprika.com/networks/ethereum/pools/search?token_address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&limit=5" | jq '.results[] | .id' ``` ### Rate limiting Don't hammer the API. Keyless requests are capped at 15 a minute and [free-key](https://console.dexpaprika.com) requests at 30, and [Pro lifts that to 500 a minute](https://dexpaprika.com/api/pricing). Batch your requests and cache results: ```javascript theme={null} // Example: Batch multiple token histories const tokens = ['USDC', 'WETH', 'USDT']; const historyPromises = tokens.map(token => fetch(`/api/history/${token}`).then(r => r.json()) ); const allHistories = await Promise.all(historyPromises); ``` *** ## Troubleshooting common issues ### "Empty response" Pool might not have data for your date range: ```bash theme={null} # Check pool age first curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" | jq '.created_at' ``` ### "Weird price spikes" You hit a low-liquidity period. Switch to longer intervals or higher-volume pools: ```bash theme={null} # Use 6h intervals to smooth out anomalies curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-24h&interval=6h&limit=4&inversed=true" ``` ### "Upside-down prices" You need the inverted ratio: ```bash theme={null} # Flip from TOKEN/ETH to ETH/TOKEN curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?start=-24h&interval=1h&inversed=true&limit=10" ``` ### "403 Forbidden" The request asked for more history or finer candles than your plan allows. The `message` says which plan lifts the limit: ```json theme={null} {"message":"OHLCV history beyond the last 24 hours requires an API key (free key: 7 days, Dev plan: 30 days, Pro plan: unlimited)"} ``` Move `start` inside the window, pick a coarser `interval`, or send a key. A `403` is not worth retrying unchanged. *** ## What's next? > [card] [Pool details API](/api-reference/pools/get-a-pool-on-a-network) > > Get liquidity, fees, and other pool metrics. > [card] [Real-time price feeds](/tutorials/fetch-token-price) > > Combine historical data with live prices. ### FAQs > [accordion] What if my date range predates the pool? > > First check the pool’s `created_at`; set `start` to not precede the creation time. > [accordion] Which interval should I use? > > For charts: `1h`/`24h`. For anomaly smoothing: `6h`/`12h`. For near real-time: `1m`/`5m`, which need Dev or Pro. > [accordion] Why is volume zero in some windows? > > No trades occurred in that interval; aggregate longer or switch pools with higher activity. > [accordion] How do I invert the pair? > > Pass `inversed=true` to flip from token0/token1 to token1/token0. ## Need help? > [card] [Discord community](https://discord.gg/DhJge5TUGM) > > Ask questions and see what others are building. > [card] [Direct support](mailto:support@coinpaprika.com) > > Hit a wall? We'll help you debug it. # Crypto analytics with ClickHouse Source: https://docs.dexpaprika.com/tutorials/scaling-with-clickhouse Take your crypto analytics to the next level with ClickHouse. This guide shows you how to build a production-grade data pipeline for massive datasets and lightning-fast queries. ## Tutorial overview Scale from local to production by ingesting high-frequency pool OHLCV into ClickHouse for sub-second analytics. ## From local to production scale When your analytics needs grow beyond a single machine and you require a database designed for production scale, it's time to consider ClickHouse. ClickHouse is built for handling billions of rows with sub-second query times, making it perfect for production analytics, real-time dashboards, and enterprise-grade data analysis. > [!NOTE] > > Looking for other analytics solutions? Check out our full list of [API Tutorials](/tutorials/tutorial_intro) for more step-by-step guides. **Why ClickHouse for crypto analytics?** * **Massive scale:** Built to handle billions of rows and petabytes of data, far beyond the scope of local, in-process databases. * **Lightning speed:** Optimized columnar storage delivers queries that are 10-100x faster than traditional row-based systems. * **Real-time ingestion:** Built for continuous data streaming and updates. * **Production ready:** Used by companies like Uber, Cloudflare, and Spotify for analytics at scale. ```mermaid theme={null} graph TD; subgraph "Step 1: Infrastructure"; A["Setup ClickHouse Server"]; end subgraph "Step 2: Data Ingestion"; B["Run Python ETL script"]; C["DexPaprika API"]; D["ClickHouse database
('crypto_analytics')"]; B --"Fetches pool & OHLCV data"--> C; B --"Loads millions of rows"--> D; end subgraph "Step 3 & 4: Analysis"; E["Option A:
Direct SQL queries"]; F["Option B:
AI assistant via MCP"]; D --> E; D --> F; end A --> B; ``` **The goal:** By the end of this guide, you will have a production-grade ClickHouse setup that can: 1. Ingest 15-minute OHLCV data for the top 250 Uniswap v3 pools (6 days of history) 2. Handle real-time data updates via streaming 3. Run complex analytical queries in milliseconds 4. Enable AI-powered analysis through MCP server integration > [card] [Step 1: ClickHouse Setup](#step-1-setting-up-clickhouse) > > Install and configure ClickHouse for crypto analytics. > [card] [Step 2: ETL Pipeline](#step-2-build-the-production-etl-pipeline) > > Create a robust data pipeline for high-frequency data ingestion. > [card] [Step 3: Advanced Queries](#step-3-lightning-fast-analytics-optional) > > Run complex analytics on 15-minute interval data. > [card] [Step 4: MCP Integration](#step-4-ai-powered-analysis-with-an-mcp-server) > > Enable AI-powered analysis through MCP server integration. *** ## Step 1: Setting up ClickHouse ### **Option A: Local installation (recommended for learning)** Install ClickHouse locally for development and testing: ```bash theme={null} # macOS brew install clickhouse ``` > [!NOTE] > > **macOS specifics: Cask installation** \ > The `brew install clickhouse` command now installs a Cask, not a standard formula. This provides a single `clickhouse` binary that acts as a multi-tool for both the server and client. Commands that refer to `clickhouse-server` or `brew services` will not work. > > Use the following commands instead: > > ```bash theme={null} > # To start the server on macOS (runs in the foreground): > clickhouse server > > # To connect with the client in a new terminal: > clickhouse client > ``` ```bash theme={null} # Ubuntu/Debian sudo apt-get install -y apt-transport-https ca-certificates dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list sudo apt-get update sudo apt-get install -y clickhouse-server clickhouse-client # Start the server sudo systemctl start clickhouse-server ``` ### **Option B: ClickHouse Cloud (recommended for production)** For production workloads, use [ClickHouse Cloud](https://clickhouse.com/cloud): 1. Sign up for a free trial at clickhouse.com/cloud 2. Create a new service 3. Note your connection details (host, port, username, password) > [!NOTE] > > **Moving forward:** \ > The rest of this tutorial will assume you are using a **local ClickHouse installation (Option A)**. The Python scripts are configured for this by default. If you choose to use ClickHouse Cloud, remember to update the `CLICKHOUSE_HOST`, `CLICKHOUSE_PORT`, `CLICKHOUSE_USER`, and `CLICKHOUSE_PASSWORD` variables in the scripts accordingly. ### **Test your connection** ```bash theme={null} # Local installation (macOS) clickhouse client # Local installation (Linux) clickhouse-client # ClickHouse Cloud clickhouse-client --host your-host.clickhouse.cloud --port 9440 --user default --password your-password --secure ``` *** ## Step 2: Build the production ETL pipeline Create a new file named `build_clickhouse_db.py`. This script efficiently handles high-frequency data from the top 500 pools, incorporating robust error handling and API management strategies. It uses two endpoints: [pool search](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) with a `dex_name` filter to discover pools, and the [Pool OHLCV Data endpoint](/api-reference/pools/get-ohlcv-data-for-a-pool-pair) to fetch historical price data. > [!NOTE] > > This script needs a [free API key](https://console.dexpaprika.com). Without one, OHLCV reaches back only 24 hours at `1h` and up, and the script asks for six days of 15-minute candles. Export the key before running it; it goes in the `Authorization` header on its own. On Pro, point `API_BASE_URL` at `https://api-pro.dexpaprika.com`. Limits per plan: [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). > > ```bash theme={null} > export DEXPAPRIKA_API_KEY="your-key" > ``` ```python build_clickhouse_db.py [expandable] theme={null} import requests import pandas as pd import clickhouse_connect from datetime import datetime, timedelta import logging import time import asyncio import aiohttp from typing import List, Dict import json import math import os # --- Configuration --- API_BASE_URL = "https://api.dexpaprika.com" API_KEY = os.environ["DEXPAPRIKA_API_KEY"] # free key from console.dexpaprika.com NETWORK = "ethereum" DEX_ID = "uniswap_v3" HISTORY_DAYS = 6 # a free key reaches 7 days back; stay inside it TOP_POOLS_LIMIT = 250 # Focus on top 250 pools by volume BATCH_SIZE = 15 # Process pools in smaller batches CONCURRENT_REQUESTS = 4 # Concurrent requests for API calls OHLCV_API_LIMIT = 100 # API limit for OHLCV requests INTERVAL = "15m" # 15-minute intervals (a free key allows 10m and longer) # ClickHouse Configuration CLICKHOUSE_HOST = "localhost" # or your ClickHouse Cloud host CLICKHOUSE_PORT = 8123 CLICKHOUSE_USER = "default" CLICKHOUSE_PASSWORD = "" # Set if using ClickHouse Cloud CLICKHOUSE_DATABASE = "crypto_analytics" # Setup logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') async def fetch_with_retry(session, url, params=None, retries=5, backoff_factor=0.5): """Generic fetch function with exponential backoff.""" for attempt in range(retries): try: async with session.get(url, params=params, timeout=30) as response: response.raise_for_status() return await response.json() except (aiohttp.ClientError, asyncio.TimeoutError) as e: if attempt == retries - 1: logging.error(f"Final attempt failed for {url}: {e}") raise sleep_time = backoff_factor * (2 ** attempt) logging.warning(f"Request to {url} failed: {e}. Retrying in {sleep_time:.2f}s...") await asyncio.sleep(sleep_time) class ClickHouseETL: def __init__(self): # Connect without a database first to ensure it exists with clickhouse_connect.get_client( host=CLICKHOUSE_HOST, port=CLICKHOUSE_PORT, username=CLICKHOUSE_USER, password=CLICKHOUSE_PASSWORD ) as client: client.command(f"CREATE DATABASE IF NOT EXISTS {CLICKHOUSE_DATABASE}") # Now, connect to the specific database for table operations self.client = clickhouse_connect.get_client( host=CLICKHOUSE_HOST, port=CLICKHOUSE_PORT, username=CLICKHOUSE_USER, password=CLICKHOUSE_PASSWORD, database=CLICKHOUSE_DATABASE ) self.api_semaphore = asyncio.Semaphore(CONCURRENT_REQUESTS) self.setup_database() def setup_database(self): """Create tables optimized for 15-minute interval data.""" logging.info("Setting up ClickHouse tables...") # Create pools table with ReplacingMergeTree to handle duplicates pools_schema = """ CREATE TABLE IF NOT EXISTS pools ( address String, dex_name String, volume_24h_usd Float64, created_at DateTime, token0_symbol Nullable(String), token1_symbol Nullable(String), pair Nullable(String) MATERIALIZED if(isNotNull(token0_symbol) AND isNotNull(token1_symbol), concat(token0_symbol, '-', token1_symbol), NULL), created_date Date MATERIALIZED toDate(created_at), volume_rank UInt32 ) ENGINE = ReplacingMergeTree(created_at) ORDER BY (address, volume_24h_usd, created_at) PARTITION BY toYYYYMM(created_date) """ self.client.command(pools_schema) # Create OHLCV table optimized for time-series analytics ohlcv_schema = """ CREATE TABLE IF NOT EXISTS pool_ohlcv ( timestamp DateTime, network String, pool_address String, open Float64, high Float64, low Float64, close Float64, volume_usd Float64, date Date MATERIALIZED toDate(timestamp), hour UInt8 MATERIALIZED toHour(timestamp), minute UInt8 MATERIALIZED toMinute(timestamp), quarter_hour UInt8 MATERIALIZED intDiv(toMinute(timestamp), 15) ) ENGINE = ReplacingMergeTree(timestamp) ORDER BY (pool_address, timestamp) PARTITION BY (date, network) """ self.client.command(ohlcv_schema) logging.info("Database and tables setup complete.") async def fetch_top_pools(self) -> List[Dict]: """Fetch top pools by volume from the specified DEX, handling cursor pagination.""" logging.info(f"Fetching top {TOP_POOLS_LIMIT} pools for {DEX_ID} on {NETWORK}...") all_pools = [] cursor = None async with aiohttp.ClientSession(headers={"Authorization": API_KEY}) as session: while len(all_pools) < TOP_POOLS_LIMIT: # The DEX is a filter now: /networks/{network}/dexes/{dex}/pools was # removed and returns 410. detailed=true keeps name/symbol on tokens[]. url = f"{API_BASE_URL}/networks/{NETWORK}/pools/search" params = {"dex_name": DEX_ID, "limit": 100, "order_by": "volume_usd_24h", "sort": "desc", "detailed": "true"} if cursor: params["cursor"] = cursor try: data = await fetch_with_retry(session, url, params=params) pools = data.get('results', []) if not pools: break all_pools.extend(pools) logging.info(f"Fetched a page, got {len(pools)} pools. Total: {len(all_pools)}") if len(all_pools) >= TOP_POOLS_LIMIT: all_pools = all_pools[:TOP_POOLS_LIMIT] break if not data.get('has_next_page'): break cursor = data.get('next_cursor') await asyncio.sleep(0.5) # Be respectful to the API except Exception as e: logging.error(f"Error fetching a page of pools: {e}") break logging.info(f"Finished fetching pools. Total: {len(all_pools)}") return all_pools async def fetch_pool_ohlcv_paginated(self, session: aiohttp.ClientSession, pool_address: str) -> List[Dict]: """Fetch complete OHLCV data for a pool using intelligent, dynamic windowing.""" async with self.api_semaphore: final_end_time = datetime.utcnow() current_start_time = final_end_time - timedelta(days=HISTORY_DAYS) all_ohlcv = [] try: interval_minutes = int(INTERVAL.replace('m', '')) minutes_per_call = OHLCV_API_LIMIT * interval_minutes time_delta_per_call = timedelta(minutes=minutes_per_call) except ValueError: logging.error(f"Invalid INTERVAL format: {INTERVAL}. Defaulting to 15 minutes.") interval_minutes = 15 time_delta_per_call = timedelta(minutes=OHLCV_API_LIMIT * 15) while current_start_time < final_end_time: batch_end_time = min(current_start_time + time_delta_per_call, final_end_time) url = f"{API_BASE_URL}/networks/{NETWORK}/pools/{pool_address}/ohlcv" params = { "start": current_start_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "end": batch_end_time.strftime('%Y-%m-%dT%H:%M:%SZ'), "interval": INTERVAL, "limit": OHLCV_API_LIMIT } try: batch_data = await fetch_with_retry(session, url, params=params) if batch_data: for record in batch_data: record['network'] = NETWORK record['pool_address'] = pool_address if 'volume_usd' not in record: avg_price = (record.get('open', 0) + record.get('close', 0)) / 2 record['volume_usd'] = record.get('volume', 0) * avg_price if avg_price > 0 else 0 all_ohlcv.extend(batch_data) except Exception as e: logging.warning(f"Could not fetch OHLCV batch for {pool_address}: {e}") current_start_time = batch_end_time await asyncio.sleep(0.75) # Crucial delay to prevent rate-limiting logging.info(f"Pool {pool_address}: collected {len(all_ohlcv)} OHLCV records.") return all_ohlcv async def fetch_pool_ohlcv_batch(self, pool_addresses: List[str]) -> List[Dict]: """Fetch OHLCV data for multiple pools concurrently.""" logging.info(f"Fetching {INTERVAL} OHLCV for {len(pool_addresses)} pools...") all_ohlcv = [] async with aiohttp.ClientSession(headers={"Authorization": API_KEY}) as session: tasks = [self.fetch_pool_ohlcv_paginated(session, addr) for addr in pool_addresses] results = await asyncio.gather(*tasks, return_exceptions=True) for i, result in enumerate(results): if isinstance(result, list): all_ohlcv.extend(result) elif isinstance(result, Exception): logging.warning(f"OHLCV fetch failed for pool {pool_addresses[i]}: {result}") return all_ohlcv def load_pools_data(self, pools: List[Dict]): """Load pools data into ClickHouse with volume ranking.""" if not pools: return logging.info("Processing and loading pools data...") for i, pool in enumerate(pools): tokens = pool.get('tokens', []) pool['token0_symbol'] = tokens[0]['symbol'] if len(tokens) > 0 else None pool['token1_symbol'] = tokens[1]['symbol'] if len(tokens) > 1 else None pool['volume_rank'] = i + 1 df = pd.DataFrame(pools) df = df[['id', 'dex_name', 'volume_usd_24h', 'created_at', 'token0_symbol', 'token1_symbol', 'volume_rank']] df = df.rename(columns={'id': 'address', 'volume_usd_24h': 'volume_24h_usd'}) df['created_at'] = pd.to_datetime(df['created_at']) self.client.insert_df('pools', df) logging.info(f"Loaded {len(df)} pools into 'pools' table.") def load_ohlcv_data(self, ohlcv_data: List[Dict]): """Load OHLCV data into ClickHouse.""" if not ohlcv_data: return logging.info(f"Processing and loading {len(ohlcv_data)} OHLCV records...") df = pd.DataFrame(ohlcv_data) df['timestamp'] = pd.to_datetime(df['time_close']) df = df[['timestamp', 'network', 'pool_address', 'open', 'high', 'low', 'close', 'volume_usd']] self.client.insert_df('pool_ohlcv', df) logging.info(f"Loaded {len(df)} records into 'pool_ohlcv' table.") async def run_etl(self): """Run the complete ETL process.""" logging.info(f"Starting ClickHouse ETL process for top {TOP_POOLS_LIMIT} pools...") pools = await self.fetch_top_pools() if pools: self.load_pools_data(pools) pool_addresses = [pool['id'] for pool in pools if pool.get('id')] for i in range(0, len(pool_addresses), BATCH_SIZE): batch_addresses = pool_addresses[i:i + BATCH_SIZE] batch_num = (i // BATCH_SIZE) + 1 total_batches = (len(pool_addresses) + BATCH_SIZE - 1) // BATCH_SIZE logging.info(f"Processing OHLCV batch {batch_num}/{total_batches} ({len(batch_addresses)} pools)") ohlcv_data = await self.fetch_pool_ohlcv_batch(batch_addresses) self.load_ohlcv_data(ohlcv_data) if i + BATCH_SIZE < len(pool_addresses): logging.info(f"--- Finished batch {batch_num}, sleeping for 10 seconds ---") await asyncio.sleep(10) logging.info("ETL process completed!") pool_count = self.client.command("SELECT COUNT() FROM pools") ohlcv_count = self.client.command("SELECT COUNT() FROM pool_ohlcv") unique_pools_with_data = self.client.command("SELECT COUNT(DISTINCT pool_address) FROM pool_ohlcv") avg_records = ohlcv_count / unique_pools_with_data if unique_pools_with_data > 0 else 0 logging.info(f"Final counts - Pools: {pool_count}, OHLCV records: {ohlcv_count:,}") logging.info(f"Coverage - {unique_pools_with_data} pools with data, avg {avg_records:.1f} records/pool.") async def main(): etl = ClickHouseETL() await etl.run_etl() if __name__ == "__main__": # pip install clickhouse-connect aiohttp pandas requests asyncio.run(main()) ``` > [!NOTE] > > This script is used for performance and reliability, using several good practices common in data pipelines: > > * **Asynchronous operations:** By using `asyncio` and `aiohttp`, the script can make many API requests concurrently instead of one by one. > * **Dynamic windowing:** The `fetch_pool_ohlcv_paginated` function calculates how much data to request per API call based on the `OHLCV_API_LIMIT`. > * **Concurrency control & throttling:** An `asyncio.Semaphore`, combined with carefully tuned `BATCH_SIZE` and `asyncio.sleep()` calls, keeps the script under the free tier's 15 requests a minute keyless, or 30 with a [free key](https://console.dexpaprika.com). [Pro raises that to 500 a minute](https://dexpaprika.com/api/pricing), so a 250-pool backfill completes in a fraction of the time. > * **Resiliency:** The `fetch_with_retry` function automatically retries failed requests with an exponential backoff delay. ### **Required libraries** ```bash theme={null} pip install clickhouse-connect aiohttp pandas requests ``` *** ## Step 3: Lightning-fast analytics (Optional) Once your database is populated, you can query it directly using any ClickHouse-compatible SQL client or a Python script. While the next step (AI Integration) is recommended for the most powerful analysis, running queries directly is a great way to verify your data. You can create a file named `query_clickhouse.py` to see how fast ClickHouse can process complex analytical queries on the millions of rows you've ingested. ```python query_clickhouse.py [expandable] theme={null} import clickhouse_connect import pandas as pd import time client = clickhouse_connect.get_client( host='localhost', port=8123, database='crypto_analytics' ) print("=== ClickHouse 15-Minute Analytics Demo ===\n") # Query 1: Top Pools by Volume with Data Coverage print("--- Top 10 Pools by Volume (with data coverage) ---") start_time = time.time() result1 = client.query_df(""" SELECT p.pair, p.address, max(p.volume_24h_usd) as volume_24h, min(p.volume_rank) as best_rank, count(o.timestamp) as ohlcv_records FROM pools p LEFT JOIN pool_ohlcv o ON p.address = o.pool_address GROUP BY p.pair, p.address ORDER BY volume_24h DESC LIMIT 10 """) print(result1) print(f"Query executed in {time.time() - start_time:.3f} seconds\n") # Query 2: 15-Minute Volume Patterns Analysis print("--- Volume Patterns by 15-Minute Intervals ---") result2 = client.query_df(""" SELECT hour, quarter_hour * 15 as minute_of_hour, COUNT(DISTINCT pool_address) as active_pools, round(avg(volume_usd), 2) as avg_15min_volume, round(sum(volume_usd), 2) as total_15min_volume FROM pool_ohlcv WHERE volume_usd > 0 AND volume_usd < 1000000000 -- Defensive filter GROUP BY hour, quarter_hour ORDER BY total_15min_volume DESC """) print(result2.head(10)) # Query 3: High-Frequency Price Action Analysis (Top 5 Pools) print("\n--- High-Frequency Volatility Analysis (Top 5 Pools) ---") result3 = client.query_df(""" WITH top_pools AS ( SELECT address from pools ORDER BY volume_24h_usd DESC LIMIT 5 ), pool_volatility AS ( SELECT o.pool_address, p.pair, (o.high - o.low) / o.low * 100 as interval_volatility FROM pool_ohlcv o JOIN pools p ON o.pool_address = p.address WHERE o.pool_address IN (SELECT address FROM top_pools) AND o.low > 0 ) SELECT pair, pool_address, avg(interval_volatility) as avg_15min_volatility, max(interval_volatility) as max_15min_volatility FROM pool_volatility GROUP BY pair, pool_address ORDER BY avg_15min_volatility DESC """) print(result3.head(15)) # Query 4: Peak Trading Hours Analysis print("\n--- Peak Trading Hours Analysis ---") result4 = client.query_df(""" SELECT hour, COUNT(DISTINCT pool_address) as active_pools, round(sum(volume_usd), 2) as hourly_volume, round(avg(volume_usd), 2) as avg_15min_volume, round(avg((high - low) / low * 100), 4) as avg_volatility_pct FROM pool_ohlcv WHERE volume_usd > 0 AND low > 0 AND volume_usd < 1000000000 -- Defensive filter GROUP BY hour ORDER BY hourly_volume DESC """) print(result4.head(10)) # Query 5: Database performance and storage stats print("\n--- Database Performance Stats ---") stats = client.query_df(""" SELECT table as table_name, formatReadableSize(sum(bytes_on_disk)) as size, sum(rows) as row_count, formatReadableSize(sum(bytes_on_disk)/sum(rows)) as avg_row_size FROM system.parts WHERE database = 'crypto_analytics' AND active = 1 GROUP BY table """) print(stats) # Query 6: Data quality check print("\n--- Data Quality Summary ---") quality_check = client.query_df(""" SELECT 'Total Records' as metric, toString(COUNT(*)) as value FROM pool_ohlcv UNION ALL SELECT 'Date Range', concat(toString(MIN(date)), ' to ', toString(MAX(date))) FROM pool_ohlcv UNION ALL SELECT 'Unique Pools with Data', toString(COUNT(DISTINCT pool_address)) FROM pool_ohlcv UNION ALL SELECT 'Avg Records per Day', toString(ROUND(COUNT(*) / nullif(COUNT(DISTINCT date), 0))) FROM pool_ohlcv UNION ALL SELECT 'Expected 15min Intervals vs Actual', concat( toString(dateDiff('minute', MIN(timestamp), MAX(timestamp)) / 15), ' vs ', toString(count()) ) FROM pool_ohlcv """) print(quality_check) ``` You can run the script by executing it from your terminal: ```bash theme={null} python query_clickhouse.py ``` Now, let's move on to the recommended final step: connecting your database to an AI assistant. *** ## Step 4: AI-powered analysis with an MCP server Enable seamless analysis of your local ClickHouse database through the [ClickHouse MCP Server](https://github.com/ClickHouse/mcp-clickhouse). This allows AI assistants like Claude Desktop to connect to your database, list tables, and run `SELECT` queries securely. ### 1. Install the MCP server The server is a Python package that can be installed via `pip`: ```bash theme={null} pip install clickhouse-mcp-server ``` ### 2. Configure your AI client Next, configure your AI client (e.g., Claude Desktop) to use the server. You'll need to edit its configuration file. * **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json` * **Windows:** `%APPDATA%/Claude/claude_desktop_config.json` Add the following JSON block to the `mcpServers` section of the file. This tells the client how to run the server and provides the connection details for your local ClickHouse instance. > [!NOTE] > > **Finding the command path** \ > The most common point of failure is an incorrect command path. The command should be the **absolute path** to the `clickhouse-mcp-server` executable that `pip` installed. > Find this path by running `which clickhouse-mcp-server` in your terminal and use the output in the `command` field below. ```json theme={null} { "mcpServers": { "clickhouse-mcp-server": { "command": "/path/to/your/clickhouse-mcp-server", "args": [], "env": { "CLICKHOUSE_HOST": "localhost", "CLICKHOUSE_USER": "default", "CLICKHOUSE_PASSWORD": "", "CLICKHOUSE_DATABASE": "crypto_analytics", "CLICKHOUSE_SECURE": "false" } } } } ``` ### 3. Restart and analyze Save the configuration file and **restart your AI client**. Once restarted, you can start asking it to analyze the data in your `crypto_analytics` database. ### Troubleshooting & important notes * **"Server disconnected" error:** This almost always means the `command` path in your configuration is incorrect. Double-check the absolute path using `which clickhouse-mcp-server`. * **AI connects to the `default` database:** We observed that the AI client might sometimes choose to connect to the `default` database on its own, even if `crypto_analytics` is specified in the config. This will result in it seeing no tables. * **Solution: Be explicit:** To ensure the AI works correctly, always specify the database in your prompt. This overrides the AI's tendency to use the default. **Good example prompts:** * "Using the clickhouse-mcp-server, **connect to the `crypto_analytics` database** and then list the tables." * "**In the `crypto_analytics` database**, show me the top 10 pools by volume from the `pools` table." * "Calculate the average daily volume for the top 5 most volatile pools **from the `crypto_analytics` database**." *** ## What you've built: A production-grade analytics pipeline Congratulations! You've successfully built a scalable crypto analytics pipeline with ClickHouse. You've ingested a large dataset of OHLCV data, and you've enabled a powerful AI assistant to securely query and analyze that data. **Key achievements:** * **Built a production-ready ETL pipeline:** You have a reusable, high-performance Python script that can create a comprehensive, multi-million row database from any supported DEX and network. * **Unlocked lightning-fast SQL:** You can now perform complex analytical queries on a massive dataset in milliseconds, directly on your machine. * **Mastered a scalable workflow:** This "local-first" data strategy, combined with ClickHouse's power, provides a solid foundation for building real-time dashboards, conducting in-depth market research, and developing sophisticated trading algorithms. * **Enabled secure AI analysis:** By connecting your database to an AI assistant via an MCP server, you've created a powerful and secure way to explore your data using natural language. ### FAQs > [accordion] When should I move from DuckDB to ClickHouse? > > When your dataset no longer fits comfortably on a single machine or you need concurrent users and sub-second queries on billions of rows. > [accordion] How do I size batches and concurrency? > > Tune `BATCH_SIZE` and concurrency based on CPU/network; watch error rates and back off on timeouts. > [accordion] What’s the recommended interval for high-frequency analytics? > > `15m` is a great compromise and works with a free key; `1m`/`5m` for ultra-short-term dashboards need Dev or Pro. > [accordion] How do I keep the DB fresh? > > Run the ETL incrementally (cron or scheduler) to append the latest OHLCV windows. # Search tokens, pools and DEXes by name Source: https://docs.dexpaprika.com/tutorials/search Find a token's contract address, its pools and matching DEXes from a name, symbol or address with one DexPaprika search call, and pick the right token among look-alikes. Works without an API key. `GET /search?query=...` looks a term up across every chain and returns three lists: `tokens`, `pools` and `dexes`. It is how you get from a name or symbol to the contract address every other endpoint needs. No key is needed: ```bash theme={null} curl -s "https://api.dexpaprika.com/search?query=uniswap" \ | jq '{tokens: [.tokens[:2][] | {chain, symbol, id, liquidity_usd}], pools: (.pools | length), dexes: (.dexes | length)}' ``` ```json theme={null} { "tokens": [ { "chain": "ethereum", "symbol": "UNI", "id": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "liquidity_usd": 31344284.455901023 }, { "chain": "bsc", "symbol": "UNI", "id": "0xbf5140a22578168fd562dccf235e5d43a02ce9b1", "liquidity_usd": 1657969.1284209501 } ], "pools": 20, "dexes": 34 } ``` The term can be a token name, a symbol or a contract address. A full address returns that one token and the pools it trades in. *** ## Which plan you need Search works on every plan. A key changes the limits and the host. | Caller | Host | Header | | - | - | - | | No key | `api.dexpaprika.com` | none | | Free key | `api.dexpaprika.com` | `Authorization: ` | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | `Authorization: ` | The key goes in `Authorization` on its own. Search-as-you-type sends a request per keystroke, which reaches the keyless per-minute limit fast; debounce it, and see [pricing](https://dexpaprika.com/api/pricing) and [console.dexpaprika.com](https://console.dexpaprika.com) for higher limits. ```bash No key theme={null} curl -s "https://api.dexpaprika.com/search?query=0x6982508145454ce325ddbe47a25d4ec3d2311933" \ | jq '.tokens[] | {chain, symbol, name}' ``` ```bash Dev or Pro key theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/search?query=0x6982508145454ce325ddbe47a25d4ec3d2311933" \ | jq '.tokens[] | {chain, symbol, name}' ``` *** ## What comes back | List | Each item carries | | - | - | | `tokens`, up to 10 | `id` (the contract address), `chain`, `name`, `symbol`, `decimals`, `price_usd`, `liquidity_usd`, `volume_usd` and `price_usd_change` over 24 hours, plus `website` and `description` | | `pools`, up to 20 | `id` (the pool address), `chain`, `dex_name`, both `tokens`, `price_usd`, `volume_usd`, `transactions` and price change over 5m, 1h and 24h | | `dexes` | `id` (the factory address), `dex_id`, `dex_name`, `chain`, `protocol`, `volume_usd_24h`, `txns_24h`, `pools_count` | Any list can be empty. A token symbol usually fills `tokens` and `pools` and leaves `dexes` empty; a DEX name such as `uniswap` fills all three. *** ## Find the right token in Python A popular symbol is shared by many tokens: copies, bridged versions, meme tokens with the same ticker. This script keeps exact symbol matches and ranks them by liquidity, a reasonable first filter. One request: ```python theme={null} import os import requests # No key: leave both variables unset. Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} def find_token(symbol): r = requests.get(f"{API}/search", headers=HEADERS, params={"query": symbol}, timeout=30) r.raise_for_status() exact = [t for t in r.json()["tokens"] if t["symbol"].upper() == symbol.upper()] return sorted(exact, key=lambda t: t["liquidity_usd"] or 0, reverse=True) print(f"{'chain':<10}{'address':<46}{'liquidity (USD)':>16}") for t in find_token("PEPE")[:4]: print(f"{t['chain']:<10}{t['id']:<46}{t['liquidity_usd'] or 0:>16,.0f}") ``` ```text theme={null} chain address liquidity (USD) ethereum 0x6982508145454ce325ddbe47a25d4ec3d2311933 17,762,839 bsc 0x25d887ce7a35172c62febfd67a1856f20faebb00 252,090 solana PEPEqnuuCDbBC89p1u9vpnP1KQ2oj1xTcQBsjt9X55m 120,986 solana 3Dqb9PytTmkjvf9AGus1m2brGoc2VcVxBULTcHRaMPPn 22,454 ``` Output from 12 October 2026: four tokens called PEPE on three chains. Pass the `chain` and `id` you picked to [token price](/tutorials/fetch-token-price), [token pools](/tutorials/token-pools) or [token OHLCV](/tutorials/token-ohlcv). *** ## Things to know **One word per query.** A term with a space in it, such as `usd coin`, answers `400` with `invalid_param` on `query`. Search for `usdc` or for one word of the name. **A symbol is not an identity.** Anyone can deploy a token called PEPE. Liquidity and volume are a good first filter, and the contract address is the only thing that identifies a token for sure. When you already have the address, search by it. **In `pools`, `dex_id` is the factory address.** Search returns a pool's `dex_id` as the address of the DEX factory contract, the same value as `id` in `dexes`. Everywhere else, including pool details and pool search, `dex_id` is the readable id such as `uniswap_v3`. Use `dex_name` for display, or fetch the pool's details for the readable id. **Order is not a ranking you should rely on.** Sort the lists yourself by the field that matters to you, as the script does. *** ## Where to go next * [Screen tokens](/tutorials/token-screener): filter tokens by volume, liquidity and more instead of by name * [Pool details](/tutorials/pool-details): everything about one pool from the `pools` list * [Search reference](/api-reference/search/search-for-tokens-pools-and-dexes) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # Technical indicators: RSI, EMA, MACD, Bollinger Bands and VWAP Source: https://docs.dexpaprika.com/tutorials/technical-indicators Get RSI, EMA, MACD, Bollinger Bands and VWAP for any DEX pool or token from one DexPaprika endpoint, computed server-side from OHLCV candles. All five work on pools without a key. ## What you'll build A screen that reads RSI and MACD for a pool straight from the API, without downloading candles and computing the indicator yourself. The server computes it from the same OHLCV candles that [pool OHLCV](/tutorials/retrieve-historical-data) returns, so the numbers line up with the charts you already draw. By the end you will have: * A curl that returns hourly RSI for a pool, with no key * A Python script that flags overbought and oversold pools and MACD crosses * A clear picture of which indicator needs which plan *** ## Which plan you need | | Keyless | Free key | Dev | Pro, Enterprise | | - | - | - | - | - | | Pool indicators, all five | `1h` and up, last 24 hours | `10m` and up, last 7 days | Every interval, last 30 days | Every interval, no history limit | | Token indicators, all five | No, `403` | No, `403` | Every interval, last 30 days | Every interval, no history limit | Pool indicators follow the same limits as [pool OHLCV](/knowledge-base/rate-limits#ohlcv-limits-by-plan), because they are computed from those candles. Paid plans call `https://api-pro.dexpaprika.com` with the key as the entire `Authorization` header. Compare plans on [pricing](https://dexpaprika.com/api/pricing) and get a key in [console.dexpaprika.com](https://console.dexpaprika.com). *** ## The call Hourly RSI for the USDC/WETH pool on Uniswap v3, last six hours, no key: ```bash theme={null} curl "https://api.dexpaprika.com/networks/ethereum/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/indicators?indicator=rsi&interval=1h&start=-6h" ``` ```json theme={null} { "network": "ethereum", "pool_address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "indicator": "rsi", "interval": "1h", "parameters": {"period": 14}, "data": [ {"timestamp": "2026-10-13T04:00:00Z", "value": 48.97613814905609}, {"timestamp": "2026-10-13T05:00:00Z", "value": 51.73891491670169}, {"timestamp": "2026-10-13T06:00:00Z", "value": 52.29616419545377}, {"timestamp": "2026-10-13T07:00:00Z", "value": 51.08967021129084}, {"timestamp": "2026-10-13T08:00:00Z", "value": 48.99167645194149} ], "has_next_page": false, "next_cursor": "" } ``` Values come oldest first, one per candle. `timestamp` is the candle's open time, and only completed candles count, so the candle that is still open has no value yet. `parameters` echoes what was used, defaults included. Set `interval` every time. It defaults to `24h`, or to `1h` without a key, since a daily candle does not fit the keyless 24-hour window. With a free key, a daily series cut to the last 7 days is six values. *** ## The five indicators Pick the indicator with the `indicator` query parameter. Pools use `/networks/{network}/pools/{pool_address}/indicators`, tokens use `/networks/{network}/tokens/{token_address}/indicators`. `indicator` is required, and a parameter that belongs to another indicator, such as `fast_period` with `indicator=rsi`, is refused with `400`. | Indicator | `indicator` | Parameters (default) | Each value carries | | - | - | - | - | | Relative Strength Index | `rsi` | `period` (14) | `value`, 0 to 100 | | Exponential moving average | `ema` | `period` (20) | `value`, on the same price as the candles | | MACD | `macd` | `fast_period` (12), `slow_period` (26), `signal_period` (9) | `macd`, `signal`, `histogram` | | Bollinger Bands | `bbands` | `period` (20), `std_dev` (2) | `upper`, `middle`, `lower` | | Rolling VWAP | `vwap` | `period` (14) | `value` | Every indicator also takes: | Parameter | What it does | | - | - | | `interval` | `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h` (default) or `1d`, which is the same as `24h` | | `limit` | Values per response, 1 to 1000, default 100 | | `start` | First candle: `-24h`, `-7d`, Unix seconds, RFC3339 or a date. Without it you get the last `limit` candles | | `end` | End of the range, exclusive, same formats. Defaults to now | | `cursor` | `next_cursor` from the previous page. Not combined with `start` | With `start`, `limit` counts forward from it. When the range holds more candles than `limit`, `has_next_page` is `true` and `next_cursor` continues it. *** ## Screen a pool in Python RSI over 70 is commonly read as overbought and under 30 as oversold. A MACD histogram that changes sign means MACD crossed its signal line. This script checks both on the last completed hourly candle: ```python theme={null} import requests API = "https://api.dexpaprika.com" def indicator(network, pool, name, **params): r = requests.get( f"{API}/networks/{network}/pools/{pool}/indicators", params={"indicator": name, "interval": "1h", "start": "-24h", **params}, timeout=30, ) r.raise_for_status() return r.json()["data"] pool = "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" # USDC/WETH, Uniswap v3 rsi = indicator("ethereum", pool, "rsi")[-1] macd = indicator("ethereum", pool, "macd")[-2:] state = "overbought" if rsi["value"] > 70 else "oversold" if rsi["value"] < 30 else "neutral" print(f"RSI(14) at {rsi['timestamp']}: {rsi['value']:.1f} ({state})") prev, last = macd if prev["histogram"] < 0 <= last["histogram"]: print(f"MACD crossed above its signal line at {last['timestamp']}") elif prev["histogram"] > 0 >= last["histogram"]: print(f"MACD crossed below its signal line at {last['timestamp']}") else: print(f"No MACD cross in the last candle (histogram {last['histogram']:.2f})") ``` ``` RSI(14) at 2026-10-13T08:00:00Z: 52.5 (neutral) No MACD cross in the last candle (histogram 5.64) ``` Two requests, two credits. A screen over many pools reaches the keyless [rate limit](/knowledge-base/rate-limits) quickly; a [free key](https://console.dexpaprika.com) raises it. *** ## Four things that will surprise you **The same candle can get a different value from a different `start`.** RSI, EMA and MACD are smoothed: each value carries some weight from every candle before it. The API reads only the candles each indicator strictly needs before your `start`, 14 for RSI(14), so a short range starts the smoothing late. Hourly RSI(14) for one 09:00 candle on the pool above, measured on 12 October: | `start` | RSI at 09:00 | | - | - | | `-6h` | 52.47 | | `-24h` | 60.52 | | `-3d` | 61.29 | | `-7d` and earlier | 61.18, the same as from 30 days of candles | Start at least ten periods before the first value you use, 140 candles for RSI(14), and keep the tail. Without a key the 24-hour window holds 24 hourly candles: enough to get RSI(14) for every hour of the day, not enough for it to settle, which is the `-24h` row above. A [free key](https://console.dexpaprika.com) opens 7 days, 168 hourly candles, which is enough at `1h` and shorter intervals, but only seven daily ones, so daily RSI and EMA need a paid plan to settle. The same effect explains differences from a charting site that has years of history behind each point. **A short range on a quiet pool can fail.** The warm-up is measured in time, `period` intervals back, so minutes without a trade leave it short of candles. `interval=1m&limit=2` on the pool above answered `400` with `insufficient data: rsi needs at least 15 candles. Received 12`, and `limit=50` worked. Ask for more values than you need. **Quiet intervals have no candle, so they have no value.** Indicators are computed over the candles that exist. On a thinly traded pool at `5m`, the period of an RSI spans more wall-clock time than you would expect. **Pool indicators follow the pool's OHLCV price, with no way to flip it.** An EMA, Bollinger Band or VWAP on a pool is on the same price as [pool OHLCV](/tutorials/retrieve-historical-data) with its default `inversed=false`, and the indicator endpoints take no `inversed`. For one USD series across every pool a token trades in, use the token indicators, built on [token OHLCV](/tutorials/token-ohlcv). *** ## Errors | Status | `error` | What happened | | - | - | - | | `403` | `plan_required`, no `param` | The endpoint needs Dev or higher: every token indicator | | `403` | `plan_required`, `"param": "interval"` | An interval below your plan's smallest: `1h` without a key, `10m` with a free key | | `403` | `plan_required`, `"param": "start"` or `"end"` | History before your plan's window: 24 hours without a key, 7 days with a free key, 30 days on Dev | | `400` | `missing_param`, `"param": "indicator"` | No `indicator` in the query | | `400` | `invalid_param` | A parameter out of range or not used by this indicator, named in `param`. For example `fast_period` must be below `slow_period` | | `400` | `invalid_param`, no `param` | `insufficient data`: the range holds too few candles to compute the indicator. Widen it | | `429` | `rate_limited` | Too many requests; wait `Retry-After` seconds | A paid-only request without a paid key looks like this: ```json theme={null} {"error": "plan_required", "tier": "keyless", "message": "this endpoint requires a Dev or Pro plan", "required_tier": "dev"} ``` More on [error handling](/knowledge-base/error-handling). *** ## Where to go next * Indicators reference for [pools](/api-reference/pools/get-a-technical-indicator-for-a-pool) and [tokens](/api-reference/tokens/get-a-technical-indicator-for-a-token): every parameter and response code * [Pool OHLCV](/tutorials/retrieve-historical-data): the candles behind the pool indicators * [Token OHLCV](/tutorials/token-ohlcv): the USD candles behind the token indicators * [Pricing](https://dexpaprika.com/api/pricing) and [console.dexpaprika.com](https://console.dexpaprika.com): plans and your key # Token price history across every pool Source: https://docs.dexpaprika.com/tutorials/token-ohlcv Get USD OHLCV candles for any token, aggregated across every pool it trades in, with one DexPaprika call. No pool picking, no pair math. ## What you'll build A USD price chart for any token on any of our networks, from one call per range. The candles are aggregated across every pool the token trades in, so you skip the step that usually comes first: finding the right pool and converting its pair price to dollars. By the end you will have: * A curl that returns hourly candles for a token * A Python function that pulls a longer range in pages and returns a DataFrame * A TypeScript version for a web chart * A way to continue the same series live > [!WARNING] > > **This endpoint needs a Dev, Pro or Enterprise plan.** Keyless requests and free keys get `403` with `"error": "plan_required"` (the `message` reads `this endpoint requires a Dev or Pro plan`). On the free tier you can build the same chart from a single pool with [pool OHLCV](/tutorials/retrieve-historical-data). Compare plans on [pricing](https://dexpaprika.com/api/pricing) and get your key in [console.dexpaprika.com](https://console.dexpaprika.com). *** ## Why a token series, not a pool series A token rarely trades in one place. [WETH on Ethereum](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) sits in hundreds of thousands of pools in our index (`summary.pools` on the token), paired with stablecoins, with other majors and with long-tail tokens. Charting it from one pool has three problems: 1. **You have to choose the pool.** The busiest one today may not be the busiest one next month, so a backtest built on it quietly changes venue. 2. **The price is in pair terms.** A WETH/USDC pool prices WETH in USDC. A WETH/WBTC pool prices it in WBTC. You convert, or you only ever use stablecoin pairs. 3. **One pool's volume is not the token's volume.** A single pool undercounts activity, often by a lot. The token endpoint answers all three. Every candle is a volume-weighted USD price across the token's pools on that network, and `volume` is the USD traded across all of them. *** ## The call Hourly WETH candles for the last 24 hours: ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/ohlcv?start=-24h&interval=1h&limit=24" ``` Two things to get right from the first request: * **Host.** Paid plans use `api-pro.dexpaprika.com`. The key goes in the `Authorization` header as the entire value, nothing in front of it. * **`interval` and `limit`.** They default to `24h` and `10`. Leave them out and you get ten daily candles, which is rarely what a chart wants. | Parameter | What it does | | - | - | | `start` | Required. `-24h`, `-7d`, `-90m`, an RFC3339 timestamp, a date or Unix seconds. | | `end` | Optional, same formats. | | `interval` | `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h` or `24h`. | | `limit` | Candles per request, 1 to 1000. | The response is an array of candles, oldest first. Here is UNI on Ethereum for three hours on 29 September, a fixed range you can repeat: ```bash theme={null} curl -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/networks/ethereum/tokens/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984/ohlcv?start=2026-09-29T05:00:00Z&end=2026-09-29T08:00:00Z&interval=1h&limit=3" ``` ```json theme={null} [ {"time_open":"2026-09-29T05:00:00Z","time_close":"2026-09-29T06:00:00Z","open":8.5630146329623,"high":8.661425871121041,"low":8.5630146329623,"close":8.661425871121041,"volume":425749}, {"time_open":"2026-09-29T06:00:00Z","time_close":"2026-09-29T07:00:00Z","open":8.661568793754963,"high":8.760416399493314,"low":8.599524076158955,"close":8.757341687363281,"volume":279004}, {"time_open":"2026-09-29T07:00:00Z","time_close":"2026-09-29T08:00:00Z","open":8.75679778753968,"high":8.951270464962873,"low":8.756419288173142,"close":8.94618973724396,"volume":714215} ] ``` Prices are USD at full precision; round them for display, not before you store them. `volume` is the USD value traded in the token across all its pools during the candle, as a whole number. *** ## Pull a longer range in Python One request returns up to 1000 candles. A month of hourly candles fits in one call; a day of one-minute candles does not. This function walks forward in windows of 1000 candles until it reaches `end`: ```python theme={null} import os from datetime import datetime, timedelta, timezone import pandas as pd import requests API = "https://api-pro.dexpaprika.com" HEADERS = {"Authorization": os.environ["DEXPAPRIKA_API_KEY"]} STEP = {"1m": 60, "5m": 300, "10m": 600, "15m": 900, "30m": 1800, "1h": 3600, "6h": 21600, "12h": 43200, "24h": 86400} def token_ohlcv(network, token, start, end, interval="1h"): step = timedelta(seconds=STEP[interval] * 1000) rows, cursor = [], start while cursor < end: window_end = min(cursor + step, end) r = requests.get( f"{API}/networks/{network}/tokens/{token}/ohlcv", headers=HEADERS, params={ "start": cursor.isoformat().replace("+00:00", "Z"), "end": window_end.isoformat().replace("+00:00", "Z"), "interval": interval, "limit": 1000, }, timeout=30, ) r.raise_for_status() rows.extend(r.json()) cursor = window_end df = pd.DataFrame(rows) if df.empty: return df df["time_open"] = pd.to_datetime(df["time_open"]) return df.drop_duplicates("time_open").set_index("time_open") end = datetime.now(timezone.utc) df = token_ohlcv( "ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", start=end - timedelta(days=2), end=end, interval="5m", ) print(df.tail()) ``` Each request costs one credit, however many candles it returns, so 1000-candle windows are also the cheapest way to page. > [!NOTE] > > On Dev, `start` must be inside the last 30 days. Asking for more returns `403` with a message naming the plan that lifts the limit. Pro and Enterprise have no plan limit on history. The table is on [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan). *** ## Chart it in TypeScript The same call from a browser app or a server route. The candle shape maps directly onto most charting libraries: ```typescript theme={null} type Candle = { time_open: string; time_close: string; open: number; high: number; low: number; close: number; volume: number; }; async function tokenOhlcv(network: string, token: string, start: string, interval = "1h", limit = 500) { const url = new URL(`https://api-pro.dexpaprika.com/networks/${network}/tokens/${token}/ohlcv`); url.search = new URLSearchParams({ start, interval, limit: String(limit) }).toString(); const res = await fetch(url, { headers: { Authorization: process.env.DEXPAPRIKA_API_KEY! } }); if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`); return (await res.json()) as Candle[]; } const candles = await tokenOhlcv("solana", "So11111111111111111111111111111111111111112", "-7d", "1h", 168); const series = candles.map((c) => ({ time: Date.parse(c.time_open) / 1000, open: c.open, high: c.high, low: c.low, close: c.close, })); ``` Keep the key on the server. A key shipped in browser code is a key anyone can read. *** ## Three things that will surprise you **Quiet intervals have no candle.** A candle exists only for an interval in which the token traded. On a large token at `1h` you will not notice; on a small token at `1m` you will see gaps. Fill them on your side if your chart library needs a continuous axis, usually by carrying the previous close forward with zero volume. **The last candle may still be open.** If the current interval has not ended, the last candle's `time_close` is earlier than a full interval after `time_open`, and its values keep moving. Re-read it on your next poll instead of treating it as final. **This is not a pool price.** On a token with a dominant pool the two series sit close together. Where liquidity is split, or one pool is thin, they can differ, and that difference is the point: the token series reflects where the volume actually traded. *** ## Continue the series live The same token candles are available as a stream on [`/sse/ohlcv`](/streaming/ohlcv-streaming), pushed as each bucket closes, on the same paid plans. Load history from this endpoint, then subscribe for new candles: ```bash theme={null} curl -N -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://streaming-pro.dexpaprika.com/sse/ohlcv?method=token_ohlcv&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&interval=60s" ``` Key the store on the candle's open time and overwrite on repeat, because the stream can republish a candle with late trades included. The [streaming guide](/streaming/ohlcv-streaming) covers resume and cost. *** ## Where to go next * [Token OHLCV reference](/api-reference/tokens/get-ohlcv-data-for-a-token): every parameter and response code * [Pool OHLCV](/tutorials/retrieve-historical-data): one pool's history, available on the free tier * [OHLCV limits by plan](/knowledge-base/rate-limits#ohlcv-limits-by-plan): intervals and history per plan * [Pricing](https://dexpaprika.com/api/pricing) and [console.dexpaprika.com](https://console.dexpaprika.com): plans and your key # Find every pool a token trades in Source: https://docs.dexpaprika.com/tutorials/token-pools List every pool a token trades in on one network with DexPaprika pool search: busiest first, cursor paging, and the move off the removed token pools endpoint. ## What you'll build A list of every liquidity pool on one network that contains a given token, busiest first, with paging that walks the list as far as you need. That list is the input for three common jobs: * Picking the pool to read a token's price or OHLCV history from (on Dev or Pro, [token OHLCV](/tutorials/token-ohlcv) skips the pick) * Watching where a token's volume moves between DEXes * Building a per-token dashboard that shows every venue at once One call does it: `GET /networks/{network}/pools/search` with a `token_address` parameter. > [!WARNING] > > This call replaces `GET /networks/{network}/tokens/{token_address}/pools`, which was removed and now returns `410 Gone`. If you are migrating, the [before and after](#moving-off-the-removed-endpoint) section maps the old parameters to the new ones. *** ## The call Every Solana pool that contains wrapped SOL, three busiest first: ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112&order_by=volume_usd_24h&sort=desc&limit=3" ``` Four parameters do the work: | Parameter | What it does | | - | - | | `token_address` | Keeps only pools that contain this token. One address per call. | | `order_by=volume_usd_24h` | Busiest pools first. Leave it out and the API still sorts by 24h volume; the `query` echo in the response shows which order applied. | | `sort=desc` | Direction. `asc` puts the quietest pools first. | | `limit=3` | Rows per page, default 50, maximum 100. Paging past the first page needs an API key. | The network is part of the path, so the address is looked up on that chain only. The other search filters combine with `token_address` using AND: add `liquidity_usd_min` to skip thin pools, `dex_name` with the `dex_id` slug from a response to stay on one DEX, `created_after` to see only new venues. The [pool filtering tutorial](/tutorials/pool-filtering) lists them all. > [!NOTE] > > `order_by` accepts `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_48h`, `price_change_percentage_24h`, `price_change_percentage_6h`, `price_change_percentage_1h` and `price_change_percentage_5m`. *** ## The response The call above returned three rows. Here is one of them, with the other two cut for length; they have the same shape: ```json theme={null} { "results": [ { "id": "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE", "dex_id": "orca", "dex_name": "Orca", "chain": "solana", "volume_usd_24h": 168496953.16201064, "created_at": "2023-06-30T06:20:58Z", "created_at_block_number": 202532154, "transactions_24h": 112721, "price_usd": 100.60809068912208, "price_change_percentage_5m": -0.1062529142312169, "price_change_percentage_1h": 0.431175977902886, "price_change_percentage_6h": 0.5926833874484059, "price_change_percentage_24h": 3.36743033127382, "fee": null, "volume_usd_7d": 760412464.2545992, "volume_usd_30d": 4684625060.048196, "liquidity_usd": 24495221.15357559, "tokens": [ { "id": "So11111111111111111111111111111111111111112", "chain": "solana", "has_image": true, "no_index": false }, { "id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "chain": "solana", "has_image": true, "no_index": false } ] } ], "has_next_page": true, "next_cursor": "eyJjaGFpbiI6InNvbGFuYSIsImZhY3RvcnlfaWQi...", "query": { "network": "solana", "limit": 3, "token_address": "So11111111111111111111111111111111111111112", "order_by": "volume_usd_24h", "sort": "desc" } } ``` Field names as they come off the wire: * `id` is the pool address. `dex_id` is the DEX slug and `dex_name` its label. * `tokens` lists the pool's tokens by `id` only. A search row carries no symbol or name. When you need `SOL/USDC` rather than two addresses, call [pool details](/api-reference/pools/get-a-pool-on-a-network) for that `id`; its `tokens` array carries `symbol`, `name` and `decimals`. * `query` echoes what the API applied. Read it after every call. It is how you know `token_address` was honoured and which `order_by` ran. * `transactions_24h` is the trade count and `liquidity_usd` the pool's depth. Both are per pool, not per token. *** ## Network scope, one token per call, empty lists, thin pools > [!WARNING] > > **Network-scoped only.** The cross-network `GET /pools/search` does not take `token_address`. Until 23 November 2026 the call returns `200`, its `query` echo drops the parameter, and the rows come from other chains too. From that date it answers `400` with `unknown_param`. To cover several networks, loop over them and make one per-network call each. > [!WARNING] > > **One token per query.** Repeating the parameter, as in `token_address=A&token_address=B`, is not a pair filter. Until 23 November 2026 the API keeps one of the values, and which one is not guaranteed by order; from that date it answers `400` with `repeated_param`. To find pools for a pair, filter on one token and check the `tokens` array for the other in your own code. > [!NOTE] > > **An unknown address is not an error.** A wrong or mistyped address returns `200` with `"results": []`, `"has_next_page": false` and an empty `next_cursor`, and `query` still echoes the address you sent. An empty list usually means the address is wrong for that network, so check both before concluding the token has no pools. A token's address usually differs from chain to chain. > [!NOTE] > > **Volume and depth are different lists.** The busiest pool by `volume_usd_24h` can be a day-old pool with almost no liquidity. When you want the pool to price against, add a floor: > > ```bash theme={null} > curl "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112&liquidity_usd_min=1000000&order_by=volume_usd_24h&sort=desc&limit=3" > ``` *** ## Paging with the cursor > [!NOTE] > > Paging needs an API key. Without one you get the first page, and a request with `cursor` returns `403` with `"param": "cursor"`. A [free key](https://console.dexpaprika.com) pages without limit: send it in the `Authorization` header. The response above ended with `"has_next_page": true` and a `next_cursor`. Pass that value back as `cursor`, with every other parameter unchanged and your key in the `Authorization` header: ```bash theme={null} BASE="https://api.dexpaprika.com/networks/solana/pools/search" Q="token_address=So11111111111111111111111111111111111111112&order_by=volume_usd_24h&sort=desc&limit=3" # Page one, keeping only the cursor CURSOR=$(curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" "$BASE?$Q" | python3 -c "import json, sys; print(json.load(sys.stdin)['next_cursor'])") # Page two curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" "$BASE?$Q&cursor=$CURSOR" ``` Page two picks up below the last volume of page one, repeats no pool, still carries `has_next_page` and a fresh `next_cursor`, and every row still contains the token. Keep going until `has_next_page` is `false`. There are no page numbers. Each page is one request and one credit, however many pools it returns. [Token details](/api-reference/tokens/get-a-tokens-latest-data-on-a-network) reports a token's pool count under `summary.pools`, and for a base asset like SOL it runs into the millions. Raise `limit` for fewer pages, add `liquidity_usd_min` to cut the tail, and stop at a page count you chose rather than at the end of the list. The free API key from [console.dexpaprika.com](https://console.dexpaprika.com) that paging needs also raises the limits on these calls; [pricing](https://dexpaprika.com/api/pricing) has the current quotas and the [rate limits page](/knowledge-base/rate-limits) explains how they are counted. *** ## Moving off the removed endpoint Before: ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/tokens/So11111111111111111111111111111111111111112/pools?order_by=volume_usd&sort=desc&limit=3" ``` That path now answers `410 Gone` with a body that names the replacement: ```json theme={null} { "code": 410, "message": "endpoint removed", "replacement": "/networks/{network}/pools/search", "documentation": "https://api.dexpaprika.com/docs/#tag/Pools/operation/searchNetworkPools" } ``` After: ```bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112&order_by=volume_usd_24h&sort=desc&limit=3" ``` What moved where: | Old | New | | - | - | | path `/networks/{network}/tokens/{token_address}/pools` | `/networks/{network}/pools/search?token_address={token_address}` | | `order_by=volume_usd` | `order_by=volume_usd_24h` (the default) | | `page` | `cursor`, carrying `next_cursor` from the previous response | | `address` (second-token pair filter) | no equivalent; filter on one token and check `tokens` yourself | | `reorder` (pair-perspective flip) | no equivalent; rows are pool-perspective | | response `pools` + `page_info` | `results` + `has_next_page` + `next_cursor` | *** ## Full example The single call in curl, and a paged walk in Python and JavaScript that collects the busiest pools and prints what each one is paired with. The walks read a free key from `DEXPAPRIKA_API_KEY`, because paging needs one: ```bash bash theme={null} curl "https://api.dexpaprika.com/networks/solana/pools/search?token_address=So11111111111111111111111111111111111111112&order_by=volume_usd_24h&sort=desc&limit=3" ``` ```python python theme={null} import os import requests BASE = "https://api.dexpaprika.com/networks/solana/pools/search" HEADERS = {"Authorization": os.environ["DEXPAPRIKA_API_KEY"]} # a free key pages without limit SOL = "So11111111111111111111111111111111111111112" MAX_PAGES = 3 params = {"token_address": SOL, "order_by": "volume_usd_24h", "sort": "desc", "limit": 100} pools = [] for _ in range(MAX_PAGES): data = requests.get(BASE, params=params, headers=HEADERS, timeout=30).json() pools.extend(data["results"]) if not data["has_next_page"]: break params["cursor"] = data["next_cursor"] print(f"{len(pools)} pools contain {SOL[:6]}...") for pool in pools[:5]: other = next(t["id"] for t in pool["tokens"] if t["id"] != SOL) print(f"{pool['dex_name']:<14} {pool['id']} paired with {other[:8]}... ${pool['volume_usd_24h']:,.0f} 24h") ``` ```javascript javascript theme={null} const BASE = "https://api.dexpaprika.com/networks/solana/pools/search"; const HEADERS = { Authorization: process.env.DEXPAPRIKA_API_KEY }; // a free key pages without limit const SOL = "So11111111111111111111111111111111111111112"; const MAX_PAGES = 3; const params = new URLSearchParams({ token_address: SOL, order_by: "volume_usd_24h", sort: "desc", limit: "100" }); const pools = []; for (let page = 0; page < MAX_PAGES; page++) { const data = await (await fetch(`${BASE}?${params}`, { headers: HEADERS })).json(); pools.push(...data.results); if (!data.has_next_page) break; params.set("cursor", data.next_cursor); } console.log(`${pools.length} pools contain ${SOL.slice(0, 6)}...`); for (const pool of pools.slice(0, 5)) { const other = pool.tokens.find((t) => t.id !== SOL)?.id ?? "?"; console.log(`${pool.dex_name.padEnd(14)} ${pool.id} paired with ${other.slice(0, 8)}... $${Math.round(pool.volume_usd_24h).toLocaleString()} 24h`); } ``` *** ## Next steps > [card] [Pool filtering](/tutorials/pool-filtering) > > Every search filter, and how to combine them into a screener > [card] [Pool details](/api-reference/pools/get-a-pool-on-a-network) > > Symbols, reserves and price stats for one pool id > [card] [Pool search reference](/api-reference/pools/advanced-pool-filtering-on-a-specific-network) > > Every parameter and the full response schema > [card] [Historical data](/tutorials/retrieve-historical-data) > > OHLCV history for the pool you picked ### FAQs > [accordion] Can I list a token's pools on every network in one call? > > No. The `token_address` filter works on `GET /networks/{network}/pools/search` only. The cross-network `GET /pools/search` ignores it until 23 November 2026 and answers `400` (`unknown_param`) from that date. Fetch the [network list](/api-reference/networks/get-a-list-of-available-blockchain-networks) and make one per-network call for each chain the token lives on. > [accordion] Why do the rows show token addresses but no symbols? > > Search rows carry each token's `id` and `chain` only. Call [pool details](/api-reference/pools/get-a-pool-on-a-network) with the pool `id` to get `symbol`, `name` and `decimals` for both tokens. > [accordion] How do I find the pool for a token pair? > > Filter on one token and check the `tokens` array for the other in your own code. Repeating `token_address` does not narrow the list to a pair: until 23 November 2026 the API keeps one value, not guaranteed by order, and from that date it answers `400` (`repeated_param`). > [accordion] The list came back empty. Is the token unsupported? > > An unknown address returns `200` with an empty `results` array rather than a `404`, so an empty list usually means the address does not exist on that network. Check that the address belongs to the chain in the path; a token's address usually differs from chain to chain. > [accordion] What happened to /networks/\{network}/tokens/\{token_address}/pools? > > It was removed and returns `410 Gone`. Use `GET /networks/{network}/pools/search?token_address={address}`. The `page` parameter became `cursor`, `order_by=volume_usd` became `order_by=volume_usd_24h`, and the `address` pair filter and `reorder` flag have no equivalent. # Screen tokens by volume and liquidity Source: https://docs.dexpaprika.com/tutorials/token-screener Build a token screener with DexPaprika: filter tokens on one chain or many by volume, liquidity, FDV, price change, swaps and creation date, sort the result and page through it. The first page works without an API key; paging needs a free key. `GET /networks/{network}/tokens/search` filters the tokens on one chain by 24h, 7d and 30d volume, liquidity, FDV, price, 24h price change, swap count and creation time, and sorts what is left. `GET /tokens/search` does the same across several chains at once. Neither needs a key for the first page of results. Today's biggest 24h gainers on Ethereum with at least $1M of liquidity and $1M of volume: ```bash theme={null} curl -s "https://api.dexpaprika.com/networks/ethereum/tokens/search?liquidity_usd_min=1000000&volume_usd_24h_min=1000000&order_by=price_change_percentage_24h&sort=desc&limit=3" \ | jq '.results[0]' ``` ```json theme={null} { "chain": "ethereum", "address": "0x4b66157747185640880ca15478ef5e07d69baff5", "price_usd": 0.004663709893559609, "price_change_percentage_24h": 14381.824659445929, "volume_usd_24h": 6523748.872418517, "volume_usd_7d": 6523748.872418522, "volume_usd_30d": 6523748.872418522, "liquidity_usd": 2605932.372249988, "fdv_usd": 4663709.89355961, "txns_24h": 6165, "created_at": "2026-10-11T14:15:38Z" } ``` These endpoints filter, they do not match names. To find a token by name or symbol, use [search](/tutorials/search). To filter pools rather than tokens, use [pool filtering](/tutorials/pool-filtering). *** ## Which plan you need Both endpoints work on every plan. Without a key you get the first page of results; paging with `cursor` needs a key, and a free one pages without limit. A key also changes the limits and the host. | Caller | Host | Header | | - | - | - | | No key | `api.dexpaprika.com` | none | | Free key | `api.dexpaprika.com` | `Authorization: ` | | Dev, Pro, Enterprise | `api-pro.dexpaprika.com` | `Authorization: ` | The key goes in `Authorization` on its own. A screener that refreshes often is where the per-minute limit bites first; compare plans on [pricing](https://dexpaprika.com/api/pricing) and get a key in [console.dexpaprika.com](https://console.dexpaprika.com). ```bash No key theme={null} curl -s "https://api.dexpaprika.com/tokens/search?chains=ethereum,arbitrum&liquidity_usd_min=1000000&limit=5" \ | jq '[.results[] | {chain, address, liquidity_usd}]' ``` ```bash Dev or Pro key theme={null} curl -s -H "Authorization: $DEXPAPRIKA_API_KEY" \ "https://api-pro.dexpaprika.com/tokens/search?chains=ethereum,arbitrum&liquidity_usd_min=1000000&limit=5" \ | jq '[.results[] | {chain, address, liquidity_usd}]' ``` *** ## Filters and sorting Every filter is optional and they combine with AND. | Parameter | Filters on | | - | - | | `volume_usd_24h_min`, `volume_usd_24h_max` | 24h trading volume, USD | | `volume_usd_7d_min`, `volume_usd_7d_max` | 7-day trading volume, USD | | `volume_usd_30d_min`, `volume_usd_30d_max` | 30-day trading volume, USD | | `liquidity_usd_min`, `liquidity_usd_max` | Liquidity across the token's pools, USD | | `fdv_usd_min`, `fdv_usd_max` | Fully diluted valuation, USD | | `price_usd_min`, `price_usd_max` | Price, USD | | `price_change_percentage_24h_min`, `_max` | 24h price change, in percent: `10` is +10% | | `txns_24h_min`, `txns_24h_max` | Swaps in the last 24 hours | | `created_after`, `created_before` | When the token's record was created in DexPaprika: `-7d`, Unix seconds or RFC3339. Keyless and free keys do not see the last hour ([search freshness](/knowledge-base/rate-limits#search-freshness)) | | `chains` | `/tokens/search` only: comma-separated network ids. Leave it out to search every chain | `order_by` takes `volume_usd_24h` (the default), `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `price_change_percentage_24h`, `created_at` or `fdv_usd`, and `sort` takes `desc` (the default) or `asc`. `limit` is 1 to 100, default 50. Results carry addresses and numbers, not names. Add `detailed=true` to get `name`, `symbol` and `decimals` too, plus activity over the last 1m, 5m, 15m, 30m, 1h, 6h and 24h. *** ## A gainers screener in Python This script lists the biggest 24h gainers on Ethereum that clear $1M of liquidity and $1M of volume, then pages once to get the next batch. Two requests: > [!NOTE] > > Paging needs an API key. Without one you get the first page, and a request with `cursor` returns `403` with `"param": "cursor"`. A [free key](https://console.dexpaprika.com) pages without limit: send it in the `Authorization` header. The script below stops after the first page when no key is set. ```python theme={null} import os import requests # No key: leave both variables unset (first page only). Free key: set DEXPAPRIKA_API_KEY. # Dev or Pro key: also set DEXPAPRIKA_API=https://api-pro.dexpaprika.com API = os.environ.get("DEXPAPRIKA_API", "https://api.dexpaprika.com") KEY = os.environ.get("DEXPAPRIKA_API_KEY") HEADERS = {"Authorization": KEY} if KEY else {} FILTERS = { "liquidity_usd_min": 1_000_000, "volume_usd_24h_min": 1_000_000, "order_by": "price_change_percentage_24h", "sort": "desc", "detailed": "true", "limit": 5, } def screen(network, pages=2): cursor = None for _ in range(pages): params = dict(FILTERS, **({"cursor": cursor} if cursor else {})) r = requests.get(f"{API}/networks/{network}/tokens/search", headers=HEADERS, params=params, timeout=30) r.raise_for_status() page = r.json() yield from page["results"] if not page["has_next_page"] or not KEY: # paging needs a key break cursor = page["next_cursor"] print(f"{'symbol':<10}{'24h':>9}{'liquidity (USD)':>18}{'24h volume (USD)':>19}") for t in screen("ethereum"): print(f"{t['symbol'][:9]:<10}{t['price_change_percentage_24h']:>+8.1f}%" f"{t['liquidity_usd']:>18,.0f}{t['volume_usd_24h']:>19,.0f}") ``` ```text theme={null} symbol 24h liquidity (USD) 24h volume (USD) DOPE +14381.8% 2,605,932 6,523,749 7AΩ∞ +25.2% 8,989,888 31,956,195 VIBE +12.1% 2,530,747 4,154,938 AZTEC +8.0% 7,413,585 3,550,410 eUSD +2.5% 1,418,655 2,045,757 PEPE +2.3% 17,772,334 1,999,145 ETH+ +1.4% 9,410,471 1,389,760 BULL +1.4% 9,547,006 28,390,287 wTAO +1.3% 2,700,449 1,589,451 ONDO +1.2% 1,394,617 1,707,307 ``` Output from 12 October 2026. The first row moved more than 14,000% in a day, which is why the filters below matter. *** ## Things to know **Send the same filters with every cursor.** `next_cursor` continues the query that produced it. Send it with the same filters and sort, as the script does; the cursor alone answers `400` with `invalid cursor`. **Only the 24h price change filters tokens.** Pool search also filters on 5m, 1h, 6h and 48h price change; token search does not, and it drops those parameters without an error. See [pool filtering](/tutorials/pool-filtering) for the pool windows. **`created_at` is not the deployment date.** It is when DexPaprika created the token's record, and a long-established token can carry a recent one. Do not read `created_after=-7d` as "launched this week"; for brand new pools, use [find new pools](/tutorials/find-new-pools). **Check outliers before you trust them.** Liquidity and FDV are computed from on-chain pool reserves and prices, so one badly priced pool can push a token's liquidity far out of line. Liquidity many times larger than FDV is one tell. Look at the token's pools with [token pools](/tutorials/token-pools) before acting on it. **Sorting by price change surfaces the extremes.** `order_by=price_change_percentage_24h` puts the most extreme moves first, whatever caused them. Raise `liquidity_usd_min` and `volume_usd_24h_min` until the list is what you want to watch. *** ## Where to go next * [Token pools](/tutorials/token-pools): every pool a token trades in * [Token price](/tutorials/fetch-token-price) and [batch prices](/tutorials/batch-token-prices) * [Token search reference](/api-reference/tokens/advanced-token-filtering-on-a-specific-network) and [cross-network reference](/api-reference/tokens/advanced-token-filtering-across-multiple-networks) * [Pricing](https://dexpaprika.com/api/pricing), [console.dexpaprika.com](https://console.dexpaprika.com) and [docs home](https://docs.dexpaprika.com) # API tutorials Source: https://docs.dexpaprika.com/tutorials/tutorial_intro Learn how to use the DexPaprika API with step-by-step tutorials. ## Available tutorials | Tutorial | Description | | - | - | | [CLI](/tutorials/cli) | Install the DexPaprika CLI and query DEX data from your terminal. | | [Fetching token prices](/tutorials/fetch-token-price) | Retrieve the price of any token using the DexPaprika API. | | [Batch token prices](/tutorials/batch-token-prices) | Fetch prices for multiple tokens in a single request, for up to 90% fewer HTTP calls, though the credit cost is unchanged. | | [Pool filtering](/tutorials/pool-filtering) | Filter pools by volume, transaction count, and creation date using the advanced filter endpoint. | | [Token pools](/tutorials/token-pools) | List every pool a token trades in on one network, busiest first, and page through the list with the cursor. | | [Find new pools](/tutorials/find-new-pools) | Discover newly created liquidity pools on any network by sorting pools by creation date. | | [Retrieve historical data](/tutorials/retrieve-historical-data) | Get OHLCV (Open, High, Low, Close, Volume) historical price data for any token. | | [Token OHLCV](/tutorials/token-ohlcv) | USD candles for a token aggregated across every pool it trades in, with paging and live continuation. Dev or Pro. | | [Vibe coding with AI](/ai-integration/vibe-coding-with-ai) | Use Claude Code or Cursor with DexPaprika access to build a crypto dashboard from natural language prompts. | | [Build a price alert bot](/tutorials/crypto-alert-bot) | Create a real-time cryptocurrency price alert system using DexPaprika API and Telegram. | | [Local analytics with DuckDB](/tutorials/local-analytics-with-duckdb) | Build a local analytics database with DuckDB to query Uniswap v3 data instantly. | | [Scaling with ClickHouse](/tutorials/scaling-with-clickhouse) | Create a production-grade ClickHouse pipeline for massive datasets. | | [Real-time analytics with InfluxDB](/tutorials/real-time-analytics-with-influxdb) | Time-series analytics pipeline for real-time monitoring. | > [!TIP] > > Do you have an interesting implementation that you want to share with others? We'd be happy to share your tutorial utilizing our API with others. [Reach us out on Discord!](https://discord.gg/DhJge5TUGM) ## Get support > [card] [Join Discord community](https://discord.gg/DhJge5TUGM) > > Connect with our community and get real-time support. > [card] [Give Feedback](mailto:support@coinpaprika.com) > > Share your experience and help us improve the API. ### FAQs > [accordion] Do tutorials require an API key? > > No. Every example runs keyless. A [free registered key](https://console.dexpaprika.com) raises the credit allowance from 10,000 to 100,000, and none of the examples need it. > [accordion] Which networks are covered? > > Check the [Networks API](/api-reference/networks/get-a-list-of-available-blockchain-networks) for the current list. > [accordion] Where can I run examples quickly? > > Use curl from your terminal or the API Reference playground directly in these docs.