RFQ
Cancel and resubmit a maker quote atomically
Maker-side call that atomically cancels an existing quote and submits a new signed quote for the same RFQ in one operation. You provide the new priced legs, direction, max fee, and EIP-712 signature, plus the quote to cancel (by quote_id or nonce_to_cancel). Returns the cancellation result together with the newly created quote. Requires trade scope for every instrument quoted.
POST
/
private
/
replace_quote
Cancel and resubmit a maker quote atomically
curl --request POST \
--url https://api.derive.xyz/v3/private/replace_quote \
--header 'Content-Type: application/json' \
--data '
{
"direction": "<unknown>",
"legs": "<unknown>",
"max_fee": "<string>",
"nonce": "<unknown>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<unknown>",
"signature_expiry_sec": "<unknown>",
"signer": "<unknown>",
"subaccount_id": 1,
"client": "",
"extra_fee": "0",
"label": "",
"mmp": false,
"nonce_to_cancel": "<unknown>",
"quote_id_to_cancel": null,
"referral_code": ""
}
'import requests
url = "https://api.derive.xyz/v3/private/replace_quote"
payload = {
"direction": "<unknown>",
"legs": "<unknown>",
"max_fee": "<string>",
"nonce": "<unknown>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<unknown>",
"signature_expiry_sec": "<unknown>",
"signer": "<unknown>",
"subaccount_id": 1,
"client": "",
"extra_fee": "0",
"label": "",
"mmp": False,
"nonce_to_cancel": "<unknown>",
"quote_id_to_cancel": None,
"referral_code": ""
}
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({
direction: '<unknown>',
legs: '<unknown>',
max_fee: '<string>',
nonce: '<unknown>',
rfq_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
signature: '<unknown>',
signature_expiry_sec: '<unknown>',
signer: '<unknown>',
subaccount_id: 1,
client: '',
extra_fee: '0',
label: '',
mmp: false,
nonce_to_cancel: '<unknown>',
quote_id_to_cancel: null,
referral_code: ''
})
};
fetch('https://api.derive.xyz/v3/private/replace_quote', 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/replace_quote",
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([
'direction' => '<unknown>',
'legs' => '<unknown>',
'max_fee' => '<string>',
'nonce' => '<unknown>',
'rfq_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'signature' => '<unknown>',
'signature_expiry_sec' => '<unknown>',
'signer' => '<unknown>',
'subaccount_id' => 1,
'client' => '',
'extra_fee' => '0',
'label' => '',
'mmp' => false,
'nonce_to_cancel' => '<unknown>',
'quote_id_to_cancel' => null,
'referral_code' => ''
]),
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/replace_quote"
payload := strings.NewReader("{\n \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\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/replace_quote")
.header("Content-Type", "application/json")
.body("{\n \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/replace_quote")
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 \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"cancelled_quote": {
"creation_timestamp": 123,
"extra_fee": "<string>",
"fee": "<string>",
"fill_pct": "<string>",
"is_transfer": true,
"label": "<string>",
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"legs_hash": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature_expiry_sec": 123,
"subaccount_id": 123,
"tx_hash": "<string>"
},
"create_quote_error": {
"code": 123,
"message": "<string>",
"data": "<string>"
},
"quote": {
"creation_timestamp": 123,
"extra_fee": "<string>",
"fee": "<string>",
"fill_pct": "<string>",
"is_transfer": true,
"label": "<string>",
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"legs_hash": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature_expiry_sec": 123,
"subaccount_id": 123,
"tx_hash": "<string>"
}
}Body
application/json
Non-negative decimal string of the human value (e.g. "1.5"), up to 12 fractional digits; a string or JSON number is accepted
UUID v4 string
Required range:
x >= 0Non-negative decimal string of the human value (e.g. "1.5"), up to 12 fractional digits; a string or JSON number is accepted
Optional UUID v4 string
⌘I
Cancel and resubmit a maker quote atomically
curl --request POST \
--url https://api.derive.xyz/v3/private/replace_quote \
--header 'Content-Type: application/json' \
--data '
{
"direction": "<unknown>",
"legs": "<unknown>",
"max_fee": "<string>",
"nonce": "<unknown>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<unknown>",
"signature_expiry_sec": "<unknown>",
"signer": "<unknown>",
"subaccount_id": 1,
"client": "",
"extra_fee": "0",
"label": "",
"mmp": false,
"nonce_to_cancel": "<unknown>",
"quote_id_to_cancel": null,
"referral_code": ""
}
'import requests
url = "https://api.derive.xyz/v3/private/replace_quote"
payload = {
"direction": "<unknown>",
"legs": "<unknown>",
"max_fee": "<string>",
"nonce": "<unknown>",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature": "<unknown>",
"signature_expiry_sec": "<unknown>",
"signer": "<unknown>",
"subaccount_id": 1,
"client": "",
"extra_fee": "0",
"label": "",
"mmp": False,
"nonce_to_cancel": "<unknown>",
"quote_id_to_cancel": None,
"referral_code": ""
}
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({
direction: '<unknown>',
legs: '<unknown>',
max_fee: '<string>',
nonce: '<unknown>',
rfq_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
signature: '<unknown>',
signature_expiry_sec: '<unknown>',
signer: '<unknown>',
subaccount_id: 1,
client: '',
extra_fee: '0',
label: '',
mmp: false,
nonce_to_cancel: '<unknown>',
quote_id_to_cancel: null,
referral_code: ''
})
};
fetch('https://api.derive.xyz/v3/private/replace_quote', 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/replace_quote",
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([
'direction' => '<unknown>',
'legs' => '<unknown>',
'max_fee' => '<string>',
'nonce' => '<unknown>',
'rfq_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'signature' => '<unknown>',
'signature_expiry_sec' => '<unknown>',
'signer' => '<unknown>',
'subaccount_id' => 1,
'client' => '',
'extra_fee' => '0',
'label' => '',
'mmp' => false,
'nonce_to_cancel' => '<unknown>',
'quote_id_to_cancel' => null,
'referral_code' => ''
]),
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/replace_quote"
payload := strings.NewReader("{\n \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\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/replace_quote")
.header("Content-Type", "application/json")
.body("{\n \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/replace_quote")
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 \"direction\": \"<unknown>\",\n \"legs\": \"<unknown>\",\n \"max_fee\": \"<string>\",\n \"nonce\": \"<unknown>\",\n \"rfq_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"signature\": \"<unknown>\",\n \"signature_expiry_sec\": \"<unknown>\",\n \"signer\": \"<unknown>\",\n \"subaccount_id\": 1,\n \"client\": \"\",\n \"extra_fee\": \"0\",\n \"label\": \"\",\n \"mmp\": false,\n \"nonce_to_cancel\": \"<unknown>\",\n \"quote_id_to_cancel\": null,\n \"referral_code\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"cancelled_quote": {
"creation_timestamp": 123,
"extra_fee": "<string>",
"fee": "<string>",
"fill_pct": "<string>",
"is_transfer": true,
"label": "<string>",
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"legs_hash": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature_expiry_sec": 123,
"subaccount_id": 123,
"tx_hash": "<string>"
},
"create_quote_error": {
"code": 123,
"message": "<string>",
"data": "<string>"
},
"quote": {
"creation_timestamp": 123,
"extra_fee": "<string>",
"fee": "<string>",
"fill_pct": "<string>",
"is_transfer": true,
"label": "<string>",
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"legs_hash": "<string>",
"max_fee": "<string>",
"mmp": true,
"nonce": "<string>",
"quote_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rfq_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"signature_expiry_sec": 123,
"subaccount_id": 123,
"tx_hash": "<string>"
}
}