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

# Token candlestick (OHLC)

> Returns OHLC candlestick data for a token or pool at the given resolution. Provide pool_id, token_address, or both. When token_address is provided, all resolutions describe that token. With only pool_id, the pool’s preferred token is used. Pagination is returned in the top-level response `pagination` field. Set fields=array for six-element rows [time, open, high, low, close, volume], retaining null slots. Time has the same millisecond Unix timestamp as long/short mode.

```bash theme={null}
curl "https://staging-api.struct.to/v1/token/market/candlestick?chain=robinhood&chain_id=4663&pool_id=0xEd50bDeeA8aDC232f159486192a4157281D722ff&token_address=0x39dBED3a2bd333467115dE45665cC57F813C4571&resolution=60" \
  -H "X-API-Key: YOUR_API_KEY"
```

```json Response (Long) theme={null}
[
  {
    "time": 1784216400000,
    "open": 0.0912,
    "high": 0.0998,
    "low": 0.0884,
    "close": 0.0966,
    "volume": 13499.42
  }
]
```

```jsonc Response (Short) theme={null}
[
  {
    "t": 1784216400000,
    "o": 0.0912,
    "h": 0.0998,
    "l": 0.0884,
    "c": 0.0966,
    "v": 13499.42
  }
]
```


## OpenAPI

````yaml onchain-openapi.json GET /token/market/candlestick
openapi: 3.1.0
info:
  title: Struct On-chain API
  description: >-
    RESTful API for token market data, discovery, holders, audits, and trader
    analytics across supported chains. Pass `fields=short` or header
    `x-field-names: short` for abbreviated keys. HTTP defaults to `long`. Token
    candlesticks, token trades and wallet batch trades also support
    `fields=array` for typed positional rows.
  version: 1.0.0
servers:
  - url: https://staging-api.struct.to/v1
    description: Staging
security:
  - ApiKey: []
paths:
  /token/market/candlestick:
    get:
      tags:
        - Token / Market
      summary: Token candlestick (OHLC)
      description: >-
        Returns OHLC candlestick data for a token or pool at the given
        resolution. Provide pool_id, token_address, or both. When token_address
        is provided, all resolutions describe that token. With only pool_id, the
        pool’s preferred token is used. Pagination is returned in the top-level
        response `pagination` field. Set fields=array for six-element rows
        [time, open, high, low, close, volume], retaining null slots. Time has
        the same millisecond Unix timestamp as long/short mode.
      operationId: get_token_candlestick
      parameters:
        - name: chain
          in: query
          description: Chain name. Required unless `chain_id` is provided.
          required: false
          schema:
            type: string
          example: robinhood
        - name: chain_id
          in: query
          description: Chain id. Required unless `chain` is provided. Use `-1` for Solana.
          required: false
          schema:
            type: integer
            format: int64
          example: 4663
        - name: fields
          in: query
          description: >-
            Response format: long (default), short, or array. Array rows are
            [time, open, high, low, close, volume]. The x-field-names header
            takes precedence.
          required: false
          schema:
            type: string
        - name: pool_id
          in: query
          description: Pool address. Either `pool_id` or `token_address` is required.
          required: false
          schema:
            type: string
          example: '0xEd50bDeeA8aDC232f159486192a4157281D722ff'
        - name: token_address
          in: query
          description: Token address. Either `pool_id` or `token_address` is required.
          required: false
          schema:
            type: string
          example: '0x39dBED3a2bd333467115dE45665cC57F813C4571'
        - name: resolution
          in: query
          description: Candle resolution (required).
          required: true
          schema:
            $ref: '#/components/schemas/CandlestickResolution'
          example: '60'
        - name: count_back
          in: query
          description: >-
            Number of candles to return (default 500, max 2500). Alias:
            `countBack`.
          required: false
          schema:
            type: integer
            format: int32
        - name: from
          in: query
          description: Unix timestamp (seconds) lower bound.
          required: false
          schema:
            type: integer
            format: int64
        - name: to
          in: query
          description: Unix timestamp (seconds) upper bound.
          required: false
          schema:
            type: integer
            format: int64
        - name: data_type
          in: query
          description: >-
            Series to chart (default `price_usd`): `price` / `market_cap` in the
            pool's counter-token units, `price_usd` / `market_cap_usd` in USD,
            `price_native` / `market_cap_native` in the chain's native coin
            (SOL, ETH, BNB, ...).
          required: false
          schema:
            $ref: '#/components/schemas/CandlestickDataType'
        - name: x-field-names
          in: header
          required: false
          description: >-
            Select long (full) or short (abbreviated) field names. HTTP defaults
            to `long`. Takes precedence over `fields`. See [Response
            Format](/api-reference/response-format#long-and-short-field-names).
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
      responses:
        '200':
          description: Candlestick series
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CandlestickResponseFormats'
              examples:
                long:
                  summary: Response (Long)
                  value:
                    - time: 1784216400000
                      open: 0.0912
                      high: 0.0998
                      low: 0.0884
                      close: 0.0966
                      volume: 13499.42
                short:
                  summary: Response (Short)
                  value:
                    - t: 1784216400000
                      o: 0.0912
                      h: 0.0998
                      l: 0.0884
                      c: 0.0966
                      v: 13499.42
        '400':
          description: >-
            Validation error — missing `pool_id`/`token_address` or
            `resolution`, invalid address, or unsupported
            `resolution`/`data_type`.
components:
  schemas:
    CandlestickResolution:
      type: string
      description: >-
        Candle resolution for `/token/market/candlestick`.

        `1S`/`5S`/`15S`/`30S` are seconds; `1`/`5`/`15`/`30`/`60`/`240`/`720`
        are

        minutes; `D`/`1D` are one day.
      enum:
        - 1S
        - 5S
        - 15S
        - 30S
        - '1'
        - '5'
        - '15'
        - '30'
        - '60'
        - '240'
        - '720'
        - D
        - 1D
    CandlestickDataType:
      type: string
      description: |-
        Which price/market-cap series the candlestick endpoint charts.
        - `price`: price in the pool's counter-token units
        - `price_usd`: price in USD (default)
        - `price_native`: price in the chain's native coin (SOL, ETH, BNB, ...)
        - `market_cap`: market cap in the pool's counter-token units
        - `market_cap_usd`: market cap in USD
        - `market_cap_native`: market cap in the chain's native coin
      enum:
        - price
        - price_usd
        - price_native
        - market_cap
        - market_cap_usd
        - market_cap_native
    CandlestickResponseFormats:
      oneOf:
        - $ref: '#/components/schemas/CandlestickResponse'
        - $ref: '#/components/schemas/CandlestickArrayResponse'
    CandlestickResponse:
      type: array
      items:
        $ref: '#/components/schemas/CandlestickBar'
    CandlestickArrayResponse:
      type: array
      items:
        type: array
        items: false
        prefixItems:
          - type: integer
            format: int64
            minimum: 0
          - type:
              - number
              - 'null'
            format: double
          - type:
              - number
              - 'null'
            format: double
          - type:
              - number
              - 'null'
            format: double
          - type:
              - number
              - 'null'
            format: double
          - type:
              - number
              - 'null'
            format: double
      description: >-
        Positional candle payload; the request selects this schema with
        fields=array.
    CandlestickBar:
      type: object
      required:
        - time
      properties:
        time:
          type: integer
          format: int64
          minimum: 0
        open:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        high:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        low:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        close:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        volume:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
    Decimal:
      type: number
      format: double
      description: Floating-point number serialized as JSON number.
      examples:
        - 4.108801574e-7
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Secret API key (`sk_*`) or JWT public key (`pk_jwt_*`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.