GaiaExGaiaEx
API

Quick Start Trading Guide

Start trading on GaiaEx in 5 minutes. Code examples in Python, JavaScript, and curl — place your first order with no KYC.

AI AGENT READYEquip Claude Code, OpenAI Codex & Antigravity (`agy`) with Official GaiaEx Skills
CLAUDE CODESKILL.md
Claude SKILL.md

Drop-in Claude Code skill with HMAC-SHA256 signing, /fapi/v1 & /fapi/v2 schemas, and secret-redaction guardrails.

Raw ↗
OPENAI CODEXAGENTS.md
Codex AGENTS.md

Drop-in repository AGENTS.md for OpenAI Codex CLI — tick-size rules, rate-limit budgets, and self-custody boundaries.

Raw ↗
ANTIGRAVITYAGY.md
Antigravity AGY.md

Google Antigravity (agy) & Gemini agent spec with verified async Python WebSocket + REST execution templates.

Raw ↗
UNIVERSAL LLMllms.txt
/llms.txt Index

Single-URL machine-readable index of all GaiaEx documentation pages, OpenAPI 3.0 schema, and Postman collection.

Raw ↗

Prerequisites

IF YOU ALREADY HAVE MONEY IN THE APP, YOU CAN TRADE TODAY

Deposited USDC or USDT plus a freshly created API key is all you need. Your wallet address is automatically resolved server-side from your X-MBX-APIKEY header — the snippets below are copy-paste runnable with only GAIAEX_API_KEY and GAIAEX_API_SECRET.

  • A GaiaEx account, set up in the mobile app (account handshake is a one-time in-app flow)
  • USDC or USDT already deposited into the account via the mobile app — API keys trade against your existing balance and cannot deposit or withdraw funds
  • A programming environment for your language of choice (or any standard GaiaEx Unified Futures SDK such as ccxt or Python SDK)

Step 1: Create an API Key

API keys are created exclusively in the GaiaEx mobile app.

  1. Open the GaiaEx mobile app (iOS / Android)
  2. Tap the Settings icon (gear, bottom-right)
  3. Tap API Keys
  4. Tap Create API Key
  5. Set permissions: read for data access, trade for order execution
  6. Copy and securely store your API Key and API Secret

DANGER

Your API Secret is only shown once at creation time. Store it securely. If lost, revoke the key and create a new one.

PROGRAMMATIC MANAGEMENT

After creating your first API key via the mobile app, you can list keys programmatically using the /api-keys REST endpoints. Note: updating (PATCH) and revoking (DELETE) keys also require a passkey step-up — these operations are app-only in practice and cannot be performed headlessly via API key alone. See the API Keys page for details.

Step 2: Install Dependencies

pip install requests
npm install axios

Go standard library only — no external dependencies.

go mod init gaiaex-client
cargo add reqwest --features json,blocking
cargo add hmac sha2 hex serde serde_json once_cell
# Install libcurl and OpenSSL (Ubuntu/Debian)
sudo apt install libcurl4-openssl-dev libssl-dev nlohmann-json3-dev
<!-- Maven: pom.xml -->
<dependency>
  <groupId>com.squareup.okhttp3</groupId>
  <artifactId>okhttp</artifactId>
  <version>4.12.0</version>
</dependency>

.NET HttpClient is built-in — no NuGet packages needed.

dotnet new console -n GaiaExClient
# curl + openssl (pre-installed on most systems)
curl --version
openssl version

Step 3: Set Up Authentication

Every signed /fapi/v1 and /fapi/v2 call uses the GaiaEx Unified Futures authentication standard: pass your API key in the X-MBX-APIKEY header, append timestamp=<ms> and recvWindow=5000 to the query string (or form body), and append signature=HMAC-SHA256(api_secret, query_string). Your wallet address is automatically resolved server-side from your API key.

Environment variable convention

Every example on this page assumes these two variables are exported in your shell (or your CI/CD secrets store, or injected by your secrets manager at boot):

export GAIAEX_API_KEY="your_api_key_here"
export GAIAEX_API_SECRET="your_api_secret_here"

Rotate your key by updating these values — the code never changes. For production, pull them from a secrets manager (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) instead of a static shell export — see Security Best Practices.

import hmac, hashlib, os, time, urllib.parse, requests

# Credentials load from environment variables — never hardcoded, never committed.
API_KEY    = os.environ["GAIAEX_API_KEY"]
API_SECRET = os.environ["GAIAEX_API_SECRET"]
BASE_URL   = "https://openapi.gaiaex.com"

def fapi_request(method: str, path: str, params: dict | None = None):
    p = dict(params or {})
    p["timestamp"] = int(time.time() * 1000)
    p.setdefault("recvWindow", 5000)
    query = urllib.parse.urlencode(p)
    sig = hmac.new(
        API_SECRET.encode("utf-8"),
        query.encode("utf-8"),
        hashlib.sha256,
    ).hexdigest()
    url = f"{BASE_URL}{path}?{query}&signature={sig}"
    headers = {"X-MBX-APIKEY": API_KEY}
    return requests.request(method.upper(), url, headers=headers, timeout=20).json()
const crypto = require('crypto');
const axios = require('axios');

const API_KEY    = process.env.GAIAEX_API_KEY;
const API_SECRET = process.env.GAIAEX_API_SECRET;
const BASE_URL   = 'https://openapi.gaiaex.com';

async function fapiRequest(method, path, params = {}) {
  const qs = new URLSearchParams({
    ...params,
    timestamp: Date.now().toString(),
    recvWindow: '5000',
  }).toString();
  const sig = crypto.createHmac('sha256', API_SECRET)
    .update(qs).digest('hex');
  const url = `${BASE_URL}${path}?${qs}&signature=${sig}`;
  const { data } = await axios.request({
    method,
    url,
    headers: { 'X-MBX-APIKEY': API_KEY },
    timeout: 20000,
  });
  return data;
}
package main

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"strconv"
	"time"
)

var (
	apiKey    = os.Getenv("GAIAEX_API_KEY")
	apiSecret = os.Getenv("GAIAEX_API_SECRET")
	baseURL   = "https://openapi.gaiaex.com"
)

func fapiRequest(method, path string, params map[string]string) ([]byte, error) {
	v := url.Values{}
	for k, val := range params {
		v.Set(k, val)
	}
	v.Set("timestamp", strconv.FormatInt(time.Now().UnixMilli(), 10))
	v.Set("recvWindow", "5000")
	query := v.Encode()

	mac := hmac.New(sha256.New, []byte(apiSecret))
	mac.Write([]byte(query))
	sig := hex.EncodeToString(mac.Sum(nil))

	fullURL := fmt.Sprintf("%s%s?%s&signature=%s", baseURL, path, query, sig)
	req, _ := http.NewRequest(method, fullURL, nil)
	req.Header.Set("X-MBX-APIKEY", apiKey)
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	return io.ReadAll(resp.Body)
}
use hmac::{Hmac, Mac};
use sha2::Sha256;
use std::env;
use std::time::{SystemTime, UNIX_EPOCH};
use once_cell::sync::Lazy;

static API_KEY: Lazy<String> = Lazy::new(|| env::var("GAIAEX_API_KEY").unwrap());
static API_SECRET: Lazy<String> = Lazy::new(|| env::var("GAIAEX_API_SECRET").unwrap());

const BASE_URL: &str = "https://openapi.gaiaex.com";

type HmacSha256 = Hmac<Sha256>;

fn fapi_request(method: &str, path: &str, extra_query: &str) -> serde_json::Value {
    let ts = SystemTime::now()
        .duration_since(UNIX_EPOCH).unwrap()
        .as_millis().to_string();
    let query = if extra_query.is_empty() {
        format!("timestamp={}&recvWindow=5000", ts)
    } else {
        format!("{}&timestamp={}&recvWindow=5000", extra_query, ts)
    };
    let mut mac = HmacSha256::new_from_slice(API_SECRET.as_bytes()).unwrap();
    mac.update(query.as_bytes());
    let sig = hex::encode(mac.finalize().into_bytes());
    let url = format!("{}{}?{}&signature={}", BASE_URL, path, query, sig);

    let client = reqwest::blocking::Client::new();
    let req = match method {
        "POST" => client.post(&url),
        "PUT" => client.put(&url),
        "DELETE" => client.delete(&url),
        _ => client.get(&url),
    };
    req.header("X-MBX-APIKEY", API_KEY.as_str())
        .send().unwrap()
        .json().unwrap()
}
#include <curl/curl.h>
#include <openssl/hmac.h>
#include <nlohmann/json.hpp>
#include <chrono>
#include <cstdlib>
#include <iomanip>
#include <sstream>

using json = nlohmann::json;

// Load credentials from environment variables at startup — never hardcoded.
const std::string API_KEY    = std::getenv("GAIAEX_API_KEY");
const std::string API_SECRET = std::getenv("GAIAEX_API_SECRET");
const std::string BASE_URL   = "https://openapi.gaiaex.com";

std::string hmac_sha256(const std::string& key, const std::string& msg) {
    unsigned char digest[EVP_MAX_MD_SIZE];
    unsigned int len = 0;
    HMAC(EVP_sha256(), key.c_str(), key.size(),
         (unsigned char*)msg.c_str(), msg.size(), digest, &len);
    std::ostringstream ss;
    for (unsigned i = 0; i < len; i++)
        ss << std::hex << std::setfill('0') << std::setw(2) << (int)digest[i];
    return ss.str();
}

static size_t write_cb(void* p, size_t s, size_t n, std::string* d) {
    d->append((char*)p, s * n); return s * n;
}

json fapi_request(const std::string& method, const std::string& path,
                  const std::string& extra_query = "") {
    auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
        std::chrono::system_clock::now().time_since_epoch()).count();
    std::string ts = std::to_string(ms);
    std::string query = extra_query.empty()
        ? ("timestamp=" + ts + "&recvWindow=5000")
        : (extra_query + "&timestamp=" + ts + "&recvWindow=5000");
    std::string sig = hmac_sha256(API_SECRET, query);
    std::string url = BASE_URL + path + "?" + query + "&signature=" + sig;

    CURL* curl = curl_easy_init();
    std::string resp;
    struct curl_slist* hdrs = nullptr;
    std::string auth_hdr = "X-MBX-APIKEY: " + API_KEY;
    hdrs = curl_slist_append(hdrs, auth_hdr.c_str());
    curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, method.c_str());
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hdrs);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resp);
    curl_easy_perform(curl);
    curl_slist_free_all(hdrs);
    curl_easy_cleanup(curl);
    return json::parse(resp);
}
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import okhttp3.*;

public class GaiaEx {
    // Load credentials from environment variables — never hardcoded.
    static final String API_KEY    = System.getenv("GAIAEX_API_KEY");
    static final String API_SECRET = System.getenv("GAIAEX_API_SECRET");
    static final String BASE_URL   = "https://openapi.gaiaex.com";
    static final OkHttpClient client = new OkHttpClient();

    static String hmacSha256(String key, String msg) throws Exception {
        Mac mac = Mac.getInstance("HmacSHA256");
        mac.init(new SecretKeySpec(key.getBytes(), "HmacSHA256"));
        byte[] digest = mac.doFinal(msg.getBytes());
        StringBuilder sb = new StringBuilder();
        for (byte b : digest) sb.append(String.format("%02x", b));
        return sb.toString();
    }

    static String fapiRequest(String method, String path, String extraQuery) throws Exception {
        long ts = System.currentTimeMillis();
        String query = (extraQuery == null || extraQuery.isEmpty())
            ? ("timestamp=" + ts + "&recvWindow=5000")
            : (extraQuery + "&timestamp=" + ts + "&recvWindow=5000");
        String sig = hmacSha256(API_SECRET, query);
        String url = BASE_URL + path + "?" + query + "&signature=" + sig;

        RequestBody empty = RequestBody.create(new byte[0], null);
        Request.Builder rb = new Request.Builder()
            .url(url)
            .addHeader("X-MBX-APIKEY", API_KEY);
        if ("POST".equals(method) || "PUT".equals(method)) {
            rb.method(method, empty);
        } else if ("DELETE".equals(method)) {
            rb.delete();
        } else {
            rb.get();
        }
        try (Response resp = client.newCall(rb.build()).execute()) {
            return resp.body().string();
        }
    }
}
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

class GaiaEx {
    // Load credentials from environment variables at startup.
    static readonly string ApiKey    = Environment.GetEnvironmentVariable("GAIAEX_API_KEY")!;
    static readonly string ApiSecret = Environment.GetEnvironmentVariable("GAIAEX_API_SECRET")!;
    const string BaseUrl = "https://openapi.gaiaex.com";
    static readonly HttpClient http = new();

    static string HmacSha256(string key, string msg) {
        using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
        return Convert.ToHexString(
            hmac.ComputeHash(Encoding.UTF8.GetBytes(msg))).ToLower();
    }

    static async Task<JsonDocument> FapiRequest(HttpMethod method, string path, string extraQuery = "") {
        var ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
        var query = string.IsNullOrEmpty(extraQuery)
            ? $"timestamp={ts}&recvWindow=5000"
            : $"{extraQuery}&timestamp={ts}&recvWindow=5000";
        var sig = HmacSha256(ApiSecret, query);
        var url = $"{BaseUrl}{path}?{query}&signature={sig}";
        var req = new HttpRequestMessage(method, url);
        req.Headers.Add("X-MBX-APIKEY", ApiKey);
        var resp = await http.SendAsync(req);
        return JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
    }
}
# Credentials come from environment variables already exported in your shell.
API_KEY="$GAIAEX_API_KEY"
API_SECRET="$GAIAEX_API_SECRET"
BASE_URL="https://openapi.gaiaex.com"

# Helper: sign and send a /fapi/v1 or /fapi/v2 request
fapi_request() {
  local method="$1" path="$2" extra_query="$3"
  local ts=$(date +%s000)
  local query
  if [ -z "$extra_query" ]; then
    query="timestamp=${ts}&recvWindow=5000"
  else
    query="${extra_query}&timestamp=${ts}&recvWindow=5000"
  fi
  local sig=$(echo -n "$query" | openssl dgst -sha256 -hmac "$API_SECRET" | awk '{print $2}')
  curl -s -X "$method" -H "X-MBX-APIKEY: $API_KEY" \
       "${BASE_URL}${path}?${query}&signature=${sig}"
}

Step 4: Check Your Balance

Call GET /fapi/v2/balance to retrieve your USDC and USDT futures balances.

balances = fapi_request("GET", "/fapi/v2/balance")
for b in balances:
    print(f"{b['asset']}: available={b['availableBalance']} total={b['balance']}")
const balances = await fapiRequest('GET', '/fapi/v2/balance');
for (const b of balances) {
  console.log(`${b.asset}: available=${b.availableBalance} total=${b.balance}`);
}
func main() {
    raw, _ := fapiRequest("GET", "/fapi/v2/balance", nil)
    fmt.Println(string(raw))
}
fn main() {
    let balances = fapi_request("GET", "/fapi/v2/balance", "");
    println!("Balances: {}", balances);
}
int main() {
    auto balances = fapi_request("GET", "/fapi/v2/balance");
    std::cout << balances.dump(2) << std::endl;
}
public static void main(String[] args) throws Exception {
    String balances = fapiRequest("GET", "/fapi/v2/balance", "");
    System.out.println(balances);
}
var balances = await FapiRequest(HttpMethod.Get, "/fapi/v2/balance");
Console.WriteLine(balances.RootElement.ToString());
fapi_request "GET" "/fapi/v2/balance" "" | python3 -m json.tool

Response:

[
  {
    "accountAlias": "gaiaex-usdc",
    "asset": "USDC",
    "balance": "1000.00",
    "crossWalletBalance": "1000.00",
    "crossUnPnl": "12.50",
    "availableBalance": "850.00",
    "updateTime": 1743508800000
  },
  {
    "accountAlias": "gaiaex-usdt",
    "asset": "USDT",
    "balance": "500.00",
    "crossWalletBalance": "500.00",
    "crossUnPnl": "0.00",
    "availableBalance": "500.00",
    "updateTime": 1743508800000
  }
]

Step 5: Check Your Positions

Call GET /fapi/v2/positionRisk to return open positions with entry price, mark price, unrealized PnL, leverage, and liquidation price.

positions = fapi_request("GET", "/fapi/v2/positionRisk")
for p in positions:
    if float(p.get("positionAmt", 0)) != 0:
        print(p["symbol"], p["positionAmt"], "entry", p["entryPrice"], "PnL", p["unRealizedProfit"])
const positions = await fapiRequest('GET', '/fapi/v2/positionRisk');
for (const p of positions) {
  if (parseFloat(p.positionAmt) !== 0) {
    console.log(p.symbol, p.positionAmt, 'entry', p.entryPrice, 'PnL', p.unRealizedProfit);
  }
}
raw, _ := fapiRequest("GET", "/fapi/v2/positionRisk", nil)
fmt.Println(string(raw))
let positions = fapi_request("GET", "/fapi/v2/positionRisk", "");
println!("{}", positions);
auto positions = fapi_request("GET", "/fapi/v2/positionRisk");
for (auto& p : positions) {
    std::cout << p["symbol"] << " " << p["positionAmt"] << " entry " << p["entryPrice"] << " PnL " << p["unRealizedProfit"] << "\n";
}
String positions = fapiRequest("GET", "/fapi/v2/positionRisk", "");
System.out.println(positions);
var positions = await FapiRequest(HttpMethod.Get, "/fapi/v2/positionRisk");
foreach (var p in positions.RootElement.EnumerateArray()) {
    Console.WriteLine($"{p.GetProperty("symbol")} {p.GetProperty("positionAmt")} entry {p.GetProperty("entryPrice")} PnL {p.GetProperty("unRealizedProfit")}");
}
fapi_request "GET" "/fapi/v2/positionRisk" "" | python3 -m json.tool

Response:

[
  {
    "symbol": "BTCUSDC",
    "positionAmt": "0.05",
    "entryPrice": "74200.00",
    "markPrice": "75100.00",
    "unRealizedProfit": "45.00",
    "liquidationPrice": "67400.00",
    "leverage": "10",
    "marginType": "cross",
    "isolatedMargin": "0.00",
    "positionSide": "BOTH",
    "updateTime": 1743508800000
  }
]

Step 6: Check Your Open Orders

Call GET /fapi/v1/openOrders to list resting (unfilled) orders. Use GET /fapi/v1/allOrders for filled or canceled order history.

opens = fapi_request("GET", "/fapi/v1/openOrders", {"symbol": "BTCUSDC"})
for o in opens:
    print(o["orderId"], o["symbol"], o["side"], o["origQty"], "@", o["price"])
const opens = await fapiRequest('GET', '/fapi/v1/openOrders', { symbol: 'BTCUSDC' });
for (const o of opens) {
  console.log(o.orderId, o.symbol, o.side, o.origQty, '@', o.price);
}
raw, _ := fapiRequest("GET", "/fapi/v1/openOrders", map[string]string{"symbol": "BTCUSDC"})
fmt.Println(string(raw))
let opens = fapi_request("GET", "/fapi/v1/openOrders", "symbol=BTCUSDC");
println!("{}", opens);
auto opens = fapi_request("GET", "/fapi/v1/openOrders", "symbol=BTCUSDC");
for (auto& o : opens) {
    std::cout << o["orderId"] << " " << o["symbol"] << " " << o["side"] << " " << o["origQty"] << " @ " << o["price"] << "\n";
}
String opens = fapiRequest("GET", "/fapi/v1/openOrders", "symbol=BTCUSDC");
System.out.println(opens);
var opens = await FapiRequest(HttpMethod.Get, "/fapi/v1/openOrders", "symbol=BTCUSDC");
foreach (var o in opens.RootElement.EnumerateArray()) {
    Console.WriteLine($"{o.GetProperty("orderId")} {o.GetProperty("symbol")} {o.GetProperty("side")} {o.GetProperty("origQty")} @ {o.GetProperty("price")}");
}
fapi_request "GET" "/fapi/v1/openOrders" "symbol=BTCUSDC" | python3 -m json.tool
# Historical (all orders including filled / canceled):
fapi_request "GET" "/fapi/v1/allOrders" "symbol=BTCUSDC" | python3 -m json.tool

Step 7: Place a Limit Order

Call POST /fapi/v1/order with standard GaiaEx Unified Futures parameters (symbol, side, type, timeInForce, quantity, price).

order = fapi_request("POST", "/fapi/v1/order", {
    "symbol": "BTCUSDC",
    "side": "BUY",
    "type": "LIMIT",
    "timeInForce": "GTC",
    "quantity": "0.001",
    "price": "80000",
})
print(f"Order placed: {order['orderId']}")
const order = await fapiRequest('POST', '/fapi/v1/order', {
  symbol: 'BTCUSDC',
  side: 'BUY',
  type: 'LIMIT',
  timeInForce: 'GTC',
  quantity: '0.001',
  price: '80000',
});
console.log(`Order placed: ${order.orderId}`);
raw, _ := fapiRequest("POST", "/fapi/v1/order", map[string]string{
    "symbol":      "BTCUSDC",
    "side":        "BUY",
    "type":        "LIMIT",
    "timeInForce": "GTC",
    "quantity":    "0.001",
    "price":       "80000",
})
fmt.Println(string(raw))
let order = fapi_request(
    "POST",
    "/fapi/v1/order",
    "symbol=BTCUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=80000",
);
println!("Order placed: {}", order["orderId"]);
auto order = fapi_request(
    "POST",
    "/fapi/v1/order",
    "symbol=BTCUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=80000"
);
std::cout << "Order placed: " << order["orderId"] << std::endl;
String order = fapiRequest(
    "POST",
    "/fapi/v1/order",
    "symbol=BTCUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=80000"
);
System.out.println("Order placed: " + order);
var order = await FapiRequest(
    HttpMethod.Post,
    "/fapi/v1/order",
    "symbol=BTCUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=80000"
);
Console.WriteLine($"Order placed: {order.RootElement.GetProperty("orderId")}");
fapi_request "POST" "/fapi/v1/order" "symbol=BTCUSDC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=80000" | python3 -m json.tool

Response:

{
  "orderId": 123456789,
  "symbol": "BTCUSDC",
  "status": "NEW",
  "clientOrderId": "autoclient-123456",
  "price": "80000",
  "avgPrice": "0.00",
  "origQty": "0.001",
  "executedQty": "0.000",
  "cumQuote": "0.00",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "reduceOnly": false,
  "side": "BUY",
  "positionSide": "BOTH",
  "updateTime": 1743508800000
}

Step 8: Modify an Order

MODIFY ORDER (PUT /fapi/v1/order)

Calling PUT /fapi/v1/order modifies an existing open limit order. Always read orderId from the modify response for any subsequent cancel or modify calls.

r = fapi_request("PUT", "/fapi/v1/order", {
    "symbol": "BTCUSDC",
    "orderId": 123456789,
    "side": "BUY",
    "quantity": "0.001",
    "price": "79000",
})
print(f"Modified orderId: {r['orderId']} @ {r['price']}")
const r = await fapiRequest('PUT', '/fapi/v1/order', {
  symbol: 'BTCUSDC',
  orderId: 123456789,
  side: 'BUY',
  quantity: '0.001',
  price: '79000',
});
console.log(`Modified orderId: ${r.orderId} @ ${r.price}`);
raw, _ := fapiRequest("PUT", "/fapi/v1/order", map[string]string{
    "symbol":   "BTCUSDC",
    "orderId":  "123456789",
    "side":     "BUY",
    "quantity": "0.001",
    "price":    "79000",
})
fmt.Println(string(raw))
let r = fapi_request(
    "PUT",
    "/fapi/v1/order",
    "symbol=BTCUSDC&orderId=123456789&side=BUY&quantity=0.001&price=79000",
);
println!("Modified orderId: {}", r["orderId"]);
auto r = fapi_request(
    "PUT",
    "/fapi/v1/order",
    "symbol=BTCUSDC&orderId=123456789&side=BUY&quantity=0.001&price=79000"
);
std::cout << "Modified orderId: " << r["orderId"] << "\n";
String r = fapiRequest(
    "PUT",
    "/fapi/v1/order",
    "symbol=BTCUSDC&orderId=123456789&side=BUY&quantity=0.001&price=79000"
);
System.out.println("Modified: " + r);
var r = await FapiRequest(
    HttpMethod.Put,
    "/fapi/v1/order",
    "symbol=BTCUSDC&orderId=123456789&side=BUY&quantity=0.001&price=79000"
);
Console.WriteLine($"Modified orderId: {r.RootElement.GetProperty("orderId")}");
fapi_request "PUT" "/fapi/v1/order" "symbol=BTCUSDC&orderId=123456789&side=BUY&quantity=0.001&price=79000" | python3 -m json.tool

Response:

{
  "orderId": 123456789,
  "symbol": "BTCUSDC",
  "status": "NEW",
  "clientOrderId": "autoclient-123456",
  "price": "79000",
  "avgPrice": "0.00",
  "origQty": "0.001",
  "executedQty": "0.000",
  "cumQuote": "0.00",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "reduceOnly": false,
  "side": "BUY",
  "positionSide": "BOTH",
  "updateTime": 1743508800000
}

Step 9: Cancel the Order

Call DELETE /fapi/v1/order with symbol and orderId (or origClientOrderId) to cancel an open order.

result = fapi_request("DELETE", "/fapi/v1/order", {
    "symbol": "BTCUSDC",
    "orderId": 123456789,
})
print(f"Canceled: {result['status']}")
const result = await fapiRequest('DELETE', '/fapi/v1/order', {
  symbol: 'BTCUSDC',
  orderId: 123456789,
});
console.log(`Canceled: ${result.status}`);
raw, _ := fapiRequest("DELETE", "/fapi/v1/order", map[string]string{
    "symbol":  "BTCUSDC",
    "orderId": "123456789",
})
fmt.Println(string(raw))
let result = fapi_request("DELETE", "/fapi/v1/order", "symbol=BTCUSDC&orderId=123456789");
println!("Canceled: {}", result["status"]);
auto result = fapi_request("DELETE", "/fapi/v1/order", "symbol=BTCUSDC&orderId=123456789");
std::cout << "Canceled: " << result["status"] << std::endl;
String result = fapiRequest("DELETE", "/fapi/v1/order", "symbol=BTCUSDC&orderId=123456789");
System.out.println("Canceled: " + result);
var result = await FapiRequest(HttpMethod.Delete, "/fapi/v1/order", "symbol=BTCUSDC&orderId=123456789");
Console.WriteLine($"Canceled: {result.RootElement.GetProperty("status")}");
fapi_request "DELETE" "/fapi/v1/order" "symbol=BTCUSDC&orderId=123456789" | python3 -m json.tool

Next Steps