Upstox Developer API

The Upstox Developer API is a free OAuth 2.0 REST and WebSocket suite for building trading and investment applications against a live SEBI-registered brokerage account. It covers order placement, modification and cancellation (V2 and the newer V3 endpoints with order slicing), multi-order and exit-all-positions batch operations, GTT and trailing-stop-loss conditional orders, portfolio holdings, positions and MTF positions, funds and margin, brokerage and charge calculation, trade-wise profit and loss reporting, market quotes with LTP/OHLC/full depth and option greeks, historical and intraday candle data, expired instrument history for backtesting, option chains and contracts, company fundamentals by ISIN, IPO listing and application, mutual fund orders, SIPs and holdings, fund pay-in and payout management, market information analytics (FII/DII activity, OI, change in OI, max pain, put-call ratio), a kill switch, static IP management for algo-trading compliance, and streaming market-data and portfolio feeds over WebSocket.

Operations 101

PUT /v3/order/modify #
PUT /v3/order/gtt/modify Modify GTT order #
PUT /v2/user/payments/payout/{transaction_id} #
DELETE /v2/user/payments/payout/{transaction_id} #
GET /v2/user/ip #
PUT /v2/user/ip #
PUT /v2/portfolio/convert-position Convert Positions #
PUT /v2/order/modify Modify order #
POST /v3/order/place #
POST /v3/order/gtt/place Place GTT order #
POST /v3/login/auth/token/request/{client_id} Init token API #
GET /v2/user/payments/payout #
POST /v2/user/payments/payout #
GET /v2/user/kill-switch Get kill switch status #
POST /v2/user/kill-switch Update kill switch #
POST /v2/order/positions/exit Exit all positions #
POST /v2/order/place Place order #
POST /v2/order/multi/place Place multi order #
POST /v2/login/authorization/token Get token API #
GET /v2/ipos/orders Get IPO Orders #
POST /v2/ipos/orders Apply for IPO #
POST /v2/events #
POST /v2/charges/margin Calculate Margin #
GET /v3/user/get-funds-and-margin Get User Fund And Margin #
GET /v3/portfolio/mtf-positions Get MTF positions #
GET /v3/order/gtt Get GTT order details #
GET /v3/market-quote/option-greek Market quotes and instruments - Option Greek #
GET /v3/market-quote/ohlc Market quotes and instruments - OHLC quotes #
GET /v3/market-quote/ltp Market quotes and instruments - LTP quotes. #
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 #
GET /v2/user/profile Get profile #
GET /v2/user/payments/payout/modes #
GET /v2/user/payments/payin #
GET /v2/user/get-funds-and-margin Get User Fund And Margin #
GET /v2/trade/profit-loss/metadata Get profit and loss meta data on trades #
GET /v2/trade/profit-loss/data Get Trade-wise Profit and Loss Report Data #
GET /v2/trade/profit-loss/charges Get profit and loss on trades #
GET /v2/portfolio/short-term-positions Get Positions #
GET /v2/portfolio/long-term-holdings Get Holdings #
GET /v2/order/trades Get trades for order #
GET /v2/order/trades/get-trades-for-day Get trades #
GET /v2/order/retrieve-all Get order book #
GET /v2/order/history Get order history #
GET /v2/order/details Get order details #
GET /v2/option/contract Get option contracts #
GET /v2/option/chain Get option chain #
GET /v2/news Get News #
GET /v2/mf/sips Get mutual fund SIPs #
GET /v2/mf/orders Get mutual fund orders #
GET /v2/mf/orders/{order_id} Get mutual fund order by id #
GET /v2/mf/holdings Get mutual fund holdings #
GET /v2/market/timings/{date} Get Exchange Timings on particular date #
GET /v2/market/status/{exchange} Get Market status for particular exchange #
GET /v2/market/smartlist/options Get Smartlist Options #
GET /v2/market/smartlist/mtf Get Smartlist MTF #
GET /v2/market/smartlist/futures Get Smartlist Futures #
GET /v2/market/pcr Get PCR Data #
GET /v2/market/oi Get OI Data #
GET /v2/market/max-pain Get Max Pain Data #
GET /v2/market/holidays Get Holiday list of current year #
GET /v2/market/holidays/{date} Get Holiday on particular date #
GET /v2/market/fii Get FII Data #
GET /v2/market/dii Get DII Data #
GET /v2/market/change-oi Get Change in OI Data #
GET /v2/market-quote/quotes Market quotes and instruments - Full market quotes #
GET /v2/market-quote/ohlc Market quotes and instruments - OHLC quotes #
GET /v2/market-quote/ltp Market quotes and instruments - LTP quotes. #
GET /v2/login/authorization/dialog Authorize API #
GET /v2/ipos Get IPO Listing #
GET /v2/ipos/{id} Get IPO Details #
GET /v2/ipos/orders/{order_id} Get IPO Order #
DELETE /v2/ipos/orders/{order_id} Cancel IPO Order #
GET /v2/instruments/search Search instruments #
GET /v2/historical-candle/{instrumentKey}/{interval}/{to_date} Historical candle data #
GET /v2/historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} Historical candle data #
GET /v2/historical-candle/intraday/{instrumentKey}/{interval} Intra day candle data #
GET /v2/fundamentals/{isin}/share-holdings Get Share Holdings #
GET /v2/fundamentals/{isin}/profile Get Company Profile #
GET /v2/fundamentals/{isin}/key-ratios Get Key Ratios #
GET /v2/fundamentals/{isin}/income-statement Get Income Statement #
GET /v2/fundamentals/{isin}/corporate-actions Get Corporate Actions #
GET /v2/fundamentals/{isin}/cash-flow Get Cash Flow #
GET /v2/fundamentals/{isin}/balance-sheet Get Balance Sheet #
GET /v2/fundamentals/{instrument_key}/competitors Get Competitors #
GET /v2/feed/portfolio-stream-feed Portfolio Stream Feed #
GET /v2/feed/portfolio-stream-feed/authorize Portfolio Stream Feed Authorize #
GET /v2/feed/market-data-feed Market Data Feed #
GET /v2/feed/market-data-feed/authorize Market Data Feed Authorize #
GET /v2/expired-instruments/option/contract Get expired option contracts #
GET /v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date} Expired Historical candle data #
GET /v2/expired-instruments/future/contract Expired instruments - Get future contracts #
GET /v2/expired-instruments/expiries Expired instruments - Get expiries #
GET /v2/charges/historical-trades Get historical trades #
GET /v2/charges/brokerage Brokerage details #
DELETE /v3/order/gtt/cancel Cancel GTT order #
DELETE /v3/order/cancel #
DELETE /v2/order/multi/cancel Cancel multi order #
DELETE /v2/order/cancel Cancel order #
DELETE /v2/logout Logout #

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-developer-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 email required.

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

OpenAPI Specification

upstox-developer-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
- url: https://api-v2.upstox.com
tags:
- name: Login
- name: User
- name: Portfolio
- name: Order
- name: Pre Risk Checks
- name: Market Quote
- name: Market Quote V3
- name: Market Holidays and Timings
- name: Options
- name: Trade Profit And Loss
- name: History
- name: History V3
- name: History V3
  description: Historical Candle Data V3
- name: Charge
- name: Websocket
- name: Post Trade
- name: Expired Instrument
- name: Instruments
- name: News
- name: Mutual Fund
- name: Fundamentals
- name: IPO
- name: PAYMENTS
- name: Events
paths:
  /v3/order/modify:
    put:
      tags:
      - Order
      operationId: modifyOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModifyOrderRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ModifyOrderV3Response'
      security:
      - OAUTH2: []
  /v3/order/gtt/modify:
    put:
      tags:
      - Order
      summary: Modify GTT order
      description: This API allows you to modify GTT orders.
      operationId: modifyGTTOrder
      parameters:
      - name: Origin
        in: header
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GttModifyOrderRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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/GttTriggerOrderResponse'
      security:
      - OAUTH2: []
  /v2/user/payments/payout/{transaction_id}:
    put:
      tags:
      - PAYMENTS
      operationId: modifyPayout
      parameters:
      - name: transaction_id
        in: path
        description: Payout transaction id
        required: true
        schema:
          type: string
        example: imps_0426_7654321
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModifyPayoutRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PayoutDetailsResponse'
      security:
      - OAUTH2: []
    delete:
      tags:
      - PAYMENTS
      operationId: cancelPayout
      parameters:
      - name: transaction_id
        in: path
        description: Payout transaction id
        required: true
        schema:
          type: string
        example: imps_0426_7654321
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PayoutDetailsResponse'
      security:
      - OAUTH2: []
  /v2/user/ip:
    get:
      tags:
      - User
      operationId: getUserIps
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/UserIpResponse'
      security:
      - OAUTH2: []
    put:
      tags:
      - User
      operationId: updateUserIp
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserIpRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/UserIpResponse'
      security:
      - OAUTH2: []
  /v2/portfolio/convert-position:
    put:
      tags:
      - Portfolio
      summary: Convert Positions
      description: Convert the margin product of an open position
      operationId: convertPositions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConvertPositionRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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/ConvertPositionResponse'
        '401':
          description: Authorization Failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
      security:
      - OAUTH2: []
  /v2/order/modify:
    put:
      tags:
      - Order
      summary: Modify order
      description: This API allows you to modify an order. For modification orderId is mandatory. With orderId you need to
        send the optional parameter which needs to be modified. In case the optional parameters aren't sent, the default will
        be considered from the original order
      operationId: modifyOrder_1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModifyOrderRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI100010 - Unknown order id | order request rejected
          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/ModifyOrderResponse'
      security:
      - OAUTH2: []
  /v3/order/place:
    post:
      tags:
      - Order
      operationId: placeOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaceOrderV3Request'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PlaceOrderV3Response'
      security:
      - OAUTH2: []
  /v3/order/gtt/place:
    post:
      tags:
      - Order
      summary: Place GTT order
      description: This API allows you to place GTT orders.
      operationId: placeGTTOrder
      parameters:
      - name: Origin
        in: header
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GttPlaceOrderRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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/GttTriggerOrderResponse'
      security:
      - OAUTH2: []
  /v3/login/auth/token/request/{client_id}:
    post:
      tags:
      - Login
      summary: Init token API
      description: This API provides the initialize the generate token and it's expiry for an indie user
      operationId: initTokenRequestForIndieUser
      parameters:
      - name: client_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndieUserTokenRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1017 - API Key is required <br/>UDAPI1024 - App Secret is required <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/TokenResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
  /v2/user/payments/payout:
    get:
      tags:
      - PAYMENTS
      operationId: getPayoutHistory
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PaymentHistoryResponse'
      security:
      - OAUTH2: []
    post:
      tags:
      - PAYMENTS
      operationId: initiatePayout
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiatePayoutRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/PayoutDetailsResponse'
      security:
      - OAUTH2: []
  /v2/user/kill-switch:
    get:
      tags:
      - User
      summary: Get kill switch status
      description: Returns the disable/enable status of all trading segments for the user.
      operationId: getKillSwitch
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1181 - The specified segment does not exist.
          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/KillSwitchResponse'
      security:
      - OAUTH2: []
    post:
      tags:
      - User
      summary: Update kill switch
      description: Enable or disable specific trading segments.
      operationId: updateKillSwitch
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/KillSwitchSegmentUpdateRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: 'UDAPI1184 - Segment status cannot be changed until all open positions are closed.

            UDAPI1185 - Cannot enable segment - cooling period is still in effect.

            UDAPI1186 - The specified segment does not exist.

            UDAPI1187 - Failed to update segment status due to an error processing open orders.

            UDAPI1188 - Invalid action. Allowed values are ENABLE and DISABLE.'
          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/KillSwitchResponse'
      security:
      - OAUTH2: []
  /v2/order/positions/exit:
    post:
      tags:
      - Order
      summary: Exit all positions
      description: 'This API provides the functionality to exit all the positions '
      operationId: exitPositions
      parameters:
      - name: tag
        in: query
        description: The tag associated with the positions for which the positions must be exit
        required: false
        schema:
          type: string
      - name: segment
        in: query
        description: The segment for which the positions must be exit
        required: false
        schema:
          type: string
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1105 - Invalid segment. <br>UDAPI1108 - No open position available to exit.<br>UDAPI1109 - Available
            open positions should not be more than limit.
          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/CancelOrExitMultiOrderResponse'
      security:
      - OAUTH2: []
  /v2/order/place:
    post:
      tags:
      - Order
      summary: Place order
      description: This API allows you to place an order to the exchange via Upstox.
      operationId: placeOrder_1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaceOrderRequest'
        required: true
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              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/ApiGatewayErrorRespo

# --- truncated at 32 KB (379 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/upstox/refs/heads/main/openapi/upstox-developer-api-openapi.yml