> ## Documentation Index
> Fetch the complete documentation index at: https://whitebit-mintlify-fix-broken-links-1776643999.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create limit order

> Place a spot limit order to buy or sell at a specified price via the WhiteBIT V4 API.

export const RelatedResources = ({children}) => {
  const ref = useRef(null);
  const [visible, setVisible] = useState(false);
  useEffect(() => {
    if (!ref.current) return;
    const el = ref.current;
    if (el.parentElement) {
      el.parentElement.appendChild(el);
    }
    setVisible(true);
  }, []);
  return <div ref={ref} className="related-resources" style={{
    marginTop: "2.5rem",
    paddingTop: "1.5rem",
    borderTop: "1px solid var(--border-color, #e5e7eb)",
    opacity: visible ? 1 : 0,
    transition: "opacity 0.15s ease-in"
  }}>
      <h2 style={{
    marginTop: 0
  }}>Related resources</h2>
      {children}
    </div>;
};

<RelatedResources>
  * [Query unexecuted orders](/api-reference/spot-trading/query-unexecuted-orders) — list open orders
  * [Cancel order](/api-reference/spot-trading/cancel-order) — cancel an open order
  * [Modify order](/api-reference/spot-trading/modify-order) — modify an existing order
  * [Bulk limit order](/api-reference/spot-trading/bulk-limit-order) — place multiple limit orders
</RelatedResources>


## OpenAPI

````yaml /openapi/private/http-trade-v4.yaml POST /api/v4/order/new
openapi: 3.0.3
info:
  title: Private HTTP API V4 - Collateral Trading
  description: |
    WhiteBIT Private HTTP API V4 for collateral/margin trading operations.

    Base URL: https://whitebit.com

    All endpoints return time in Unix-time format.
    All endpoints return either a JSON object or array.
    For receiving responses from API calls please use http method POST.

    Authentication required for all endpoints.
  version: 4.0.0
  license:
    name: WhiteBIT Terms of Service
    url: https://whitebit.com/terms
servers:
  - url: https://whitebit.com
    description: WhiteBIT Global Server
  - url: https://whitebit.eu
    description: WhiteBIT EU Server
security:
  - ApiKeyAuth: []
    PayloadAuth: []
    SignatureAuth: []
tags:
  - name: Collateral Trading
    description: Endpoints for collateral/margin trading operations
  - name: Spot Trading
    description: Endpoints for spot trading operations
  - name: Market Fee
    description: Endpoints for querying trading fees
paths:
  /api/v4/order/new:
    post:
      tags:
        - Spot Trading
      summary: Create Limit Order
      description: >
        The endpoint creates a [limit trading order](/glossary#limit-order). The
        order remains on the order book until filled, cancelled, or expired.
        Minimum and maximum values for `amount` and `price` are market-dependent
        — query `GET /api/v4/public/markets` for per-market constraints.


        **Order validation rules** (per-market, from `GET
        /api/v4/public/markets`):

        - `amount` must have at most `stockPrec` decimal places

        - `price` must have at most `moneyPrec` decimal places

        - `amount` must be ≥ `minAmount`

        - `amount × price` must be ≥ `minTotal`

        - `amount × price` must be ≤ `maxTotal` (when `maxTotal` is not `"0"`)


        <Warning>

        Rate limit: 10000 requests/10 sec.

        </Warning>


        <Note>
          - RPI orders do not appear in public order book feeds (`depth`, `bookTicker`). RPI orders are visible only in private active orders and in the exchange UI order book (web/mobile).
          - RPI orders are post-only by design and cannot be used with the IOC flag. The API returns error code `37` when both `rpi=true` and `ioc=true` are used.
        </Note>


        <Accordion title="Error Codes">
          - `30` - default validation error code
          - `31` - market validation failed
          - `32` - amount validation failed
          - `33` - price validation failed
          - `36` - client_order_id validation failed
          - `37` - `ioc=true` cannot be used with `postOnly=true` or `rpi=true`
        </Accordion>


        <Accordion title="Errors">

        ```json

        {
          "code": 30,
          "message": "Validation failed",
          "errors": {
            "amount": ["Amount field is required."],
            "market": ["Market field is required."],
            "price": ["Price field is required."],
            "side": ["Side field is required."]
          }
        }

        ```


        ```json

        {
          "code": 30,
          "message": "Validation failed",
          "errors": {
            "side": ["Side field should contain only 'buy' or 'sell' values."]
          }
        }

        ```


        ```json

        {
          "code": 32,
          "message": "Validation failed",
          "errors": {
            "amount": ["Amount field should be numeric string or number."]
          }
        }

        ```


        ```json

        {
          "code": 33,
          "message": "Validation failed",
          "errors": {
            "price": ["Price field should be numeric string or number."]
          }
        }

        ```


        ```json

        {
          "code": 31,
          "message": "Validation failed",
          "errors": {
            "market": ["Market is not available."]
          }
        }

        ```


        ```json

        {
          "code": 31,
          "message": "Validation failed",
          "errors": {
            "market": ["Market field should not be empty string."]
          }
        }

        ```


        ```json

        {
          "code": 32,
          "message": "Validation failed",
          "errors": {
            "amount": [
              "Given amount is less than min amount 0.001",
              "Min amount step = 0.000001"
            ]
          }
        }

        ```


        ```json

        {
          "code": 36,
          "message": "Validation failed",
          "errors": {
            "client_order_id": ["ClientOrderId field should be a string."]
          }
        }

        ```


        ```json

        {
          "code": 36,
          "message": "Validation failed",
          "errors": {
            "client_order_id": [
              "ClientOrderId field should contain only latin letters, numbers and dashes."
            ]
          }
        }

        ```


        ```json

        {
          "code": 36,
          "message": "Validation failed",
          "errors": {
            "client_order_id": [
              "This client order id is already used by the current account."
            ]
          }
        }

        ```


        ```json

        {
          "code": 37,
          "message": "Validation failed",
          "errors": {
            "ioc": ["Either IOC or PostOnly flag in true state is allowed."]
          }
        }

        ```


        ```json

        {
          "code": 30,
          "message": "Validation failed",
          "errors": {
            "total": ["Total (amount * price) is less than 5.05"]
          }
        }

        ```


        ```json

        {
          "code": 32,
          "message": "Validation failed",
          "errors": {
            "amount": [
              "Min amount step = 0.01"
            ]
          }
        }

        ```


        ```json

        {
          "code": 33,
          "message": "Validation failed",
          "errors": {
            "price": ["Price field should be at least 10", "Min price step = 0.000001"]
          }
        }

        ```


        ```json

        {
          "code": 33,
          "message": "Validation failed",
          "errors": {
            "price": ["Price should be greater than 0."]
          }
        }

        ```


        ```json

        {
          "code": 35,
          "message": "Validation failed",
          "errors": {
            "maker_fee": ["Incorrect maker fee"]
          }
        }

        ```

        </Accordion>
      operationId: createLimitOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LimitOrderRequest'
      responses:
        '200':
          description: Order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Inner validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily unavailable
      security:
        - ApiKeyAuth: []
          PayloadAuth: []
          SignatureAuth: []
components:
  schemas:
    LimitOrderRequest:
      type: object
      required:
        - market
        - side
        - amount
        - price
        - request
        - nonce
      properties:
        market:
          type: string
          description: >-
            Trading pair. Format: `BASE_QUOTE` (e.g., `BTC_USDT`). Query `GET
            /api/v4/public/markets` for available markets.
          example: BTC_USDT
        side:
          type: string
          enum:
            - buy
            - sell
          description: 'Order side. Allowed values: `buy`, `sell`.'
          example: buy
        amount:
          type: string
          description: >-
            Order quantity in base (stock) currency. Minimum and maximum values
            are market-dependent. Query `GET /api/v4/public/markets` for
            `minAmount`, `minTotal`, `maxTotal`. Precision: `stockPrec`.
          example: '0.001'
        price:
          type: string
          description: >-
            Limit price per unit in quote (money) currency. Minimum and maximum
            values are market-dependent. Precision: `moneyPrec`.
          example: '9800'
        client_order_id:
          type: string
          description: >-
            Custom client order identifier. The identifier must be unique per
            account and contain only letters, numbers, dashes, dots, or
            underscores.
          example: order1987111
        postOnly:
          type: boolean
          default: false
          description: >-
            Post-only flag. When `true`, the order executes only as a
            [maker](/glossary#maker) order and the system rejects the order if
            it would match immediately. Default: `false`.
          example: false
        ioc:
          type: boolean
          default: false
          description: >
            Immediate-or-cancel (IOC) flag. When `true`, the matching engine
            executes all or part of the order immediately and cancels any
            unfilled portion. Default: `false`.


            IOC does not support `rpi=true` because RPI uses post-only behavior
            by design.

            The API returns error code `37` when a request sets both `ioc=true`
            and `rpi=true`.


            Refer to [Order Parameter Rules](/guides/order-parameter-rules) for
            unsupported parameter combinations.
          example: false
        bboRole:
          type: integer
          enum:
            - 1
            - 2
          description: >-
            Best Bid/Offer ([BBO](/glossary#bbo)) execution method. The system
            selects the best market price for execution. `1` = Queue method, `2`
            = Counterparty method. Use method `2` with the `ioc` flag.
        stp:
          type: string
          enum:
            - 'no'
            - cancel_both
            - cancel_new
            - cancel_old
          default: 'no'
          description: >-
            Self-trade prevention mode. Allowed values: `no`, `cancel_both`,
            `cancel_new`, `cancel_old`. Default: `no`.
          example: 'no'
        rpi:
          type: boolean
          default: false
          description: >
            Enables Retail Price Improvement (RPI) mode. Default: `false`.


            RPI orders use post-only behavior by design. An RPI order does not
            support `ioc=true`.

            The API returns error code `37` when a request sets both `rpi=true`
            and `ioc=true`.

            RPI orders do not appear in public order book feeds (`depth`,
            `bookTicker`). RPI orders are visible only in private active orders
            and in the exchange UI order book (web/mobile).

            RPI executions may apply custom fees or rebates, especially when
            trading via sub-accounts. Use Query Market Fee / Query All Market
            Fees to verify effective fees.


            Refer to [Order Parameter Rules](/guides/order-parameter-rules) for
            unsupported parameter combinations.
          example: true
        request:
          type: string
          example: '{{request}}'
        nonce:
          type: string
          example: '{{nonce}}'
    OrderResponse:
      type: object
      properties:
        order_id:
          type: integer
          description: Unique identifier assigned to the order by the matching engine.
          example: 4180284841
        client_order_id:
          type: string
          description: >-
            Custom client order identifier supplied in the request. Returns an
            empty string when not specified.
          example: order1987111
        market:
          type: string
          description: 'Trading pair for the order. Format: `BASE_QUOTE` (e.g., `BTC_USDT`).'
          example: BTC_USDT
        side:
          type: string
          description: 'Order side. Possible values: `buy`, `sell`.'
          example: buy
        type:
          type: string
          description: >-
            Order type. Possible values: `limit`, `market`, `stock market`,
            `stop limit`, `stop market`.
          example: limit
        timestamp:
          type: number
          description: >-
            Unix timestamp in seconds (UTC) of order creation, with microsecond
            precision.
          example: 1595792396.165973
        deal_money:
          type: string
          description: >-
            Filled amount in quote currency. Returns `"0"` while the order
            remains unfilled.
          example: '0'
        deal_stock:
          type: string
          description: >-
            Filled amount in base currency. Returns `"0"` while the order
            remains unfilled.
          example: '0'
        amount:
          type: string
          description: >-
            Order quantity in base currency for limit and stop-limit orders, or
            in quote currency for buy market orders.
          example: '0.01'
        left:
          type: string
          description: >-
            Remaining unfilled quantity. Equals `amount` for new orders and
            `"0"` for fully filled orders.
          example: '0.001'
        deal_fee:
          type: string
          description: >-
            Cumulative trading fee charged for filled portions, denominated in
            the fee asset.
          example: '0'
        price:
          type: string
          description: >-
            Limit price per unit in quote currency. Returns `"0"` for market
            orders.
          example: '40000'
        postOnly:
          type: boolean
          description: >-
            Post-only flag. When `true`, the order executes only as a maker
            order and is rejected if it would match immediately. Default:
            `false`.
          example: false
        ioc:
          type: boolean
          description: >-
            Immediate-or-cancel flag. When `true`, the order executes available
            quantity immediately and cancels the unfilled remainder. Default:
            `false`.
          example: false
        status:
          $ref: '#/components/schemas/OrderStatus'
        stp:
          type: string
          description: >-
            Self-trade prevention mode. Possible values: `no`, `cancel_both`,
            `cancel_new`, `cancel_old`. Default: `no`.
          example: 'no'
        positionSide:
          type: string
          description: Position side (for collateral orders)
          example: LONG
        rpi:
          type: boolean
          description: Indicates Retail Price Improvement (RPI) mode for the order.
          example: true
        reduceOnly:
          type: boolean
          description: >-
            Reduce-only flag. When `true`, the order can only reduce or close an
            existing position. See [reduce-only](/glossary#reduce-only).
          example: false
        activated:
          type: integer
          description: >-
            Activation status of the stop order. 0 = not yet triggered (waiting
            for the activation_price condition to be met). 1 = triggered (the
            stop condition has been met and the order is now active).
          example: 0
        activationCondition:
          type: string
          enum:
            - lte
            - gte
          description: >-
            Condition that triggers the stop order. "lte" = activate when the
            market price falls to or below activation_price. "gte" = activate
            when the market price rises to or above activation_price.
          example: lte
        activation_price:
          type: string
          description: >-
            The trigger price for the stop order. Always equals the
            activation_price value submitted in the request.
          example: '40000'
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: Error code
          example: 30
        message:
          type: string
          description: Error message
          example: Validation failed
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Detailed error information
    OrderStatus:
      type: string
      description: >-
        Order lifecycle status. `NEW` — accepted, not yet matched. `FILLED` —
        fully executed. `CANCELED` — canceled before execution. `PARTIAL_FILLED`
        — partially executed, remainder still active. `PARTIAL_CANCELED` —
        partially filled, remainder canceled. `CANCELED_TAKER_BAND` — partially
        filled up to the taker band limit, remainder canceled to protect against
        excessive order book slippage. `AUTO_CANCELED_REDUCE_ONLY` — pending
        reduce-only order auto-canceled because the associated position was
        closed.
      example: FILLED
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-TXC-APIKEY
      description: The public WhiteBIT API key.
    PayloadAuth:
      type: apiKey
      in: header
      name: X-TXC-PAYLOAD
      description: Base64-encoded JSON request body.
    SignatureAuth:
      type: apiKey
      in: header
      name: X-TXC-SIGNATURE
      description: >-
        HMAC-SHA512 signature of the payload, hex-encoded. Computed as
        hex(HMAC-SHA512(payload, api_secret)).

````