Place a new order
Submits a signed limit or market order for a subaccount, specifying instrument, direction, amount, limit price and max fee, plus optional flags like time-in-force, reduce-only, post-only and MMP. The same endpoint also creates trigger orders (via trigger_type/trigger_price) and algo orders (via algo_type), though the two cannot be combined in one request. Requires a signed order payload and Orderbook trade scope for the instrument’s asset; returns the created order with its assigned id and current status.
curl --request POST \
--url https://api.derive.xyz/v3/private/order \
--header 'Content-Type: application/json' \
--data '
{
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"algo_duration_sec": null,
"algo_num_slices": null,
"algo_type": "twap",
"client": null,
"extra_fee": null,
"is_atomic_signing": null,
"label": null,
"mmp": null,
"order_type": "limit",
"reduce_only": null,
"referral_code": null,
"reject_post_only": null,
"reject_timestamp": null,
"time_in_force": "gtc",
"trigger_price": null
}
'import requests
url = "https://api.derive.xyz/v3/private/order"
payload = {
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"algo_duration_sec": None,
"algo_num_slices": None,
"algo_type": "twap",
"client": None,
"extra_fee": None,
"is_atomic_signing": None,
"label": None,
"mmp": None,
"order_type": "limit",
"reduce_only": None,
"referral_code": None,
"reject_post_only": None,
"reject_timestamp": None,
"time_in_force": "gtc",
"trigger_price": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '<string>',
instrument_name: '<string>',
limit_price: '<string>',
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
algo_duration_sec: null,
algo_num_slices: null,
algo_type: 'twap',
client: null,
extra_fee: null,
is_atomic_signing: null,
label: null,
mmp: null,
order_type: 'limit',
reduce_only: null,
referral_code: null,
reject_post_only: null,
reject_timestamp: null,
time_in_force: 'gtc',
trigger_price: null
})
};
fetch('https://api.derive.xyz/v3/private/order', 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://api.derive.xyz/v3/private/order",
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([
'amount' => '<string>',
'instrument_name' => '<string>',
'limit_price' => '<string>',
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'algo_duration_sec' => null,
'algo_num_slices' => null,
'algo_type' => 'twap',
'client' => null,
'extra_fee' => null,
'is_atomic_signing' => null,
'label' => null,
'mmp' => null,
'order_type' => 'limit',
'reduce_only' => null,
'referral_code' => null,
'reject_post_only' => null,
'reject_timestamp' => null,
'time_in_force' => 'gtc',
'trigger_price' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.derive.xyz/v3/private/order"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.derive.xyz/v3/private/order")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}"
response = http.request(request)
puts response.read_body{
"order": {
"amount": "<string>",
"average_price": "<string>",
"creation_timestamp": 123,
"extra_fee": "<string>",
"filled_amount": "<string>",
"instrument_name": "<string>",
"is_transfer": true,
"last_update_timestamp": 123,
"limit_price": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"order_fee": "<string>",
"order_id": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"replaced_order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"signature_expiry_sec": 123,
"signed_limit_price": "<string>",
"signer": "<string>",
"subaccount_id": 123,
"trigger_price": "<string>",
"algo_duration_sec": 123,
"algo_num_slices": 123,
"algo_slices_completed": 123,
"algo_type": "twap",
"cancel_reason": "",
"label": "",
"trigger_reject_message": "<string>"
},
"trades": [
{
"expected_rebate": "<string>",
"extra_fee": "<string>",
"index_price": "<string>",
"instrument_name": "<string>",
"is_transfer": true,
"mark_price": "<string>",
"op_uuid": "<string>",
"order_id": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"realized_pnl": "<string>",
"realized_pnl_excl_fees": "<string>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccount_id": 123,
"timestamp": 123,
"trade_amount": "<string>",
"trade_fee": "<string>",
"trade_id": "<string>",
"trade_price": "<string>",
"label": "",
"tx_hash": "<string>"
}
]
}Body
private/order params.
Order amount in units of the base, as a decimal string (e.g. "1.5") or a JSON number.
buy, sell Limit price in quote currency, as a decimal string (e.g. "3100.5") or a JSON number.
Max fee per unit of volume in quote currency, as a decimal string or a JSON number.
twap Optional extra fee per unit of volume, as a decimal string or JSON number. Defaults to zero.
limit, market gtc, post_only, fok, ioc Trigger price as a decimal string or JSON number; omit for non-trigger orders.
mark, index stoploss, takeprofit curl --request POST \
--url https://api.derive.xyz/v3/private/order \
--header 'Content-Type: application/json' \
--data '
{
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"algo_duration_sec": null,
"algo_num_slices": null,
"algo_type": "twap",
"client": null,
"extra_fee": null,
"is_atomic_signing": null,
"label": null,
"mmp": null,
"order_type": "limit",
"reduce_only": null,
"referral_code": null,
"reject_post_only": null,
"reject_timestamp": null,
"time_in_force": "gtc",
"trigger_price": null
}
'import requests
url = "https://api.derive.xyz/v3/private/order"
payload = {
"amount": "<string>",
"instrument_name": "<string>",
"limit_price": "<string>",
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"algo_duration_sec": None,
"algo_num_slices": None,
"algo_type": "twap",
"client": None,
"extra_fee": None,
"is_atomic_signing": None,
"label": None,
"mmp": None,
"order_type": "limit",
"reduce_only": None,
"referral_code": None,
"reject_post_only": None,
"reject_timestamp": None,
"time_in_force": "gtc",
"trigger_price": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '<string>',
instrument_name: '<string>',
limit_price: '<string>',
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
algo_duration_sec: null,
algo_num_slices: null,
algo_type: 'twap',
client: null,
extra_fee: null,
is_atomic_signing: null,
label: null,
mmp: null,
order_type: 'limit',
reduce_only: null,
referral_code: null,
reject_post_only: null,
reject_timestamp: null,
time_in_force: 'gtc',
trigger_price: null
})
};
fetch('https://api.derive.xyz/v3/private/order', 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://api.derive.xyz/v3/private/order",
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([
'amount' => '<string>',
'instrument_name' => '<string>',
'limit_price' => '<string>',
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'algo_duration_sec' => null,
'algo_num_slices' => null,
'algo_type' => 'twap',
'client' => null,
'extra_fee' => null,
'is_atomic_signing' => null,
'label' => null,
'mmp' => null,
'order_type' => 'limit',
'reduce_only' => null,
'referral_code' => null,
'reject_post_only' => null,
'reject_timestamp' => null,
'time_in_force' => 'gtc',
'trigger_price' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.derive.xyz/v3/private/order"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.derive.xyz/v3/private/order")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"limit_price\": \"<string>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"algo_duration_sec\": null,\n \"algo_num_slices\": null,\n \"algo_type\": \"twap\",\n \"client\": null,\n \"extra_fee\": null,\n \"is_atomic_signing\": null,\n \"label\": null,\n \"mmp\": null,\n \"order_type\": \"limit\",\n \"reduce_only\": null,\n \"referral_code\": null,\n \"reject_post_only\": null,\n \"reject_timestamp\": null,\n \"time_in_force\": \"gtc\",\n \"trigger_price\": null\n}"
response = http.request(request)
puts response.read_body{
"order": {
"amount": "<string>",
"average_price": "<string>",
"creation_timestamp": 123,
"extra_fee": "<string>",
"filled_amount": "<string>",
"instrument_name": "<string>",
"is_transfer": true,
"last_update_timestamp": 123,
"limit_price": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"order_fee": "<string>",
"order_id": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"replaced_order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<string>",
"signature_expiry_sec": 123,
"signed_limit_price": "<string>",
"signer": "<string>",
"subaccount_id": 123,
"trigger_price": "<string>",
"algo_duration_sec": 123,
"algo_num_slices": 123,
"algo_slices_completed": 123,
"algo_type": "twap",
"cancel_reason": "",
"label": "",
"trigger_reject_message": "<string>"
},
"trades": [
{
"expected_rebate": "<string>",
"extra_fee": "<string>",
"index_price": "<string>",
"instrument_name": "<string>",
"is_transfer": true,
"mark_price": "<string>",
"op_uuid": "<string>",
"order_id": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"realized_pnl": "<string>",
"realized_pnl_excl_fees": "<string>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccount_id": 123,
"timestamp": 123,
"trade_amount": "<string>",
"trade_fee": "<string>",
"trade_id": "<string>",
"trade_price": "<string>",
"label": "",
"tx_hash": "<string>"
}
]
}