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

# Get open interest

> Historical open interest timeseries for a perpetual market.

<Warning>
  **Alpha** — The Market Data API is in alpha. Schema and response format may change. To request access, [contact us](https://www.allium.so/contact) or reach out to your account manager.
</Warning>

Returns the open interest timeseries for a perpetual market. Open interest is a stock variable, so each bucket reports the last sample within it ("OI as of the end of the bucket"). Perp markets only.

<Note>
  The query window is currently capped at **7 days** per request.
</Note>


## OpenAPI

````yaml _openapi/market-data-api.json GET /api/v1/markets/{market_id}/perps/open_interest
openapi: 3.1.0
info:
  title: Allium Market Data API
  version: 0.1.0
  description: >-
    Unified market data — reference, pricing, and perps primitives across
    trading venues. Alpha; schema may change.
servers:
  - url: https://api.allium.so
security:
  - APIKeyBearer: []
paths:
  /api/v1/markets/{market_id}/perps/open_interest:
    get:
      summary: Get open interest
      description: >-
        Open interest timeseries for a perpetual market (last sample per
        bucket). Query window capped at 7 days per request.
      parameters:
        - $ref: '#/components/parameters/MarketIdPath'
        - name: interval
          in: query
          required: true
          description: Bucket interval.
          schema:
            type: string
            enum:
              - 1m
              - 5m
              - 15m
              - 1h
              - 4h
              - 1d
          example: 1h
        - $ref: '#/components/parameters/StartTimestamp'
        - $ref: '#/components/parameters/EndTimestamp'
        - name: limit
          in: query
          description: Maximum rows to return (1–5000).
          schema:
            type: integer
            default: 500
            minimum: 1
            maximum: 5000
      responses:
        '200':
          description: Open interest samples.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/OpenInterest'
                required:
                  - items
components:
  parameters:
    MarketIdPath:
      name: market_id
      in: path
      required: true
      description: Canonical market slug, {venue}:{instrument_type}:{pair}.
      schema:
        type: string
      example: hl:perp:BTC-USDC
    StartTimestamp:
      name: start_timestamp
      in: query
      required: true
      description: Start of the window (ISO 8601; naive datetimes treated as UTC).
      schema:
        type: string
      example: '2026-05-01T00:00:00Z'
    EndTimestamp:
      name: end_timestamp
      in: query
      required: true
      description: End of the window (ISO 8601).
      schema:
        type: string
      example: '2026-05-02T00:00:00Z'
  schemas:
    OpenInterest:
      type: object
      properties:
        market_id:
          type: string
          examples:
            - hl:perp:BTC-USDC
        ts:
          type: string
          description: ISO 8601 timestamp at the bucket boundary.
          examples:
            - '2026-05-01T01:00:00.000000+00:00'
        oi_base:
          type: string
          description: Open interest in base-asset units.
          examples:
            - '12483.50'
        oi_quote_usd:
          type: string
          description: Open interest in USD notional.
          examples:
            - '1308734500.00'
      required:
        - market_id
        - ts
        - oi_base
        - oi_quote_usd
  securitySchemes:
    APIKeyBearer:
      type: apiKey
      in: header
      name: X-API-KEY

````