curl --request POST \
--url https://whitebit.com/api/v4/order/collateral/limit \
--header 'Content-Type: application/json' \
--header 'X-TXC-APIKEY: <api-key>' \
--header 'X-TXC-PAYLOAD: <api-key>' \
--header 'X-TXC-SIGNATURE: <api-key>' \
--data '
{
"market": "BTC_USDT",
"side": "buy",
"amount": "0.01",
"price": "40000",
"postOnly": false,
"ioc": false,
"clientOrderId": "order1987111",
"stopLoss": "50000",
"takeProfit": "30000",
"positionSide": "LONG",
"rpi": true,
"reduceOnly": false,
"request": "{{request}}",
"nonce": 1594297865000
}
'import requests
url = "https://whitebit.com/api/v4/order/collateral/limit"
payload = {
"market": "BTC_USDT",
"side": "buy",
"amount": "0.01",
"price": "40000",
"postOnly": False,
"ioc": False,
"clientOrderId": "order1987111",
"stopLoss": "50000",
"takeProfit": "30000",
"positionSide": "LONG",
"rpi": True,
"reduceOnly": False,
"request": "{{request}}",
"nonce": 1594297865000
}
headers = {
"X-TXC-APIKEY": "<api-key>",
"X-TXC-PAYLOAD": "<api-key>",
"X-TXC-SIGNATURE": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-TXC-APIKEY': '<api-key>',
'X-TXC-PAYLOAD': '<api-key>',
'X-TXC-SIGNATURE': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
market: 'BTC_USDT',
side: 'buy',
amount: '0.01',
price: '40000',
postOnly: false,
ioc: false,
clientOrderId: 'order1987111',
stopLoss: '50000',
takeProfit: '30000',
positionSide: 'LONG',
rpi: true,
reduceOnly: false,
request: '{{request}}',
nonce: 1594297865000
})
};
fetch('https://whitebit.com/api/v4/order/collateral/limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://whitebit.com/api/v4/order/collateral/limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'market' => 'BTC_USDT',
'side' => 'buy',
'amount' => '0.01',
'price' => '40000',
'postOnly' => false,
'ioc' => false,
'clientOrderId' => 'order1987111',
'stopLoss' => '50000',
'takeProfit' => '30000',
'positionSide' => 'LONG',
'rpi' => true,
'reduceOnly' => false,
'request' => '{{request}}',
'nonce' => 1594297865000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-TXC-APIKEY: <api-key>",
"X-TXC-PAYLOAD: <api-key>",
"X-TXC-SIGNATURE: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://whitebit.com/api/v4/order/collateral/limit"
payload := strings.NewReader("{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-TXC-APIKEY", "<api-key>")
req.Header.Add("X-TXC-PAYLOAD", "<api-key>")
req.Header.Add("X-TXC-SIGNATURE", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://whitebit.com/api/v4/order/collateral/limit")
.header("X-TXC-APIKEY", "<api-key>")
.header("X-TXC-PAYLOAD", "<api-key>")
.header("X-TXC-SIGNATURE", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whitebit.com/api/v4/order/collateral/limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-TXC-APIKEY"] = '<api-key>'
request["X-TXC-PAYLOAD"] = '<api-key>'
request["X-TXC-SIGNATURE"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}"
response = http.request(request)
puts response.read_body{
"orderId": 4180284841,
"clientOrderId": "order1987111",
"market": "BTC_USDT",
"side": "buy",
"type": "limit",
"timestamp": 1595792396.165973,
"dealMoney": "0",
"dealStock": "0",
"amount": "0.01",
"left": "0.001",
"dealFee": "0",
"price": "40000",
"postOnly": false,
"ioc": false,
"status": "FILLED",
"stp": "no",
"oto": {
"otoId": 29457221,
"stopLoss": "30000",
"takeProfit": "50000"
},
"positionSide": "LONG",
"rpi": true,
"reduceOnly": false
}{
"code": 30,
"message": "Validation failed",
"errors": {}
}Collateral limit order
The endpoint creates a limit order using collateral balance. The order executes at the specified price or better. Use buy to open or increase a long position and sell to open or increase a short position. To close a position, place an opposite-side order matching the position amount.
Order validation rules (per-market, from GET /api/v4/public/markets):
amountmust have at moststockPrecdecimal placespricemust have at mostmoneyPrecdecimal placesamountmust be ≥minAmountamount × pricemust be ≥minTotalamount × pricemust be ≤maxTotal(whenmaxTotalis not"0")
Price and amount steps: from September 18, 2026, price and an attached stopLoss or takeProfit price must be multiples of the market tickSize, and amount a multiple of stepSize. See Price and amount steps.
Rate limit: 10000 requests/10 sec.
For open long position use buy, for short sell. To close current position, place opposite order with current position amount.
- RPI orders are post-only by design and cannot be used with the IOC flag. The API returns error code
40when bothrpi=trueandioc=trueare used. retail=truemarks the order as a retail-source taker eligible to match RPI-maker liquidity. The Retail flag must be enabled on the account; contact the account manager to enable it.retail=trueandrpi=truecannot be combined. The API returns error code41when both flags are set.retail=truehas no effect on apostOnly=trueorder. Post-only orders are makers and cannot be retail takers.
curl --request POST \
--url https://whitebit.com/api/v4/order/collateral/limit \
--header 'Content-Type: application/json' \
--header 'X-TXC-APIKEY: <api-key>' \
--header 'X-TXC-PAYLOAD: <api-key>' \
--header 'X-TXC-SIGNATURE: <api-key>' \
--data '
{
"market": "BTC_USDT",
"side": "buy",
"amount": "0.01",
"price": "40000",
"postOnly": false,
"ioc": false,
"clientOrderId": "order1987111",
"stopLoss": "50000",
"takeProfit": "30000",
"positionSide": "LONG",
"rpi": true,
"reduceOnly": false,
"request": "{{request}}",
"nonce": 1594297865000
}
'import requests
url = "https://whitebit.com/api/v4/order/collateral/limit"
payload = {
"market": "BTC_USDT",
"side": "buy",
"amount": "0.01",
"price": "40000",
"postOnly": False,
"ioc": False,
"clientOrderId": "order1987111",
"stopLoss": "50000",
"takeProfit": "30000",
"positionSide": "LONG",
"rpi": True,
"reduceOnly": False,
"request": "{{request}}",
"nonce": 1594297865000
}
headers = {
"X-TXC-APIKEY": "<api-key>",
"X-TXC-PAYLOAD": "<api-key>",
"X-TXC-SIGNATURE": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-TXC-APIKEY': '<api-key>',
'X-TXC-PAYLOAD': '<api-key>',
'X-TXC-SIGNATURE': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
market: 'BTC_USDT',
side: 'buy',
amount: '0.01',
price: '40000',
postOnly: false,
ioc: false,
clientOrderId: 'order1987111',
stopLoss: '50000',
takeProfit: '30000',
positionSide: 'LONG',
rpi: true,
reduceOnly: false,
request: '{{request}}',
nonce: 1594297865000
})
};
fetch('https://whitebit.com/api/v4/order/collateral/limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://whitebit.com/api/v4/order/collateral/limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'market' => 'BTC_USDT',
'side' => 'buy',
'amount' => '0.01',
'price' => '40000',
'postOnly' => false,
'ioc' => false,
'clientOrderId' => 'order1987111',
'stopLoss' => '50000',
'takeProfit' => '30000',
'positionSide' => 'LONG',
'rpi' => true,
'reduceOnly' => false,
'request' => '{{request}}',
'nonce' => 1594297865000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-TXC-APIKEY: <api-key>",
"X-TXC-PAYLOAD: <api-key>",
"X-TXC-SIGNATURE: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://whitebit.com/api/v4/order/collateral/limit"
payload := strings.NewReader("{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-TXC-APIKEY", "<api-key>")
req.Header.Add("X-TXC-PAYLOAD", "<api-key>")
req.Header.Add("X-TXC-SIGNATURE", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://whitebit.com/api/v4/order/collateral/limit")
.header("X-TXC-APIKEY", "<api-key>")
.header("X-TXC-PAYLOAD", "<api-key>")
.header("X-TXC-SIGNATURE", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whitebit.com/api/v4/order/collateral/limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-TXC-APIKEY"] = '<api-key>'
request["X-TXC-PAYLOAD"] = '<api-key>'
request["X-TXC-SIGNATURE"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": \"BTC_USDT\",\n \"side\": \"buy\",\n \"amount\": \"0.01\",\n \"price\": \"40000\",\n \"postOnly\": false,\n \"ioc\": false,\n \"clientOrderId\": \"order1987111\",\n \"stopLoss\": \"50000\",\n \"takeProfit\": \"30000\",\n \"positionSide\": \"LONG\",\n \"rpi\": true,\n \"reduceOnly\": false,\n \"request\": \"{{request}}\",\n \"nonce\": 1594297865000\n}"
response = http.request(request)
puts response.read_body{
"orderId": 4180284841,
"clientOrderId": "order1987111",
"market": "BTC_USDT",
"side": "buy",
"type": "limit",
"timestamp": 1595792396.165973,
"dealMoney": "0",
"dealStock": "0",
"amount": "0.01",
"left": "0.001",
"dealFee": "0",
"price": "40000",
"postOnly": false,
"ioc": false,
"status": "FILLED",
"stp": "no",
"oto": {
"otoId": 29457221,
"stopLoss": "30000",
"takeProfit": "50000"
},
"positionSide": "LONG",
"rpi": true,
"reduceOnly": false
}{
"code": 30,
"message": "Validation failed",
"errors": {}
}453. See all details in Order types — Regional restrictions.Authorizations
Body
Available margin market. Example: BTC_USDT
"BTC_USDT"
Amount of stock currency to buy or sell. Minimum and step values are market-dependent — query the market info endpoint for constraints.
"0.01"
Limit order price in money currency. Minimum price step is market-dependent — query the market info endpoint for constraints.
"40000"
Custom client order identifier. Uniqueness is enforced only among the account's open (pending) orders on the same market — once a previous order is filled or canceled, the same identifier can be reused, including on the same market. Contains only letters, numbers, dashes, dots, or underscores.
"order1987111"
Stop loss price.
When provided, the system creates an OTO order with a stop loss condition.
"50000"
Take profit price.
When provided, the system creates an OTO order with a take profit condition.
"30000"
When true, guarantees the order executes as a maker order. The system rejects the order if it would immediately match as taker. Default: false.
false
Retail-source taker flag. When true, the order is eligible to match against orders submitted by RPI makers and may receive price improvement at execution. Default: false.
The Retail flag must be enabled on the account before a private-API request can set retail=true. The API returns error code 42 when the flag is not enabled. Contact the account manager to enable the Retail flag.
The Retail flag cannot be combined with rpi. The API returns error code 41 when a request sets both retail=true and rpi=true.
The flag has no effect on a postOnly=true order. Post-only orders are makers; only takers carry the retail designation.
Refer to Retail flag and Order Parameter Rules for unsupported parameter combinations.
false
Position direction. Optional at the request layer but functionally required when hedge mode is enabled. See positionSide.
- One-way mode (default account mode): the field is ignored. Orders always use
BOTH, and the response returnspositionSide: "BOTH"whether the field is sent or omitted. - Hedge mode: the field MUST be
LONGorSHORT. SendingBOTH, omitting the field, or sending a value that does not match the account's mode causes the trade service to reject the order with error code114(Hedge mode position side does not match).
LONG, SHORT, BOTH "LONG"
When true, the order can only reduce or close an existing position — the order cannot increase the position or open a new one. If the order amount exceeds the current position size, the system reduces the order to match — the response returns the adjusted amount. Cannot be combined with stopLoss or takeProfit. The API returns error code 116 if no open position exists or the order side matches the position direction. See reduce-only.
false
Self-trade prevention mode. Allowed values: no (self-trades allowed), cb (cancel both the new and the existing order), cn (cancel the new order, keep the existing), co (cancel the existing order, place the new one). Default: no.
Legacy values cancel_both, cancel_new, cancel_old are deprecated: the API accepts the legacy values with identical behavior until a deprecation deadline is announced, then rejects the legacy values. Responses always return the abbreviated form, regardless of which variant the request used.
no, cb, cn, co "no"
Response
Successful response - order created
Order status. FILLED — fully executed. PARTIALLY_FILLED — partially executed, remainder still active. CANCELED — canceled before full execution. REST uses the single-L spelling CANCELED; the double-L CANCELLED and the WebSocket-only NEW state are not returned by this API.
FILLED, PARTIALLY_FILLED, CANCELED "FILLED"
Retail-source taker flag. The field is present only when the order was placed with retail=true. See Retail flag.
true
Was this page helpful?