curl --request POST \
--url https://api.qfex.com/user/builder-code \
--header 'Content-Type: application/json' \
--header 'x-qfex-hmac-signature: <api-key>' \
--header 'x-qfex-nonce: <api-key>' \
--header 'x-qfex-public-key: <api-key>' \
--header 'x-qfex-timestamp: <api-key>' \
--data '
{
"builder_fee_share_bps": 3000,
"qfex_fee_share_bps": 5000
}
'import requests
url = "https://api.qfex.com/user/builder-code"
payload = {
"builder_fee_share_bps": 3000,
"qfex_fee_share_bps": 5000
}
headers = {
"x-qfex-hmac-signature": "<api-key>",
"x-qfex-nonce": "<api-key>",
"x-qfex-public-key": "<api-key>",
"x-qfex-timestamp": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-qfex-hmac-signature': '<api-key>',
'x-qfex-nonce': '<api-key>',
'x-qfex-public-key': '<api-key>',
'x-qfex-timestamp': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({builder_fee_share_bps: 3000, qfex_fee_share_bps: 5000})
};
fetch('https://api.qfex.com/user/builder-code', 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.qfex.com/user/builder-code",
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([
'builder_fee_share_bps' => 3000,
'qfex_fee_share_bps' => 5000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-qfex-hmac-signature: <api-key>",
"x-qfex-nonce: <api-key>",
"x-qfex-public-key: <api-key>",
"x-qfex-timestamp: <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.qfex.com/user/builder-code"
payload := strings.NewReader("{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-qfex-hmac-signature", "<api-key>")
req.Header.Add("x-qfex-nonce", "<api-key>")
req.Header.Add("x-qfex-public-key", "<api-key>")
req.Header.Add("x-qfex-timestamp", "<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.qfex.com/user/builder-code")
.header("x-qfex-hmac-signature", "<api-key>")
.header("x-qfex-nonce", "<api-key>")
.header("x-qfex-public-key", "<api-key>")
.header("x-qfex-timestamp", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qfex.com/user/builder-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-qfex-hmac-signature"] = '<api-key>'
request["x-qfex-nonce"] = '<api-key>'
request["x-qfex-public-key"] = '<api-key>'
request["x-qfex-timestamp"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}"
response = http.request(request)
puts response.read_body{
"builder_code": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"builder_fee_share_bps": 2500,
"builder_fee_share_percent": 123,
"created_at": "2023-11-07T05:31:56Z",
"qfex_fee_share_bps": 7500,
"qfex_fee_share_percent": 123,
"updated_at": "2023-11-07T05:31:56Z",
"$schema": "https://api.qfex.com/schemas/BuilderCodeDetails.json"
}{
"$schema": "https://api.qfex.com/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Create Builder Code
Create the authenticated user’s builder code. The code is generated server-side as a UUID. Specify both QFEX and builder fee shares in basis points; they need not sum to 10000. QFEX share must be at least 5000 (50%), builder share must be >= 0, and their sum must be at most 10000. Each user may create one code. Attach the returned builder_code as params.builder_code on the Trade WebSocket auth message.
curl --request POST \
--url https://api.qfex.com/user/builder-code \
--header 'Content-Type: application/json' \
--header 'x-qfex-hmac-signature: <api-key>' \
--header 'x-qfex-nonce: <api-key>' \
--header 'x-qfex-public-key: <api-key>' \
--header 'x-qfex-timestamp: <api-key>' \
--data '
{
"builder_fee_share_bps": 3000,
"qfex_fee_share_bps": 5000
}
'import requests
url = "https://api.qfex.com/user/builder-code"
payload = {
"builder_fee_share_bps": 3000,
"qfex_fee_share_bps": 5000
}
headers = {
"x-qfex-hmac-signature": "<api-key>",
"x-qfex-nonce": "<api-key>",
"x-qfex-public-key": "<api-key>",
"x-qfex-timestamp": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-qfex-hmac-signature': '<api-key>',
'x-qfex-nonce': '<api-key>',
'x-qfex-public-key': '<api-key>',
'x-qfex-timestamp': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({builder_fee_share_bps: 3000, qfex_fee_share_bps: 5000})
};
fetch('https://api.qfex.com/user/builder-code', 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.qfex.com/user/builder-code",
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([
'builder_fee_share_bps' => 3000,
'qfex_fee_share_bps' => 5000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-qfex-hmac-signature: <api-key>",
"x-qfex-nonce: <api-key>",
"x-qfex-public-key: <api-key>",
"x-qfex-timestamp: <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.qfex.com/user/builder-code"
payload := strings.NewReader("{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-qfex-hmac-signature", "<api-key>")
req.Header.Add("x-qfex-nonce", "<api-key>")
req.Header.Add("x-qfex-public-key", "<api-key>")
req.Header.Add("x-qfex-timestamp", "<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.qfex.com/user/builder-code")
.header("x-qfex-hmac-signature", "<api-key>")
.header("x-qfex-nonce", "<api-key>")
.header("x-qfex-public-key", "<api-key>")
.header("x-qfex-timestamp", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qfex.com/user/builder-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-qfex-hmac-signature"] = '<api-key>'
request["x-qfex-nonce"] = '<api-key>'
request["x-qfex-public-key"] = '<api-key>'
request["x-qfex-timestamp"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"builder_fee_share_bps\": 3000,\n \"qfex_fee_share_bps\": 5000\n}"
response = http.request(request)
puts response.read_body{
"builder_code": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"builder_fee_share_bps": 2500,
"builder_fee_share_percent": 123,
"created_at": "2023-11-07T05:31:56Z",
"qfex_fee_share_bps": 7500,
"qfex_fee_share_percent": 123,
"updated_at": "2023-11-07T05:31:56Z",
"$schema": "https://api.qfex.com/schemas/BuilderCodeDetails.json"
}{
"$schema": "https://api.qfex.com/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Authorizations
HMAC-SHA256 signature (hex-encoded).
Unique request nonce (hex encoded, max 100 characters).
QFEX API Authentication requires these headers:
- x-qfex-public-key: Your public API key
- x-qfex-hmac-signature: HMAC signature of the request (hex encoded)
- x-qfex-nonce: Unique nonce for the request (hex encoded, max 100 characters)
- x-qfex-timestamp: Unix timestamp of the request
These four are required. Optionally send x-qfex-requested-account-id (UUID) to act as a subaccount; see Signature Generation below.
Signature Generation:
- Generate a cryptographically secure random nonce (hex encoded, max 100 characters) and capture the current Unix timestamp.
- Build the string
${nonce}:${unix_ts}and compute an HMAC-SHA256 using your secret key. - Hex-encode the HMAC result to get the signature.
- Send the required auth headers below. The nonce must be unique within a 15 minute window.
Important: The signature itself must be hex-encoded before being sent in the x-qfex-hmac-signature header.
Optional header: x-qfex-requested-account-id (UUID) selects a subaccount; omit it to use the primary account.
Unix timestamp (seconds since epoch).
Body
Builder share of the trading fee in basis points. Must be >= 0. qfex_fee_share_bps + builder_fee_share_bps must be <= 10000.
0 <= x <= 50003000
QFEX share of the trading fee in basis points. Minimum 5000 (50%).
5000 <= x <= 100005000
Response
Created
Server-generated UUID to send as params.builder_code on Trade WebSocket auth.
Builder share of the trading fee in basis points.
0 <= x <= 5000Builder share of the trading fee as a percent (bps / 100).
QFEX share of the trading fee in basis points. Minimum 5000 (50%).
5000 <= x <= 10000QFEX share of the trading fee as a percent (bps / 100).
A URL to the JSON Schema for this object.
"https://api.qfex.com/schemas/BuilderCodeDetails.json"