Zero Hash Index API

Obtain the index price on an instrument

Documentation

Specifications

Other Resources

OpenAPI Specification

zero-hash-index-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: zerohash Index API
  description: '

    ### Authentication


    zerohash Uses HMAC SHA-256 verification to ensure the authenticity of API requests, follow instructions by link [https://docs.zerohash.com/reference/api-authentication](https://docs.zerohash.com/reference/api-authentication)


    <a href="/zh-swagger.json">Download zerohash OpenAPI Schema as JSON</a>

    '
  version: 1.7.0
servers:
- url: https://api.cert.zerohash.com
  description: Certification API server
security:
- apiKey: []
  apiPassphrase: []
tags:
- name: Index
  description: Obtain the index price on an instrument
paths:
  /index:
    get:
      tags:
      - Index
      summary: List index prices
      description: Request the latest zerohash index value for the most recently calculated data.
      parameters:
      - $ref: '#/components/parameters/Signature'
      - $ref: '#/components/parameters/Timestamp'
      - name: underlying
        in: query
        description: underlying currency
        required: true
        allowEmptyValue: false
        schema:
          $ref: '#/components/schemas/LiquidityEnabledUnderlyingCurrency'
      - name: quoted_currency
        in: query
        description: quoted currency
        required: true
        allowEmptyValue: false
        schema:
          $ref: '#/components/schemas/QuotedCurrency'
      responses:
        '200':
          description: Latest zerohash index value for the requested underlying/quoted pair.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetIndexResponse'
        '400':
          description: Bad request
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Code403'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Code404'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Code500'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Code503'
components:
  schemas:
    UnderlyingCurrency:
      type: string
      description: the underlying asset
      example: BTC
      enum:
      - AAVE.ETH
      - ADA
      - ALGO
      - AVAX
      - BAT.ETH
      - BCH
      - BTC
      - BUSD.ETH
      - COMP.ETH
      - DAI.ETH
      - DOGE
      - DOT
      - EGLD
      - EOS
      - ETC
      - ETH
      - ETH.ARBITRUM
      - GRT.ETH
      - GYEN.ETH
      - HBAR
      - LINK.ETH
      - LTC
      - LUNA
      - MATIC.ETH
      - MATIC.POLYGON
      - MKR.ETH
      - MOB
      - SAND.ETH
      - SOL
      - UNI.ETH
      - USDC.ETH
      - USDC.ALGO
      - USDC.POLYGON
      - USDC.SOL
      - USDC.HBAR
      - USDC.XLM
      - USDC.AVAX
      - USDT.ETH
      - UST
      - WBTC.ETH
      - XEM
      - XLM
      - XRP
      - XTZ
      - ZUSD.ETH
    Code503:
      type: object
      description: 'A downstream dependency was unavailable, timed out, or returned a retryable error. Safe to retry; the response carries a `zh-allow-retry: true` header.'
      required:
      - error
      properties:
        error:
          type: string
          example: Service Unavailable
    GetIndexResponse:
      type: object
      properties:
        timestamp:
          type: number
          description: Unix timestamp in milliseconds indicating when the index was calculated.
          example: 1564686909724
        index:
          type: string
          description: The specific index, which is the unique combination of `underlying` and `quoted_currency`
          example: BTC/USD
        underlying:
          $ref: '#/components/schemas/UnderlyingCurrency'
        quoted_currency:
          $ref: '#/components/schemas/QuotedCurrency'
        value:
          type: number
          description: The index price for the underlying asset, as quoted in the quoted_currency
          example: 1234.5678901234
    Code404:
      type: object
      description: The requested resource does not exist or is not visible to the caller.
      required:
      - error
      properties:
        error:
          type: string
          example: Not Found
    LiquidityEnabledUnderlyingCurrency:
      type: string
      description: The underlying asset in the trading pair. E.g. `BTC` in the pair `BTC/USD`.
      example: BTC
      enum:
      - USDC.OPTIMISM
      - USDC.SUI
      - DOT
      - FIL
      - PYUSD.ETH
      - TRX
      - ZRX
      - DAI.ETH
      - USDC.WORLDCHAIN
      - USDP
      - USDT.BSC
      - USDT.CELO
      - PEPE.ETH
      - SAND
      - USDC.DOTHUB
      - USDC.SEI
      - USDC.SOL
      - USDC.ZKSYNC
      - ENA.ETH
      - MANA.ETH
      - PYTH.SOL
      - SOL
      - USDC.BASE
      - USDC.CELO
      - USDT
      - ADA
      - INJ.ETH
      - MATIC.POLYGON
      - PAXG
      - USD
      - AAVE.ETH
      - ALGO
      - EURC.XLM
      - KNC.ETH
      - PNUT.SOL
      - SHIB
      - BCH
      - DOGE
      - EGLD
      - JTO.SOL
      - UNI.ETH
      - USDC
      - USDC.ARBITRUM
      - ONDO.ETH
      - PENGU.SOL
      - USD
      - WLFI.ETH
      - XLM
      - APT
      - CC
      - ETH.OPTIMISM
      - ETH.WORLDCHAIN
      - LDO.ETH
      - MORPHO.ETH
      - SEI
      - ETH.ZKSYNC
      - USDC.AVAX
      - USDC.XLM
      - USDT.DOTHUB
      - USDT.SOL
      - MANA
      - USDC.ALGO
      - MATIC.ETH
      - NEAR
      - UNI
      - USDT.ARBITRUM
      - USDT.AVAX
      - OMG
      - ARB.ARBITRUM
      - COMP.ETH
      - GRT.ETH
      - USDC.POLYGON
      - AVAX
      - AAVE
      - CELO
      - PYUSD.SOL
      - PAXG.ETH
      - USDC.MONAD
      - BAT
      - COMP
      - ETH.ARBITRUM
      - ETH.BASE
      - OP.OPTIMISM
      - TRUMP.SOL
      - ENJ.ETH
      - SUI
      - USDT.ETH
      - USDT.OPTIMISM
      - USDT.TRX
      - USDT.XPL
      - OMG.ETH
      - XRP
      - HBAR
      - USDC.APT
      - USDC.ETH
      - BNB
      - ATOM
      - BAT.ETH
      - GRT
      - LINK.ETH
      - USDP.SOL
      - ZK.ZKSYNC
      - BONK.SOL
      - KNC
      - TIA
      - ZRO.ETH
      - ZRX.ETH
      - PUMP.SOL
      - USD
      - XTZ
      - CRV.ETH
      - GALA.ETH
      - TON
      - USDT.POLYGON
      - WBTC.ETH
      - XPL
      - BTC
      - MON
      - SHIB.ETH
      - USDC.BSC
      - WLD.WORLDCHAIN
      - W.SOL
      - LTC
      - RLUSD.ETH
      - WBTC
      - LINK
      - USDCX.CANTON
      - ETH
      - WIF.SOL
      - APE.ETH
      - EURC
      - MKR.ETH
      - RLUSD.XRP
    QuotedCurrency:
      type: string
      description: the quoted asset
      example: USD
      enum:
      - CAD
      - EUR
      - GBP
      - JPY
      - MXN
      - USD
    Code403:
      type: object
      description: Authentication or authorization failed. `error` is always `true`; `message` explains which check failed (missing API key, bad signature, insufficient permission, etc.).
      required:
      - error
      - message
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: This api key does not have write permission to this endpoint
    Code500:
      type: object
      description: An unexpected error occurred on the server. The request can be retried after a short delay, but the same inputs may reproduce the error.
      required:
      - error
      properties:
        error:
          type: string
          example: Internal Server Error
  parameters:
    Timestamp:
      name: X-SCX-TIMESTAMP
      in: header
      description: Current Unix timestamp in seconds. Must be within 60 seconds of server time or the request is rejected.
      required: true
      schema:
        type: string
        example: '1678901234'
    Signature:
      name: X-SCX-SIGNED
      in: header
      description: HMAC-SHA256 signature of the request, base64-encoded. See the [Authentication guide](https://docs.zerohash.com/reference/api-authentication) for the exact signing formula.
      required: true
      schema:
        type: string
  securitySchemes:
    apiKey:
      type: apiKey
      description: Your API public key. See the [Authentication guide](https://docs.zerohash.com/reference/api-authentication) for how to obtain keys.
      in: header
      name: X-SCX-API-KEY
    apiPassphrase:
      type: apiKey
      description: The passphrase associated with your API key, set when the key was created.
      in: header
      name: X-SCX-PASSPHRASE
x-readme:
  proxy-enabled: false