private/order_debug
Takes the same params as private/order and rebuilds the order Action without executing anything, returning the EIP-712 encoded_data, encoded_data_hashed, action_hash, typed_data_hash, domain_separator, action_typehash, module, owner and expected_signer, plus the decoded order action data. Byte-compare these against your local computation to find why a signature is rejected. Requires a logged-in session; no trade scope needed.
curl --request POST \
--url https://api.derive.xyz/v3/private/order_debug \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--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_debug"
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 = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'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_debug', 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_debug",
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",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <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://api.derive.xyz/v3/private/order_debug"
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("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<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://api.derive.xyz/v3/private/order_debug")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.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_debug")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
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{
"action_hash": "<string>",
"action_typehash": "<string>",
"domain_separator": "<string>",
"encoded_data": "<string>",
"encoded_data_hashed": "<string>",
"expected_signer": "<string>",
"input_data": {
"data": {
"asset_address": "<string>",
"asset_sub_id": "<string>",
"desired_amount": "<string>",
"is_bid": true,
"limit_price": "<string>",
"recipient_id": 1,
"worst_fee": "<string>"
},
"expiry": 1,
"module": "<string>",
"nonce": "<string>",
"owner": "<string>",
"signer": "<string>",
"subaccount_id": 1
},
"module": "<string>",
"owner": "<string>",
"typed_data_hash": "<string>",
"recovered_signer": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}Authorizations
The wallet the request acts for.
The current time in milliseconds, as a decimal string.
EIP-191 signature of the timestamp, by the wallet or one of its session keys.
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 builder fee for the whole order, in USDC, as a decimal string or JSON number. Each fill pays its pro-rata share. Defaults to zero.
Tags the order for market maker protection. Only tagged orders are cancelled by cancel on disconnect.
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 Response
Success
Debug-route payload for one rebuilt action: the EIP-712 hashes plus the action input fields.
EIP-712 struct hash of the Action: keccak256(abi.encode(action_typehash, …, encoded_data_hashed, …)).
ACTION_TYPEHASH — keccak of the Action struct type string; invariant across deployments.
EIP-712 domain separator of the Matching contract for this deployment.
ABI-encoded, module-specific action payload (the data bytes), 0x-hex.
keccak256(encoded_data) — the value packed into the struct hash.
The signer the signature is checked against.
The rebuilt Action envelope and its decoded module-specific data.
Show child attributes
Show child attributes
Per-action module contract address bound into the signed struct.
Wallet that owns the subaccount the action applies to.
Final EIP-712 digest the client signs: keccak256(0x1901 || domain_separator || action_hash).
null on the debug routes (no signature is checked there); on a signature-mismatch error this is the address actually recovered.
curl --request POST \
--url https://api.derive.xyz/v3/private/order_debug \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--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_debug"
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 = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'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_debug', 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_debug",
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",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <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://api.derive.xyz/v3/private/order_debug"
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("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<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://api.derive.xyz/v3/private/order_debug")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.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_debug")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
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{
"action_hash": "<string>",
"action_typehash": "<string>",
"domain_separator": "<string>",
"encoded_data": "<string>",
"encoded_data_hashed": "<string>",
"expected_signer": "<string>",
"input_data": {
"data": {
"asset_address": "<string>",
"asset_sub_id": "<string>",
"desired_amount": "<string>",
"is_bid": true,
"limit_price": "<string>",
"recipient_id": 1,
"worst_fee": "<string>"
},
"expiry": 1,
"module": "<string>",
"nonce": "<string>",
"owner": "<string>",
"signer": "<string>",
"subaccount_id": 1
},
"module": "<string>",
"owner": "<string>",
"typed_data_hash": "<string>",
"recovered_signer": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}