Upstox History V3 API

Historical Candle Data V3

Operations 3

GET /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date} Historical candle data #
GET /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}/{from_date} Historical candle data #
GET /v3/historical-candle/intraday/{instrumentKey}/{unit}/{interval} Intra day candle data #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/upstox-history-v3-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

upstox-history-v3-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAPI definition History V3 API
  version: v0
  description: Historical Candle Data V3
servers:
- url: https://api-v2.upstox.com
tags:
- name: History V3
  description: Historical Candle Data V3
paths:
  /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}:
    get:
      tags:
      - History V3
      summary: Historical candle data
      description: Get OHLC values for all instruments for the present trading day with expanded interval options.
      operationId: getHistoricalCandleData
      parameters:
      - name: instrumentKey
        in: path
        required: true
        schema:
          type: string
          pattern: ^(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+(,(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+)*?$
      - name: unit
        in: path
        required: true
        schema:
          type: string
          pattern: ^(minutes|hours|days|weeks|months)$
      - name: interval
        in: path
        required: true
        schema:
          type: integer
          format: int32
      - name: to_date
        in: path
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: 'UDAPI1015 - to_date must be greater than or equal to from_date and Date should be in valid format: yyyy-mm-dd<br>UDAPI1021 - Instrument key is of invalid format<br>UDAPI1022 - to_date is required<br>UDAPI1146 - Invalid unit<br>UDAPI1147 - Invalid interval<br>UDAPI100011 - Invalid Instrument key'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '500':
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '423':
          description: Locked
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '429':
          description: Too Many Requests
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetHistoricalCandleResponse'
  /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}/{from_date}:
    get:
      tags:
      - History V3
      summary: Historical candle data
      description: Get OHLC values for all instruments for the present trading day with expanded interval options
      operationId: getHistoricalCandleData_1
      parameters:
      - name: instrumentKey
        in: path
        required: true
        schema:
          type: string
          pattern: ^(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+(,(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+)*?$
      - name: unit
        in: path
        required: true
        schema:
          type: string
          pattern: ^(minutes|hours|days|weeks|months)$
      - name: interval
        in: path
        required: true
        schema:
          type: integer
          format: int32
      - name: to_date
        in: path
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
      - name: from_date
        in: path
        required: true
        schema:
          type: string
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: 'UDAPI1015 - to_date must be greater than or equal to from_date and Date should be in valid format: yyyy-mm-dd<br>UDAPI1021 - Instrument key is of invalid format<br>UDAPI1022 - to_date is required<br>UDAPI1146 - Invalid unit<br>UDAPI1147 - Invalid interval<br>UDAPI1148 - Invalid date range<br>UDAPI100011 - Invalid Instrument key'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '500':
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '423':
          description: Locked
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '429':
          description: Too Many Requests
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetHistoricalCandleResponse'
  /v3/historical-candle/intraday/{instrumentKey}/{unit}/{interval}:
    get:
      tags:
      - History V3
      summary: Intra day candle data
      description: Get OHLC values for all instruments for the present trading day
      operationId: getIntraDayCandleData
      parameters:
      - name: instrumentKey
        in: path
        required: true
        schema:
          type: string
          pattern: ^(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+(,(?:NSE_EQ|NSE_FO|NCD_FO|BSE_EQ|BSE_FO|BCD_FO|MCX_FO|NSE_INDEX|BSE_INDEX|MCX_INDEX|NSE_COM|GLOBAL_INDEX|GLOBAL_INDICATOR)\|[\w ^]+)*?$
      - name: unit
        in: path
        required: true
        schema:
          type: string
          pattern: ^(minutes|hours|days)$
      - name: interval
        in: path
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1021 - Instrument key is of invalid format<br>UDAPI1146 - Invalid unit<br>UDAPI1147 - Invalid interval<br>UDAPI100011 - Invalid Instrument key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '500':
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '423':
          description: Locked
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '429':
          description: Too Many Requests
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetIntraDayCandleResponse'
components:
  schemas:
    GetHistoricalCandleResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          $ref: '#/components/schemas/HistoricalCandleData'
          description: Get OHLC values for all instruments across various timeframes
    GetIntraDayCandleResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          $ref: '#/components/schemas/IntraDayCandleData'
          description: Get OHLC values for all instruments across various timeframes
    IntraDayCandleData:
      type: object
      properties:
        candles:
          type: array
          example: '[[<br>        "2022-11-21T00:00:00+05:30",<br>        37.4,<br>        37.8,<br>        36.95,<br>        37.6,<br>        5539471,<br>        0<br>      ]]'
          items:
            type: array
            items: {}
          readOnly: true
    HistoricalCandleData:
      type: object
      properties:
        candles:
          type: array
          example: '[[<br>        "2022-11-21T00:00:00+05:30",<br>        37.4,<br>        37.8,<br>        36.95,<br>        37.6,<br>        5539471,<br>        0<br>      ]]'
          items:
            type: array
            items: {}
          readOnly: true
    Problem:
      type: object
      properties:
        errorCode:
          type: string
          deprecated: true
          description: Unique code for the error state
        message:
          type: string
          description: Verbose message for the error state
        propertyPath:
          type: string
          deprecated: true
          description: Path to property failing validation
        invalidValue:
          deprecated: true
          description: Invalid value for the property failing validation
        error_code:
          type: string
        property_path:
          type: string
        invalid_value: {}
    ApiGatewayErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    OAUTH2:
      type: oauth2
      scheme: BEARER
      flows:
        authorizationCode:
          authorizationUrl: https://api-v2.upstox.com/v2/login/authorization/dialog
          tokenUrl: https://api-v2.upstox.com/v2/login/authorization/token
          scopes:
            read: Read access
            write: Write access