GaiaExGaiaEx
API

GaiaEx API Platform Overview

What is GaiaEx, our non-custodial architecture, supported markets, and how the clearinghouse model works for traders.

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 ↗

Start Trading in Four Steps

Everything you need to go from zero to a live order via the GaiaEx Unified Futures API (/fapi/v1 & /fapi/v2).

  1. Download the GaiaEx mobile app — iOS or Android.
  2. Open an account — one tap. Account setup and the EIP-712 wallet handshake happen in-app; no paperwork, no waiting. This step is required once and cannot be completed via the API.
  3. Deposit collateral:
    • USDC margin: fund your USDC balance from the GaiaEx app. Minimum 5 USDC. Funds are credited in 1–5 minutes.
    • USDT margin: fund your USDT balance from the GaiaEx app. USDC and USDT are independent margin balances.
  4. Create an API key — Settings → API Keys → Create. This step requires a passkey step-up in the app and cannot be automated via the REST API (bots cannot self-issue keys). Give the key read + trade permission. Copy the api_key and api_secret, then export them as environment variables:
export GAIAEX_API_KEY="your_api_key_here"
export GAIAEX_API_SECRET="your_api_secret_here"

That's it — you're trading-ready. Your wallet address is automatically resolved server-side from your API key, so standard quantitative SDKs (ccxt, Python, TypeScript, Rust) and bots never need to pass a wallet address. The snippet below authenticates with X-MBX-APIKEY and fetches your futures balances via GET /fapi/v2/balance. If it returns your balance array, you can place your first order (see Quick Start).

import hmac, hashlib, time, os, requests

api_key    = os.environ["GAIAEX_API_KEY"]
api_secret = os.environ["GAIAEX_API_SECRET"]

query = f"timestamp={int(time.time() * 1000)}&recvWindow=5000"
sig   = hmac.new(api_secret.encode(), query.encode(), hashlib.sha256).hexdigest()

r = requests.get(
    f"https://openapi.gaiaex.com/fapi/v2/balance?{query}&signature={sig}",
    headers={"X-MBX-APIKEY": api_key},
)
print(r.json())

WHY ENVIRONMENT VARIABLES?

Every example in these docs loads credentials from the environment, not a file in your project directory. Rotate your API key by updating the exported values — your code never changes and never contains a literal secret. For production servers, pull these values from a secrets manager (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) at boot instead of a static shell export — see Security Best Practices.

What is GaiaEx

GaiaEx is a self-custody derivatives DEX offering USDC-margined and USDT-margined perpetuals from a single GaiaEx Unified Futures API (/fapi/v1 & /fapi/v2). GaiaEx supports ~217 tradable instruments (167 perpetuals + up to 50 spot) across crypto, real-world assets (equities, commodities, forex), venture tokens, and spot markets.

All positions settle on-chain; GaiaEx never takes custody of your collateral.

Why no chain names?

GaiaEx uses embedded MPC wallets (Wallet-as-a-Service). Underlying settlement and deposit routing are handled automatically by the platform. The API operates at the instrument level — settlement mechanics are not part of the integration surface.

CapabilityDescription
USDC Perps102 crypto symbols (+31 RWA/venture), up to 40x leverage, USDC margin (e.g., BTCUSDC, ETHUSDC, SOLUSDC)
USDT Perps34 symbols (crypto + commodities), up to 200x leverage, USDT margin (e.g., BTCUSDT, ETHUSDT, SOLUSDT)
RWA & Venture Perps31 symbols — equities, commodities, forex (GOLDUSDC / xyz:GOLD, NVDAUSDC / xyz:NVDA, SP500USDC / xyz:SP500), cash indices (cash: prefix), and venture tokens (vntl: prefix), USDC margin
Spot Markets50 pairs, USDC settlement, TOKEN/USDC format
Non-CustodialUser's embedded wallet (Privy MPC) signs the EIP-712 onboarding handshake once; the resulting agent key is scoped to trading only (canWithdraw=false) and stored encrypted server-side

How Self-Custody Works

When you first open the GaiaEx app, you sign a one-time EIP-712 structured-data message with your embedded wallet. This authorizes GaiaEx to derive an agent key — a narrowly scoped key that can submit and cancel orders on your behalf but cannot move collateral. All on-chain order settlement happens under this agent key. Your main wallet retains full custody; the agent key cannot withdraw funds.

GaiaEx routes your order to the correct margin product based on the symbol you pass — no manual switching required.

Margin Products & Symbol Routing

GaiaEx offers two independent margin products. Each has its own order book and margin pool. From the API's perspective you interact with both through the same /fapi/v1 and /fapi/v2 endpoints — the correct product is selected automatically based on the symbol you pass.

Symbol patternExampleProductMarginMax leverage
USDC suffix (or bare ticker / -USDC)BTCUSDC, ETHUSDC, SOLUSDCUSDC PerpUSDCup to 40x
USDT suffix (or -USDT)BTCUSDT, ETHUSDT, SOLUSDTUSDT PerpUSDTup to 200x
RWA ticker / xyz: / cash: / vntl:GOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500), vntl:OPENAIRWA / venture perpUSDCvaries
TICKER/USDCBTC/USDCSpotUSDCn/a

Separate Margin Accounts

Your USDC balance and USDT balance are completely independent margin accounts. When querying GET /fapi/v2/balance or GET /fapi/v2/account, the response includes asset rows for both USDC and USDT.

Withdrawal Paths

Withdrawals are initiated from the GaiaEx app (not available via API keys) and use an EIP-712 signature from the user's main wallet:

  • USDC balance — withdraw USDC from the GaiaEx app
  • USDT balance — withdraw USDT from the GaiaEx app

No manual switching

You never need to "select" a margin product in the API. Pass BTCUSDC or BTCUSDT — the backend routes automatically. Two margin products means two separate margin pools; plan your collateral deposits accordingly.

API Overview

The GaiaEx API exposes the full trading platform through a GaiaEx Unified Futures REST API and real-time WebSocket streams.

InterfaceBase URLPurpose
REST API (/fapi/v1 & /fapi/v2)https://openapi.gaiaex.comTrading, account management, market data
WebSocketwss://openapi.gaiaex.comReal-time order books, user data, wallet updates
WebSocket (dedicated)wss://ws.gaiaex.comSame streams, shorter URL paths

Two Account Namespaces

Because GaiaEx has two margin products, USDC Perps (BTCUSDC, ETHUSDC, SOLUSDC) and USDT Perps (BTCUSDT, ETHUSDT, SOLUSDT) have separate margin, separate balance, and separate position state. The endpoint URL pattern is identical for both; only the symbol suffix differs.

Authentication

Two methods are supported — choose based on your use case:

MethodBest ForMechanism
API Key + HMAC-SHA256Bots, automated trading, Quantitative SDKsX-MBX-APIKEY header + HMAC-SHA256(api_secret, query_or_form_body) passed as signature=<hex> with timestamp=<ms> and optional recvWindow=<ms>
Bearer Session TokenMobile app, web appAuthorization: Bearer <token> — issued after EIP-712 wallet handshake in-app

Public market data endpoints (/fapi/v1/ping, /fapi/v1/time, /fapi/v1/exchangeInfo, /fapi/v1/depth, /fapi/v1/klines, /fapi/v1/ticker/24hr) require no authentication.

API KEY CREATION IS APP-ONLY

The POST /api-keys endpoint requires a passkey step-up — a biometric or hardware-key confirmation inside the GaiaEx mobile app. This means bots and scripts cannot self-issue API keys. Keys must be created manually in the app (Settings → API Keys) and then used programmatically.

What You Can Build

  • Trading bots & CCXT / Python SDK integrations — place, cancel, and modify orders across both USDC Perps and USDT Perps; set leverage and margin type
  • Portfolio dashboards — stream positions, balances, PnL, and funding history in real time
  • Market data feeds — subscribe to order book updates, candles, and ticker data
  • Risk management tools — query liquidation prices, margin usage, and position risk
  • Wallet read integrations — portfolio tracking and swap-route previews (read-only; quote endpoints return prices and routes for display)

Scope of the API

The REST API covers trading, account reads, referral, and read-only wallet data. Funding (deposits and withdrawals), on-chain transfers, swaps, account setup (EIP-712 handshake), passkey registration, and API key creation happen in the GaiaEx mobile app using the user's embedded wallet — they are not callable via API key.

Supported Markets

USDC Perps

Perpetual futures margined in USDC. 102 crypto symbols available, up to 40x leverage, plus 31 RWA and venture symbols:

Asset ClassFormatExamplesMargin
Crypto perps<BASE>USDC (or bare ticker / -USDC)BTCUSDC, ETHUSDC, SOLUSDCUSDC
Equities, Commodities, Indices (RWA)<ASSET>USDC (or xyz:<ASSET>)GOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500)USDC
Cash Indicescash:<INDEX>cash:USA500, cash:NAS100USDC
Venture Token Perpsvntl:<TOKEN>vntl:OPENAI, vntl:ANTHROPICUSDC

USDT Perps

Perpetual futures margined in USDT. 34 symbols covering crypto and commodities, up to 200x leverage:

Asset ClassFormatExamplesMargin
Crypto perps<BASE>USDT (or -USDT)BTCUSDT, ETHUSDT, SOLUSDTUSDT
Commodities<ASSET>USDTGOLDUSDT, OILUSDTUSDT

Spot Markets

50 on-chain spot pairs with direct token settlement. Symbols follow the TOKEN/USDC or TOKEN/USDT format.

FormatExamplesSettlement
TOKEN/USDCBTC/USDC, ETH/USDCUSDC
TOKEN/USDTBTC/USDT, ETH/USDTUSDT

Symbol Summary

FormatExampleMarket
<BASE>USDCBTCUSDC, ETHUSDC, SOLUSDCUSDC Perp (up to 40x)
<BASE>USDTBTCUSDT, ETHUSDT, SOLUSDTUSDT Perp (up to 200x)
<RWA>USDC / xyz:TICKERGOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500)RWA Perp (USDC margin)
cash:TICKERcash:USA500, cash:NAS100Cash Index Perp (USDC margin)
vntl:TICKERvntl:OPENAIVenture Token Perp (USDC margin)
TOKEN/USDCBTC/USDCUSDC Spot

Use GET /fapi/v1/exchangeInfo for the complete, always-current symbol list with filters, tick sizes, precision, and margin asset.

Multi-Chain Ecosystem

The GaiaEx wallet supports asset management and cross-chain operations across the following networks:

Network
Ethereum
Polygon
Optimism
Solana
TRON
Bitcoin

Trading collateral: USDC Perps are collateralized with USDC; USDT Perps with USDT. Deposits and withdrawals are handled in the GaiaEx app — the backend manages all collateral routing transparently.

Next Steps

  • Follow the Quick Start for a complete code cookbook — auth, balance, positions, orders, place / modify / cancel — in Python, JavaScript, Go, Rust, C++, Java, C#, and curl.
  • Read General Info for base URL, X-MBX-APIKEY authentication details, HMAC signing walkthrough, timeouts, retries, and idempotency.
  • Review Common Definitions for order types, symbol formats, and margin modes.
  • Ready for AI? See AI Agent Integration — build an autonomous agent on top of these endpoints. The agent trades within the API key's scope; it cannot move funds.