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

# Batch Download Trades

> Batch download trades with filters by token, chain, and timeframe. Supports cursor-based pagination for downloading large datasets.

### Query Details

This endpoint allows batch downloading of trades across the entire platform with filtering capabilities. Ideal for:

* Downloading all trades for a specific chain
* Downloading all trades involving a specific token
* Building historical trade datasets
* Analytics and backtesting

| Parameter      | Required | Description                                                     |
| -------------- | -------- | --------------------------------------------------------------- |
| `from`         | Yes      | Start of timeframe (Unix timestamp in ms or ISO 8601 date)      |
| `to`           | Yes      | End of timeframe (Unix timestamp in ms or ISO 8601 date)        |
| `blockchain`   | No       | Blockchain filter (e.g., "solana", "base", "ethereum", "evm:1") |
| `tokenAddress` | No       | Token address to filter by (matches token0 or token1)           |
| `limit`        | No       | Number of results per page (default: 1000, max: 5000)           |
| `cursor`       | No       | Cursor for pagination (from previous response's `nextCursor`)   |
| `sortOrder`    | No       | Sort order: `asc` (default) or `desc`                           |

<Warning>
  **Timeframe Limit**: The maximum timeframe between `from` and `to` is **1 hour** (3,600,000 ms). For longer periods, make multiple requests with sequential timeframes.
</Warning>

***

### Response Overview

The response uses the same trade format as `/api/2/token/trades` for consistency.

**Pagination object:**

* **count**: Number of trades returned in this response
* **nextCursor**: Cursor to use for fetching the next page (null if no more results)
* **hasMore**: Boolean indicating if more results are available
* **from/to**: Timestamps of the queried timeframe

**Trade object fields:**

* **id**: Unique swap identifier
* **operation**: Operation type (regular, deposit, withdrawal)
* **type**: Trade direction (buy, sell, deposit, withdrawal)
* **baseTokenAmount/quoteTokenAmount**: Token amounts (formatted)
* **baseTokenAmountRaw/quoteTokenAmountRaw**: Token amounts in smallest units
* **baseTokenAmountUSD/quoteTokenAmountUSD**: Trade value in USD
* **baseTokenPriceUSD/quoteTokenPriceUSD**: Token prices at execution time
* **date**: Trade timestamp in milliseconds
* **blockchain**: Human-readable blockchain name
* **transactionHash**: Transaction hash
* **marketAddress**: Pool/market address
* **swapSenderAddress**: Address that executed the swap
* **transactionSenderAddress**: Transaction originator (tx.from)
* **swapRecipient**: Actual beneficiary of the swap
* **baseToken**: Base token metadata (address, name, symbol, logo, decimals)
* **quoteToken**: Quote token metadata (address, name, symbol, logo, decimals)
* **labels**: Array of labels (sniper, bundler, insider, etc.)
* **platform**: Trading platform metadata (if available)
* **totalFeesUSD/gasFeesUSD/platformFeesUSD/mevFeesUSD**: Fee breakdown

***

### Usage Examples

**Download all Solana trades in a 1-hour window:**

```bash theme={null}
curl -X GET "https://api.mobula.io/api/2/trades/filters?blockchain=solana&from=1706745600000&to=1706749200000&limit=5000" \
  -H "Authorization: YOUR_API_KEY"
```

**Filter by specific token:**

```bash theme={null}
curl -X GET "https://api.mobula.io/api/2/trades/filters?tokenAddress=So11111111111111111111111111111111111111112&from=1706745600000&to=1706749200000&limit=5000" \
  -H "Authorization: YOUR_API_KEY"
```

**Paginate through large result sets:**

```bash theme={null}
# First request
curl -X GET "https://api.mobula.io/api/2/trades/filters?blockchain=base&from=1706745600000&to=1706749200000&limit=5000"

# Next page using cursor from previous response
curl -X GET "https://api.mobula.io/api/2/trades/filters?blockchain=base&from=1706745600000&to=1706749200000&limit=5000&cursor=1706745612345:2847563921"
```

***

### Sample Response

```json theme={null}
{
  "data": [
    {
      "id": "2847563921",
      "operation": "regular",
      "type": "buy",
      "baseTokenAmount": 150.25,
      "baseTokenAmountRaw": "150250000",
      "baseTokenAmountUSD": 150.25,
      "quoteTokenAmount": 1.5,
      "quoteTokenAmountRaw": "1500000000",
      "quoteTokenAmountUSD": 150.25,
      "date": 1706745612345,
      "swapSenderAddress": "7yBt...sender",
      "transactionSenderAddress": "7yBt...sender",
      "swapRecipient": "7yBt...sender",
      "blockchain": "Solana",
      "transactionHash": "5xKp...abc123",
      "marketAddress": "8xKp...pool123",
      "baseTokenPriceUSD": 1.0,
      "quoteTokenPriceUSD": 100.17,
      "labels": [],
      "baseToken": {
        "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "name": "USD Coin",
        "symbol": "USDC",
        "logo": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png",
        "decimals": 6
      },
      "quoteToken": {
        "address": "So11111111111111111111111111111111111111112",
        "name": "Wrapped SOL",
        "symbol": "SOL",
        "logo": "https://assets.coingecko.com/coins/images/4128/small/solana.png",
        "decimals": 9
      },
      "platform": {
        "id": "raydium",
        "name": "Raydium",
        "logo": "https://..."
      },
      "totalFeesUSD": 0.15,
      "gasFeesUSD": 0.001,
      "platformFeesUSD": 0.149,
      "mevFeesUSD": null
    }
  ],
  "pagination": {
    "count": 5000,
    "nextCursor": "1706745612345:2847563922",
    "hasMore": true,
    "from": 1706745600000,
    "to": 1706749200000
  }
}
```

<Tip>
  Use `sortOrder=asc` (default) for chronological batch downloads. This ensures consistent cursor-based pagination when downloading historical data.
</Tip>

<Info>
  **Base/Quote Token Logic**: When filtering by `tokenAddress`, that token becomes the base token. Without a token filter, token0 is used as base. The `type` field (buy/sell) is relative to the base token.
</Info>


## OpenAPI

````yaml get /2/trades/filters
openapi: 3.0.0
info:
  version: 1.0.0
  title: Mobula API
  description: >-
    Documentation of the Mobula API


    **Demo API**: The default server (demo-api.mobula.io) is a demo API with
    rate limits.

    For production use, please use api.mobula.io with an API key from
    https://admin.mobula.io
servers:
  - url: https://demo-api.mobula.io/api/
    description: Demo API (rate limited, for testing only)
  - url: https://api.mobula.io/api/
    description: Production API (requires API key)
security: []
tags:
  - name: V2 - Token
    description: Token details, price, security, ATH, and holder data
  - name: V2 - Market Data
    description: Market details, OHLCV history, and lighthouse metrics
  - name: V2 - Trades
    description: Token trades, enriched trades, and trade filters
  - name: V2 - Wallet
    description: Wallet positions, activity, trades, analysis, and labels
  - name: V2 - Assets
    description: Cross-chain asset details and price history
  - name: V2 - Swap
    description: Swap quoting and execution
  - name: V2 - Perps
    description: Perpetual futures quoting, execution, and positions
  - name: V2 - Bridge
    description: Cross-chain bridge quoting and intent status (Alpha Preview)
  - name: V2 - DeFi
    description: Bonding pools and pulse data
  - name: V2 - Search
    description: Universal fast search
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V1 - Market Data
    description: Market prices, history, sparklines, pairs, and multi-data
  - name: V1 - Wallet
    description: Wallet portfolio, transactions, history, and NFTs
  - name: V1 - Token
    description: First buyers
  - name: V1 - Trades
    description: Market trades by pair
  - name: V1 - Metadata
    description: Token metadata, categories, trendings, and news
  - name: V1 - Assets
    description: List all assets
  - name: V1 - Search
    description: Search for assets, tokens, and pairs
  - name: V1 - DeFi
    description: Bonding pool pulse data
  - name: V1 - Blockchains
    description: Blockchain listings, pairs, and stats
  - name: V1 - Webhooks
    description: Webhook management
  - name: V1 - Feed
    description: Custom feed creation
paths:
  /2/trades/filters:
    get:
      tags:
        - V2 - Trades
      summary: Batch download trades with filters
      description: >-
        Batch download trades with filters by token, chain, and timeframe.
        Supports cursor-based pagination.
      parameters:
        - schema:
            type: string
          required: false
          name: tokenAddress
          in: query
        - schema:
            type: string
          required: false
          name: chainId
          in: query
        - schema:
            type: number
          required: true
          name: from
          in: query
        - schema:
            type: number
          required: true
          name: to
          in: query
        - schema:
            type: number
          required: false
          name: limit
          in: query
        - schema:
            type: string
          required: false
          name: cursor
          in: query
        - schema:
            type: string
            enum:
              - asc
              - desc
          required: false
          name: sortOrder
          in: query
      responses:
        '200':
          description: Trades filters response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        operation:
                          type: string
                          enum:
                            - regular
                            - mev
                            - mev_sandwiched
                            - deposit
                            - withdrawal
                            - bond
                        type:
                          type: string
                          enum:
                            - buy
                            - sell
                            - deposit
                            - withdrawal
                        baseTokenAmount:
                          type: number
                        baseTokenAmountRaw:
                          type: string
                        baseTokenAmountUSD:
                          type: number
                        quoteTokenAmount:
                          type: number
                        quoteTokenAmountRaw:
                          type: string
                        quoteTokenAmountUSD:
                          type: number
                        preBalanceBaseToken:
                          type: string
                          nullable: true
                        preBalanceQuoteToken:
                          type: string
                          nullable: true
                        postBalanceBaseToken:
                          type: string
                          nullable: true
                        postBalanceQuoteToken:
                          type: string
                          nullable: true
                        date:
                          type: number
                        swapSenderAddress:
                          type: string
                        transactionSenderAddress:
                          type: string
                        swapRecipient:
                          type: string
                          nullable: true
                        blockchain:
                          type: string
                        transactionHash:
                          type: string
                        marketAddress:
                          type: string
                        marketAddresses:
                          type: array
                          items:
                            type: string
                        baseTokenPriceUSD:
                          type: number
                        quoteTokenPriceUSD:
                          type: number
                        baseTokenMarketCapUSD:
                          type: number
                          nullable: true
                        quoteTokenMarketCapUSD:
                          type: number
                          nullable: true
                        labels:
                          type: array
                          nullable: true
                          items:
                            type: string
                          default: []
                        walletMetadata:
                          type: object
                          nullable: true
                          properties:
                            entityName:
                              type: string
                              nullable: true
                            entityLogo:
                              type: string
                              nullable: true
                            entityLabels:
                              type: array
                              items:
                                type: string
                            entityType:
                              type: string
                              nullable: true
                            entityDescription:
                              type: string
                              nullable: true
                            entityTwitter:
                              type: string
                              nullable: true
                            entityWebsite:
                              type: string
                              nullable: true
                            entityGithub:
                              type: string
                              nullable: true
                            entityDiscord:
                              type: string
                              nullable: true
                            entityTelegram:
                              type: string
                              nullable: true
                            extra:
                              type: object
                              additionalProperties:
                                nullable: true
                          required:
                            - entityName
                            - entityLogo
                            - entityLabels
                            - entityType
                            - entityDescription
                            - entityTwitter
                            - entityWebsite
                            - entityGithub
                            - entityDiscord
                            - entityTelegram
                        baseToken:
                          type: object
                          nullable: true
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                              nullable: true
                            symbol:
                              type: string
                              nullable: true
                            logo:
                              type: string
                              nullable: true
                            decimals:
                              type: number
                          required:
                            - address
                            - name
                            - symbol
                            - logo
                            - decimals
                        quoteToken:
                          type: object
                          nullable: true
                          properties:
                            address:
                              type: string
                            name:
                              type: string
                              nullable: true
                            symbol:
                              type: string
                              nullable: true
                            logo:
                              type: string
                              nullable: true
                            decimals:
                              type: number
                          required:
                            - address
                            - name
                            - symbol
                            - logo
                            - decimals
                        platform:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: string
                            name:
                              type: string
                            logo:
                              type: string
                              nullable: true
                          required:
                            - id
                            - name
                            - logo
                        totalFeesUSD:
                          type: number
                          nullable: true
                        gasFeesUSD:
                          type: number
                          nullable: true
                        platformFeesUSD:
                          type: number
                          nullable: true
                        mevFeesUSD:
                          type: number
                          nullable: true
                      required:
                        - id
                        - operation
                        - type
                        - baseTokenAmount
                        - baseTokenAmountRaw
                        - baseTokenAmountUSD
                        - quoteTokenAmount
                        - quoteTokenAmountRaw
                        - quoteTokenAmountUSD
                        - date
                        - swapSenderAddress
                        - transactionSenderAddress
                        - blockchain
                        - transactionHash
                        - marketAddress
                        - baseTokenPriceUSD
                        - quoteTokenPriceUSD
                  pagination:
                    type: object
                    properties:
                      count:
                        type: number
                      nextCursor:
                        type: string
                        nullable: true
                      hasMore:
                        type: boolean
                      from:
                        type: number
                      to:
                        type: number
                    required:
                      - count
                      - nextCursor
                      - hasMore
                      - from
                      - to
                required:
                  - data
                  - pagination

````