Create Order
Place a new spot order on the exchange.
HTTP
| Method | POST |
| Endpoint | /trade/api/v2/order |
| Rate limit | 100 requests per 10 seconds |
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
side | string | Yes | buy or sell (case-insensitive). |
symbol | string | Yes | BASE/QUOTE, e.g. BTC/USDT, BTC/INR. |
type | string | Yes | Order type. Currently only LIMIT is supported. |
price | number | Yes | Limit price. |
quantity | number | Yes | Base asset quantity to buy or sell. |
exchange | string | Yes | See Exchange Identifiers. |
client_order_id | string | No | Your idempotency key. Send a UUID you generate; if a network blip forces a retry, send the same value and we'll de-duplicate instead of placing twice. Echoed back in order responses and the order-updates socket. |
expiry_period | integer | No | Order TTL in seconds. Default 90. Longer TTLs reduce false-cancel rates if a fast quote moves away briefly; shorter TTLs let you react sooner. |
Use Trade Info to fetch the min/max order size and the right precision for price and quantity before submitting. For retry-safe placement, see the idempotency pattern.
Example
- Python
- Java
- Go
- Node.js
import requests
body = {
"side": "sell",
"symbol": "BTC/USDT",
"type": "limit",
"price": 26000,
"quantity": 0.0009,
"exchange": "c2c1",
}
headers, path = sign_request("POST", "/trade/api/v2/order")
response = requests.post(BASE_URL + path, headers=headers, json=body)
print(response.json())
import java.math.BigDecimal;
HashMap<String, Object> body = new HashMap<>();
body.put("side", "sell");
body.put("symbol", "BTC/USDT");
body.put("type", "limit");
body.put("price", new BigDecimal("26000"));
body.put("quantity", new BigDecimal("0.0009"));
body.put("exchange", "c2c1");
HttpResponse<String> resp = client.send(
"POST", "/trade/api/v2/order", null, body);
System.out.println(resp.body());
body := map[string]any{
"side": "sell",
"symbol": "BTC/USDT",
"type": "limit",
"price": 26000,
"quantity": 0.0009,
"exchange": "c2c1",
}
bodyJSON, _ := json.Marshal(body)
headers, p, err := SignRequest("POST", "/trade/api/v2/order", nil)
if err != nil { panic(err) }
req, _ := http.NewRequest("POST", BaseURL+p, bytes.NewReader(bodyJSON))
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const body = {
"side": "sell",
"symbol": "BTC/USDT",
"type": "limit",
"price": 26000,
"quantity": 0.0009,
"exchange": "c2c1",
};
const {headers, path} = signRequest('POST', '/trade/api/v2/order');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
console.log(await r.json());
Response
{
"data": {
"order_id": "927db2d9-643c-47a3-9c0f-78741ac95cf5",
"symbol": "BTC/USDT",
"price": 26000,
"average_price": 0,
"orig_qty": 0.0009,
"executed_qty": 0,
"status": "OPEN",
"side": "SELL",
"exchange": "c2c1",
"order_source": "API_TRADING",
"created_time": 1689661638000,
"updated_time": 1689661639000
}
}
Response Parameters
| Field | Type | Description |
|---|---|---|
order_id | string | CoinSwitch order ID (UUID). |
symbol | string | Symbol echoed back. |
price | number | Limit price you placed. |
average_price | number | Average fill price. 0 until any fill occurs. |
orig_qty | number | Original base quantity placed. |
executed_qty | number | Base quantity filled so far. |
status | string | One of the values in Order Lifecycle. |
side | string | BUY or SELL (uppercase in response). |
exchange | string | Exchange the order was routed to. |
order_source | string | Always API_TRADING for orders placed via this API. |
created_time | integer | Order creation time (Unix milliseconds). |
updated_time | integer | Last update time (Unix milliseconds). |
Errors
| HTTP | Body | Cause |
|---|---|---|
422 | {"message":"Input price must be of type number"} | Validation failed. Check parameter types. |
400 | {"message":"Amount is more than available balance"} | Insufficient balance for the order's notional value. |
401 | {"message":"Invalid Access"} | Bad signature, expired epoch, or wrong API key. See Authentication. |