Upstox User API

The User API from Upstox — 5 operation(s) for user.

Operations 7

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/user/ip Get my registered static IPs · Get user ips #
Ask an LLM
“Which static IP addresses are registered for my API orders?”
“What primary and secondary IPs are whitelisted on my account?”
Tell an agent
Show my registered static IPs.
List the primary and secondary IPs on my account.
PUT /v2/user/ip Update my registered static IPs · Update user ip #
Ask an LLM
“How do I register a new static IP for placing orders through the API?”
“Can I set a secondary IP as a backup?”
Tell an agent
Set my primary IP to {primary_ip}.
Register {primary_ip} as primary and {secondary_ip} as secondary IP.
GET /v2/user/kill-switch Check kill switch status by segment · Get kill switch status #
Ask an LLM
“Which trading segments have I disabled with the kill switch?”
“Is trading currently blocked on any segment of my account?”
Tell an agent
Show my kill switch status for every segment.
Tell me which segments are enabled or disabled for trading.
POST /v2/user/kill-switch Enable or disable trading segments · Update kill switch #
Ask an LLM
“How do I turn on the kill switch to stop myself trading F&O?”
“Can I re-enable a trading segment I switched off?”
Tell an agent
Turn on the kill switch for these segments.
Re-enable trading on the segments I previously disabled.
GET /v3/user/get-funds-and-margin Get detailed funds and margin breakdown (v3) · Get User Fund And Margin #
Ask an LLM
“How much of my balance is pledged margin versus cash available to trade?”
“Why is part of my money unavailable to trade?”
Tell an agent
Show my detailed v3 funds breakdown.
Break down my cash, pledged margin and available-to-trade balance.
GET /v2/user/profile Get my account profile · Get profile #
Ask an LLM
“Which exchanges, products and order types are enabled on my account?”
“What profile details does Upstox hold for the logged-in user?”
Tell an agent
Show my user profile.
List the exchanges and products enabled for me.
GET /v2/user/get-funds-and-margin Get funds and margin by segment (v2) · Get User Fund And Margin #
Ask an LLM
“How much money do I have for equity versus commodity trading?”
“What's my available margin in the commodity segment?”
Tell an agent
Show my equity and commodity funds.
Get my available margin for segment {segment}.

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-user-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-user-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenAPI definition User API
  version: v0
servers:
- url: https://api-v2.upstox.com
tags:
- name: User
paths:
  /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: []
      summary: Get user ips
      x-summary-source: derived
    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: []
      summary: Update user ip
      x-summary-source: derived
  /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: []
  /v3/user/get-funds-and-margin:
    get:
      tags:
      - User
      summary: Get User Fund And Margin
      description: Shows the detailed balance breakdown of the user including cash, pledged margin, available-to-trade, and unavailable-to-trade components.
      operationId: getUserFundMarginV3
      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/GetUserFundMarginV3Response'
      security:
      - OAUTH2: []
  /v2/user/profile:
    get:
      tags:
      - User
      summary: Get profile
      description: This API allows to fetch the complete information of the user who is logged in including the products, order types and exchanges enabled for the user
      operationId: getProfile
      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/GetProfileResponse'
      security:
      - OAUTH2: []
  /v2/user/get-funds-and-margin:
    get:
      tags:
      - User
      summary: Get User Fund And Margin
      description: Shows the balance of the user in equity and commodity market.
      operationId: getUserFundMargin
      parameters:
      - name: segment
        in: query
        required: false
        schema:
          type: string
          enum:
          - SEC
          - COM
      responses:
        '405':
          description: Method Not Allowed
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiGatewayErrorResponse'
        '400':
          description: UDAPI1019 - segment is invalid
          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/GetUserFundMarginResponse'
      security:
      - OAUTH2: []
components:
  schemas:
    UserIpResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          $ref: '#/components/schemas/UserIpResponseData'
          description: Current IP configuration.
    UserFundMarginData:
      type: object
      properties:
        used_margin:
          type: number
          format: float
          description: "Positive values denote the amount blocked into an Open order or position. \nNegative value denotes the amount being released."
          example: 120.01
          readOnly: true
        payin_amount:
          type: number
          format: float
          description: Instant payin will reflect here
          example: 0
          readOnly: true
        span_margin:
          type: number
          format: float
          description: Amount blocked on futures and options towards SPAN
          example: 0
          readOnly: true
        adhoc_margin:
          type: number
          format: float
          description: Payin amount credited through a manual process
          example: 0
          readOnly: true
        notional_cash:
          type: number
          format: float
          description: The amount maintained for withdrawal
          example: 0
          readOnly: true
        available_margin:
          type: number
          format: float
          description: Total margin available for trading
          example: 200.0
          readOnly: true
        exposure_margin:
          type: number
          format: float
          description: Amount blocked on futures and options towards Exposure
          example: 0
          readOnly: true
    CashUnavailableToTrade:
      type: object
      properties:
        unsettled_profit:
          $ref: '#/components/schemas/UnsettledProfit'
    GetProfileResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          $ref: '#/components/schemas/ProfileData'
          description: Response data for user profile
    PledgeMarginUsed:
      type: object
      properties:
        total:
          type: number
          format: float
        mtf:
          type: number
          format: float
        span_exposure:
          type: number
          format: float
        cash_margin_var_elm:
          type: number
          format: float
        premium_present:
          type: number
          format: float
        delivery_margin:
          $ref: '#/components/schemas/DeliveryMargin'
    MarginFromPledge:
      type: object
      properties:
        total:
          type: number
          format: float
        equity:
          type: number
          format: float
        mutual_funds:
          type: number
          format: float
    UserIpResponseData:
      type: object
      properties:
        primary_ip:
          type: string
        secondary_ip:
          type: string
        primary_ip_updated_at:
          type: string
          description: ISO-8601 timestamp when primary IP was last changed.
        secondary_ip_updated_at:
          type: string
          description: ISO-8601 timestamp when secondary IP was last changed.
        primary_ip_family_members:
          type: array
          items:
            $ref: '#/components/schemas/FamilyMemberData'
        secondary_ip_family_members:
          type: array
          items:
            $ref: '#/components/schemas/FamilyMemberData'
        access_tokens_invalidated:
          type: boolean
    ProfileData:
      type: object
      properties:
        email:
          type: string
          description: E-mail address of the user
          example: client@email.com
          readOnly: true
        exchanges:
          type: array
          description: Lists the exchanges to which the user has access
          example: NSE
          items:
            type: string
            enum:
            - NSE
            - NFO
            - CDS
            - BSE
            - BFO
            - BCD
            - MCX
            - NSCOM
          readOnly: true
        products:
          type: array
          description: Lists the products types to which the user has access
          example: D
          items:
            type: string
            enum:
            - I
            - D
            - CO
            - OCO
            - MTF
          readOnly: true
        broker:
          type: string
          description: The broker ID
          example: UPSTOX
          readOnly: true
        user_id:
          type: string
          description: Uniquely identifies the user
          example: 202251
          readOnly: true
        user_name:
          type: string
          description: Name of the user
          example: client
          readOnly: true
        order_types:
          type: array
          description: Order types enabled for the user
          example: LIMIT
          items:
            type: string
            enum:
            - MARKET
            - LIMIT
            - SL
            - SL-M
          readOnly: true
        user_type:
          type: string
          description: "\t\nIdentifies the user's registered role at the broker. This will be individual for all retail users"
          example: individual
          readOnly: true
        poa:
          type: boolean
          description: "\t\nTo depict if the user has given power of attorney for transactions"
          example: true
          readOnly: true
        ddpi:
          type: boolean
          description: "\t\nIndicates if DDPI is enabled for trading"
          example: true
          readOnly: true
        is_active:
          type: boolean
          description: "\t\nWhether the status of account is active or not"
          example: true
          readOnly: true
    KillSwitchResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          type: array
          items:
            $ref: '#/components/schemas/KillSwitchSegmentData'
    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: {}
    CashBreakdown:
      type: object
      properties:
        opening_balance:
          type: number
          format: float
        added_today:
          type: number
          format: float
        withdrawn_today:
          type: number
          format: float
        amount_from_stock_sale:
          type: number
          format: float
        unpaid_charges:
          type: number
          format: float
    KillSwitchSegmentUpdateRequest:
      type: object
      properties:
        segment:
          type: string
          enum:
          - BSE_EQ
          - NSE_EQ
          - NCD_FO
          - BCD_FO
          - NSE_FO
          - BSE_FO
          - BSE_MF
          - MCX_FO
          - NSE_COM
        action:
          type: string
          enum:
          - ENABLE
          - DISABLE
      required:
      - action
      - segment
    PledgeUnavailableToTrade:
      type: object
      properties:
        equity:
          type: number
          format: float
        mutual_funds:
          type: number
          format: float
    UpdateUserIpRequest:
      type: object
      properties:
        primary_ip:
          type: string
        secondary_ip:
          type: string
    KillSwitchSegmentData:
      type: object
      properties:
        segment:
          type: string
        segment_status:
          type: string
          enum:
          - ACTIVE
          - INACTIVE
        kill_switch_enabled:
          type: boolean
    GetUserFundMarginResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/UserFundMarginData'
          description: Response data for Balance
    Loss:
      type: object
      properties:
        total:
          type: number
          format: float
        realised:
          type: number
          format: float
        unrealised:
          type: number
          format: float
    FamilyMemberData:
      type: object
      properties:
        user_id:
          type: string
        name:
          type: string
    UnavailableToTrade:
      type: object
      properties:
        cash_unavailable_to_trade:
          $ref: '#/components/schemas/CashUnavailableToTrade'
        pledge_unavailable_to_trade:
          $ref: '#/components/schemas/PledgeUnavailableToTrade'
    GetUserFundMarginV3Response:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        data:
          $ref: '#/components/schemas/UserFundMarginV3Data'
          description: Response data for fund and margin v3
    DeliveryMargin:
      type: object
      properties:
        total:
          type: number
          format: float
        equity:
          type: number
          format: float
        fo_settlement:
          type: number
          format: float
    AvailableToTrade:
      type: object
      properties:
        total:
          type: number
          format: float
        cash_available_to_trade:
          $ref: '#/components/schemas/CashAvailableToTrade'
        pledge_available_to_trade:
          $ref: '#/components/schemas/PledgeAvailableToTrade'
    CashAvailableToTrade:
      type: object
      properties:
        total:
          type: number
          format: float
        cash:
          $ref: '#/components/schemas/CashBreakdown'
        margin_used:
          $ref: '#/components/schemas/CashMarginUsed'
    CashMarginUsed:
      type: object
      properties:
        total:
          type: number
          format: float
        mtf:
          type: number
          format: float
        loss:
          $ref: '#/components/schemas/Loss'
        span_exposure:
          type: number
          format: float
        cash_margin_var_elm:
          type: number
          format: float
        premium_present:
          type: number
          format: float
        delivery_margin:
          $ref: '#/components/schemas/DeliveryMargin'
    PledgeAvailableToTrade:
      type: object
      properties:
        margin_from_pledge:
          $ref: '#/components/schemas/MarginFromPledge'
        margin_used:
          $ref: '#/components/schemas/PledgeMarginUsed'
    ApiGatewayErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - success
          - error
          - partial_success
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Problem'
    UnsettledProfit:
      type: object
      properties:
        todays_profit:
          type: number
          format: float
        previous_days:
          type: number
          format: float
    UserFundMarginV3Data:
      type: object
      properties:
        available_to_trade:
          $ref: '#/components/schemas/AvailableToTrade'
        unavailable_to_trade:
          $ref: '#/components/schemas/UnavailableToTrade'
  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)