Upstox Expired Instrument API

The Expired Instrument API from Upstox — 4 operation(s) for expired instrument.

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /v2/expired-instruments/option/contract List expired option contracts for an underlying · Get expired option contracts #
Ask an LLM
“How do I find option contracts that have already expired for an index?”
“Which Nifty option strikes existed for an expiry that is now past?”
Tell an agent
List the expired option contracts for {instrument_key} that expired on {expiry_date}.
Get every expired call and put for underlying {instrument_key} at expiry {expiry_date}.
GET /v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date} Get historical candles for an expired contract · Expired Historical candle data #
Ask an LLM
“How do I get OHLC candles for a futures or options contract that has already expired?”
“Can I backtest on 1-minute bars of an expired option?”
Tell an agent
Get {interval} candles for expired contract {expired_instrument_key} from {from_date} to {to_date}.
Pull the OHLC history of expired instrument {expired_instrument_key} at {interval} between {from_date} and {to_date}.
GET /v2/expired-instruments/future/contract List expired futures contracts for an underlying · Expired instruments - Get future contracts #
Ask an LLM
“Where can I find futures contracts that expired on a past date?”
“What futures contract keys existed for an underlying at a given past expiry?”
Tell an agent
List the expired futures contracts for {instrument_key} with expiry {expiry_date}.
Find the expired future on underlying {instrument_key} that settled on {expiry_date}.
GET /v2/expired-instruments/expiries List past expiry dates for an instrument · Expired instruments - Get expiries #
Ask an LLM
“Which expiry dates are available for historical data on an underlying?”
“How do I find out what past expiries exist before querying expired contracts?”
Tell an agent
List all the expiry dates available for {instrument_key}.
Show me which past expiries I can query for underlying {instrument_key}.

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:upstox-expired-instrument-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-expired-instrument-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAPI definition Expired Instrument API
  version: v0
servers:
- url: https://api-v2.upstox.com
tags:
- name: Expired Instrument
paths:
  /v2/expired-instruments/option/contract:
    get:
      tags:
      - Expired Instrument
      summary: Get expired option contracts
      description: This API provides the functionality to retrieve the expired option contracts
      operationId: getExpiredOptionContracts
      parameters:
      - name: instrument_key
        in: query
        description: Instrument key for an underlying symbol
        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 ^]+)*?$
        example: NSE_INDEX|Nifty 50
      - name: expiry_date
        in: query
        description: 'Expiry date in format: YYYY-mm-dd'
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
        example: '2024-02-01'
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: ''
          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/GetOptionContractResponse'
      security:
      - OAUTH2: []
  /v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date}:
    get:
      tags:
      - Expired Instrument
      summary: Expired Historical candle data
      description: 'Get Expired OHLC values for all instruments across various timeframes. Expired Historical data can be fetched for the following durations.

        1minute: last 1 month candles till endDate

        30minute: last 1 year candles till endDate

        day: last 1 year candles till endDate

        week: last 10 year candles till endDate

        month: last 10 year candles till endDate'
      operationId: getExpiredHistoricalCandleData
      parameters:
      - name: expired_instrument_key
        in: path
        description: Expired Instrument Key of asset
        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)\|[\w\d\-]+\|(0[1-9]|[12]\d|3[01])-(0[1-9]|1[012])-(\d{4})$
        example: NSE_EQ|INE848E01016|24-04-2025
      - name: interval
        in: path
        description: Interval to get expired ohlc data
        required: true
        schema:
          type: string
          pattern: ^(1minute|3minute|5minute|15minute|30minute|day)$
        example: day
      - name: to_date
        in: path
        description: to date
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
        example: '2025-01-01'
      - name: from_date
        in: path
        description: from date
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
        example: '2024-01-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>UDAPI1020 - Interval accepts one of (1minute,30minute,day,week,month)<br>UDAPI1021 - Instrument key is of invalid format<br>UDAPI1022 - to_date is required<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'
      security:
      - OAUTH2: []
  /v2/expired-instruments/future/contract:
    get:
      tags:
      - Expired Instrument
      summary: Expired instruments - Get future contracts
      description: This API provides the functionality to retrieve expired future contracts for a given instrument key and expiry date.
      operationId: getExpiredFutureContracts
      parameters:
      - name: instrument_key
        in: query
        description: Instrument Key of asset
        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 ^]+)*?$
        example: NSE_EQ|INE848E01016
      - name: expiry_date
        in: query
        description: Expiry date of the instrument
        required: true
        schema:
          type: string
          pattern: ^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
        example: '2023-10-05'
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1009 - instrument_key is required<br>UDAPI1011 - instrument_key is of invalid format<br>UDAPI100011 - Invalid Instrument key<br>
          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/GetExpiredFuturesContractResponse'
      security:
      - OAUTH2: []
  /v2/expired-instruments/expiries:
    get:
      tags:
      - Expired Instrument
      summary: Expired instruments - Get expiries
      description: This API provides the functionality to retrieve expiry dates for a given instrument key.
      operationId: getExpiriesResponse
      parameters:
      - name: instrument_key
        in: query
        description: Instrument Key of asset
        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 ^]+)*?$
        example: NSE_EQ|INE848E01016
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1009 - instrument_key is required<br>UDAPI1011 - instrument_key is of invalid format<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/GetExpiriesResponse'
      security:
      - OAUTH2: []
components:
  schemas:
    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: {}
    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
    ExpiredFutureData:
      type: object
      properties:
        name:
          type: string
          description: Name of the instrument
          example: NIFTY
        segment:
          type: string
          description: Segment of the instrument
          example: NSE_FO
        exchange:
          type: string
          description: Exchange of the instrument
          example: NSE
        expiry:
          type: string
          description: Expiry date of the instrument
          example: '2024-12-26'
        instrument_key:
          type: string
          description: Unique key identifying the instrument
          example: NSE_FO|35005
        exchange_token:
          type: string
          description: Token assigned by the exchange
          example: 35005
        trading_symbol:
          type: string
          description: Symbol used for trading
          example: NIFTY FUT 26 DEC 24
        tick_size:
          type: number
          format: double
          description: Minimum price movement
          example: 5
        lot_size:
          type: integer
          format: int64
          description: Number of units per lot
          example: 25
        instrument_type:
          type: string
          description: Type of the instrument
          example: FUT
        freeze_quantity:
          type: number
          format: double
          description: Maximum allowed quantity
          example: 1800
        underlying_key:
          type: string
          description: Key of the underlying asset
          example: NSE_INDEX|Nifty 50
        underlying_type:
          type: string
          description: Type of the underlying asset
          example: INDEX
        underlying_symbol:
          type: string
          description: Symbol of the underlying asset
          example: NIFTY
        minimum_lot:
          type: integer
          format: int64
          description: Minimum lot size
          example: 25
    GetExpiriesResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          type: array
          items:
            type: string
    GetOptionContractResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          type: array
          description: Response data for option contracts
          items:
            $ref: '#/components/schemas/InstrumentData'
    InstrumentData:
      type: object
      properties:
        name:
          type: string
        segment:
          type: string
        exchange:
          type: string
        isin:
          type: string
        expiry:
          type: string
          format: date-time
        country:
          type: string
        latency:
          type: string
        description:
          type: string
        currency:
          type: string
        weekly:
          type: boolean
        instrument_key:
          type: string
        exchange_token:
          type: string
        trading_symbol:
          type: string
        short_name:
          type: string
        tick_size:
          type: number
          format: double
        lot_size:
          type: integer
          format: int64
        instrument_type:
          type: string
        freeze_quantity:
          type: number
          format: double
        underlying_key:
          type: string
        underlying_type:
          type: string
        underlying_symbol:
          type: string
        last_trading_date:
          type: string
          format: date-time
        strike_price:
          type: number
          format: double
        price_quote_unit:
          type: string
        qty_multiplier:
          type: integer
          format: int64
        minimum_lot:
          type: integer
          format: int64
        start_time:
          type: string
        end_time:
          type: string
        week_days:
          type: string
        general_denominator:
          type: number
          format: double
        general_numerator:
          type: number
          format: double
        price_numerator:
          type: number
          format: double
        price_denominator:
          type: number
          format: double
        mtf_enabled:
          type: boolean
        mtf_bracket:
          type: number
          format: double
        security_type:
          type: string
        cas_eligible:
          type: boolean
    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
    ApiGatewayErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Problem'
    GetExpiredFuturesContractResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          type: array
          items:
            $ref: '#/components/schemas/ExpiredFutureData'
  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
x-provenance:
  method: harvested
  publisher: Upstox
  source: https://api-v2.upstox.com/api-docs
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)