Polygon.io Aggregates API

Aggregate (OHLC) bar data.

OpenAPI Specification

polygon-io-aggregates-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Polygon.io REST API (Stocks) Aggregates API
  version: '1.0'
  description: 'Polygon.io (rebranded as Massive in early 2026) exposes real-time

    and historical US equity market data via a REST API at

    `https://api.polygon.io`. This specification captures a

    representative subset of the Stocks API: aggregate bars and ticker

    reference. Authentication uses an API key, sent either as the

    `apiKey` query parameter or as `Authorization: Bearer <apiKey>`.

    '
  contact:
    name: Polygon.io / Massive Documentation
    url: https://polygon.io/docs/stocks
servers:
- url: https://api.polygon.io
  description: Polygon.io REST API
security:
- apiKeyQuery: []
- bearerAuth: []
tags:
- name: Aggregates
  description: Aggregate (OHLC) bar data.
paths:
  /v2/aggs/ticker/{stocksTicker}/range/{multiplier}/{timespan}/{from}/{to}:
    get:
      tags:
      - Aggregates
      operationId: getAggregateBars
      summary: Get aggregate (OHLC) bars for a ticker
      description: 'Returns aggregate bars for a stock over a given date range in

        custom time window sizes (e.g., 5-minute bars between two dates).

        '
      parameters:
      - in: path
        name: stocksTicker
        required: true
        schema:
          type: string
        description: Case-sensitive stock ticker symbol (e.g., AAPL).
      - in: path
        name: multiplier
        required: true
        schema:
          type: integer
          minimum: 1
        description: Size of the timespan multiplier.
      - in: path
        name: timespan
        required: true
        schema:
          type: string
          enum:
          - second
          - minute
          - hour
          - day
          - week
          - month
          - quarter
          - year
      - in: path
        name: from
        required: true
        schema:
          type: string
        description: Start of the aggregate window (YYYY-MM-DD or millisecond timestamp).
      - in: path
        name: to
        required: true
        schema:
          type: string
        description: End of the aggregate window (YYYY-MM-DD or millisecond timestamp).
      - in: query
        name: adjusted
        schema:
          type: boolean
          default: true
        description: Whether the results are adjusted for splits.
      - in: query
        name: sort
        schema:
          type: string
          enum:
          - asc
          - desc
      - in: query
        name: limit
        schema:
          type: integer
          minimum: 1
          maximum: 50000
          default: 5000
      responses:
        '200':
          description: Aggregate bars response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AggregatesResponse'
components:
  schemas:
    AggregatesResponse:
      type: object
      properties:
        ticker:
          type: string
        adjusted:
          type: boolean
        queryCount:
          type: integer
        resultsCount:
          type: integer
        status:
          type: string
        request_id:
          type: string
        count:
          type: integer
        next_url:
          type: string
          format: uri
        results:
          type: array
          items:
            $ref: '#/components/schemas/AggregateBar'
    AggregateBar:
      type: object
      properties:
        T:
          type: string
          description: Ticker symbol (only present on certain endpoints).
        v:
          type: number
          description: Trading volume.
        vw:
          type: number
          description: Volume-weighted average price.
        o:
          type: number
          description: Open price.
        c:
          type: number
          description: Close price.
        h:
          type: number
          description: High price.
        l:
          type: number
          description: Low price.
        t:
          type: integer
          format: int64
          description: Unix millisecond timestamp.
        n:
          type: integer
          description: Number of transactions.
  securitySchemes:
    apiKeyQuery:
      type: apiKey
      in: query
      name: apiKey
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key