> ## 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.

# Get Historical Pair Data (OHLCV) (Legacy)

> Provides historical OHLCV data for trading pairs or assets with flexible time ranges and price formats for market analysis.

<Warning>
  **Legacy Endpoint**

  This endpoint is deprecated. Please use the new v2 endpoints instead:

  * [/api/2/market/ohlcv-history](/rest-api-reference/endpoint/market-ohlcv-history) - For pool/market queries by address
  * [/api/2/token/ohlcv-history](/rest-api-reference/endpoint/token-ohlcv-history) - For token/asset queries by name, symbol, or token address
</Warning>

### Query Details

Input in "address" field the contract address of the pair/pool you want to query. You can also query via asset explained [in great details here](/rest-api-reference/docs/market-asset-query) and it will return the largest pair's data for this asset (the input is the "asset" input, you cannot use symbol here).
By default, MEV data is not included in the response.

By default, the currency is USD. You can set it to base token by setting "usd" param to false.

| Parameter    | Type    | Description                                                                                                                  |
| ------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `blockchain` | string  | Blockchain identifier (e.g., `"ethereum"`, `"bsc"`, `"solana"`). Automatically normalized.                                   |
| `asset`      | string  | Asset name or identifier. Returns data for the most liquid pair of the asset.                                                |
| `symbol`     | string  | Token ticker symbol (e.g., `"ETH"`). Optional, not used when querying by `asset`.                                            |
| `address`    | string  | Contract address of the pair or pool. Takes priority over `asset` and `symbol`.                                              |
| `baseToken`  | string  | Contract address of the base token in the pair. Normalized automatically.                                                    |
| `from`       | number  | Start of the timeframe (Unix timestamp in ms). Defaults to `0`.                                                              |
| `to`         | number  | End of the timeframe (Unix timestamp in ms). Defaults to current time.                                                       |
| `period`     | string  | Candle resolution. Options: `1s`, `5s`, `15s`, `30s`, `1min`, `5min`, `15min`, `1h`, `4h`, `1d`, `7d`, `30d`. Default: `5m`. |
| `amount`     | number  | Number of candles to return. Defaults to `1000`. Overrides `from/to` if both are set.                                        |
| `usd`        | boolean | Price reference mode. `true` = USD (default), `false` = base token pricing.                                                  |
| `mode`       | enum    | Data source mode. `"pool"` (default) returns pool-specific data, `"asset"` aggregates by asset.                              |

### Data details

Available resolutions:

* 1s
* 5s
* 15s
* 30s
* 1min
* 5min
* 15min
* 1h
* 4h
* 1d
* 7d
* 30d

### Troubleshoot

By default, the amount param is set to 1000, and has priority over from/to params - which means if you set a very large timeframe, which low granularity, and don't adapt the amount parameter, it will be capped at 1000 entries. You can increase the amount parameter to get more data points.

### Get a specific timeframe

The current endpoint is designed to serve TradingView user interface, which isn't thinking with timeframes but with candle amounts. If no trades are happening in a given timeframe, the amount of candles will be reduced to the amount of intervals where trades happened.
To get a specific timeframe, you can use the `from` and `to` parameters, coupled with "amount" being set to : `to - from` / resolution - and filter out manually the data points that are not in the timeframe you want.

### Usage Example:

* Query by Address, Period, USD, and Time Range

```bash theme={null}
curl -X GET "https://api.mobula.io/api/1/market/history/pair?period=15min&blockchain=ethereum&to=1754313334939&from=1754310600000&amount=3&address=0xefb47fcfcad4f96c83d4ca676842fb03ef20a477&usd=true"
```


## OpenAPI

````yaml get /1/market/history/pair
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 - Usage
    description: Per-key API and WebSocket usage history
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V2 - Prediction Markets
    description: >-
      Polymarket markets/events, wallet positions, and the full execution stack
      (auth, order build/submit/cancel, approvals, pUSD wrap/unwrap, deploy,
      deposit/withdraw, redeem). Alpha — see /api/2/pm/*.
  - 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, 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:
  /1/market/history/pair:
    get:
      tags:
        - V1 - Market Data
      summary: Get market history pair
      parameters:
        - schema:
            type: string
            description: Blockchain name or chain ID
          required: false
          description: Blockchain name or chain ID
          name: blockchain
          in: query
        - schema:
            type: string
            description: Token contract address
          required: false
          description: Token contract address
          name: asset
          in: query
        - schema:
            type: string
            description: Token symbol
          required: false
          description: Token symbol
          name: symbol
          in: query
        - schema:
            type: string
            description: Pool/pair address
          required: false
          description: Pool/pair address
          name: address
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: Base token address
          required: false
          description: Base token address
          name: baseToken
          in: query
        - schema:
            anyOf:
              - type: integer
                nullable: true
              - type: string
                nullable: true
              - nullable: true
            description: Start date (timestamp or ISO string)
          required: false
          description: Start date (timestamp or ISO string)
          name: from
          in: query
        - schema:
            anyOf:
              - type: integer
                nullable: true
              - type: string
                nullable: true
              - nullable: true
            description: End date (timestamp or ISO string)
          required: false
          description: End date (timestamp or ISO string)
          name: to
          in: query
        - schema:
            type: string
            description: Candle period (e.g., "5m", "1h", "24h")
          required: false
          description: Candle period (e.g., "5m", "1h", "24h")
          name: period
          in: query
        - schema:
            type: number
            nullable: true
            description: Token amount for price calculation
          required: false
          description: Token amount for price calculation
          name: amount
          in: query
      responses:
        '200':
          description: Market history response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        volume:
                          type: number
                        open:
                          type: number
                        high:
                          type: number
                        low:
                          type: number
                        close:
                          type: number
                        time:
                          type: number
                      required:
                        - volume
                        - open
                        - high
                        - low
                        - close
                        - time
                required:
                  - data

````