GaiaEx API Platform Overview
What is GaiaEx, our non-custodial architecture, supported markets, and how the clearinghouse model works for traders.
SKILL.mdDrop-in Claude Code skill with HMAC-SHA256 signing, /fapi/v1 & /fapi/v2 schemas, and secret-redaction guardrails.
AGENTS.mdDrop-in repository AGENTS.md for OpenAI Codex CLI — tick-size rules, rate-limit budgets, and self-custody boundaries.
AGY.mdGoogle Antigravity (agy) & Gemini agent spec with verified async Python WebSocket + REST execution templates.
llms.txtSingle-URL machine-readable index of all GaiaEx documentation pages, OpenAPI 3.0 schema, and Postman collection.
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).
- Download the GaiaEx mobile app — iOS or Android.
- 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.
- 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.
- 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 + tradepermission. Copy theapi_keyandapi_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.
| Capability | Description |
|---|---|
| USDC Perps | 102 crypto symbols (+31 RWA/venture), up to 40x leverage, USDC margin (e.g., BTCUSDC, ETHUSDC, SOLUSDC) |
| USDT Perps | 34 symbols (crypto + commodities), up to 200x leverage, USDT margin (e.g., BTCUSDT, ETHUSDT, SOLUSDT) |
| RWA & Venture Perps | 31 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 Markets | 50 pairs, USDC settlement, TOKEN/USDC format |
| Non-Custodial | User'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 pattern | Example | Product | Margin | Max leverage |
|---|---|---|---|---|
USDC suffix (or bare ticker / -USDC) | BTCUSDC, ETHUSDC, SOLUSDC | USDC Perp | USDC | up to 40x |
USDT suffix (or -USDT) | BTCUSDT, ETHUSDT, SOLUSDT | USDT Perp | USDT | up to 200x |
RWA ticker / xyz: / cash: / vntl: | GOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500), vntl:OPENAI | RWA / venture perp | USDC | varies |
TICKER/USDC | BTC/USDC | Spot | USDC | n/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.
| Interface | Base URL | Purpose |
|---|---|---|
REST API (/fapi/v1 & /fapi/v2) | https://openapi.gaiaex.com | Trading, account management, market data |
| WebSocket | wss://openapi.gaiaex.com | Real-time order books, user data, wallet updates |
| WebSocket (dedicated) | wss://ws.gaiaex.com | Same 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:
| Method | Best For | Mechanism |
|---|---|---|
| API Key + HMAC-SHA256 | Bots, automated trading, Quantitative SDKs | X-MBX-APIKEY header + HMAC-SHA256(api_secret, query_or_form_body) passed as signature=<hex> with timestamp=<ms> and optional recvWindow=<ms> |
| Bearer Session Token | Mobile app, web app | Authorization: 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 Class | Format | Examples | Margin |
|---|---|---|---|
| Crypto perps | <BASE>USDC (or bare ticker / -USDC) | BTCUSDC, ETHUSDC, SOLUSDC | USDC |
| Equities, Commodities, Indices (RWA) | <ASSET>USDC (or xyz:<ASSET>) | GOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500) | USDC |
| Cash Indices | cash:<INDEX> | cash:USA500, cash:NAS100 | USDC |
| Venture Token Perps | vntl:<TOKEN> | vntl:OPENAI, vntl:ANTHROPIC | USDC |
USDT Perps
Perpetual futures margined in USDT. 34 symbols covering crypto and commodities, up to 200x leverage:
| Asset Class | Format | Examples | Margin |
|---|---|---|---|
| Crypto perps | <BASE>USDT (or -USDT) | BTCUSDT, ETHUSDT, SOLUSDT | USDT |
| Commodities | <ASSET>USDT | GOLDUSDT, OILUSDT | USDT |
Spot Markets
50 on-chain spot pairs with direct token settlement. Symbols follow the TOKEN/USDC or TOKEN/USDT format.
| Format | Examples | Settlement |
|---|---|---|
TOKEN/USDC | BTC/USDC, ETH/USDC | USDC |
TOKEN/USDT | BTC/USDT, ETH/USDT | USDT |
Symbol Summary
| Format | Example | Market |
|---|---|---|
<BASE>USDC | BTCUSDC, ETHUSDC, SOLUSDC | USDC Perp (up to 40x) |
<BASE>USDT | BTCUSDT, ETHUSDT, SOLUSDT | USDT Perp (up to 200x) |
<RWA>USDC / xyz:TICKER | GOLDUSDC (xyz:GOLD), NVDAUSDC (xyz:NVDA), SP500USDC (xyz:SP500) | RWA Perp (USDC margin) |
cash:TICKER | cash:USA500, cash:NAS100 | Cash Index Perp (USDC margin) |
vntl:TICKER | vntl:OPENAI | Venture Token Perp (USDC margin) |
TOKEN/USDC | BTC/USDC | USDC 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-APIKEYauthentication 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.