Exchange API Reference
Programmatic access to the Orange Gateway 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 Orange Gateway account settings.
Introduction
The Orange Gateway 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.orangegateway.com/graphql for all GraphQL operations — spot trading, 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.orangegateway.com
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).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
wallet_id |
String |
optional | Wallet ID (optional) |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query account_transactions Read account ledger (trades, fees, deposits, withdrawals, transfers).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
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 group marked conditional appears on a key only when vaults are enabled for the user's account.
Accounts and balances
| Permission | Description |
|---|---|
accounts_balances | Read current balances per currency (free, total, exposed, margin exposure). |
daily_balances_report | Read end-of-day balance snapshots / history. |
account_transactions | Read account ledger (trades, fees, deposits, withdrawals, transfers). |
accounts | List the user's accounts and metadata. |
API and webhooks
| Permission | Description |
|---|---|
create_api_key | Create new API keys. |
update_api_key | Rename, expire, enable/disable, change permissions of existing keys. |
delete_api_key | Revoke API keys. |
webhooks | List configured webhooks. |
create_webhook | Register a new webhook endpoint. |
update_webhook | Modify an existing webhook. |
delete_webhook | Remove a webhook. |
Conversions and payments
| Permission | Description |
|---|---|
create_conversion_quote | Get a locked exchange-rate quote between two currencies. |
conversion_quotes | List previously generated quotes. |
create_conversion_order | Execute a conversion against a quote. |
conversions | List conversion history. |
payments_fees | Read fee schedule for deposits / withdrawals. |
trading_fees | Read trading fee tiers per instrument. |
payments_limits | Read user's daily / weekly payment limits. |
payments | List deposit / withdrawal history. |
payments_routes | List available deposit / withdrawal methods and bank details. |
create_withdrawal_crypto | Initiate a crypto withdrawal to an external address. |
create_withdrawal_fiat | Initiate a fiat withdrawal via bank transfer. |
deposit_bank_details_fiat | Read bank account details for fiat deposits. |
deposit_addresses_crypto | Generate / read crypto deposit addresses. |
estimate_network_fee | Estimate the on-chain network fee for a pending withdrawal. |
Orders and trades
| Permission | Description |
|---|---|
create_order | Place spot orders (market, limit, stop). |
cancel_order | Cancel a single open order or all orders. |
open_orders | List currently open spot orders. |
closed_orders | List filled / cancelled spot orders. |
estimate_order | Preview cost, fees, and slippage before placing an order. |
trades | List executed trades / fills. |
instruments | List trading pairs with metadata and current prices. |
currencies | List supported currencies. |
trading_limits | Read user's per-instrument trading limits. |
Vaults (conditional: only when vaults are enabled for the user)
| Permission | Description |
|---|---|
vaults | List available yield vaults. |
vaults_accounts | Read user's vault account balances. |
vaults_transactions | Read vault deposit / withdrawal history. |
create_vault_deposit | Deposit funds into a vault. |
create_vault_withdrawal | Withdraw funds from a vault. |
vaults_transactions_requests | List pending vault transactions. |
cancel_vault_transaction_request | Cancel a pending vault transaction. |
estimate_vault_interests | Estimate yield on a planned vault deposit. |
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
| Trigger | Fired when |
|---|---|
signin | The user signs in. |
user_created | A user record is created. |
user_updated | A user record is updated. |
account_created | A new account is provisioned for the user. |
mfa_enabled | Multi-factor authentication is enabled on the account. |
Crypto addresses
| Trigger | Fired when |
|---|---|
crypto_address_created | A new deposit address is generated. |
crypto_address_added | An external withdrawal address is whitelisted. |
Spot orders & trades
| Trigger | Fired when |
|---|---|
order_new | A spot order is placed. |
order_completed | A spot order is fully filled. |
order_cancelled | A spot order is cancelled. |
order_rejected | A spot order is rejected. |
trade_completed | A trade (fill) is executed. |
strategy_rule_violation | An order trips a trading-strategy compliance rule. |
Conversions
| Trigger | Fired when |
|---|---|
conversion_new | A conversion order is created. |
conversion_completed | A conversion completes. |
conversion_rejected | A conversion is rejected. |
Payments (deposits / withdrawals)
| Trigger | Fired when |
|---|---|
payment_new | A deposit or withdrawal is initiated. |
payment_unconfirmed | An on-chain deposit is detected but not yet confirmed. |
payment_manual_approval_required | A payment requires manual approval. |
payment_approved | A payment is approved. |
payment_completed | A payment settles successfully. |
payment_rejected | A payment is rejected. |
manual_balance_update | An operator manually adjusts a balance. |
account_transaction | An account-ledger entry is recorded. |
Vaults
| Trigger | Fired when |
|---|---|
vault_deposit | Funds are deposited into a vault. |
vault_withdrawal | Funds are withdrawn from a vault. |
vault_interests_accrued | Vault interest is accrued to the user. |
vault_expired | A fixed-term vault reaches expiry. |
vault_deactivated | A vault is deactivated. |
OTC
| Trigger | Fired when |
|---|---|
otc_order_new | An OTC order is placed. |
otc_order_completed | An OTC order completes. |
otc_order_cancelled | An OTC order is cancelled. |
otc_order_rejected | An OTC order is rejected. |
Referrals
| Trigger | Fired when |
|---|---|
referral_rewarded | A referral reward is granted. |
referral_one_time_rewarded | A one-time referral bonus is granted. |
referral_cashback_rewarded | A referral cashback reward is granted. |
referral_commission_rewarded | A referral commission is granted. |
referral_rebate_rewarded | A 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.
The x-webhook-signature header
Every delivery carries an x-webhook-signature HTTP header containing the SHA-256 hex digest of the concatenation of the webhook_id and the JSON-serialised request body. Compute the same digest on your side and compare to the header. 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/orangegateway", (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.timingSafeEqualin Node.js,hmac.compare_digestin Python) to avoid timing side-channel leaks. - Acknowledge quickly. Return a
2xxresponse 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_idis ever leaked by deleting the existing webhook and creating a new one.
mutation create_api_key Create new API keys.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation update_api_key Rename, expire, enable/disable, change permissions of existing keys.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation delete_api_key Revoke API keys.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation create_webhook Register a new webhook endpoint.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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/orangegateway","triggers":["order_new","order_completed","trade_completed","payment_new","payment_completed"]}}'
import requests
url = "https://api.orangegateway.com/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/orangegateway",
"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.orangegateway.com/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/orangegateway",
"triggers": [
"order_new",
"order_completed",
"trade_completed",
"payment_new",
"payment_completed"
]
},
}),
});
const data = await response.json();
console.log(data);Try It
mutation delete_webhook Remove a webhook.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id |
String! |
required | ID of the webhook to delete. |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
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.orangegateway.com/graphql for all spot subscriptions.
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.orangegateway.com/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
idfield 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_ordersafter reconnectingall_orders) so you do not miss updates that occurred while disconnected.
subscription orderbook Real-time spot order book (bid / ask walls).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
instrument_id | String! | required | Trading pair to subscribe to (e.g. BTC-USDT). |
Each update
| Field | Type | Description |
|---|---|---|
instrument_id | String | The 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.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
instruments | [String!] | optional | Restrict updates to the given instruments. Omit to receive updates for every instrument. |
Each update
| Field | Type | Description |
|---|---|---|
order_id | String | Order whose status changed. |
status | String | New order status. |
updated_at | String | Update 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.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
instrument_id | String | optional | Restrict to one instrument. Omit to receive updates for every instrument. |
Each update
| Field | Type | Description |
|---|---|---|
instrument_id | String | The instrument this tick is for. |
ask | Float | Best ask price. |
bid | Float | Best bid price. |
price_24h_change | Float | Percent change over the last 24 hours. |
ts_iso | String | Tick 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.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
instrument_id | String! | required | Trading pair to subscribe to. |
periodicity | InstrumentHistoryPeriodicity! | required | Bar interval (e.g. 1m, 5m, 15m, 1h, 4h, 1d). |
Each update
| Field | Type | Description |
|---|---|---|
instrument_id | String | Instrument the bar applies to. |
open | Float | Open price. |
high | Float | High price. |
low | Float | Low price. |
close | Float | Close price. |
ts_iso | String | Bar 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
}
}
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.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation create_conversion_order Execute a conversion against a quote.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
conversion_quote_id |
String! |
required | Conversion quote ID from create_conversion_quote |
wallet_id |
String! |
required | Wallet ID for the conversion |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query conversions List conversion history.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query payments_fees Read fee schedule for deposits/withdrawals.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
fee_group_id |
String |
optional | Filter by user fee group |
currency_id |
String |
optional | Filter by currency |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query trading_fees Read trading fee tiers per instrument.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
instrument_id |
String |
optional | Filter by instrument ID |
fee_group_id |
String |
optional | Filter by fee group ID |
pager |
PagerInput |
optional | Pagination parameters |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation payments_limits Read the user's daily/weekly payment limits.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query payments List deposit/withdrawal history.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query payments_routes List available deposit/withdrawal methods and bank details.
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
No variables. Just press Execute.
mutation create_withdrawal_crypto Initiate a crypto withdrawal to an external address.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation create_withdrawal_fiat Initiate a fiat withdrawal via bank transfer.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query deposit_addresses_crypto Generate / read crypto deposit addresses.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
Orders & Trades
Place and manage spot orders, browse instruments, and preview order cost before placement.
mutation create_order Place spot orders (market, limit, stop).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation cancel_order Cancel a single open order or all orders.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query open_orders List currently open spot orders.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query closed_orders List filled / cancelled spot orders.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query estimate_order Preview cost, fees, and slippage before placing an order.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query instruments List trading pairs with metadata and current prices.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query currencies List supported currencies.
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
No variables. Just press Execute.
Vaults
Optional group: only available if vaults are enabled for the account.
query vaults List available yield vaults.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query vaults_accounts Read the user's vault account balances.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query vaults_transactions Read vault deposit / withdrawal history.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation create_vault_deposit Deposit funds into a vault.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation create_vault_withdrawal Withdraw funds from a vault.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query vaults_transactions_requests List pending vault transactions.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
mutation cancel_vault_transaction_request Cancel a pending vault transaction.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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
query estimate_vault_interests Estimate yield on a planned vault deposit.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
vault_id |
String! |
required | Vault ID |
amount |
Float! |
required | Deposit amount |
duration_seconds |
Int |
optional | Duration in seconds (if omitted, estimates annual) |
Response
| Field | Type | Description |
|---|---|---|
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.orangegateway.com/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.orangegateway.com/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.orangegateway.com/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);