HitBTC Futures Positions API

The Futures Positions API from HitBTC — 3 operation(s) for futures positions.

Operations 3

POST /futures/position/leverage Set leverage #
DELETE /futures/position Close futures margin positions #
DELETE /futures/position/{margin_mode}/{symbol} Close a futures margin position #

Documentation

Specifications

Schemas & Data

Work with this as data

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

MCP server

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

https://apis.io/mcp

Tools for apis

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

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/hitbtc:hitbtc-futures-positions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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

hitbtc-futures-positions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Hitbtc Futures Positions API
  version: ''
  description: 'Operations tagged Futures Positions across 2 of this provider''s published API definitions: hitbtc-api-v3-spec.yaml, hitbtc-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: /api/3
- url: https://api.hitbtc.com/api/3
  description: Production; the served spec declares the relative server /api/3 and the docs at api.hitbtc.com name this host
- url: https://api.demo.hitbtc.com/api/3
  description: Demo Environment (Sandbox), per api.hitbtc.com docs
tags:
- name: Futures Positions
paths:
  /futures/position/leverage:
    post:
      deprecated: true
      tags:
      - Futures Positions
      summary: Set leverage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/trading_SetLeverageRequest'
              - $ref: '#/components/schemas/trading_Contract'
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/trading_SetLeverageRequest'
              - $ref: '#/components/schemas/trading_Contract'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/trading_FuturesPosition'
                  - $ref: '#/components/schemas/trading_Currency'
                  - $ref: '#/components/schemas/trading_ReportReason'
                  - $ref: '#/components/schemas/trading_Contract'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_NotAvailable'
                - $ref: '#/components/schemas/trading_ExchangeClosed'
                - $ref: '#/components/schemas/trading_SymbolExpired'
                - $ref: '#/components/schemas/trading_UnknownMarginMode'
                - $ref: '#/components/schemas/trading_InvalidUserLeverage'
        '401':
          $ref: '#/components/responses/trading_401'
        '403':
          $ref: '#/components/responses/trading_403'
        '406':
          description: Not Acceptable
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_SymbolExpired'
                - $ref: '#/components/schemas/trading_MarginTradingIsDisabled'
                - $ref: '#/components/schemas/trading_CcNoMoney'
                - $ref: '#/components/schemas/trading_NoAvailableMargin'
                - $ref: '#/components/schemas/trading_PositionBlocked'
                - $ref: '#/components/schemas/trading_PositionIsCloseOnly'
        '500':
          description: Interval Server Error
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_Internal'
                - $ref: '#/components/schemas/trading_ResponseFormatter'
        '504':
          $ref: '#/components/responses/trading_504'
        default:
          $ref: '#/components/responses/trading_Error'
      description: '**Permission**: Place/cancel orders


        **IP limit**: 300/450'
      security:
      - trading_BasicAuth: []
      - trading_BearerAuth: []
      operationId: postFuturesPositionLeverage
      x-operation-id-source: derived
    servers:
    - url: /api/3
  /futures/position:
    delete:
      tags:
      - Futures Positions
      summary: Close futures margin positions
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/trading_FuturesPosition'
                  - $ref: '#/components/schemas/trading_Contract'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_NotAvailable'
                - $ref: '#/components/schemas/trading_ExchangeClosed'
                - $ref: '#/components/schemas/trading_SymbolExpired'
        '401':
          $ref: '#/components/responses/trading_401'
        '403':
          $ref: '#/components/responses/trading_403'
        '406':
          description: Not Acceptable
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_SymbolExpired'
                - $ref: '#/components/schemas/trading_MarginTradingIsDisabled'
                - $ref: '#/components/schemas/trading_CcNoMoney'
                - $ref: '#/components/schemas/trading_PositionNotOpened'
                - $ref: '#/components/schemas/trading_PositionBlocked'
        '500':
          description: Interval Server Error
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_Internal'
                - $ref: '#/components/schemas/trading_ResponseFormatter'
        '504':
          $ref: '#/components/responses/trading_504'
        default:
          $ref: '#/components/responses/trading_Error'
      description: '**Permission**: Place/cancel orders


        **IP limit**: 300/450'
      security:
      - trading_BasicAuth: []
      - trading_BearerAuth: []
      operationId: deleteFuturesPosition
      x-operation-id-source: derived
    servers:
    - url: /api/3
  /futures/position/{margin_mode}/{symbol}:
    delete:
      tags:
      - Futures Positions
      summary: Close a futures margin position
      parameters:
      - $ref: '#/components/parameters/trading_MarginModePath'
      - $ref: '#/components/parameters/trading_SymbolPath'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/trading_ClosePositionRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/trading_ClosePositionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/trading_FuturesPosition'
                - $ref: '#/components/schemas/trading_Contract'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_InvalidPrice'
                - $ref: '#/components/schemas/trading_BadPrice'
                - $ref: '#/components/schemas/trading_NotAvailable'
                - $ref: '#/components/schemas/trading_SymbolNotFound'
                - $ref: '#/components/schemas/trading_ExchangeClosed'
                - $ref: '#/components/schemas/trading_PositionNotOpened'
                - $ref: '#/components/schemas/trading_SymbolExpired'
                - $ref: '#/components/schemas/trading_UnknownMarginMode'
        '401':
          $ref: '#/components/responses/trading_401'
        '403':
          $ref: '#/components/responses/trading_403'
        '406':
          description: Not Acceptable
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/trading_SymbolExpired'
                - $ref: '#/components/schemas/trading_MarginTradingIsDisabled'
                - $ref: '#/components/schemas/trading_PositionNotOpened'
                - $ref: '#/components/schemas/trading_PositionBlocked'
        '500':
          $ref: '#/components/responses/trading_500'
        '504':
          $ref: '#/components/responses/trading_504'
        default:
          $ref: '#/components/responses/trading_Error'
      description: '**Permission**: Place/cancel orders


        **IP limit**: 300/450'
      security:
      - trading_BasicAuth: []
      - trading_BearerAuth: []
      operationId: deleteFuturesPositionByMarginModeBySymbol
      x-operation-id-source: derived
    servers:
    - url: /api/3
components:
  schemas:
    trading_PositionBlocked:
      title: Position blocked
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Position has the `blocked` status.

        '
      example:
        error:
          code: 20051
          message: Margin trading forbidden
    trading_ResponseFormatter:
      title: Formatter error
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Any of:

        * the position symbol is not found when returning the response;

        * a margin balance currency is not found when returning the response.

        '
      example:
        error:
          code: 500
          message: Internal error
          description: response formatter error
    trading_BadFormatHS256:
      title: Bad format (HS256)
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Any of:

        * missing required parameters;

        * the maximum time window is exceeded.

        '
      example:
        error:
          code: 1004
          message: Unsupported authorization method
    trading_MarginModeCommon:
      title: Margin mode
      type: string
      enum:
      - cross
      - Cross
      - isolated
      - Isolated
      description: Margin mode.
    trading_NotAvailable:
      title: Not available
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Trading on the requested market is not available.

        '
      example:
        error:
          code: 20044
          message: Trading operation not allowed
    trading_PositionBase:
      title: Margin position
      type: object
      required:
      - id
      - symbol
      - margin_mode
      - quantity
      - price_entry
      - price_margin_call
      - price_liquidation
      - pnl
      - created_at
      - updated_at
      - status
      - required_margin
      - orders_margin
      - margin_auto
      - amr
      properties:
        id:
          type: integer
          format: uint64
          description: Position identifier.
          example: 1408
        symbol:
          type: string
          description: Symbol code.
          example: BTCUSDT
        margin_mode:
          $ref: '#/components/schemas/trading_MarginModeCommon'
        quantity:
          type: string
          description: Position quantity.
          example: '0.00007'
        price_entry:
          type: string
          description: Average weighted price of position open orders.
          example: '33304.11'
        price_margin_call:
          type: string
          description: Margin call price.
          example: '25395.20'
        price_liquidation:
          type: string
          description: Liquidation price.
          example: '24884.62'
        pnl:
          type: string
          description: Unrealized profit and loss.
          example: '0.014772687500'
        fee_cumulative:
          type: string
          description: "Total amount of fees paid throughout the position lifetime until it\n is closed.\n\nFormat: Decimal\n\nValues: `0` if a new position created\n\n⚠️ This value does zero out after the position closes  and does not\n when it flips.\n"
          example: '0.14'
        created_at:
          type: string
          format: date-time
          description: Position creation date and time.
          example: '2024-03-22T17:26:10.758Z'
        updated_at:
          type: string
          format: date-time
          description: Position last update date and time.
          example: '2024-03-22T21:20:03.64Z'
        status:
          type: string
          enum:
          - normal
          - blocked
          - closeOnly
          description: "Position status.\n\nValues:\n* `normal`—the client can place and cancel orders, amend and change\n  the margin;\n* `blocked`—the client cannot place orders on either side;\n* `closeOnly`—the client may only place orders to close the\n  position.\n"
        required_margin:
          type: string
          description: 'Amount of currency reserved for close orders.

            '
          example: '1.126441946273'
        orders_margin:
          type: string
          description: 'Amount of currency reserved for open orders.

            '
          example: '0'
        margin_call:
          type: boolean
          description: 'Flag indicating whether additional margin is required to maintain the position.

            '
        margin_auto:
          type: boolean
          description: "Flag indicating whether AMM (auto margin management) is enabled for\n the position.\n"
        amr:
          type: boolean
          description: "Current value of the AMR (auto margin replenishment) flag of the\n position.\n"
    trading_UnauthorizedBasic:
      title: Unauthorized (Basic)
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Any of:

        * invalid API key;

        * user is not allowed to perform the requested operation.

        '
      example:
        error:
          code: 1002
          message: Authorization is required or has been failed
    trading_PositionIsCloseOnly:
      title: Position is close-only
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'The position price has reached the margin-call mark and open orders are

        no longer allowed.

        '
      example:
        error:
          code: 20034
          message: Position in close only state
    trading_ReportReason:
      title: Report reason
      required:
      - report_reason
      properties:
        report_reason:
          type: string
          enum:
          - created
          - openTrade
          - closeTrade
          - flipTrade
          - updated
          - marginChanged
          - closed
          - status
          - liquidated
          - interestTaken
          - liquidationTrade
          - fundingTaken
          - deleveraged
          - deleverageTrade
          - leverageChanged
          - amrChanged
          description: "Position report reason.\n\nValues:\n* `created`—new position has been created as a result of the first\n  set margin request;\n* `openTrade`—opening trade has been executed;\n* `closeTrade`—closing trade has been executed;\n* `flipTrade`—position has been flipped as a result of an opposite\n  order execution with quantity exceeding the position quantity;\n* `updated`—position has been changed as a result of either order\n  placing, canceling, position status changing, or a \"margin call\";\n* `marginChanged`—position margin has been added or withdrawn as a\n  result of any subsequent set margin request (refer to `created`);\n* `closed`—position quantity has zeroed as a result of a close\n  trade;\n* `status`—response to a position request;\n* `liquidated`—position has been closed as a result of a liquidation\n  trade (including one during auto-deleveraging);\n* `interestTaken`—interest rate has been paid;\n* `liquidationTrade`—liquidation order has been placed;\n* `fundingTaken`—funding has been paid/taken;\n* `deleveraged`—position has been deleveraged;\n* `deleverageTrade`—a part of position quantity has been\n  deleveraged;\n* `leverageChanged`—leverage of a futures position has been changed;\n* `amrChanged`—the value of the AMR (auto margin replenishment) flag\n  has changed.\n"
    trading_StrictValidateRequest:
      title: Strict validate
      type: object
      properties:
        strict_validate:
          type: boolean
          description: Price and quantity will be checked for incrementation within the symbol tick size and quantity step (see the symbol `tick_size` and `quantity_increment`).
          default: false
    trading_UnknownMarginMode:
      title: Unknown margin mode
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Invalid margin mode.

        '
      example:
        error:
          code: 2025
          message: Unknown margin mode
    trading_FuturesPosition:
      title: Margin position
      allOf:
      - $ref: '#/components/schemas/trading_Leverage'
      - $ref: '#/components/schemas/trading_FuturesPositionBase'
    trading_SymbolCommon:
      title: Symbol
      type: string
      description: Symbol code.
    trading_Contract:
      title: Contract
      example:
        symbol: BTCUSDT_PERP
    trading_ExchangeClosed:
      title: Exchange closed
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Exchange is temporary closed.

        '
      example:
        error:
          code: 20010
          message: Exchange temporary closed
    trading_Error:
      title: Error
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: integer
              format: int
            message:
              type: string
            description:
              type: string
    trading_SetLeverageRequest:
      title: Set leverage request
      allOf:
      - $ref: '#/components/schemas/trading_LeverageRequest'
      - $ref: '#/components/schemas/trading_StrictValidateRequest'
      - type: object
        required:
        - symbol
        - margin_mode
        - leverage
        properties:
          symbol:
            type: string
            description: Symbol code.
            example: BTCUSDT_PERP
          margin_mode:
            $ref: '#/components/schemas/trading_MarginModeCommon'
        example: '10.00'
    trading_UnauthorizedJWT:
      title: Unauthorized (Bearer)
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Invalid JWT.

        '
      example:
        error:
          code: 1002
          message: Authorization is required or has been failed
    trading_Internal:
      title: Internal Server Error
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: Unclassified internal error.
      example:
        error:
          code: 500
          message: Internal Server Error
    trading_SymbolNotFound:
      title: Symbol not found
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'The symbol featured in the request has not been found.

        '
      example:
        error:
          code: 2001
          message: Symbol not found
    trading_PositionNotOpened:
      title: Position not opened
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Requested position is not open (has `0` quantity).

        '
      example:
        error:
          code: 20032
          message: Margin account of position not found
    trading_Leverage:
      title: Leverage
      type: object
      required:
      - leverage
      properties:
        leverage:
          type: string
          description: 'Leverage—the ratio of the user own funds to funds borrowed from the

            platform.

            '
          example: '12.00'
    trading_UnauthorizedHS256:
      title: Unauthorized (HS256)
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Any of:

        * invalid API key;

        * user is not allowed to perform the requested operation;

        * invalid time window value;

        * invalid HMAC signature format;

        * invalid HMAC signature value.

        '
      example:
        error:
          code: 1002
          message: Authorization is required or has been failed
    trading_Forbidden:
      title: Forbidden
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: "Any of:\n* insufficient API key permissions;\n* provided IP address is not in the white list;\n* the user is not eligible for the given liquidity pool due to the\n  configuration.\n"
      example:
        error:
          code: 1003
          message: Action is forbidden for this API key
    trading_StrictValidateCommon:
      title: Strict validate
      type: boolean
      default: false
      description: Price and quantity will be checked for incrementation within the symbol tick size and quantity step (see the symbol `tick_size` and `quantity_increment`).
    trading_InvalidPrice:
      title: Invalid price
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Invalid price value.


        Any of:

        * price is not a decimal with a dot as the separator;

        * maximum bit depth is exceeded;

        * price is less or equal to zero.

        '
      example:
        error:
          code: 2020
          message: Price is not a valid decimal
    trading_RequestTimeout:
      title: Request Timeout
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Operation was canceled.

        '
      example:
        error:
          code: 504
          message: Request Timeout
    trading_BadFormat:
      title: Bad format
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Provided parameters do not meet any supported authentication scheme.

        '
      example:
        error:
          code: 1004
          message: Unsupported authorization method
    trading_CcNoMoney:
      title: No funds on CCA
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Order placing exceeds the central counterparty balance limit.

        '
      example:
        error:
          code: 20047
          message: Borrowing pool exhausted for requested currency
    trading_SymbolExpired:
      title: Symbol expired
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Trades on the given symbol are suspended.

        '
      example:
        error:
          code: 20046
          message: Exchange symbol is expired
    trading_InvalidUserLeverage:
      title: Invalid user leverage
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Invalid leverage value.

        '
      example:
        error:
          code: 10024
          message: Invalid user leverage
    trading_Currency:
      title: Currency
      type: object
      required:
      - currency
      properties:
        currency:
          $ref: '#/components/schemas/trading_CurrencyCommon'
    trading_FuturesPositionBase:
      title: Margin position
      allOf:
      - $ref: '#/components/schemas/trading_PositionBase'
      - properties:
          sum_fundings:
            type: string
            description: 'Sum of all settled funding to a position.

              '
            example: '0'
          adl_ranking:
            type: string
            description: 'Rank of a position which defines how appropriate a position is

              to be used for closing bankrupt positions avoided liquidation.


              The rank represents the probability of a position becoming

              deleveraged: a high rank value signifies a high probability,

              and vice versa.


              Values: 0 – 4

              '
            example: '0'
    trading_ClosePositionRequest:
      title: Close position request
      type: object
      properties:
        price:
          type: number
          exclusiveMinimum: 0
          description: Position close price.
          example: 27001.99
        strict_validate:
          $ref: '#/components/schemas/trading_StrictValidateCommon'
    trading_BadPrice:
      title: Bad price
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Invalid price format.

        '
      example:
        error:
          code: 2022
          message: Bad price
    trading_CurrencyCommon:
      title: Currency
      type: string
      description: Currency code.
      example: USDT
    trading_MarginTradingIsDisabled:
      title: Margin trading is disabled
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Margin trading is forbidden for the user.

        '
      example:
        error:
          code: 20040
          message: Margin trading forbidden
    trading_NoAvailableMargin:
      title: Limit exceeded
      schema:
        $ref: '#/components/schemas/trading_Error'
      type: object
      description: 'Position does not have enough margin to remove (set margin request),

        place/replace an order, or satisfy the requested leverage.

        '
      example:
        error:
          code: 20003
          message: Limit exceeded
    trading_LeverageRequest:
      title: Leverage
      type: object
      properties:
        leverage:
          type: string
          description: 'User leverage.


            Format: decimal with up to 2 digits after the dot


            Values: > 0


            ⚠️ Leverage can be declined if the resulting position value violates risk limit.

            '
  parameters:
    trading_SymbolPath:
      name: symbol
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/trading_SymbolCommon'
    trading_MarginModePath:
      name: margin_mode
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/trading_MarginModeCommon'
  responses:
    trading_401:
      description: Unauthorized
      content:
        application/json:
          schema:
            oneOf:
            - $ref: '#/components/schemas/trading_UnauthorizedBasic'
            - $ref: '#/components/schemas/trading_UnauthorizedHS256'
            - $ref: '#/components/schemas/trading_UnauthorizedJWT'
            - $ref: '#/components/schemas/trading_BadFormat'
            - $ref: '#/components/schemas/trading_BadFormatHS256'
    trading_500:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/trading_Internal'
    trading_403:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/trading_Forbidden'
    trading_504:
      description: Gateway Timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/trading_RequestTimeout'
    trading_Error:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/trading_Error'
  securitySchemes:
    wallet_BasicAuth:
      type: http
      description: Provide a public key as the username and a secret key as the password.
      scheme: basic
    wallet_BearerAuth:
      type: http
      description: Provide a bearer token obtained from the authentication service.
      scheme: bearer
      bearerFormat: JWT
    trading_BasicAuth:
      type: http
      description: Provide a public key as the username and a secret key as the password.
      scheme: basic
    trading_BearerAuth:
      type: http
      description: Provide a bearer token obtained from the authentication service.
      scheme: bearer
      bearerFormat: JWT
x-refined-from:
- hitbtc-api-v3-spec.yaml
- hitbtc-openapi.yml