Polygon Books API

Level-2 order book.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

polygon-books-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Polygon Crypto REST Aggregates Books API
  version: '1.0'
  description: 'Polygon Crypto API exposes aggregated cross-exchange data for crypto

    pairs (e.g., X:BTCUSD) via `https://api.polygon.io`. This spec

    covers aggregates, daily open/close, snapshots, and level-2 books.

    Auth uses an API key via `apiKey` query parameter or

    `Authorization: Bearer`.

    '
  contact:
    name: Polygon Documentation
    url: https://polygon.io/docs/crypto
servers:
- url: https://api.polygon.io
  description: Polygon REST API
security:
- apiKeyQuery: []
- bearerAuth: []
tags:
- name: Books
  description: Level-2 order book.
paths:
  /v2/snapshot/locale/global/markets/crypto/tickers/{ticker}/book:
    get:
      tags:
      - Books
      operationId: getCryptoL2Book
      summary: Get Level Two Book For A Crypto Pair
      description: Returns the current Level-2 book for a crypto ticker.
      parameters:
      - in: path
        name: ticker
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Level-2 book response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CryptoBookResponse'
components:
  schemas:
    CryptoBookResponse:
      type: object
      properties:
        status:
          type: string
        request_id:
          type: string
        data:
          type: object
          properties:
            ticker:
              type: string
            bids:
              type: array
              items:
                $ref: '#/components/schemas/BookLevel'
            asks:
              type: array
              items:
                $ref: '#/components/schemas/BookLevel'
            bidCount:
              type: number
            askCount:
              type: number
            spread:
              type: number
            updated:
              type: integer
              format: int64
    BookLevel:
      type: object
      properties:
        p:
          type: number
          description: Price level.
        x:
          type: object
          additionalProperties:
            type: number
          description: Map of exchange ID to size.
  securitySchemes:
    apiKeyQuery:
      type: apiKey
      in: query
      name: apiKey
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key