Exchange API Reference

Programmatic access to the CXM cryptocurrency exchange over GraphQL.

Get a Bearer Token

Obtain a JWT that you can pass as Authorization: Bearer <token> on every request in this document, and to enable the Try It action on each endpoint below. Tokens are short-lived; refresh by signing in again. Don't have an API key? Create one in your CXM account settings.

Bearer access token

          

Introduction

The CXM API is a GraphQL API. All requests are sent as POST to the /graphql endpoint of the appropriate host with a JSON body containing query and variables, and an Authorization: Bearer <token> header.

Hosts

https://api.cxm.io/graphql for all GraphQL operations: spot trading, derivatives, vaults, wallets, conversions, deposits/withdrawals, API keys, webhooks.

GraphQL subscriptions are delivered over WebSocket on the same hosts with the wss:// scheme. See the WebSocket transport guide and the Subscriptions group below.

Request shape

POST /graphql HTTP/1.1
Host: api.cxm.io
Authorization: Bearer <token>
Content-Type: application/json

{
  "query": "query { instruments { instrument_id name } }",
  "variables": {}
}

Errors

GraphQL errors are returned in the errors array of the response body with HTTP status 200. Network and auth errors return non-200 statuses.

Accounts & Balances

Read wallet balances and ledger entries for the authenticated user.

query accounts_balances Read current balances per currency (free, total, exposed, margin exposure).
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
wallet_id String optional Wallet ID (optional)

Response

FieldTypeDescription
currency_id String Currency ID
total_balance Float Total balance
free_balance Float Available balance for trading

GraphQL Operation

query accounts_balances($wallet_id: String)  {
  accounts_balances(wallet_id: $wallet_id)  {
    currency_id total_balance exposed_balance margin_exposure free_balance
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query accounts_balances($wallet_id: String) { accounts_balances(wallet_id: $wallet_id) { currency_id total_balance exposed_balance margin_exposure free_balance } }","variables":{}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query accounts_balances($wallet_id: String) { accounts_balances(wallet_id: $wallet_id) { currency_id total_balance exposed_balance margin_exposure free_balance } }""",
    "variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query accounts_balances($wallet_id: String) { accounts_balances(wallet_id: $wallet_id) { currency_id total_balance exposed_balance margin_exposure free_balance } }`,
    variables: {},
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query account_transactions Read account ledger (trades, fees, deposits, withdrawals, transfers).
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
wallet_id String! required Wallet ID
currency_id String optional Filter by currency
pager PagerInput optional Pagination parameters
dateRange DateRangeInput optional Date range filter

Response

FieldTypeDescription
account_transaction_id String Transaction ID
type AccountTransactionType Transaction type (trade, deposit, withdrawal, etc.)

GraphQL Operation

query account_transactions($wallet_id: String!, $currency_id: String, $pager: PagerInput, $dateRange: DateRangeInput)  {
  account_transactions(wallet_id: $wallet_id, currency_id: $currency_id, pager: $pager, dateRange: $dateRange)  {
    account_transaction_id currency_id type amount post_balance created_at_iso
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query account_transactions($wallet_id: String!, $currency_id: String, $pager: PagerInput, $dateRange: DateRangeInput) { account_transactions(wallet_id: $wallet_id, currency_id: $currency_id, pager: $pager, dateRange: $dateRange) { account_transaction_id currency_id type amount post_balance created_at_iso } }","variables":{"wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query account_transactions($wallet_id: String!, $currency_id: String, $pager: PagerInput, $dateRange: DateRangeInput) { account_transactions(wallet_id: $wallet_id, currency_id: $currency_id, pager: $pager, dateRange: $dateRange) { account_transaction_id currency_id type amount post_balance created_at_iso } }""",
    "variables": {
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query account_transactions($wallet_id: String!, $currency_id: String, $pager: PagerInput, $dateRange: DateRangeInput) { account_transactions(wallet_id: $wallet_id, currency_id: $currency_id, pager: $pager, dateRange: $dateRange) { account_transaction_id currency_id type amount post_balance created_at_iso } }`,
    variables: {
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this

API & Webhooks

Create and manage API keys, and register webhooks that deliver real-time events to your service. See the signature-verification guide below before going to production.

API key permissions

When creating a key with create_api_key (or editing one with update_api_key), the permissions argument accepts values from the enum below. Pass the exact lowercase string in the array. For example, ["accounts_balances", "create_order", "cancel_order"]. Grant only the permissions the key actually needs; an unauthenticated call to a permission the key does not hold returns a GraphQL error.

The two groups marked conditional appear on a key only when the corresponding product (vaults, derivatives) is enabled for the user's account.

Accounts and balances

PermissionDescription
accounts_balancesRead current balances per currency (free, total, exposed, margin exposure).
daily_balances_reportRead end-of-day balance snapshots / history.
account_transactionsRead account ledger (trades, fees, deposits, withdrawals, transfers).
accountsList the user's accounts and metadata.

API and webhooks

PermissionDescription
create_api_keyCreate new API keys.
update_api_keyRename, expire, enable/disable, change permissions of existing keys.
delete_api_keyRevoke API keys.
webhooksList configured webhooks.
create_webhookRegister a new webhook endpoint.
update_webhookModify an existing webhook.
delete_webhookRemove a webhook.

Conversions and payments

PermissionDescription
create_conversion_quoteGet a locked exchange-rate quote between two currencies.
conversion_quotesList previously generated quotes.
create_conversion_orderExecute a conversion against a quote.
conversionsList conversion history.
payments_feesRead fee schedule for deposits / withdrawals.
trading_feesRead trading fee tiers per instrument.
payments_limitsRead user's daily / weekly payment limits.
paymentsList deposit / withdrawal history.
payments_routesList available deposit / withdrawal methods and bank details.
create_withdrawal_cryptoInitiate a crypto withdrawal to an external address.
create_withdrawal_fiatInitiate a fiat withdrawal via bank transfer.
deposit_bank_details_fiatRead bank account details for fiat deposits.
deposit_addresses_cryptoGenerate / read crypto deposit addresses.
estimate_network_feeEstimate the on-chain network fee for a pending withdrawal.

Orders and trades

PermissionDescription
create_orderPlace spot orders (market, limit, stop).
cancel_orderCancel a single open order or all orders.
open_ordersList currently open spot orders.
closed_ordersList filled / cancelled spot orders.
estimate_orderPreview cost, fees, and slippage before placing an order.
tradesList executed trades / fills.
instrumentsList trading pairs with metadata and current prices.
currenciesList supported currencies.
trading_limitsRead user's per-instrument trading limits.

Vaults (conditional: only when vaults are enabled for the user)

PermissionDescription
vaultsList available yield vaults.
vaults_accountsRead user's vault account balances.
vaults_transactionsRead vault deposit / withdrawal history.
create_vault_depositDeposit funds into a vault.
create_vault_withdrawalWithdraw funds from a vault.
vaults_transactions_requestsList pending vault transactions.
cancel_vault_transaction_requestCancel a pending vault transaction.
estimate_vault_interestsEstimate yield on a planned vault deposit.

Derivatives (conditional: only when derivatives are enabled for the user)

PermissionDescription
derivatives_instrumentsList perpetual swap contracts.
open_derivatives_ordersList currently open margin orders.
closed_derivatives_ordersList filled / cancelled margin orders.
create_derivatives_orderPlace a margin / perpetual order.
cancel_derivatives_orderCancel a margin order.
estimate_derivatives_orderPreview a margin order before placing.
open_derivatives_positionsList currently open margin positions.
closed_derivatives_positionsList historical (closed) margin positions.
update_open_derivatives_positionAdjust take-profit / stop-loss / margin on an open position.
derivatives_funding_historyRead funding fees paid / earned over time.

HMAC request signing

When an API key is created with hmac_required: ON, every request authenticated with that key must carry two additional headers containing a per-request HMAC signature. The bearer token is still required. HMAC is layered on top, not a replacement.

The signing key is not the raw api_key_secret. You first derive a secret_hash from the api_key_id and api_key_secret returned by create_api_key, then sign each request with that hash. The server stores the same hash and re-derives the signature on every request.

Required headers

HeaderDescription
X-NonceUnique random value per request (UUID or 16+ bytes of randomness, hex-encoded). Each nonce is cached for two hours and rejected if reused. Reuse returns a SIGNATURE_GUARD_NONCE_ALREADY_USED error.
X-SignatureHMAC-SHA256 hex digest of rawBody + nonce, keyed by your derived secret_hash.

Step 1: Derive the signing key

Do this once, when the key is issued. Cache the result; you can discard api_key_secret after this step.

secret_hash = HMAC-SHA256(key=api_key_id, message=api_key_secret).hex()

Step 2: Sign each request

X-Signature = HMAC-SHA256(key=secret_hash, message=rawBody + nonce).hex()

rawBody is the exact UTF-8 bytes of the JSON body that will be sent on the wire (including all whitespace and key ordering). nonce is the value of the X-Nonce header.

Node.js / TypeScript

import crypto from "node:crypto";

// Compute once at startup from the values returned by create_api_key.
const SECRET_HASH = crypto
  .createHmac("sha256", API_KEY_ID)
  .update(API_KEY_SECRET)
  .digest("hex");

async function signedRequest(body: object) {
  const rawBody = JSON.stringify(body);
  const nonce = crypto.randomUUID();
  const signature = crypto
    .createHmac("sha256", SECRET_HASH)
    .update(rawBody + nonce)
    .digest("hex");

  return fetch("https://api.cxm.io/graphql", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${TOKEN}`,
      "Content-Type": "application/json",
      "X-Nonce": nonce,
      "X-Signature": signature,
    },
    body: rawBody,
  });
}

Python

import hashlib, hmac, json, uuid, requests

# Compute once at startup.
SECRET_HASH = hmac.new(
    API_KEY_ID.encode(),
    API_KEY_SECRET.encode(),
    hashlib.sha256,
).hexdigest()

def signed_request(body: dict):
    raw_body = json.dumps(body, separators=(",", ":"))
    nonce = str(uuid.uuid4())
    signature = hmac.new(
        SECRET_HASH.encode(),
        (raw_body + nonce).encode(),
        hashlib.sha256,
    ).hexdigest()

    return requests.post(
        "https://api.cxm.io/graphql",
        headers={
            "Authorization": f"Bearer {TOKEN}",
            "Content-Type": "application/json",
            "X-Nonce": nonce,
            "X-Signature": signature,
        },
        data=raw_body,
    )

Operational notes

  • Bearer token still required. The HMAC signature is checked in addition to Authorization: Bearer <token>, not instead of it.
  • Sign the bytes you actually send. If your HTTP client re-serialises the body (whitespace, key ordering, encoding), the server-side hash will not match. Build rawBody once, then both sign it and send it.
  • Fresh nonce per request. A randomUUID() or 16+ random bytes is fine. Reusing a nonce within the cache window (default 2 hours) is rejected.
  • Constant-time compare on any code path where you verify signatures locally (e.g. a request mirror), to avoid timing side-channel leaks: crypto.timingSafeEqual in Node.js, hmac.compare_digest in Python.
  • Rotate keys if api_key_secret is ever leaked: delete the existing key with delete_api_key and create a new one. The secret_hash cannot be reset without rotating.

Webhook trigger events

The triggers argument of create_webhook and update_webhook accepts an array of values from the NotificationTrigger enum. A webhook only delivers events whose trigger string appears in this list. Pass the exact lowercase strings. For example, ["order_new", "order_completed", "trade_completed", "payment_completed"].

Authentication & user

TriggerFired when
signinThe user signs in.
user_createdA user record is created.
user_updatedA user record is updated.
account_createdA new account is provisioned for the user.
mfa_enabledMulti-factor authentication is enabled on the account.

Crypto addresses

TriggerFired when
crypto_address_createdA new deposit address is generated.
crypto_address_addedAn external withdrawal address is whitelisted.

Spot orders & trades

TriggerFired when
order_newA spot order is placed.
order_completedA spot order is fully filled.
order_cancelledA spot order is cancelled.
order_rejectedA spot order is rejected.
trade_completedA trade (fill) is executed.
strategy_rule_violationAn order trips a trading-strategy compliance rule.

Conversions

TriggerFired when
conversion_newA conversion order is created.
conversion_completedA conversion completes.
conversion_rejectedA conversion is rejected.

Payments (deposits / withdrawals)

TriggerFired when
payment_newA deposit or withdrawal is initiated.
payment_unconfirmedAn on-chain deposit is detected but not yet confirmed.
payment_manual_approval_requiredA payment requires manual approval.
payment_approvedA payment is approved.
payment_completedA payment settles successfully.
payment_rejectedA payment is rejected.
manual_balance_updateAn operator manually adjusts a balance.
account_transactionAn account-ledger entry is recorded.

Derivatives / margin

TriggerFired when
derivatives_order_openA margin / perpetual order is opened.
derivatives_order_partially_filledA margin order is partially filled.
derivatives_order_completedA margin order is fully filled.
derivatives_order_cancelledA margin order is cancelled.
derivatives_order_rejectedA margin order is rejected.
margin_callThe user's margin ratio crosses the margin-call threshold.
margin_liquidationA position is liquidated.

Vaults

TriggerFired when
vault_depositFunds are deposited into a vault.
vault_withdrawalFunds are withdrawn from a vault.
vault_interests_accruedVault interest is accrued to the user.
vault_expiredA fixed-term vault reaches expiry.
vault_deactivatedA vault is deactivated.

OTC

TriggerFired when
otc_order_newAn OTC order is placed.
otc_order_completedAn OTC order completes.
otc_order_cancelledAn OTC order is cancelled.
otc_order_rejectedAn OTC order is rejected.

Referrals

TriggerFired when
referral_rewardedA referral reward is granted.
referral_one_time_rewardedA one-time referral bonus is granted.
referral_cashback_rewardedA referral cashback reward is granted.
referral_commission_rewardedA referral commission is granted.
referral_rebate_rewardedA referral rebate is granted.

Webhook signature verification

Webhooks are automated messages the exchange sends to a URL you provide whenever an event of interest occurs (payments, orders, conversions, and more). Your service just needs to be reachable over HTTPS and able to receive a POST request with a JSON body.

When you create a webhook, the exchange returns a webhook_id. Treat this value as a secret. It is the shared secret used to sign every message delivered to your endpoint.

Delivery headers

HeaderDescription
x-webhook-signatureSHA-256 hex digest of webhook_id + json_body. Note: this is a plain SHA-256 hash with the shared secret prepended, not HMAC. It is a different mechanism from HMAC request signing, which the API uses for outgoing requests.
x-webhook-exchangeIdentifier of the exchange the event originated from.
x-webhook-serial-idMonotonically increasing sequence number for the webhook. Use it to detect dropped or out-of-order deliveries.

Compute the digest on your side and compare to x-webhook-signature. Discard any request whose signatures do not match.

Node.js / TypeScript

import crypto from "node:crypto";

function createSignature(webhookId: string, payload: unknown): string {
  return crypto
    .createHash("sha256")
    .update(webhookId + JSON.stringify(payload))
    .digest("hex");
}

// Express-style handler
app.post("/webhooks/cxm", (req, res) => {
  const expected = createSignature(WEBHOOK_ID, req.body);
  const received = req.header("x-webhook-signature");

  if (!received || expected !== received) {
    return res.status(401).send("invalid signature");
  }

  // Signature is valid; process the event
  processEvent(req.body);
  res.status(200).send("ok");
});

Python

import hashlib, json

def create_signature(webhook_id: str, payload) -> str:
    body = json.dumps(payload, separators=(",", ":"))
    return hashlib.sha256((webhook_id + body).encode("utf-8")).hexdigest()

Operational notes

  • Use the raw request body. Different JSON serialisers produce different byte sequences (whitespace, key ordering) that break the hash. Verify before any framework middleware mutates the payload.
  • Constant-time compare (crypto.timingSafeEqual in Node.js, hmac.compare_digest in Python) to avoid timing side-channel leaks.
  • Acknowledge quickly. Return a 2xx response as soon as the signature is valid; move slow business logic to a background worker. Timed-out webhooks may be retried.
  • Rotate if the webhook_id is ever leaked by deleting the existing webhook and creating a new one.
mutation create_api_key Create new API keys.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
name String optional Descriptive name for the API key
expires_at String! required Expiration date in ISO 8601 format
is_active ToggleSwitch! required Enable or disable the key immediately
ip_address [String!] optional IP addresses allowed to use this key
permissions [Permission!]! required List of permissions (READ, TRADE, WITHDRAW, etc.)
type ApiKeyTypes! required Type of API key (SPOT, MARGIN, etc.)
hmac_required ToggleSwitch! required Require HMAC signature for requests

Response

FieldTypeDescription
api_key_id String Newly created API key (public key)
api_key_secret String API key secret (shown only once, store securely)

GraphQL Operation

mutation create_api_key($name: String, $expires_at: String!, $is_active: ToggleSwitch!, $ip_address: [String!], $permissions: [Permission!]!, $type: ApiKeyTypes!, $hmac_required: ToggleSwitch!)  {
  create_api_key(name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, type: $type, hmac_required: $hmac_required)  {
    api_key_id api_key_secret
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_api_key($name: String, $expires_at: String!, $is_active: ToggleSwitch!, $ip_address: [String!], $permissions: [Permission!]!, $type: ApiKeyTypes!, $hmac_required: ToggleSwitch!) { create_api_key(name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, type: $type, hmac_required: $hmac_required) { api_key_id api_key_secret } }","variables":{"name":"Trading Bot","expires_at":"2025-12-31T23:59:59Z","is_active":"ON","permissions":["READ","TRADE"],"type":"SPOT","hmac_required":"ON"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_api_key($name: String, $expires_at: String!, $is_active: ToggleSwitch!, $ip_address: [String!], $permissions: [Permission!]!, $type: ApiKeyTypes!, $hmac_required: ToggleSwitch!) { create_api_key(name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, type: $type, hmac_required: $hmac_required) { api_key_id api_key_secret } }""",
    "variables": {
        "name": "Trading Bot",
        "expires_at": "2025-12-31T23:59:59Z",
        "is_active": "ON",
        "permissions": [
            "READ",
            "TRADE"
        ],
        "type": "SPOT",
        "hmac_required": "ON"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_api_key($name: String, $expires_at: String!, $is_active: ToggleSwitch!, $ip_address: [String!], $permissions: [Permission!]!, $type: ApiKeyTypes!, $hmac_required: ToggleSwitch!) { create_api_key(name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, type: $type, hmac_required: $hmac_required) { api_key_id api_key_secret } }`,
    variables: {
      "name": "Trading Bot",
      "expires_at": "2025-12-31T23:59:59Z",
      "is_active": "ON",
      "permissions": [
        "READ",
        "TRADE"
      ],
      "type": "SPOT",
      "hmac_required": "ON"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation update_api_key Rename, expire, enable/disable, change permissions of existing keys.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
api_key_id String! required ID of the API key to update
name String optional New descriptive name
expires_at String optional New expiration date
is_active ToggleSwitch optional Enable or disable the key
ip_address [String!] optional New IP whitelist
permissions [Permission!] optional Updated permissions
hmac_required ToggleSwitch! required Require HMAC signature

GraphQL Operation

mutation update_api_key($api_key_id: String!, $name: String, $expires_at: String, $is_active: ToggleSwitch, $ip_address: [String!], $permissions: [Permission!], $hmac_required: ToggleSwitch!)  {
  update_api_key(api_key_id: $api_key_id, name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, hmac_required: $hmac_required)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation update_api_key($api_key_id: String!, $name: String, $expires_at: String, $is_active: ToggleSwitch, $ip_address: [String!], $permissions: [Permission!], $hmac_required: ToggleSwitch!) { update_api_key(api_key_id: $api_key_id, name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, hmac_required: $hmac_required) }","variables":{"api_key_id":"key123","name":"Updated Name","is_active":"OFF","hmac_required":"ON"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation update_api_key($api_key_id: String!, $name: String, $expires_at: String, $is_active: ToggleSwitch, $ip_address: [String!], $permissions: [Permission!], $hmac_required: ToggleSwitch!) { update_api_key(api_key_id: $api_key_id, name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, hmac_required: $hmac_required) }""",
    "variables": {
        "api_key_id": "key123",
        "name": "Updated Name",
        "is_active": "OFF",
        "hmac_required": "ON"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation update_api_key($api_key_id: String!, $name: String, $expires_at: String, $is_active: ToggleSwitch, $ip_address: [String!], $permissions: [Permission!], $hmac_required: ToggleSwitch!) { update_api_key(api_key_id: $api_key_id, name: $name, expires_at: $expires_at, is_active: $is_active, ip_address: $ip_address, permissions: $permissions, hmac_required: $hmac_required) }`,
    variables: {
      "api_key_id": "key123",
      "name": "Updated Name",
      "is_active": "OFF",
      "hmac_required": "ON"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation delete_api_key Revoke API keys.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
api_key_id String! required ID of the API key to delete

GraphQL Operation

mutation delete_api_key($api_key_id: String!)  {
  delete_api_key(api_key_id: $api_key_id)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation delete_api_key($api_key_id: String!) { delete_api_key(api_key_id: $api_key_id) }","variables":{"api_key_id":"key123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation delete_api_key($api_key_id: String!) { delete_api_key(api_key_id: $api_key_id) }""",
    "variables": {
        "api_key_id": "key123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation delete_api_key($api_key_id: String!) { delete_api_key(api_key_id: $api_key_id) }`,
    variables: {
      "api_key_id": "key123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_webhook Register a new webhook endpoint.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
name String! required Human-readable label for the webhook.
is_active ToggleSwitch! required "on" to activate immediately, "off" to create but pause.
url String! required HTTPS URL that will receive POST deliveries.
triggers [NotificationTrigger!]! required Event types the webhook subscribes to.

Response

FieldTypeDescription
webhook_id String Shared secret. Required to verify the signature of every message this webhook sends.
is_active ToggleSwitch Current activation state.
created_at String Creation timestamp.
updated_at String Last modification timestamp.
name String Label supplied on creation.
url String Delivery URL.
triggers [NotificationTrigger!] Subscribed event types.

GraphQL Operation

mutation create_webhook($name: String!, $is_active: ToggleSwitch!, $url: String!, $triggers: [NotificationTrigger!]!)  {
  create_webhook(name: $name, is_active: $is_active, url: $url, triggers: $triggers)  {
    is_active webhook_id created_at updated_at name url triggers
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_webhook($name: String!, $is_active: ToggleSwitch!, $url: String!, $triggers: [NotificationTrigger!]!) { create_webhook(name: $name, is_active: $is_active, url: $url, triggers: $triggers) { is_active webhook_id created_at updated_at name url triggers } }","variables":{"name":"Trading bot order events","is_active":"on","url":"https://example.com/webhooks/cxm","triggers":["order_new","order_completed","trade_completed","payment_new","payment_completed"]}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_webhook($name: String!, $is_active: ToggleSwitch!, $url: String!, $triggers: [NotificationTrigger!]!) { create_webhook(name: $name, is_active: $is_active, url: $url, triggers: $triggers) { is_active webhook_id created_at updated_at name url triggers } }""",
    "variables": {
        "name": "Trading bot order events",
        "is_active": "on",
        "url": "https://example.com/webhooks/cxm",
        "triggers": [
            "order_new",
            "order_completed",
            "trade_completed",
            "payment_new",
            "payment_completed"
        ]
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_webhook($name: String!, $is_active: ToggleSwitch!, $url: String!, $triggers: [NotificationTrigger!]!) { create_webhook(name: $name, is_active: $is_active, url: $url, triggers: $triggers) { is_active webhook_id created_at updated_at name url triggers } }`,
    variables: {
      "name": "Trading bot order events",
      "is_active": "on",
      "url": "https://example.com/webhooks/cxm",
      "triggers": [
        "order_new",
        "order_completed",
        "trade_completed",
        "payment_new",
        "payment_completed"
      ]
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation delete_webhook Remove a webhook.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
webhook_id String! required ID of the webhook to delete.

Response

FieldTypeDescription
delete_webhook Boolean true if the webhook was deleted.

GraphQL Operation

mutation delete_webhook($webhook_id: String!)  {
  delete_webhook(webhook_id: $webhook_id)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation delete_webhook($webhook_id: String!) { delete_webhook(webhook_id: $webhook_id) }","variables":{"webhook_id":"588abb48-2b8b-46a4-857e-1d967529758f"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation delete_webhook($webhook_id: String!) { delete_webhook(webhook_id: $webhook_id) }""",
    "variables": {
        "webhook_id": "588abb48-2b8b-46a4-857e-1d967529758f"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation delete_webhook($webhook_id: String!) { delete_webhook(webhook_id: $webhook_id) }`,
    variables: {
      "webhook_id": "588abb48-2b8b-46a4-857e-1d967529758f"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this

Subscriptions

Real-time GraphQL subscriptions delivered over a WebSocket connection. Subscribe once, receive a stream of next messages until you unsubscribe or the server closes the channel.

WebSocket transport

Subscriptions use the graphql-ws protocol over secure WebSocket (wss://).

Endpoint

wss://api.cxm.io/graphql for all subscriptions: spot, derivatives / margin, and vaults / staking.

Authentication

Send your bearer token in connectionParams on the initial connection_init frame. Do not use an HTTP Authorization header (browsers cannot set headers on WebSocket handshakes). The server reads the authorization field from connectionParams:

{
  "type": "connection_init",
  "payload": {
    "authorization": "Bearer <JWT_TOKEN>"
  }
}

The server replies with {"type": "connection_ack"} when authentication succeeds.

Opening a subscription

After connection_ack, send a subscribe frame with a unique id you choose; every next message the server sends back will carry that same id:

{
  "type": "subscribe",
  "id": "1",
  "payload": {
    "query": "subscription instrument_price($instrument_id: String) { instrument_price(instrument_id: $instrument_id) { instrument_id ask bid price_24h_change ts_iso } }",
    "variables": { "instrument_id": "BTC-USDT" }
  }
}

Each update arrives as a next frame:

{
  "type": "next",
  "id": "1",
  "payload": { "data": { "instrument_price": { "instrument_id": "BTC-USDT", "ask": 43210.5, "bid": 43208.0, "price_24h_change": 1.23, "ts_iso": "2026-04-08T12:00:00Z" } } }
}

The server signals end-of-stream with {"type": "complete", "id": "1"}; an error frame with the same shape is sent if the subscription fails. To stop receiving updates yourself, send {"type": "complete", "id": "1"}.

Keeping the connection open

The graphql-ws protocol carries its own keepalive: the server periodically sends a ping frame and the client must reply with a pong. Every compliant graphql-ws client library handles this for you; if you implement the protocol by hand, mirror every ping with a pong within a few seconds, otherwise the server will close the connection.

WebSocket connections will still drop occasionally, whether from transient network issues, load-balancer rotations, or an expired bearer token. The recommended pattern is to let the client library reconnect automatically and re-issue every active subscription on the new connection. The reference client we ship in cointrader_v4 uses these settings:

import { createClient } from "graphql-ws";

const client = createClient({
  url: "wss://api.cxm.io/graphql",
  connectionParams: { authorization: `Bearer ${token}` },
  shouldRetry: () => true,
  retryAttempts: 8,
});

client.subscribe(
  {
    query: `subscription instrument_price($instrument_id: String) {
      instrument_price(instrument_id: $instrument_id) { instrument_id ask bid price_24h_change ts_iso }
    }`,
    variables: { instrument_id: "BTC-USDT" },
  },
  {
    next: (msg) => console.log(msg.data),
    error: (err) => console.error(err),
    complete: () => console.log("server closed the stream"),
  }
);

shouldRetry: () => true with retryAttempts: 8 means the library will reconnect up to eight times after a drop, with exponential backoff between attempts; after a successful reconnect it automatically re-issues every active subscribe. If your token has expired by then, refresh it (re-run Get a Bearer Token) and update connectionParams before reconnecting.

Operational tips:

  • One connection per host. Multiplex many subscriptions on the same WebSocket instead of opening a connection per subscription. The id field on every frame keeps streams separated.
  • Refresh the token before it expires. Bearer tokens are short-lived; reconnect with a fresh token rather than letting the connection close on auth failure.
  • Resume cleanly. When reconnecting, snapshot the latest state via the equivalent query (e.g. call open_orders after reconnecting all_orders) so you do not miss updates that occurred while disconnected.
subscription orderbook Real-time spot order book (bid / ask walls).
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instrument_idString!requiredTrading pair to subscribe to (e.g. BTC-USDT).

Each update

FieldTypeDescription
instrument_idStringThe instrument this update applies to.
buy[OrderbookLevel]Bid side, an array of { quantity, price }.
sell[OrderbookLevel]Ask side, an array of { quantity, price }.

GraphQL Operation

subscription orderbook($instrument_id: String!) {
  orderbook(instrument_id: $instrument_id) {
    instrument_id
    buy { quantity price }
    sell { quantity price }
  }
}
subscription all_orders Real-time status updates for the user's spot orders.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instruments[String!]optionalRestrict updates to the given instruments. Omit to receive updates for every instrument.

Each update

FieldTypeDescription
order_idStringOrder whose status changed.
statusStringNew order status.
updated_atStringUpdate timestamp.

GraphQL Operation

subscription all_orders($instruments: [String!]) {
  all_orders(instruments: $instruments) {
    order_id status updated_at
  }
}
subscription instrument_price Real-time top-of-book bid / ask for a spot instrument.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instrument_idStringoptionalRestrict to one instrument. Omit to receive updates for every instrument.

Each update

FieldTypeDescription
instrument_idStringThe instrument this tick is for.
askFloatBest ask price.
bidFloatBest bid price.
price_24h_changeFloatPercent change over the last 24 hours.
ts_isoStringTick timestamp (ISO-8601).

GraphQL Operation

subscription instrument_price($instrument_id: String) {
  instrument_price(instrument_id: $instrument_id) {
    instrument_id ask bid price_24h_change ts_iso
  }
}
subscription instrument_price_bar Real-time OHLC candle stream for a spot instrument.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instrument_idString!requiredTrading pair to subscribe to.
periodicityInstrumentHistoryPeriodicity!requiredBar interval (e.g. 1m, 5m, 15m, 1h, 4h, 1d).

Each update

FieldTypeDescription
instrument_idStringInstrument the bar applies to.
openFloatOpen price.
highFloatHigh price.
lowFloatLow price.
closeFloatClose price.
ts_isoStringBar timestamp (ISO-8601).

GraphQL Operation

subscription instrument_price_bar($instrument_id: String!, $periodicity: InstrumentHistoryPeriodicity!) {
  instrument_price_bar(instrument_id: $instrument_id, periodicity: $periodicity) {
    instrument_id open high low close ts_iso
  }
}
subscription margin_orderbook Real-time perpetual-contract order book.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instrument_idString!requiredPerpetual contract symbol (e.g. BTC-PERP).

Each update

FieldTypeDescription
instrument_idStringInstrument the update applies to.
buy[OrderbookLevel]Bid side, an array of { quantity, price }.
sell[OrderbookLevel]Ask side, an array of { quantity, price }.

GraphQL Operation

subscription margin_orderbook($instrument_id: String!) {
  margin_orderbook(instrument_id: $instrument_id) {
    instrument_id
    buy { quantity price }
    sell { quantity price }
  }
}
subscription margin_instrument_price_bar Real-time OHLC candle stream for a perpetual contract.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
instrument_idString!requiredPerpetual contract symbol.
periodicityMarginInstrumentHistoryPeriodicity!requiredBar interval (e.g. 1m, 5m, 1h, 1d).

Each update

FieldTypeDescription
margin_instrument_idStringContract this bar applies to.
openFloatOpen price.
highFloatHigh price.
lowFloatLow price.
closeFloatClose price.
updated_at_isoStringBar timestamp (ISO-8601).

GraphQL Operation

subscription margin_instrument_price_bar($instrument_id: String!, $periodicity: MarginInstrumentHistoryPeriodicity!) {
  margin_instrument_price_bar(instrument_id: $instrument_id, periodicity: $periodicity) {
    margin_instrument_id open high low close updated_at_iso
  }
}
subscription margin_order_update Real-time status updates for the user's margin orders.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
wallet_idStringoptionalRestrict updates to a single margin wallet.

Each update

FieldTypeDescription
margin_order_idIDThe order whose state changed.
margin_position_idIDLinked position, if any.
instrument_idStringContract symbol.
sideStringBuy / sell side.
typeStringOrder type (market, limit, stop, …).
statusStringNew order status.
quantityFloatOrder quantity.
executed_quantityFloatQuantity filled so far.
priceFloatOrder price.
limit_priceFloatLimit / stop price.
leverageFloatLeverage applied.
stop_lossFloatStop-loss price.
take_profitFloatTake-profit price.
fee_amountFloatFee charged so far.
time_in_forceStringTIF (GTC, IOC, FOK, …).
updated_at_isoStringUpdate timestamp (ISO-8601).
wallet_idStringWallet the order belongs to.

GraphQL Operation

subscription margin_order_update($wallet_id: String) {
  margin_order_update(wallet_id: $wallet_id) {
    margin_order_id margin_position_id instrument_id side type status
    leverage quantity executed_quantity price limit_price
    stop_loss take_profit fee_amount time_in_force
    updated_at_iso wallet_id
  }
}
subscription open_margin_position_update Real-time updates for the user's open margin positions (P&L, exit price, margin).
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
wallet_idStringoptionalRestrict updates to a single margin wallet.

Each update

FieldTypeDescription
margin_position_idIDPosition the update applies to.
instrument_idStringContract symbol.
sideStringLong / short.
amountFloatCurrent position size.
leverageFloatLeverage on the position.
entry_priceFloatAverage entry price.
exit_priceFloatRealised exit price (for closed legs).
pnlFloatUnrealised P&L.
total_pnlFloatRealised + unrealised P&L.
marginFloatMargin allocated to the position.
margin_currency_idStringCurrency of the margin.
funding_fee_amountFloatFunding fee paid / received.
stop_lossFloatStop-loss price.
take_profitFloatTake-profit price.
close_reasonStringClose reason text (when closing).
close_reason_codeStringClose reason machine code.
updated_at_isoStringUpdate timestamp (ISO-8601).
wallet_idStringWallet the position belongs to.

GraphQL Operation

subscription open_margin_position_update($wallet_id: String) {
  open_margin_position_update(wallet_id: $wallet_id) {
    margin_position_id instrument_id side
    amount leverage entry_price exit_price
    pnl total_pnl margin margin_currency_id
    funding_fee_amount stop_loss take_profit
    close_reason close_reason_code
    updated_at_iso wallet_id
  }
}
subscription user_balance_position Real-time margin account balance, equity, and risk metrics.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
wallet_idStringoptionalRestrict updates to a single margin wallet.

Each update

FieldTypeDescription
free_balanceFloatAvailable balance.
equityFloatTotal equity (balance + unrealised P&L).
currently_used_marginFloatMargin currently locked by open positions.
margin_call_left_marginFloatMargin remaining before margin call.
liquidation_left_marginFloatMargin remaining before liquidation.
margin_ratio_percentageFloatCurrent margin ratio %.
risk_levelStringRisk-level classification.
pnlFloatUnrealised P&L.
total_pnlFloatRealised + unrealised P&L.
unsettled_balanceFloatBalance pending settlement.

GraphQL Operation

subscription user_balance_position($wallet_id: String) {
  user_balance_position(wallet_id: $wallet_id) {
    free_balance equity
    currently_used_margin margin_call_left_margin liquidation_left_margin
    margin_ratio_percentage risk_level
    pnl total_pnl unsettled_balance
  }
}
subscription margin_user_update Margin notifications: margin calls, liquidation warnings, trading-status changes.
Endpoint: WSS wss://api.cxm.io/graphql
Type: Subscription

Inputs

NameTypeRequiredDescription
wallet_idStringoptionalRestrict notifications to a single margin wallet.

Each update

FieldTypeDescription
notification.titleStringNotification title.
notification.bodyStringNotification message.
notification.triggerStringTrigger type (e.g. margin_call, margin_liquidation).

GraphQL Operation

subscription margin_user_update($wallet_id: String) {
  margin_user_update(wallet_id: $wallet_id) {
    notification { title body trigger }
  }
}

Conversions & Payments

Quote and execute currency conversions, inspect payment fees and limits, and manage crypto / fiat deposits and withdrawals.

mutation create_conversion_quote Get a locked exchange-rate quote between two currencies.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
source_currency_id String! required Source currency ID
target_currency_id String! required Target currency ID
source_currency_amount Float optional Amount to convert from source
target_currency_amount Float optional Amount to receive in target
ttl Int optional Quote time-to-live in seconds

Response

FieldTypeDescription
conversion_quote_id String Unique quote ID
price Float Exchange rate

GraphQL Operation

mutation create_conversion_quote($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $ttl: Int)  {
  create_conversion_quote(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, ttl: $ttl)  {
    conversion_quote_id price expires_at_iso source_currency_amount target_currency_amount fees  {
      currency_id amount
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_conversion_quote($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $ttl: Int) { create_conversion_quote(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, ttl: $ttl) { conversion_quote_id price expires_at_iso source_currency_amount target_currency_amount fees { currency_id amount } } }","variables":{"source_currency_id":"BTC","target_currency_id":"USDT","source_currency_amount":1,"ttl":60}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_conversion_quote($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $ttl: Int) { create_conversion_quote(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, ttl: $ttl) { conversion_quote_id price expires_at_iso source_currency_amount target_currency_amount fees { currency_id amount } } }""",
    "variables": {
        "source_currency_id": "BTC",
        "target_currency_id": "USDT",
        "source_currency_amount": 1,
        "ttl": 60
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_conversion_quote($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $ttl: Int) { create_conversion_quote(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, ttl: $ttl) { conversion_quote_id price expires_at_iso source_currency_amount target_currency_amount fees { currency_id amount } } }`,
    variables: {
      "source_currency_id": "BTC",
      "target_currency_id": "USDT",
      "source_currency_amount": 1,
      "ttl": 60
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_conversion_order Execute a conversion against a quote.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
conversion_quote_id String! required Conversion quote ID from create_conversion_quote
wallet_id String! required Wallet ID for the conversion

Response

FieldTypeDescription
status String Conversion status (pending, completed, failed)

GraphQL Operation

mutation create_conversion_order($conversion_quote_id: String!, $wallet_id: String!)  {
  create_conversion_order(conversion_quote_id: $conversion_quote_id, wallet_id: $wallet_id)  {
    conversion_id status created_at price source_currency_id target_currency_id source_currency_amount target_currency_amount
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_conversion_order($conversion_quote_id: String!, $wallet_id: String!) { create_conversion_order(conversion_quote_id: $conversion_quote_id, wallet_id: $wallet_id) { conversion_id status created_at price source_currency_id target_currency_id source_currency_amount target_currency_amount } }","variables":{"conversion_quote_id":"quote-789","wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_conversion_order($conversion_quote_id: String!, $wallet_id: String!) { create_conversion_order(conversion_quote_id: $conversion_quote_id, wallet_id: $wallet_id) { conversion_id status created_at price source_currency_id target_currency_id source_currency_amount target_currency_amount } }""",
    "variables": {
        "conversion_quote_id": "quote-789",
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_conversion_order($conversion_quote_id: String!, $wallet_id: String!) { create_conversion_order(conversion_quote_id: $conversion_quote_id, wallet_id: $wallet_id) { conversion_id status created_at price source_currency_id target_currency_id source_currency_amount target_currency_amount } }`,
    variables: {
      "conversion_quote_id": "quote-789",
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query conversions List conversion history.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
wallet_id String! required Wallet ID
search String optional Search by source currency ID
pager PagerInput optional Pagination parameters
dateRange DateRangeInput optional Date range filter

Response

FieldTypeDescription
conversion_id String Conversion ID

GraphQL Operation

query conversions($wallet_id: String!, $search: String, $pager: PagerInput, $dateRange: DateRangeInput)  {
  conversions(wallet_id: $wallet_id, search: $search, pager: $pager, dateRange: $dateRange)  {
    conversion_id source_currency_id source_currency_amount target_currency_id target_currency_amount price status created_at_iso
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query conversions($wallet_id: String!, $search: String, $pager: PagerInput, $dateRange: DateRangeInput) { conversions(wallet_id: $wallet_id, search: $search, pager: $pager, dateRange: $dateRange) { conversion_id source_currency_id source_currency_amount target_currency_id target_currency_amount price status created_at_iso } }","variables":{"wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query conversions($wallet_id: String!, $search: String, $pager: PagerInput, $dateRange: DateRangeInput) { conversions(wallet_id: $wallet_id, search: $search, pager: $pager, dateRange: $dateRange) { conversion_id source_currency_id source_currency_amount target_currency_id target_currency_amount price status created_at_iso } }""",
    "variables": {
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query conversions($wallet_id: String!, $search: String, $pager: PagerInput, $dateRange: DateRangeInput) { conversions(wallet_id: $wallet_id, search: $search, pager: $pager, dateRange: $dateRange) { conversion_id source_currency_id source_currency_amount target_currency_id target_currency_amount price status created_at_iso } }`,
    variables: {
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query payments_fees Read fee schedule for deposits/withdrawals.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
fee_group_id String optional Filter by user fee group
currency_id String optional Filter by currency

Response

FieldTypeDescription
currency_id String Currency code (BTC, ETH, USD, etc.)
deposit_flat_fee Float Fixed fee for deposits
deposit_progressive_fee Float Percentage-based deposit fee
fee_group_id String Fee tier group ID
fiat_transfer_type String Type of fiat transfer (SWIFT, SEPA, etc.)
crypto_network String Blockchain network identifier
payment_route_id String Payment processor route identifier

GraphQL Operation

query payments_fees($fee_group_id: String, $currency_id: String, $pager: PagerInput)  {
  payments_fees(fee_group_id: $fee_group_id, currency_id: $currency_id, pager: $pager)  {
    currency_id deposit_flat_fee deposit_progressive_fee fee_group_id fiat_transfer_type crypto_network payment_route_id calculation_type
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query payments_fees($fee_group_id: String, $currency_id: String, $pager: PagerInput) { payments_fees(fee_group_id: $fee_group_id, currency_id: $currency_id, pager: $pager) { currency_id deposit_flat_fee deposit_progressive_fee fee_group_id fiat_transfer_type crypto_network payment_route_id calculation_type } }","variables":{"fee_group_id":"group1","currency_id":"BTC"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query payments_fees($fee_group_id: String, $currency_id: String, $pager: PagerInput) { payments_fees(fee_group_id: $fee_group_id, currency_id: $currency_id, pager: $pager) { currency_id deposit_flat_fee deposit_progressive_fee fee_group_id fiat_transfer_type crypto_network payment_route_id calculation_type } }""",
    "variables": {
        "fee_group_id": "group1",
        "currency_id": "BTC"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query payments_fees($fee_group_id: String, $currency_id: String, $pager: PagerInput) { payments_fees(fee_group_id: $fee_group_id, currency_id: $currency_id, pager: $pager) { currency_id deposit_flat_fee deposit_progressive_fee fee_group_id fiat_transfer_type crypto_network payment_route_id calculation_type } }`,
    variables: {
      "fee_group_id": "group1",
      "currency_id": "BTC"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query trading_fees Read trading fee tiers per instrument.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
instrument_id String optional Filter by instrument ID
fee_group_id String optional Filter by fee group ID
pager PagerInput optional Pagination parameters

Response

FieldTypeDescription
maker_flat Float Maker flat fee percentage
taker_flat Float Taker flat fee percentage

GraphQL Operation

query trading_fees($instrument_id: String, $fee_group_id: String, $pager: PagerInput)  {
  trading_fees(instrument_id: $instrument_id, fee_group_id: $fee_group_id, pager: $pager)  {
    instrument_id maker_flat maker_progressive taker_flat taker_progressive
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query trading_fees($instrument_id: String, $fee_group_id: String, $pager: PagerInput) { trading_fees(instrument_id: $instrument_id, fee_group_id: $fee_group_id, pager: $pager) { instrument_id maker_flat maker_progressive taker_flat taker_progressive } }","variables":{}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query trading_fees($instrument_id: String, $fee_group_id: String, $pager: PagerInput) { trading_fees(instrument_id: $instrument_id, fee_group_id: $fee_group_id, pager: $pager) { instrument_id maker_flat maker_progressive taker_flat taker_progressive } }""",
    "variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query trading_fees($instrument_id: String, $fee_group_id: String, $pager: PagerInput) { trading_fees(instrument_id: $instrument_id, fee_group_id: $fee_group_id, pager: $pager) { instrument_id maker_flat maker_progressive taker_flat taker_progressive } }`,
    variables: {},
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation payments_limits Read the user's daily/weekly payment limits.
Endpoint: POST https://api.cxm.io/graphql
Operation: calculate_payments_limits (Mutation)

Inputs

NameTypeRequiredDescription
currency_id String! required Currency code (BTC, USD, EUR, etc.)
type PaymentType! required Payment type: DEPOSIT or WITHDRAW
notion_currency String! required Display currency for limits

Response

FieldTypeDescription
payments Object Payment limits by period (daily, weekly, monthly)
aggregated Object Aggregated withdrawal limits by period

GraphQL Operation

mutation calculate_payments_limits($currency_id: String!, $type: PaymentType!, $notion_currency: String!)  {
  calculate_payments_limits(currency_id: $currency_id, type: $type, notion_currency: $notion_currency)  {
    payments  {
      daily  {
        limit filled remaining
      }
      weekly  {
        limit filled remaining
      }
      monthly  {
        limit filled remaining
      }
    }
    aggregated  {
      daily  {
        limit filled remaining
      }
      weekly  {
        limit filled remaining
      }
      monthly  {
        limit filled remaining
      }
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation calculate_payments_limits($currency_id: String!, $type: PaymentType!, $notion_currency: String!) { calculate_payments_limits(currency_id: $currency_id, type: $type, notion_currency: $notion_currency) { payments { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } aggregated { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } } }","variables":{"currency_id":"BTC","type":"DEPOSIT","notion_currency":"USD"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation calculate_payments_limits($currency_id: String!, $type: PaymentType!, $notion_currency: String!) { calculate_payments_limits(currency_id: $currency_id, type: $type, notion_currency: $notion_currency) { payments { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } aggregated { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } } }""",
    "variables": {
        "currency_id": "BTC",
        "type": "DEPOSIT",
        "notion_currency": "USD"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation calculate_payments_limits($currency_id: String!, $type: PaymentType!, $notion_currency: String!) { calculate_payments_limits(currency_id: $currency_id, type: $type, notion_currency: $notion_currency) { payments { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } aggregated { daily { limit filled remaining } weekly { limit filled remaining } monthly { limit filled remaining } } } }`,
    variables: {
      "currency_id": "BTC",
      "type": "DEPOSIT",
      "notion_currency": "USD"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query payments List deposit/withdrawal history.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
type PaymentType optional Filter by payment type (deposit, withdrawal)
currency_id String optional Filter by currency ID
status [PaymentStatus!] optional Filter by payment status
pager PagerInput optional Pagination parameters

Response

FieldTypeDescription
payment_id String Payment ID
type PaymentType Deposit or withdrawal

GraphQL Operation

query payments($type: PaymentType, $currency_id: String, $status: [PaymentStatus!], $pager: PagerInput)  {
  payments(type: $type, currency_id: $currency_id, status: $status, pager: $pager)  {
    payment_id currency_id amount type status crypto_transaction_id crypto_address fee_amount created_at
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query payments($type: PaymentType, $currency_id: String, $status: [PaymentStatus!], $pager: PagerInput) { payments(type: $type, currency_id: $currency_id, status: $status, pager: $pager) { payment_id currency_id amount type status crypto_transaction_id crypto_address fee_amount created_at } }","variables":{"type":"deposit"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query payments($type: PaymentType, $currency_id: String, $status: [PaymentStatus!], $pager: PagerInput) { payments(type: $type, currency_id: $currency_id, status: $status, pager: $pager) { payment_id currency_id amount type status crypto_transaction_id crypto_address fee_amount created_at } }""",
    "variables": {
        "type": "deposit"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query payments($type: PaymentType, $currency_id: String, $status: [PaymentStatus!], $pager: PagerInput) { payments(type: $type, currency_id: $currency_id, status: $status, pager: $pager) { payment_id currency_id amount type status crypto_transaction_id crypto_address fee_amount created_at } }`,
    variables: {
      "type": "deposit"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query payments_routes List available deposit/withdrawal methods and bank details.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Response

FieldTypeDescription
payment_route_id String Unique payment route identifier
currency_id String Currency code
psp_service_id String Payment service provider identifier
name String Payment route name (e.g., Bank Transfer, Crypto Network)
is_active Boolean Whether this route is currently available
deposit_enabled Boolean Deposits allowed for this route
withdrawal_enabled Boolean Withdrawals allowed for this route

GraphQL Operation

query payments_routes($pager: PagerInput)  {
  payments_routes(pager: $pager)  {
    payment_route_id currency_id psp_service_id name crypto_network crypto_address_generate_new crypto_address_tag_type fiat_iframe_deposit_url fiat_iframe_withdrawal_url fiat_transfer_type is_active extend_network_fee is_development verification_type deposit_enabled withdrawal_enabled is_crypto_to_fiat meta
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query payments_routes($pager: PagerInput) { payments_routes(pager: $pager) { payment_route_id currency_id psp_service_id name crypto_network crypto_address_generate_new crypto_address_tag_type fiat_iframe_deposit_url fiat_iframe_withdrawal_url fiat_transfer_type is_active extend_network_fee is_development verification_type deposit_enabled withdrawal_enabled is_crypto_to_fiat meta } }","variables":{"pager":{"limit":10000,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query payments_routes($pager: PagerInput) { payments_routes(pager: $pager) { payment_route_id currency_id psp_service_id name crypto_network crypto_address_generate_new crypto_address_tag_type fiat_iframe_deposit_url fiat_iframe_withdrawal_url fiat_transfer_type is_active extend_network_fee is_development verification_type deposit_enabled withdrawal_enabled is_crypto_to_fiat meta } }""",
    "variables": {
        "pager": {
            "limit": 10000,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query payments_routes($pager: PagerInput) { payments_routes(pager: $pager) { payment_route_id currency_id psp_service_id name crypto_network crypto_address_generate_new crypto_address_tag_type fiat_iframe_deposit_url fiat_iframe_withdrawal_url fiat_transfer_type is_active extend_network_fee is_development verification_type deposit_enabled withdrawal_enabled is_crypto_to_fiat meta } }`,
    variables: {
      "pager": {
        "limit": 10000,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_withdrawal_crypto Initiate a crypto withdrawal to an external address.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
crypto_address String! required Recipient wallet address
amount Float! required Amount to withdraw
payment_route_id String! required Payment route ID
crypto_address_tag_type CryptoAddressTagType optional Tag type (memo, destination tag)
crypto_address_tag_value String optional Tag value (memo or destination tag)
crypto_network_fee_preference CryptoNetworkFeePreference optional Network fee preference (slow, normal, fast)
mfa_token String optional MFA token for security
fees_included ToggleSwitch optional Include fees in withdrawal amount
wallet_id String optional Wallet ID

Response

FieldTypeDescription
payment_id String Payment/withdrawal ID
status PaymentStatus Withdrawal status

GraphQL Operation

mutation create_withdrawal_crypto($crypto_address: String!, $amount: Float!, $payment_route_id: String!, $crypto_address_tag_type: CryptoAddressTagType, $crypto_address_tag_value: String, $crypto_network_fee_preference: CryptoNetworkFeePreference, $mfa_token: String, $fees_included: ToggleSwitch, $wallet_id: String)  {
  create_withdrawal_crypto(crypto_address: $crypto_address, amount: $amount, payment_route_id: $payment_route_id, crypto_address_tag_type: $crypto_address_tag_type, crypto_address_tag_value: $crypto_address_tag_value, crypto_network_fee_preference: $crypto_network_fee_preference, mfa_token: $mfa_token, fees_included: $fees_included, wallet_id: $wallet_id)  {
    payment_id currency_id amount status crypto_transaction_id crypto_address fee_amount created_at
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_withdrawal_crypto($crypto_address: String!, $amount: Float!, $payment_route_id: String!, $crypto_address_tag_type: CryptoAddressTagType, $crypto_address_tag_value: String, $crypto_network_fee_preference: CryptoNetworkFeePreference, $mfa_token: String, $fees_included: ToggleSwitch, $wallet_id: String) { create_withdrawal_crypto(crypto_address: $crypto_address, amount: $amount, payment_route_id: $payment_route_id, crypto_address_tag_type: $crypto_address_tag_type, crypto_address_tag_value: $crypto_address_tag_value, crypto_network_fee_preference: $crypto_network_fee_preference, mfa_token: $mfa_token, fees_included: $fees_included, wallet_id: $wallet_id) { payment_id currency_id amount status crypto_transaction_id crypto_address fee_amount created_at } }","variables":{"crypto_address":"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa","amount":0.5,"payment_route_id":"route-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_withdrawal_crypto($crypto_address: String!, $amount: Float!, $payment_route_id: String!, $crypto_address_tag_type: CryptoAddressTagType, $crypto_address_tag_value: String, $crypto_network_fee_preference: CryptoNetworkFeePreference, $mfa_token: String, $fees_included: ToggleSwitch, $wallet_id: String) { create_withdrawal_crypto(crypto_address: $crypto_address, amount: $amount, payment_route_id: $payment_route_id, crypto_address_tag_type: $crypto_address_tag_type, crypto_address_tag_value: $crypto_address_tag_value, crypto_network_fee_preference: $crypto_network_fee_preference, mfa_token: $mfa_token, fees_included: $fees_included, wallet_id: $wallet_id) { payment_id currency_id amount status crypto_transaction_id crypto_address fee_amount created_at } }""",
    "variables": {
        "crypto_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "amount": 0.5,
        "payment_route_id": "route-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_withdrawal_crypto($crypto_address: String!, $amount: Float!, $payment_route_id: String!, $crypto_address_tag_type: CryptoAddressTagType, $crypto_address_tag_value: String, $crypto_network_fee_preference: CryptoNetworkFeePreference, $mfa_token: String, $fees_included: ToggleSwitch, $wallet_id: String) { create_withdrawal_crypto(crypto_address: $crypto_address, amount: $amount, payment_route_id: $payment_route_id, crypto_address_tag_type: $crypto_address_tag_type, crypto_address_tag_value: $crypto_address_tag_value, crypto_network_fee_preference: $crypto_network_fee_preference, mfa_token: $mfa_token, fees_included: $fees_included, wallet_id: $wallet_id) { payment_id currency_id amount status crypto_transaction_id crypto_address fee_amount created_at } }`,
    variables: {
      "crypto_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
      "amount": 0.5,
      "payment_route_id": "route-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_withdrawal_fiat Initiate a fiat withdrawal via bank transfer.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
amount Float! required Amount to withdraw
payment_route_id String! required Payment route ID for fiat
properties [FiatDepositPropertyInput!]! required Bank details (account, beneficiary, etc.)
mfa_token String optional MFA token for security
wallet_id String optional Wallet ID

Response

FieldTypeDescription
payment_id String Payment/withdrawal ID

GraphQL Operation

mutation create_withdrawal_fiat($amount: Float!, $payment_route_id: String!, $properties: [FiatDepositPropertyInput!]!, $mfa_token: String, $wallet_id: String)  {
  create_withdrawal_fiat(amount: $amount, payment_route_id: $payment_route_id, properties: $properties, mfa_token: $mfa_token, wallet_id: $wallet_id)  {
    payment_id amount status created_at
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_withdrawal_fiat($amount: Float!, $payment_route_id: String!, $properties: [FiatDepositPropertyInput!]!, $mfa_token: String, $wallet_id: String) { create_withdrawal_fiat(amount: $amount, payment_route_id: $payment_route_id, properties: $properties, mfa_token: $mfa_token, wallet_id: $wallet_id) { payment_id amount status created_at } }","variables":{"amount":1000,"payment_route_id":"route-456","properties":[{"name":"fiat_beneficiary_account_number","value":"12345678"}]}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_withdrawal_fiat($amount: Float!, $payment_route_id: String!, $properties: [FiatDepositPropertyInput!]!, $mfa_token: String, $wallet_id: String) { create_withdrawal_fiat(amount: $amount, payment_route_id: $payment_route_id, properties: $properties, mfa_token: $mfa_token, wallet_id: $wallet_id) { payment_id amount status created_at } }""",
    "variables": {
        "amount": 1000,
        "payment_route_id": "route-456",
        "properties": [
            {
                "name": "fiat_beneficiary_account_number",
                "value": "12345678"
            }
        ]
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_withdrawal_fiat($amount: Float!, $payment_route_id: String!, $properties: [FiatDepositPropertyInput!]!, $mfa_token: String, $wallet_id: String) { create_withdrawal_fiat(amount: $amount, payment_route_id: $payment_route_id, properties: $properties, mfa_token: $mfa_token, wallet_id: $wallet_id) { payment_id amount status created_at } }`,
    variables: {
      "amount": 1000,
      "payment_route_id": "route-456",
      "properties": [
        {
          "name": "fiat_beneficiary_account_number",
          "value": "12345678"
        }
      ]
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query deposit_addresses_crypto Generate / read crypto deposit addresses.
Endpoint: POST https://api.cxm.io/graphql
Operation: deposit_address_crypto (Query)

Inputs

NameTypeRequiredDescription
currency_id String! required Currency ID to deposit
payment_route_id String! required Payment route ID for the currency
reference String optional Optional reference tag

Response

FieldTypeDescription
address String Deposit wallet address
address_tag_type String Tag type (memo, destination tag, etc.)
network String Blockchain network

GraphQL Operation

query deposit_address_crypto($currency_id: String!, $payment_route_id: String!, $reference: String)  {
  deposit_address_crypto(currency_id: $currency_id, payment_route_id: $payment_route_id, reference: $reference)  {
    deposit_address_crypto_id currency_id address address_tag_type address_tag_value network created_at
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query deposit_address_crypto($currency_id: String!, $payment_route_id: String!, $reference: String) { deposit_address_crypto(currency_id: $currency_id, payment_route_id: $payment_route_id, reference: $reference) { deposit_address_crypto_id currency_id address address_tag_type address_tag_value network created_at } }","variables":{"currency_id":"BTC","payment_route_id":"route-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query deposit_address_crypto($currency_id: String!, $payment_route_id: String!, $reference: String) { deposit_address_crypto(currency_id: $currency_id, payment_route_id: $payment_route_id, reference: $reference) { deposit_address_crypto_id currency_id address address_tag_type address_tag_value network created_at } }""",
    "variables": {
        "currency_id": "BTC",
        "payment_route_id": "route-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query deposit_address_crypto($currency_id: String!, $payment_route_id: String!, $reference: String) { deposit_address_crypto(currency_id: $currency_id, payment_route_id: $payment_route_id, reference: $reference) { deposit_address_crypto_id currency_id address address_tag_type address_tag_value network created_at } }`,
    variables: {
      "currency_id": "BTC",
      "payment_route_id": "route-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this

Orders & Trades

Place and manage spot orders, browse instruments, and preview order cost before placement.

mutation create_order Place spot orders (market, limit, stop).
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
instrument_id String! required Trading pair ID, e.g. BTC-USDT
type OrderType! required Order type: market, limit, or stop
side OrderSide! required Order side: buy or sell
quantity Float! required Order quantity in base currency
price Float optional Order price (required for limit/stop orders)
stop_price Float optional Stop price for stop orders
time_in_force OrderTimeInForce optional Time in force: GTC, IOC, FOK
quantity_mode OrderQuantityMode optional Quantity mode: base or quote
expires_at String optional Expiration time in ISO format
post_only ToggleSwitch optional Post-only order flag
wallet_id String! required Wallet ID for the order

Response

FieldTypeDescription
order_id String Unique order ID
status OrderStatus Order status (pending, open, filled, cancelled)
created_at String Order creation timestamp

GraphQL Operation

mutation create_order($instrument_id: String!, $type: OrderType!, $side: OrderSide!, $quantity: Float!, $price: Float, $stop_price: Float, $time_in_force: OrderTimeInForce, $quantity_mode: OrderQuantityMode, $expires_at: String, $post_only: ToggleSwitch, $wallet_id: String!)  {
  create_order(instrument_id: $instrument_id, type: $type, side: $side, quantity: $quantity, price: $price, stop_price: $stop_price, time_in_force: $time_in_force, quantity_mode: $quantity_mode, expires_at: $expires_at, post_only: $post_only, wallet_id: $wallet_id)  {
    order_id type side status price stop_price quantity executed_quantity remaining_quantity quantity_mode instrument_id message updated_at created_at expires_at expires_at_iso time_in_force vwap wallet_id instrument  {
      quote_currency_id name base_currency_id quantity_decimals quote_quantity_decimals price_decimals
    }
    fees  {
      currency_id amount type
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_order($instrument_id: String!, $type: OrderType!, $side: OrderSide!, $quantity: Float!, $price: Float, $stop_price: Float, $time_in_force: OrderTimeInForce, $quantity_mode: OrderQuantityMode, $expires_at: String, $post_only: ToggleSwitch, $wallet_id: String!) { create_order(instrument_id: $instrument_id, type: $type, side: $side, quantity: $quantity, price: $price, stop_price: $stop_price, time_in_force: $time_in_force, quantity_mode: $quantity_mode, expires_at: $expires_at, post_only: $post_only, wallet_id: $wallet_id) { order_id type side status price stop_price quantity executed_quantity remaining_quantity quantity_mode instrument_id message updated_at created_at expires_at expires_at_iso time_in_force vwap wallet_id instrument { quote_currency_id name base_currency_id quantity_decimals quote_quantity_decimals price_decimals } fees { currency_id amount type } } }","variables":{"instrument_id":"BTC-USDT","type":"limit","side":"buy","quantity":0.01,"price":65000,"wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_order($instrument_id: String!, $type: OrderType!, $side: OrderSide!, $quantity: Float!, $price: Float, $stop_price: Float, $time_in_force: OrderTimeInForce, $quantity_mode: OrderQuantityMode, $expires_at: String, $post_only: ToggleSwitch, $wallet_id: String!) { create_order(instrument_id: $instrument_id, type: $type, side: $side, quantity: $quantity, price: $price, stop_price: $stop_price, time_in_force: $time_in_force, quantity_mode: $quantity_mode, expires_at: $expires_at, post_only: $post_only, wallet_id: $wallet_id) { order_id type side status price stop_price quantity executed_quantity remaining_quantity quantity_mode instrument_id message updated_at created_at expires_at expires_at_iso time_in_force vwap wallet_id instrument { quote_currency_id name base_currency_id quantity_decimals quote_quantity_decimals price_decimals } fees { currency_id amount type } } }""",
    "variables": {
        "instrument_id": "BTC-USDT",
        "type": "limit",
        "side": "buy",
        "quantity": 0.01,
        "price": 65000,
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_order($instrument_id: String!, $type: OrderType!, $side: OrderSide!, $quantity: Float!, $price: Float, $stop_price: Float, $time_in_force: OrderTimeInForce, $quantity_mode: OrderQuantityMode, $expires_at: String, $post_only: ToggleSwitch, $wallet_id: String!) { create_order(instrument_id: $instrument_id, type: $type, side: $side, quantity: $quantity, price: $price, stop_price: $stop_price, time_in_force: $time_in_force, quantity_mode: $quantity_mode, expires_at: $expires_at, post_only: $post_only, wallet_id: $wallet_id) { order_id type side status price stop_price quantity executed_quantity remaining_quantity quantity_mode instrument_id message updated_at created_at expires_at expires_at_iso time_in_force vwap wallet_id instrument { quote_currency_id name base_currency_id quantity_decimals quote_quantity_decimals price_decimals } fees { currency_id amount type } } }`,
    variables: {
      "instrument_id": "BTC-USDT",
      "type": "limit",
      "side": "buy",
      "quantity": 0.01,
      "price": 65000,
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation cancel_order Cancel a single open order or all orders.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
order_id String! required Order ID to cancel

GraphQL Operation

mutation cancel_order($order_id: String!)  {
  cancel_order(order_id: $order_id)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation cancel_order($order_id: String!) { cancel_order(order_id: $order_id) }","variables":{"order_id":"order-456"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation cancel_order($order_id: String!) { cancel_order(order_id: $order_id) }""",
    "variables": {
        "order_id": "order-456"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation cancel_order($order_id: String!) { cancel_order(order_id: $order_id) }`,
    variables: {
      "order_id": "order-456"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query open_orders List currently open spot orders.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
wallet_id String! required Wallet ID
instrument_id String optional Filter by trading pair ID
status [OrderStatus!] optional Filter by order statuses
side OrderSide optional Filter by side (buy or sell)
pager PagerInput optional Pagination parameters
dateRange DateRangeInput optional Date range filter

Response

FieldTypeDescription
order_id String Order ID
status OrderStatus Current order status

GraphQL Operation

query open_orders($wallet_id: String!, $instrument_id: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput)  {
  open_orders(wallet_id: $wallet_id, instrument_id: $instrument_id, status: $status, side: $side, pager: $pager, dateRange: $dateRange)  {
    order_id type side status price stop_price quantity executed_quantity remaining_quantity instrument_id created_at updated_at time_in_force wallet_id
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query open_orders($wallet_id: String!, $instrument_id: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { open_orders(wallet_id: $wallet_id, instrument_id: $instrument_id, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price stop_price quantity executed_quantity remaining_quantity instrument_id created_at updated_at time_in_force wallet_id } }","variables":{"wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query open_orders($wallet_id: String!, $instrument_id: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { open_orders(wallet_id: $wallet_id, instrument_id: $instrument_id, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price stop_price quantity executed_quantity remaining_quantity instrument_id created_at updated_at time_in_force wallet_id } }""",
    "variables": {
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query open_orders($wallet_id: String!, $instrument_id: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { open_orders(wallet_id: $wallet_id, instrument_id: $instrument_id, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price stop_price quantity executed_quantity remaining_quantity instrument_id created_at updated_at time_in_force wallet_id } }`,
    variables: {
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query closed_orders List filled / cancelled spot orders.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
wallet_id String! required Wallet ID
search String optional Search by instrument name or ID (fuzzy)
status [OrderStatus!] optional Filter by order statuses
side OrderSide optional Filter by side (buy or sell)
pager PagerInput optional Pagination parameters
dateRange DateRangeInput optional Date range filter

Response

FieldTypeDescription
order_id String Order ID
status OrderStatus Final order status
total Int Total number of closed orders

GraphQL Operation

query closed_orders($wallet_id: String!, $search: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput)  {
  closed_orders(wallet_id: $wallet_id, search: $search, status: $status, side: $side, pager: $pager, dateRange: $dateRange)  {
    order_id type side status price quantity executed_quantity instrument_id created_at updated_at total
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query closed_orders($wallet_id: String!, $search: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { closed_orders(wallet_id: $wallet_id, search: $search, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price quantity executed_quantity instrument_id created_at updated_at total } }","variables":{"wallet_id":"wallet-123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query closed_orders($wallet_id: String!, $search: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { closed_orders(wallet_id: $wallet_id, search: $search, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price quantity executed_quantity instrument_id created_at updated_at total } }""",
    "variables": {
        "wallet_id": "wallet-123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query closed_orders($wallet_id: String!, $search: String, $status: [OrderStatus!], $side: OrderSide, $pager: PagerInput, $dateRange: DateRangeInput) { closed_orders(wallet_id: $wallet_id, search: $search, status: $status, side: $side, pager: $pager, dateRange: $dateRange) { order_id type side status price quantity executed_quantity instrument_id created_at updated_at total } }`,
    variables: {
      "wallet_id": "wallet-123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query estimate_order Preview cost, fees, and slippage before placing an order.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
source_currency_id String! required Source currency ID (the one being spent)
target_currency_id String! required Target currency ID (the one being received)
source_currency_amount Float optional Amount in source currency
target_currency_amount Float optional Amount in target currency
price Float optional Expected price
instrument_id String optional Instrument ID (optional)

Response

FieldTypeDescription
type OrderType Estimated order type
price Float Estimated price
fees Array Fee breakdown by currency

GraphQL Operation

query estimate_order($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $price: Float, $instrument_id: String)  {
  estimate_order(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, price: $price, instrument_id: $instrument_id)  {
    type price quantity side quantity_mode fees  {
      currency_id amount type
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query estimate_order($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $price: Float, $instrument_id: String) { estimate_order(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, price: $price, instrument_id: $instrument_id) { type price quantity side quantity_mode fees { currency_id amount type } } }","variables":{"source_currency_id":"BTC","target_currency_id":"USDT","source_currency_amount":0.01}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query estimate_order($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $price: Float, $instrument_id: String) { estimate_order(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, price: $price, instrument_id: $instrument_id) { type price quantity side quantity_mode fees { currency_id amount type } } }""",
    "variables": {
        "source_currency_id": "BTC",
        "target_currency_id": "USDT",
        "source_currency_amount": 0.01
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query estimate_order($source_currency_id: String!, $target_currency_id: String!, $source_currency_amount: Float, $target_currency_amount: Float, $price: Float, $instrument_id: String) { estimate_order(source_currency_id: $source_currency_id, target_currency_id: $target_currency_id, source_currency_amount: $source_currency_amount, target_currency_amount: $target_currency_amount, price: $price, instrument_id: $instrument_id) { type price quantity side quantity_mode fees { currency_id amount type } } }`,
    variables: {
      "source_currency_id": "BTC",
      "target_currency_id": "USDT",
      "source_currency_amount": 0.01
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query instruments List trading pairs with metadata and current prices.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
is_active ToggleSwitch optional Filter by active status
instrument_id String optional Filter by instrument ID
search String optional Search by name or ID

Response

FieldTypeDescription
instrument_id String Unique instrument ID
base_currency_id String Base currency of pair
quote_currency_id String Quote currency of pair

GraphQL Operation

query instruments($is_active: ToggleSwitch, $instrument_id: String, $search: String)  {
  instruments(is_active: $is_active, instrument_id: $instrument_id, search: $search)  {
    name base_currency_id quote_currency_id instrument_id quantity_decimals price_decimals min_quantity max_quantity is_active price  {
      instrument_id ask bid price_24h_change
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query instruments($is_active: ToggleSwitch, $instrument_id: String, $search: String) { instruments(is_active: $is_active, instrument_id: $instrument_id, search: $search) { name base_currency_id quote_currency_id instrument_id quantity_decimals price_decimals min_quantity max_quantity is_active price { instrument_id ask bid price_24h_change } } }","variables":{}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query instruments($is_active: ToggleSwitch, $instrument_id: String, $search: String) { instruments(is_active: $is_active, instrument_id: $instrument_id, search: $search) { name base_currency_id quote_currency_id instrument_id quantity_decimals price_decimals min_quantity max_quantity is_active price { instrument_id ask bid price_24h_change } } }""",
    "variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query instruments($is_active: ToggleSwitch, $instrument_id: String, $search: String) { instruments(is_active: $is_active, instrument_id: $instrument_id, search: $search) { name base_currency_id quote_currency_id instrument_id quantity_decimals price_decimals min_quantity max_quantity is_active price { instrument_id ask bid price_24h_change } } }`,
    variables: {},
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query currencies List supported currencies.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Response

FieldTypeDescription
currency_id String Unique currency ID
precision Int Decimal precision

GraphQL Operation

query currencies  {
  currencies(limit: 400)  {
    currency_id name precision type is_active
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query currencies { currencies(limit: 400) { currency_id name precision type is_active } }","variables":{}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query currencies { currencies(limit: 400) { currency_id name precision type is_active } }""",
    "variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query currencies { currencies(limit: 400) { currency_id name precision type is_active } }`,
    variables: {},
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this

Vaults

Optional group: only available if vaults are enabled for the account.

query vaults List available yield vaults.
Endpoint: POST https://api.cxm.io/graphql
Operation: enabled_vaults (Query)

Inputs

NameTypeRequiredDescription
vault_id String optional Filter by specific vault
currency_id String optional Filter by currency
is_active ToggleSwitch optional Only active vaults
withdrawal_enabled ToggleSwitch optional Filter by withdrawal status
deposit_enabled ToggleSwitch optional Filter by deposit status
search String optional Search by name
pager PagerInput optional Pagination
sort SortInput optional Sort parameters

Response

FieldTypeDescription
vault_id ID Vault unique identifier
name String Vault name and asset
annual_rate_percent Float APY percentage
min_deposit_amount Float Minimum deposit required
is_active Boolean Is vault accepting deposits

GraphQL Operation

query enabled_vaults($vault_id: String, $currency_id: String, $is_active: ToggleSwitch, $withdrawal_enabled: ToggleSwitch, $deposit_enabled: ToggleSwitch, $search: String, $pager: PagerInput, $sort: SortInput)  {
  enabled_vaults(vault_id: $vault_id, currency_id: $currency_id, is_active: $is_active, withdrawal_enabled: $withdrawal_enabled, deposit_enabled: $deposit_enabled, search: $search, pager: $pager, sort: $sort)  {
    serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency  {
      type
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query enabled_vaults($vault_id: String, $currency_id: String, $is_active: ToggleSwitch, $withdrawal_enabled: ToggleSwitch, $deposit_enabled: ToggleSwitch, $search: String, $pager: PagerInput, $sort: SortInput) { enabled_vaults(vault_id: $vault_id, currency_id: $currency_id, is_active: $is_active, withdrawal_enabled: $withdrawal_enabled, deposit_enabled: $deposit_enabled, search: $search, pager: $pager, sort: $sort) { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } }","variables":{"is_active":"On","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query enabled_vaults($vault_id: String, $currency_id: String, $is_active: ToggleSwitch, $withdrawal_enabled: ToggleSwitch, $deposit_enabled: ToggleSwitch, $search: String, $pager: PagerInput, $sort: SortInput) { enabled_vaults(vault_id: $vault_id, currency_id: $currency_id, is_active: $is_active, withdrawal_enabled: $withdrawal_enabled, deposit_enabled: $deposit_enabled, search: $search, pager: $pager, sort: $sort) { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } }""",
    "variables": {
        "is_active": "On",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query enabled_vaults($vault_id: String, $currency_id: String, $is_active: ToggleSwitch, $withdrawal_enabled: ToggleSwitch, $deposit_enabled: ToggleSwitch, $search: String, $pager: PagerInput, $sort: SortInput) { enabled_vaults(vault_id: $vault_id, currency_id: $currency_id, is_active: $is_active, withdrawal_enabled: $withdrawal_enabled, deposit_enabled: $deposit_enabled, search: $search, pager: $pager, sort: $sort) { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } }`,
    variables: {
      "is_active": "On",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query vaults_accounts Read the user's vault account balances.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
vault_account_id String optional Specific account filter
vault_id String optional Vault filter
user_id String optional User filter
search String optional Search terms
pager PagerInput optional Pagination
sort SortInput optional Sort parameters
wallet_id String optional Wallet filter
quote_currency_id String required Currency to quote balance in

Response

FieldTypeDescription
vault_account_id ID Account unique ID
balance Float Current vault balance
free_balance Float Withdrawable balance
total_earned Object Total interest earned
today_earned Object Interest earned today

GraphQL Operation

query vaults_accounts($vault_account_id: String, $vault_id: String, $user_id: String, $search: String, $pager: PagerInput, $sort: SortInput, $wallet_id: String, $quote_currency_id: String!)  {
  vaults_accounts(vault_account_id: $vault_account_id, vault_id: $vault_id, user_id: $user_id, search: $search, pager: $pager, sort: $sort, wallet_id: $wallet_id, quote_currency_id: $quote_currency_id)  {
    balance created_at created_at_iso exposed_vault_balance free_balance serial_id total_earned  {
      total_earned_quoted total_earned
    }
    today_earned  {
      today_earned_quoted today_earned
    }
    updated_at updated_at_iso user_id vault  {
      serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency  {
        type
      }
    }
    vault_account_id vault_id version balance_quoted: balance_quoted(quote_currency_id: "$quote_currency_id")
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query vaults_accounts($vault_account_id: String, $vault_id: String, $user_id: String, $search: String, $pager: PagerInput, $sort: SortInput, $wallet_id: String, $quote_currency_id: String!) { vaults_accounts(vault_account_id: $vault_account_id, vault_id: $vault_id, user_id: $user_id, search: $search, pager: $pager, sort: $sort, wallet_id: $wallet_id, quote_currency_id: $quote_currency_id) { balance created_at created_at_iso exposed_vault_balance free_balance serial_id total_earned { total_earned_quoted total_earned } today_earned { today_earned_quoted today_earned } updated_at updated_at_iso user_id vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } vault_account_id vault_id version balance_quoted: balance_quoted(quote_currency_id: \"$quote_currency_id\") } }","variables":{"wallet_id":"wallet123","quote_currency_id":"USDT","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query vaults_accounts($vault_account_id: String, $vault_id: String, $user_id: String, $search: String, $pager: PagerInput, $sort: SortInput, $wallet_id: String, $quote_currency_id: String!) { vaults_accounts(vault_account_id: $vault_account_id, vault_id: $vault_id, user_id: $user_id, search: $search, pager: $pager, sort: $sort, wallet_id: $wallet_id, quote_currency_id: $quote_currency_id) { balance created_at created_at_iso exposed_vault_balance free_balance serial_id total_earned { total_earned_quoted total_earned } today_earned { today_earned_quoted today_earned } updated_at updated_at_iso user_id vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } vault_account_id vault_id version balance_quoted: balance_quoted(quote_currency_id: "$quote_currency_id") } }""",
    "variables": {
        "wallet_id": "wallet123",
        "quote_currency_id": "USDT",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query vaults_accounts($vault_account_id: String, $vault_id: String, $user_id: String, $search: String, $pager: PagerInput, $sort: SortInput, $wallet_id: String, $quote_currency_id: String!) { vaults_accounts(vault_account_id: $vault_account_id, vault_id: $vault_id, user_id: $user_id, search: $search, pager: $pager, sort: $sort, wallet_id: $wallet_id, quote_currency_id: $quote_currency_id) { balance created_at created_at_iso exposed_vault_balance free_balance serial_id total_earned { total_earned_quoted total_earned } today_earned { today_earned_quoted today_earned } updated_at updated_at_iso user_id vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } vault_account_id vault_id version balance_quoted: balance_quoted(quote_currency_id: "$quote_currency_id") } }`,
    variables: {
      "wallet_id": "wallet123",
      "quote_currency_id": "USDT",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query vaults_transactions Read vault deposit / withdrawal history.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
vault_id String optional Vault filter
user_id String optional User filter
vault_transaction_id String optional Specific transaction
transaction_type AccountTransactionType optional deposit, withdrawal, interest
transaction_class VaultsTransactionClass optional Transaction class
search String optional Search terms
currency_id String optional Currency filter
pager PagerInput optional Pagination
date_range DateRangeInput optional Date range
sort SortInput optional Sort parameters
wallet_id String optional Wallet filter

Response

FieldTypeDescription
vault_transaction_id ID Transaction ID
amount Float Transaction amount
transaction_class String Type of transaction
apy Float APY at time of transaction
created_at_iso DateTime Transaction timestamp

GraphQL Operation

query vaults_transactions($vault_id: String, $user_id: String, $vault_transaction_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $currency_id: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $wallet_id: String)  {
  vaults_transactions(vault_id: $vault_id, user_id: $user_id, vault_transaction_id: $vault_transaction_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, currency_id: $currency_id, pager: $pager, date_range: $date_range, sort: $sort, wallet_id: $wallet_id)  {
    vault_transaction_id amount currency_id transaction_class created_at_iso is_delayed delayed_until_iso apy vault  {
      annual_rate_percent rate_type lock_in_period_seconds
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query vaults_transactions($vault_id: String, $user_id: String, $vault_transaction_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $currency_id: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $wallet_id: String) { vaults_transactions(vault_id: $vault_id, user_id: $user_id, vault_transaction_id: $vault_transaction_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, currency_id: $currency_id, pager: $pager, date_range: $date_range, sort: $sort, wallet_id: $wallet_id) { vault_transaction_id amount currency_id transaction_class created_at_iso is_delayed delayed_until_iso apy vault { annual_rate_percent rate_type lock_in_period_seconds } } }","variables":{"wallet_id":"wallet123","transaction_type":"deposit","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query vaults_transactions($vault_id: String, $user_id: String, $vault_transaction_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $currency_id: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $wallet_id: String) { vaults_transactions(vault_id: $vault_id, user_id: $user_id, vault_transaction_id: $vault_transaction_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, currency_id: $currency_id, pager: $pager, date_range: $date_range, sort: $sort, wallet_id: $wallet_id) { vault_transaction_id amount currency_id transaction_class created_at_iso is_delayed delayed_until_iso apy vault { annual_rate_percent rate_type lock_in_period_seconds } } }""",
    "variables": {
        "wallet_id": "wallet123",
        "transaction_type": "deposit",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query vaults_transactions($vault_id: String, $user_id: String, $vault_transaction_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $currency_id: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $wallet_id: String) { vaults_transactions(vault_id: $vault_id, user_id: $user_id, vault_transaction_id: $vault_transaction_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, currency_id: $currency_id, pager: $pager, date_range: $date_range, sort: $sort, wallet_id: $wallet_id) { vault_transaction_id amount currency_id transaction_class created_at_iso is_delayed delayed_until_iso apy vault { annual_rate_percent rate_type lock_in_period_seconds } } }`,
    variables: {
      "wallet_id": "wallet123",
      "transaction_type": "deposit",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_vault_deposit Deposit funds into a vault.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
vault_id String! required Vault to deposit into
amount Float! required Deposit amount
user_id String optional User ID (if not current user)
wallet_id String optional Source wallet

Response

FieldTypeDescription
message String Operation message
status String Operation status

GraphQL Operation

mutation create_vault_deposit($vault_id: String!, $amount: Float!, $user_id: String, $wallet_id: String)  {
  create_vault_deposit(vault_id: $vault_id, amount: $amount, user_id: $user_id, wallet_id: $wallet_id)  {
    message status
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_vault_deposit($vault_id: String!, $amount: Float!, $user_id: String, $wallet_id: String) { create_vault_deposit(vault_id: $vault_id, amount: $amount, user_id: $user_id, wallet_id: $wallet_id) { message status } }","variables":{"vault_id":"vault123","amount":10000,"wallet_id":"wallet123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_vault_deposit($vault_id: String!, $amount: Float!, $user_id: String, $wallet_id: String) { create_vault_deposit(vault_id: $vault_id, amount: $amount, user_id: $user_id, wallet_id: $wallet_id) { message status } }""",
    "variables": {
        "vault_id": "vault123",
        "amount": 10000,
        "wallet_id": "wallet123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_vault_deposit($vault_id: String!, $amount: Float!, $user_id: String, $wallet_id: String) { create_vault_deposit(vault_id: $vault_id, amount: $amount, user_id: $user_id, wallet_id: $wallet_id) { message status } }`,
    variables: {
      "vault_id": "vault123",
      "amount": 10000,
      "wallet_id": "wallet123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_vault_withdrawal Withdraw funds from a vault.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
vault_id String! required Vault to withdraw from
amount Float! required Withdrawal amount
user_id String optional User ID
use_all_funds Boolean optional Withdraw entire balance
wallet_id String optional Destination wallet

Response

FieldTypeDescription
message String Withdrawal status message
status String Request status
data Object Withdrawal transaction details

GraphQL Operation

mutation create_vault_withdrawal($vault_id: String!, $amount: Float!, $user_id: String, $use_all_funds: Boolean, $wallet_id: String)  {
  create_vault_withdrawal(vault_id: $vault_id, amount: $amount, user_id: $user_id, use_all_funds: $use_all_funds, wallet_id: $wallet_id)  {
    message status data  {
      serial_id vault_id user_id vault_transaction_id vault_account_id amount balance_after currency_id transaction_type transaction_class comment created_by created_at is_delayed delayed_until delayed_until_iso
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_vault_withdrawal($vault_id: String!, $amount: Float!, $user_id: String, $use_all_funds: Boolean, $wallet_id: String) { create_vault_withdrawal(vault_id: $vault_id, amount: $amount, user_id: $user_id, use_all_funds: $use_all_funds, wallet_id: $wallet_id) { message status data { serial_id vault_id user_id vault_transaction_id vault_account_id amount balance_after currency_id transaction_type transaction_class comment created_by created_at is_delayed delayed_until delayed_until_iso } } }","variables":{"vault_id":"vault123","amount":5000,"wallet_id":"wallet123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_vault_withdrawal($vault_id: String!, $amount: Float!, $user_id: String, $use_all_funds: Boolean, $wallet_id: String) { create_vault_withdrawal(vault_id: $vault_id, amount: $amount, user_id: $user_id, use_all_funds: $use_all_funds, wallet_id: $wallet_id) { message status data { serial_id vault_id user_id vault_transaction_id vault_account_id amount balance_after currency_id transaction_type transaction_class comment created_by created_at is_delayed delayed_until delayed_until_iso } } }""",
    "variables": {
        "vault_id": "vault123",
        "amount": 5000,
        "wallet_id": "wallet123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_vault_withdrawal($vault_id: String!, $amount: Float!, $user_id: String, $use_all_funds: Boolean, $wallet_id: String) { create_vault_withdrawal(vault_id: $vault_id, amount: $amount, user_id: $user_id, use_all_funds: $use_all_funds, wallet_id: $wallet_id) { message status data { serial_id vault_id user_id vault_transaction_id vault_account_id amount balance_after currency_id transaction_type transaction_class comment created_by created_at is_delayed delayed_until delayed_until_iso } } }`,
    variables: {
      "vault_id": "vault123",
      "amount": 5000,
      "wallet_id": "wallet123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query vaults_transactions_requests List pending vault transactions.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
vault_id String optional Vault filter
user_id String optional User filter
transaction_type AccountTransactionType optional deposit or withdrawal
transaction_class VaultsTransactionClass optional Transaction class
search String optional Search terms
pager PagerInput optional Pagination
date_range DateRangeInput optional Date range
sort SortInput optional Sort parameters
currency_id String optional Currency filter
wallet_id String optional Wallet filter

Response

FieldTypeDescription
request_id ID Request identifier
status String Approval status
amount Float Request amount
created_at_iso DateTime Request timestamp

GraphQL Operation

query vaults_transactions_requests($vault_id: String, $user_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $currency_id: String, $wallet_id: String)  {
  vaults_transactions_requests(vault_id: $vault_id, user_id: $user_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, pager: $pager, date_range: $date_range, sort: $sort, currency_id: $currency_id, wallet_id: $wallet_id)  {
    serial_id request_id user_id vault_id amount transaction_class status approval_reason approved_by created_at_iso updated_at_iso approved_at vault  {
      serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency  {
        type
      }
    }
    apy
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query vaults_transactions_requests($vault_id: String, $user_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $currency_id: String, $wallet_id: String) { vaults_transactions_requests(vault_id: $vault_id, user_id: $user_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, pager: $pager, date_range: $date_range, sort: $sort, currency_id: $currency_id, wallet_id: $wallet_id) { serial_id request_id user_id vault_id amount transaction_class status approval_reason approved_by created_at_iso updated_at_iso approved_at vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } apy } }","variables":{"wallet_id":"wallet123","transaction_type":"deposit","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query vaults_transactions_requests($vault_id: String, $user_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $currency_id: String, $wallet_id: String) { vaults_transactions_requests(vault_id: $vault_id, user_id: $user_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, pager: $pager, date_range: $date_range, sort: $sort, currency_id: $currency_id, wallet_id: $wallet_id) { serial_id request_id user_id vault_id amount transaction_class status approval_reason approved_by created_at_iso updated_at_iso approved_at vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } apy } }""",
    "variables": {
        "wallet_id": "wallet123",
        "transaction_type": "deposit",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query vaults_transactions_requests($vault_id: String, $user_id: String, $transaction_type: AccountTransactionType, $transaction_class: VaultsTransactionClass, $search: String, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput, $currency_id: String, $wallet_id: String) { vaults_transactions_requests(vault_id: $vault_id, user_id: $user_id, transaction_type: $transaction_type, transaction_class: $transaction_class, search: $search, pager: $pager, date_range: $date_range, sort: $sort, currency_id: $currency_id, wallet_id: $wallet_id) { serial_id request_id user_id vault_id amount transaction_class status approval_reason approved_by created_at_iso updated_at_iso approved_at vault { serial_id vault_id currency_id name annual_rate_percent max_withdrawal_amount max_deposit_amount min_withdrawal_amount min_deposit_amount cut_off_time_seconds lock_in_period_seconds effective_date_from effective_date_to rate_type is_active withdrawal_enabled deposit_enabled last_interest_at created_at updated_at total_balance withdrawal_policy withdrawal_delay_seconds meta level5_apy currency { type } } apy } }`,
    variables: {
      "wallet_id": "wallet123",
      "transaction_type": "deposit",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation cancel_vault_transaction_request Cancel a pending vault transaction.
Endpoint: POST https://api.cxm.io/graphql
Type: Mutation

Inputs

NameTypeRequiredDescription
request_id String! required Request ID to cancel

GraphQL Operation

mutation cancel_vault_transaction_request($request_id: String!)  {
  cancel_vault_transaction_request(request_id: $request_id)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation cancel_vault_transaction_request($request_id: String!) { cancel_vault_transaction_request(request_id: $request_id) }","variables":{"request_id":"req123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation cancel_vault_transaction_request($request_id: String!) { cancel_vault_transaction_request(request_id: $request_id) }""",
    "variables": {
        "request_id": "req123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation cancel_vault_transaction_request($request_id: String!) { cancel_vault_transaction_request(request_id: $request_id) }`,
    variables: {
      "request_id": "req123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query estimate_vault_interests Estimate yield on a planned vault deposit.
Endpoint: POST https://api.cxm.io/graphql
Type: Query

Inputs

NameTypeRequiredDescription
vault_id String! required Vault ID
amount Float! required Deposit amount
duration_seconds Int optional Duration in seconds (if omitted, estimates annual)

Response

FieldTypeDescription
estimated_interest Float Interest earned estimate

GraphQL Operation

query estimate_vault_interests($vault_id: String!, $amount: Float!, $duration_seconds: Int)  {
  estimate_vault_interests(vault_id: $vault_id, amount: $amount, duration_seconds: $duration_seconds)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query estimate_vault_interests($vault_id: String!, $amount: Float!, $duration_seconds: Int) { estimate_vault_interests(vault_id: $vault_id, amount: $amount, duration_seconds: $duration_seconds) }","variables":{"vault_id":"vault123","amount":10000,"duration_seconds":86400}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query estimate_vault_interests($vault_id: String!, $amount: Float!, $duration_seconds: Int) { estimate_vault_interests(vault_id: $vault_id, amount: $amount, duration_seconds: $duration_seconds) }""",
    "variables": {
        "vault_id": "vault123",
        "amount": 10000,
        "duration_seconds": 86400
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query estimate_vault_interests($vault_id: String!, $amount: Float!, $duration_seconds: Int) { estimate_vault_interests(vault_id: $vault_id, amount: $amount, duration_seconds: $duration_seconds) }`,
    variables: {
      "vault_id": "vault123",
      "amount": 10000,
      "duration_seconds": 86400
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this

Derivatives

Optional group: only available if derivatives are enabled for the account. Scope names use the "derivatives_" prefix; the corresponding GraphQL operations are named with the "margin_" prefix.

query derivatives_instruments List perpetual swap contracts.
Endpoint: POST https://api.cxm.io/graphql
Operation: margin_instruments (Query)

Inputs

NameTypeRequiredDescription
is_active ToggleSwitch! optional Filter active instruments only
pager PagerInput optional Pagination parameters (limit, offset)

Response

FieldTypeDescription
margin_instrument_id String Unique instrument identifier
name String Instrument display name (e.g., BTC-PERP)
price Object Current bid/ask pricing
long_funding_rate Float Funding rate for long positions
short_funding_rate Float Funding rate for short positions

GraphQL Operation

query margin_instruments($is_active: ToggleSwitch!, $pager: PagerInput)  {
  margin_instruments(is_active: $is_active, pager: $pager)  {
    margin_instrument_id name base_currency_id quote_currency_id min_leverage max_leverage min_quantity max_quantity long_funding_rate short_funding_rate price_24h_change price_decimals quantity_decimals price_24h_low price_24h_high is_trading_on market_status margin_instrument_strategy_is_active margin_instrument_strategy_id class lot_size step_size cross_quote_price close_only base_currency  {
      currency_id precision is_active
    }
    quote_currency  {
      currency_id precision is_active
    }
    price  {
      margin_instrument_id ask bid updated_at
    }
    funding_data  {
      rate_type next_funding_date long_funding_rate short_funding_rate multiplier period
    }
    meta market_hours  {
      custom_periods  {
        end_time name start_time
      }
      general_rules  {
        days end_time is_active start_time
      }
      holidays  {
        end_time name start_time
      }
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query margin_instruments($is_active: ToggleSwitch!, $pager: PagerInput) { margin_instruments(is_active: $is_active, pager: $pager) { margin_instrument_id name base_currency_id quote_currency_id min_leverage max_leverage min_quantity max_quantity long_funding_rate short_funding_rate price_24h_change price_decimals quantity_decimals price_24h_low price_24h_high is_trading_on market_status margin_instrument_strategy_is_active margin_instrument_strategy_id class lot_size step_size cross_quote_price close_only base_currency { currency_id precision is_active } quote_currency { currency_id precision is_active } price { margin_instrument_id ask bid updated_at } funding_data { rate_type next_funding_date long_funding_rate short_funding_rate multiplier period } meta market_hours { custom_periods { end_time name start_time } general_rules { days end_time is_active start_time } holidays { end_time name start_time } } } }","variables":{"is_active":"On","pager":{"limit":1000,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query margin_instruments($is_active: ToggleSwitch!, $pager: PagerInput) { margin_instruments(is_active: $is_active, pager: $pager) { margin_instrument_id name base_currency_id quote_currency_id min_leverage max_leverage min_quantity max_quantity long_funding_rate short_funding_rate price_24h_change price_decimals quantity_decimals price_24h_low price_24h_high is_trading_on market_status margin_instrument_strategy_is_active margin_instrument_strategy_id class lot_size step_size cross_quote_price close_only base_currency { currency_id precision is_active } quote_currency { currency_id precision is_active } price { margin_instrument_id ask bid updated_at } funding_data { rate_type next_funding_date long_funding_rate short_funding_rate multiplier period } meta market_hours { custom_periods { end_time name start_time } general_rules { days end_time is_active start_time } holidays { end_time name start_time } } } }""",
    "variables": {
        "is_active": "On",
        "pager": {
            "limit": 1000,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query margin_instruments($is_active: ToggleSwitch!, $pager: PagerInput) { margin_instruments(is_active: $is_active, pager: $pager) { margin_instrument_id name base_currency_id quote_currency_id min_leverage max_leverage min_quantity max_quantity long_funding_rate short_funding_rate price_24h_change price_decimals quantity_decimals price_24h_low price_24h_high is_trading_on market_status margin_instrument_strategy_is_active margin_instrument_strategy_id class lot_size step_size cross_quote_price close_only base_currency { currency_id precision is_active } quote_currency { currency_id precision is_active } price { margin_instrument_id ask bid updated_at } funding_data { rate_type next_funding_date long_funding_rate short_funding_rate multiplier period } meta market_hours { custom_periods { end_time name start_time } general_rules { days end_time is_active start_time } holidays { end_time name start_time } } } }`,
    variables: {
      "is_active": "On",
      "pager": {
        "limit": 1000,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query open_derivatives_orders List currently open margin orders.
Endpoint: POST https://api.cxm.io/graphql
Operation: open_margin_orders (Query)

Inputs

NameTypeRequiredDescription
search String optional Search by order ID or instrument
pager PagerInput optional Pagination
sort SortInput optional Sort field and direction
user_id String optional Filter by user ID
dateRange DateRangeInput optional Time range filter
side MarginPositionSide optional buy or sell
status MarginOrderStatus optional open, completed, cancelled, etc.
time_in_force MarginOrderTimeInForce optional GTC, IOC, FOK, etc.
type MarginOrderType optional market or limit
instrument_id String optional Single instrument filter
instruments_ids [String!] optional Multiple instrument IDs
wallet_id String optional Filter by wallet

Response

FieldTypeDescription
margin_order_id ID Order unique identifier
status String Order status: open, completed, cancelled
side String buy or sell
type String market or limit
leverage Int Leverage multiplier
quantity Float Order size
fee_amount Float Trading fee charged

GraphQL Operation

query open_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String)  {
  open_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id)  {
    margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id margin_instrument  {
      base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency  {
        precision
      }
      base_currency  {
        precision
      }
      price  {
        ask bid
      }
      margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query open_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }","variables":{"user_id":"user123","side":"buy","status":"open","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query open_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }""",
    "variables": {
        "user_id": "user123",
        "side": "buy",
        "status": "open",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query open_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }`,
    variables: {
      "user_id": "user123",
      "side": "buy",
      "status": "open",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query closed_derivatives_orders List filled / cancelled margin orders.
Endpoint: POST https://api.cxm.io/graphql
Operation: closed_margin_orders (Query)

Inputs

NameTypeRequiredDescription
search String optional Search by ID
pager PagerInput optional Pagination
sort SortInput optional Sort parameters
user_id String optional User filter
dateRange DateRangeInput optional Time range
side MarginPositionSide optional buy or sell
status MarginOrderStatus optional completed, cancelled, rejected
time_in_force MarginOrderTimeInForce optional GTC, IOC, FOK
type MarginOrderType optional market or limit
instrument_id String optional Single instrument
instruments_ids [String!] optional Multiple instruments
wallet_id String optional Wallet filter

Response

FieldTypeDescription
margin_order_id ID Order ID
status String Final status
executed_quantity Float Amount actually filled
value Float Total notional value
fee_amount Float Trading fees

GraphQL Operation

query closed_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String)  {
  closed_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id)  {
    margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id value margin_instrument  {
      base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency  {
        precision
      }
      base_currency  {
        precision
      }
      price  {
        ask bid
      }
      margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query closed_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id value margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }","variables":{"user_id":"user123","status":"completed","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query closed_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id value margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }""",
    "variables": {
        "user_id": "user123",
        "status": "completed",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query closed_margin_orders($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $status: MarginOrderStatus, $time_in_force: MarginOrderTimeInForce, $type: MarginOrderType, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_orders(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, status: $status, time_in_force: $time_in_force, type: $type, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_order_id margin_position_id user_id instrument_id side type status leverage quantity price limit_price message created_at_timestamp stop_loss take_profit ask bid executed_quantity fee_amount time_in_force expires_at_iso updated_at_iso cross_quote_price wallet_id value margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_leverage max_leverage min_quantity max_quantity cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size class margin_instrument_id is_trading_on market_status } } }`,
    variables: {
      "user_id": "user123",
      "status": "completed",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation create_derivatives_order Place a margin / perpetual order.
Endpoint: POST https://api.cxm.io/graphql
Operation: create_margin_order (Mutation)

Inputs

NameTypeRequiredDescription
instrument_id String! required Perpetual contract symbol
side MarginPositionSide! required buy (long) or sell (short)
type MarginOrderType! required market or limit
leverage Int! required Leverage multiplier
quantity Float! required Order size
price Float optional Limit price (required for limit orders)
stop_loss Float optional Stop loss trigger price
take_profit Float optional Take profit target price
expires_at String optional Order expiry ISO timestamp
time_in_force MarginOrderTimeInForce! optional GTC, IOC, FOK
all_in ToggleSwitch optional Use all available margin
wallet_id String optional Target wallet

Response

FieldTypeDescription
margin_order_id ID ID of the created order

GraphQL Operation

mutation create_margin_order($instrument_id: String!, $side: MarginPositionSide!, $type: MarginOrderType!, $leverage: Int!, $quantity: Float!, $price: Float, $stop_loss: Float, $take_profit: Float, $expires_at: String, $time_in_force: MarginOrderTimeInForce!, $all_in: ToggleSwitch, $wallet_id: String)  {
  create_margin_order(instrument_id: $instrument_id, side: $side, type: $type, leverage: $leverage, quantity: $quantity, price: $price, stop_loss: $stop_loss, take_profit: $take_profit, expires_at: $expires_at, time_in_force: $time_in_force, all_in: $all_in, wallet_id: $wallet_id)  {
    margin_order_id
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation create_margin_order($instrument_id: String!, $side: MarginPositionSide!, $type: MarginOrderType!, $leverage: Int!, $quantity: Float!, $price: Float, $stop_loss: Float, $take_profit: Float, $expires_at: String, $time_in_force: MarginOrderTimeInForce!, $all_in: ToggleSwitch, $wallet_id: String) { create_margin_order(instrument_id: $instrument_id, side: $side, type: $type, leverage: $leverage, quantity: $quantity, price: $price, stop_loss: $stop_loss, take_profit: $take_profit, expires_at: $expires_at, time_in_force: $time_in_force, all_in: $all_in, wallet_id: $wallet_id) { margin_order_id } }","variables":{"instrument_id":"BTC-PERP","side":"buy","type":"market","leverage":10,"quantity":1}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation create_margin_order($instrument_id: String!, $side: MarginPositionSide!, $type: MarginOrderType!, $leverage: Int!, $quantity: Float!, $price: Float, $stop_loss: Float, $take_profit: Float, $expires_at: String, $time_in_force: MarginOrderTimeInForce!, $all_in: ToggleSwitch, $wallet_id: String) { create_margin_order(instrument_id: $instrument_id, side: $side, type: $type, leverage: $leverage, quantity: $quantity, price: $price, stop_loss: $stop_loss, take_profit: $take_profit, expires_at: $expires_at, time_in_force: $time_in_force, all_in: $all_in, wallet_id: $wallet_id) { margin_order_id } }""",
    "variables": {
        "instrument_id": "BTC-PERP",
        "side": "buy",
        "type": "market",
        "leverage": 10,
        "quantity": 1
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation create_margin_order($instrument_id: String!, $side: MarginPositionSide!, $type: MarginOrderType!, $leverage: Int!, $quantity: Float!, $price: Float, $stop_loss: Float, $take_profit: Float, $expires_at: String, $time_in_force: MarginOrderTimeInForce!, $all_in: ToggleSwitch, $wallet_id: String) { create_margin_order(instrument_id: $instrument_id, side: $side, type: $type, leverage: $leverage, quantity: $quantity, price: $price, stop_loss: $stop_loss, take_profit: $take_profit, expires_at: $expires_at, time_in_force: $time_in_force, all_in: $all_in, wallet_id: $wallet_id) { margin_order_id } }`,
    variables: {
      "instrument_id": "BTC-PERP",
      "side": "buy",
      "type": "market",
      "leverage": 10,
      "quantity": 1
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation cancel_derivatives_order Cancel a margin order.
Endpoint: POST https://api.cxm.io/graphql
Operation: cancel_margin_order (Mutation)

Inputs

NameTypeRequiredDescription
margin_order_id String! required Order ID to cancel

GraphQL Operation

mutation cancel_margin_order($margin_order_id: String!)  {
  cancel_margin_order(margin_order_id: $margin_order_id)
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation cancel_margin_order($margin_order_id: String!) { cancel_margin_order(margin_order_id: $margin_order_id) }","variables":{"margin_order_id":"order123"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation cancel_margin_order($margin_order_id: String!) { cancel_margin_order(margin_order_id: $margin_order_id) }""",
    "variables": {
        "margin_order_id": "order123"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation cancel_margin_order($margin_order_id: String!) { cancel_margin_order(margin_order_id: $margin_order_id) }`,
    variables: {
      "margin_order_id": "order123"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query estimate_derivatives_order Preview a margin order before placing.
Endpoint: POST https://api.cxm.io/graphql
Operation: estimate_margin_user_position (Query)

Inputs

NameTypeRequiredDescription
instrument_id String! required Perpetual contract symbol
quantity Float! required Position size to estimate
leverage Int! required Leverage multiplier (min 1)
side MarginPositionSide! required long or short
limit_price Float optional Target entry price for limit orders
use_cached_price ToggleSwitch optional Use cached price data
wallet_id String optional Specific wallet to estimate for

Response

FieldTypeDescription
order_required_margin Float Margin needed to place order
fee Float Total trading fee
order_value Float Notional order value
order_available_margin Float Available margin after trade
max_position_size_base Float Maximum position size allowed

GraphQL Operation

query estimate_margin_user_position($instrument_id: String!, $quantity: Float!, $leverage: Int!, $side: MarginPositionSide!, $limit_price: Float, $use_cached_price: ToggleSwitch, $wallet_id: String)  {
  estimate_margin_user_position(instrument_id: $instrument_id, quantity: $quantity, leverage: $leverage, side: $side, limit_price: $limit_price, use_cached_price: $use_cached_price, wallet_id: $wallet_id)  {
    order_required_margin fee order_available_margin order_value max_position_size_base min_position_size_base fees_breakdown  {
      fee value source
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query estimate_margin_user_position($instrument_id: String!, $quantity: Float!, $leverage: Int!, $side: MarginPositionSide!, $limit_price: Float, $use_cached_price: ToggleSwitch, $wallet_id: String) { estimate_margin_user_position(instrument_id: $instrument_id, quantity: $quantity, leverage: $leverage, side: $side, limit_price: $limit_price, use_cached_price: $use_cached_price, wallet_id: $wallet_id) { order_required_margin fee order_available_margin order_value max_position_size_base min_position_size_base fees_breakdown { fee value source } } }","variables":{"instrument_id":"BTC-PERP","quantity":1,"leverage":10,"side":"long"}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query estimate_margin_user_position($instrument_id: String!, $quantity: Float!, $leverage: Int!, $side: MarginPositionSide!, $limit_price: Float, $use_cached_price: ToggleSwitch, $wallet_id: String) { estimate_margin_user_position(instrument_id: $instrument_id, quantity: $quantity, leverage: $leverage, side: $side, limit_price: $limit_price, use_cached_price: $use_cached_price, wallet_id: $wallet_id) { order_required_margin fee order_available_margin order_value max_position_size_base min_position_size_base fees_breakdown { fee value source } } }""",
    "variables": {
        "instrument_id": "BTC-PERP",
        "quantity": 1,
        "leverage": 10,
        "side": "long"
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query estimate_margin_user_position($instrument_id: String!, $quantity: Float!, $leverage: Int!, $side: MarginPositionSide!, $limit_price: Float, $use_cached_price: ToggleSwitch, $wallet_id: String) { estimate_margin_user_position(instrument_id: $instrument_id, quantity: $quantity, leverage: $leverage, side: $side, limit_price: $limit_price, use_cached_price: $use_cached_price, wallet_id: $wallet_id) { order_required_margin fee order_available_margin order_value max_position_size_base min_position_size_base fees_breakdown { fee value source } } }`,
    variables: {
      "instrument_id": "BTC-PERP",
      "quantity": 1,
      "leverage": 10,
      "side": "long"
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query open_derivatives_positions List currently open margin positions.
Endpoint: POST https://api.cxm.io/graphql
Operation: open_margin_positions (Query)

Inputs

NameTypeRequiredDescription
search String optional Search by position ID
pager PagerInput optional Pagination
sort SortInput optional Sort parameters
user_id String optional User filter
dateRange DateRangeInput optional Date range
side MarginPositionSide optional long or short
instrument_id String optional Single instrument
instruments_ids [String!] optional Multiple instruments
wallet_id String optional Wallet filter

Response

FieldTypeDescription
margin_position_id ID Position unique ID
side String long or short
amount Float Position size in base asset
entry_price Float Average entry price
pnl Float Unrealized P&L
leverage Int Current leverage
funding_fee_amount Float Accrued funding fees

GraphQL Operation

query open_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String)  {
  open_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id)  {
    margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code margin_instrument  {
      base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency  {
        precision
      }
      base_currency  {
        precision
      }
      price  {
        ask bid
      }
      margin_instrument_strategy_is_active lot_size step_size
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query open_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }","variables":{"user_id":"user123","side":"long","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query open_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }""",
    "variables": {
        "user_id": "user123",
        "side": "long",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query open_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { open_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }`,
    variables: {
      "user_id": "user123",
      "side": "long",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query closed_derivatives_positions List historical (closed) margin positions.
Endpoint: POST https://api.cxm.io/graphql
Operation: closed_margin_positions (Query)

Inputs

NameTypeRequiredDescription
search String optional Search by ID
pager PagerInput optional Pagination
sort SortInput optional Sort parameters
user_id String optional User filter
dateRange DateRangeInput optional Time range
side MarginPositionSide optional long or short
instrument_id String optional Single instrument
instruments_ids [String!] optional Multiple instruments
wallet_id String optional Wallet filter

Response

FieldTypeDescription
margin_position_id ID Position ID
exit_price Float Closing price
pnl Float Realized P&L
close_reason String Why position closed
end_ts_iso DateTime Close timestamp

GraphQL Operation

query closed_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String)  {
  closed_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id)  {
    margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code end_ts_iso margin_instrument  {
      base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency  {
        precision
      }
      base_currency  {
        precision
      }
      price  {
        ask bid
      }
      margin_instrument_strategy_is_active lot_size step_size
    }
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query closed_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code end_ts_iso margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }","variables":{"user_id":"user123","side":"long","pager":{"limit":50,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query closed_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code end_ts_iso margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }""",
    "variables": {
        "user_id": "user123",
        "side": "long",
        "pager": {
            "limit": 50,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query closed_margin_positions($search: String, $pager: PagerInput, $sort: SortInput, $user_id: String, $dateRange: DateRangeInput, $side: MarginPositionSide, $instrument_id: String, $instruments_ids: [String!], $wallet_id: String) { closed_margin_positions(search: $search, pager: $pager, sort: $sort, user_id: $user_id, dateRange: $dateRange, side: $side, instrument_id: $instrument_id, instruments_ids: $instruments_ids, wallet_id: $wallet_id) { margin_position_id instrument_id user_id side leverage amount value funding_fee_amount entry_price start_price_ts end_price_ts start_ask_price start_bid_price duration end_ask_price pnl stop_loss take_profit start_ts_timestamp close_reason updated_at_iso wallet_id margin_currency_id exit_price margin total_pnl cross_quote_price end_bid_price close_reason_code end_ts_iso margin_instrument { base_currency_id quote_currency_id name price_decimals quantity_decimals min_quantity min_leverage max_leverage is_trading_on class margin_instrument_id market_status cross_quote_price close_only quote_currency { precision } base_currency { precision } price { ask bid } margin_instrument_strategy_is_active lot_size step_size } } }`,
    variables: {
      "user_id": "user123",
      "side": "long",
      "pager": {
        "limit": 50,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
mutation update_open_derivatives_position Adjust take-profit / stop-loss / margin on an open position.
Endpoint: POST https://api.cxm.io/graphql
Operation: update_open_margin_position (Mutation)

Inputs

NameTypeRequiredDescription
margin_position_id String! required Position ID to update
leverage Int! required New leverage
stop_loss Float optional Stop loss trigger price
take_profit Float optional Take profit target price

Response

FieldTypeDescription
margin_position_id ID Updated position ID

GraphQL Operation

mutation update_open_margin_position($margin_position_id: String!, $leverage: Int!, $stop_loss: Float, $take_profit: Float)  {
  update_open_margin_position(margin_position_id: $margin_position_id, leverage: $leverage, stop_loss: $stop_loss, take_profit: $take_profit)  {
    margin_position_id
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"mutation update_open_margin_position($margin_position_id: String!, $leverage: Int!, $stop_loss: Float, $take_profit: Float) { update_open_margin_position(margin_position_id: $margin_position_id, leverage: $leverage, stop_loss: $stop_loss, take_profit: $take_profit) { margin_position_id } }","variables":{"margin_position_id":"pos123","leverage":15,"stop_loss":40000,"take_profit":45000}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """mutation update_open_margin_position($margin_position_id: String!, $leverage: Int!, $stop_loss: Float, $take_profit: Float) { update_open_margin_position(margin_position_id: $margin_position_id, leverage: $leverage, stop_loss: $stop_loss, take_profit: $take_profit) { margin_position_id } }""",
    "variables": {
        "margin_position_id": "pos123",
        "leverage": 15,
        "stop_loss": 40000,
        "take_profit": 45000
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `mutation update_open_margin_position($margin_position_id: String!, $leverage: Int!, $stop_loss: Float, $take_profit: Float) { update_open_margin_position(margin_position_id: $margin_position_id, leverage: $leverage, stop_loss: $stop_loss, take_profit: $take_profit) { margin_position_id } }`,
    variables: {
      "margin_position_id": "pos123",
      "leverage": 15,
      "stop_loss": 40000,
      "take_profit": 45000
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this
query derivatives_funding_history Read funding fees paid / earned over time.
Endpoint: POST https://api.cxm.io/graphql
Operation: margin_funding_fees (Query)

Inputs

NameTypeRequiredDescription
sort SortInput optional Sort field and direction
pager PagerInput optional Pagination
dateRange DateRangeInput optional Date range filter
margin_position_id String optional Filter by specific position
wallet_id String optional Wallet filter

Response

FieldTypeDescription
margin_position_id ID Position ID
amount Float Funding fee paid/received
rate Float Funding rate at time of charge
updated_at_iso DateTime Fee calculation time
rate_type String financing or funding

GraphQL Operation

query margin_funding_fees($sort: SortInput, $pager: PagerInput, $dateRange: DateRangeInput, $margin_position_id: String, $wallet_id: String)  {
  margin_funding_fees(sort: $sort, pager: $pager, dateRange: $dateRange, margin_position_id: $margin_position_id, wallet_id: $wallet_id)  {
    amount updated_at_iso margin_position_id position_size rate currency_id rate_type
  }
}

Code Examples

curl -X POST 'https://api.cxm.io/graphql' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"query margin_funding_fees($sort: SortInput, $pager: PagerInput, $dateRange: DateRangeInput, $margin_position_id: String, $wallet_id: String) { margin_funding_fees(sort: $sort, pager: $pager, dateRange: $dateRange, margin_position_id: $margin_position_id, wallet_id: $wallet_id) { amount updated_at_iso margin_position_id position_size rate currency_id rate_type } }","variables":{"wallet_id":"wallet123","pager":{"limit":100,"offset":0}}}'
import requests

url = "https://api.cxm.io/graphql"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
    "query": """query margin_funding_fees($sort: SortInput, $pager: PagerInput, $dateRange: DateRangeInput, $margin_position_id: String, $wallet_id: String) { margin_funding_fees(sort: $sort, pager: $pager, dateRange: $dateRange, margin_position_id: $margin_position_id, wallet_id: $wallet_id) { amount updated_at_iso margin_position_id position_size rate currency_id rate_type } }""",
    "variables": {
        "wallet_id": "wallet123",
        "pager": {
            "limit": 100,
            "offset": 0
        }
    },
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("https://api.cxm.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: `query margin_funding_fees($sort: SortInput, $pager: PagerInput, $dateRange: DateRangeInput, $margin_position_id: String, $wallet_id: String) { margin_funding_fees(sort: $sort, pager: $pager, dateRange: $dateRange, margin_position_id: $margin_position_id, wallet_id: $wallet_id) { amount updated_at_iso margin_position_id position_size rate currency_id rate_type } }`,
    variables: {
      "wallet_id": "wallet123",
      "pager": {
        "limit": 100,
        "offset": 0
      }
    },
  }),
});
const data = await response.json();
console.log(data);

Try It

Authenticate at the top of the page to try this