> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dexpaprika.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Common patterns and workflows

> 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–10 tokens on the same network:

```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. 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_24h`

**Pagination:** Cursor-based. Read `has_next_page` and `next_cursor`, then pass `next_cursor` back as `cursor`.

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/tokens/So11111111111111111111111111111111111111112/pools?order_by=volume_usd&sort=desc&limit=5"
```

This returns all pools containing that token, sorted by volume. The highest-volume pool is typically the best source for price data and OHLCV history.

**Optional:** Add `reorder=true` to make the queried token the primary token in all metrics. Add `address=<second_token>` to filter to pools paired with a specific second token.

***

## Pattern 5: Get historical price data (OHLCV)

OHLCV data is per pool, not per token. The workflow is:

1. **Find the best pool** -- the highest-volume pool for the token:

```bash theme={null}
curl "https://api.dexpaprika.com/networks/ethereum/tokens/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/pools?order_by=volume_usd&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=2025-06-01&interval=24h&limit=30"
```

**Intervals:** `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `6h`, `12h`, `24h`

**`start` is required** -- ISO 8601 date or UNIX timestamp. Optional `end` parameter (max 1 year from start). Max 366 data points per request.

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 after a specific date)
curl "https://api.dexpaprika.com/networks/solana/pools/search?created_after=1709251200&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                                                                                                           |
| `created_after`               | integer | UNIX timestamp -- only pools created after this                                                                                            |
| `created_before`              | integer | UNIX timestamp -- only pools created before this                                                                                           |
| `order_by`                    | string  | `volume_usd_24h`, `volume_usd_7d`, `volume_usd_30d`, `liquidity_usd`, `txns_24h`, `created_at`, `price_usd`, `price_change_percentage_24h` |
| `sort`                        | string  | `asc` or `desc`                                                                                                                            |
| `limit`                       | integer | Items per page (default: 10)                                                                                                               |
| `cursor`                      | string  | Pass `next_cursor` from the previous response to page forward                                                                              |

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 silently ignored.
</Note>

***

## Pattern 7: Monitor pool transactions

```bash theme={null}
curl "https://api.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/dexes/raydium/pools?order_by=volume_usd&sort=desc&limit=10"
```

***

## 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) -- 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 per IP**.

***

## 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}/tokens/{address}/pools`                                       |
| 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                | `GET /networks/{network}/pools/{pool}/transactions`                                    |
| List DEXes on a network                   | `GET /networks/{network}/dexes`                                                        |
| Get pools on a specific DEX               | `GET /networks/{network}/dexes/{dex}/pools`                                            |
| Stream live prices                        | `GET https://streaming.dexpaprika.com/sse/prices?method=token_price&chain=X&address=Y` |
| Get API stats                             | `GET /stats`                                                                           |

### FAQs

<AccordionGroup>
  <Accordion title="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>

  <Accordion title="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>

  <Accordion title="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 by calling the token pools endpoint sorted by `volume_usd` descending with `limit=1`.
  </Accordion>
</AccordionGroup>

<script type="application/ld+json">
  {JSON.stringify({
      "@context": "https://schema.org",
      "@type": "FAQPage",
      "mainEntity": [
        {"@type": "Question","name": "Why do I get empty array from DexPaprika batch pricing?","acceptedAnswer": {"@type": "Answer","text": "If all tokens are unknown or unpriced, you get HTTP 200 with empty array. Verify addresses are correct."}},
        {"@type": "Question","name": "Why does the filter endpoint use different field names?","acceptedAnswer": {"@type": "Answer","text": "Filter uses address (not id), volume_usd_24h (not volume_usd), txns_24h (not transactions), and results array (not pools)."}},
        {"@type": "Question","name": "How to get OHLCV for a token in many pools?","acceptedAnswer": {"@type": "Answer","text": "Use the highest-volume pool. Find it via token pools endpoint sorted by volume_usd descending with limit=1."}}
      ]
    })}
</script>
