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

# Onchain History



## OpenAPI

````yaml open-apis/node.json get /node/v1/onchain/history/{base}/{quote}
openapi: 3.1.0
info:
  title: pragma-node
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://{environment}.pragma.build
    variables:
      environment:
        default: api.devnet
security: []
tags:
  - name: pragma-node
    description: Pragma Node API
paths:
  /node/v1/onchain/history/{base}/{quote}:
    get:
      tags:
        - crate::handlers::onchain::get_history
      operationId: get_onchain_history
      parameters:
        - name: base
          in: path
          description: Base Asset
          required: true
          schema:
            type: string
        - name: quote
          in: path
          description: Quote Asset
          required: true
          schema:
            type: string
        - name: network
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/StarknetNetwork'
        - name: timestamp
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/TimestampRange'
        - name: chunk_interval
          in: query
          required: false
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/Interval'
        - name: routing
          in: query
          required: false
          schema:
            type:
              - boolean
              - 'null'
      responses:
        '200':
          description: Get the historical onchain median price
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOnchainHistoryResponse'
components:
  schemas:
    StarknetNetwork:
      type: string
      enum:
        - starknet-mainnet
        - starknet-sepolia
    TimestampRange:
      type: string
      description: Represents a range of timestamps
    Interval:
      type: string
      enum:
        - 100ms
        - 1s
        - 5s
        - 10s
        - 1min
        - 5min
        - 15min
        - 1h
        - 2h
        - 1d
        - 1w
    GetOnchainHistoryResponse:
      type: array
      items:
        $ref: '#/components/schemas/GetOnchainHistoryEntry'
    GetOnchainHistoryEntry:
      type: object
      required:
        - pair_id
        - timestamp
        - median_price
        - decimals
        - nb_sources_aggregated
      properties:
        decimals:
          type: integer
          format: int32
          minimum: 0
        median_price:
          type: string
        nb_sources_aggregated:
          type: integer
          format: int32
          minimum: 0
        pair_id:
          type: string
        timestamp:
          type: integer
          format: int64
          minimum: 0

````