curl --request PUT \
--url https://apimonaco.xyz/api/v1/buildercodes/rules \
--header 'Content-Type: application/json' \
--header 'X-Monaco-Signature: <api-key>' \
--data '
{
"upserts": [
{
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbps": 150,
"takerCbps": 250
}
],
"deletes": [
{
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
}
],
"note": "<string>"
}
'import requests
url = "https://apimonaco.xyz/api/v1/buildercodes/rules"
payload = {
"upserts": [
{
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbps": 150,
"takerCbps": 250
}
],
"deletes": [
{
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
}
],
"note": "<string>"
}
headers = {
"X-Monaco-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Monaco-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upserts: [
{
scope: {
walletAddress: '0x0000000000000000000000000000000000000001',
tradingPairId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
marketType: 'SPOT',
track: 'BOTH'
},
makerCbps: 150,
takerCbps: 250
}
],
deletes: [
{
walletAddress: '0x0000000000000000000000000000000000000001',
tradingPairId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
marketType: 'SPOT',
track: 'BOTH'
}
],
note: '<string>'
})
};
fetch('https://apimonaco.xyz/api/v1/buildercodes/rules', 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://apimonaco.xyz/api/v1/buildercodes/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'upserts' => [
[
'scope' => [
'walletAddress' => '0x0000000000000000000000000000000000000001',
'tradingPairId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'marketType' => 'SPOT',
'track' => 'BOTH'
],
'makerCbps' => 150,
'takerCbps' => 250
]
],
'deletes' => [
[
'walletAddress' => '0x0000000000000000000000000000000000000001',
'tradingPairId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'marketType' => 'SPOT',
'track' => 'BOTH'
]
],
'note' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Monaco-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://apimonaco.xyz/api/v1/buildercodes/rules"
payload := strings.NewReader("{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Monaco-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.put("https://apimonaco.xyz/api/v1/buildercodes/rules")
.header("X-Monaco-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimonaco.xyz/api/v1/buildercodes/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Monaco-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"changes": [
{
"op": "SET",
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbpsBefore": 123,
"takerCbpsBefore": 123,
"makerCbpsAfter": 123,
"takerCbpsAfter": 123
}
],
"changesRemaining": 49,
"nextChangeAllowedAt": "2023-11-07T05:31:56Z"
}Set your builder fee rules
Set or delete your builder fee rules.
Upserts and deletes add-on rules in one save: all of it is written or none of it is. One call is one change against your daily change limit, however many rules it writes; a call that changes nothing is free. Each rule scopes your add-on by wallet (one with an account on your application), trading pair or market type, and track. Monaco’s OVERRIDE rules cannot be deleted here, and any that match an order win over your rules. A rule above the cap that applies is saved and charged at the cap.
Refused (HTTP 403 / FAILED_PRECONDITION) until Monaco turns
scoped builder fee rules on: check builderFeeRulesEnabled in
GetBuildercodesConfig first, and use SetBuilderFee until then.
curl --request PUT \
--url https://apimonaco.xyz/api/v1/buildercodes/rules \
--header 'Content-Type: application/json' \
--header 'X-Monaco-Signature: <api-key>' \
--data '
{
"upserts": [
{
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbps": 150,
"takerCbps": 250
}
],
"deletes": [
{
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
}
],
"note": "<string>"
}
'import requests
url = "https://apimonaco.xyz/api/v1/buildercodes/rules"
payload = {
"upserts": [
{
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbps": 150,
"takerCbps": 250
}
],
"deletes": [
{
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
}
],
"note": "<string>"
}
headers = {
"X-Monaco-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Monaco-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
upserts: [
{
scope: {
walletAddress: '0x0000000000000000000000000000000000000001',
tradingPairId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
marketType: 'SPOT',
track: 'BOTH'
},
makerCbps: 150,
takerCbps: 250
}
],
deletes: [
{
walletAddress: '0x0000000000000000000000000000000000000001',
tradingPairId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
marketType: 'SPOT',
track: 'BOTH'
}
],
note: '<string>'
})
};
fetch('https://apimonaco.xyz/api/v1/buildercodes/rules', 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://apimonaco.xyz/api/v1/buildercodes/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'upserts' => [
[
'scope' => [
'walletAddress' => '0x0000000000000000000000000000000000000001',
'tradingPairId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'marketType' => 'SPOT',
'track' => 'BOTH'
],
'makerCbps' => 150,
'takerCbps' => 250
]
],
'deletes' => [
[
'walletAddress' => '0x0000000000000000000000000000000000000001',
'tradingPairId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'marketType' => 'SPOT',
'track' => 'BOTH'
]
],
'note' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Monaco-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://apimonaco.xyz/api/v1/buildercodes/rules"
payload := strings.NewReader("{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Monaco-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.put("https://apimonaco.xyz/api/v1/buildercodes/rules")
.header("X-Monaco-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimonaco.xyz/api/v1/buildercodes/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Monaco-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"upserts\": [\n {\n \"scope\": {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n },\n \"makerCbps\": 150,\n \"takerCbps\": 250\n }\n ],\n \"deletes\": [\n {\n \"walletAddress\": \"0x0000000000000000000000000000000000000001\",\n \"tradingPairId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"marketType\": \"SPOT\",\n \"track\": \"BOTH\"\n }\n ],\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"changes": [
{
"op": "SET",
"scope": {
"walletAddress": "0x0000000000000000000000000000000000000001",
"tradingPairId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketType": "SPOT",
"track": "BOTH"
},
"makerCbpsBefore": 123,
"takerCbpsBefore": 123,
"makerCbpsAfter": 123,
"takerCbpsAfter": 123
}
],
"changesRemaining": 49,
"nextChangeAllowedAt": "2023-11-07T05:31:56Z"
}Authorizations
Ed25519 session-key request signing. Every authenticated request carries three headers: X-Monaco-PublicKey (64-char lowercase-hex session public key), X-Monaco-Timestamp (Unix milliseconds, within 30s of server time), and X-Monaco-Signature (hex ed25519 signature). The signature is over METHOD\npath?query\ntimestamp_ms\nSHA256_hex(body), where the body hash is the SHA-256 of the empty byte string when there is no body. Obtain the session keypair from POST /api/v1/auth/challenge followed by POST /api/v1/auth/verify.
Body
Response
OK
Was this page helpful?

