Skip to content

API keys ​

Traders who run bots or connect other tools use the REST API. They create an API token in their account, choose what it may do, and send it with every request.

5 minutesUser featureSite owner, developersVerified against the platform code

Creating a token ​

Page: account → API Management (/user/api-tokens).

  1. Under Create API Token, enter a Name (for example "Trading bot").
  2. Tick the Permissions it needs.
  3. Create. The token is shown once, with a Copy button. The user must store it safely: it can't be shown again.

The list under Manage API Tokens shows each token's name and when it was Last used. Permissions changes what an existing token may do. Delete revokes it at once.

Allowed IPs ​

Each key can be limited to allowed IPs: one IPv4/IPv6 address or range (CIDR, for example 198.51.100.0/24) per line, up to 20. Add my IP fills in the address the user is browsing from. Requests from any other IP are refused with 403 "This API key cannot be used from IP …". Empty = any IP.

Keys with the withdraw permission must have at least one allowed IP: the form refuses to save without one, and a withdraw request with a key that has no list is refused (403) before anything else is checked. The key list shows the allowed IP (or the number of them) or Any IP.

The API Management page only lists and edits API keys: app sign-ins don't appear there and can't be deleted from it.

Permissions ​

PermissionAllows
read (ticked by default)Balances, orders, history, account details, account statements
tradePlacing and cancelling spot orders, opening and closing futures positions, and creating and stopping trading bots
withdrawCreating withdrawals

Requests that need a permission the token doesn't have are refused with "Unauthorized". The website itself doesn't use tokens, so these limits only apply to API clients.

Advise least privilege

Tell your users to tick only what their bot needs, and never withdraw for a trading bot. A leaked token with only read and trade can't move funds off the exchange.

Signing in from an app ​

Besides tokens created on the website, apps can get a token by signing in with email and password at POST /api/v1/auth/token. If the user has 2FA on, the 2FA code must be sent too.

Using the API ​

Every request sends the token as a bearer token:

bash
curl https://yourdomain.com/api/v1/... \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"

API requests are limited to 200 per minute per user (or per IP address when not signed in).

Spot orders ​

POST /api/v1/orders (permission trade). Numbers can be sent as strings (recommended, exact) or JSON numbers.

FieldUsed byMeaning
market, side (buy/sell), typealltype is limit, market, stop_limit, oco or trailing_stop
pricelimit, stop_limit, ocoLimit price (for an OCO: the limit order's price)
quantityall except market buy and trailing-stop buyAmount of the base coin
quoteQuantitymarket buy, trailing-stop buyAmount of the quote coin to spend (fee included)
trigger_pricestop_limit, ocoStop price
stop_limit_priceocoLimit price of the stop-limit order
time_in_forcelimitGTC (default), IOC or FOK
post_onlylimittrue: refused if it would trade at once; always the maker fee
trailing_deltatrailing_stopCallback rate in %, 0.1 to 20, up to 2 decimals. Sell: fires when the price falls this much below its highest point; buy: when it rises this much above its lowest. Executes at market
activation_pricetrailing_stop (optional)Trailing starts when the price reaches it (sell: above the market, buy: below). Without it, trailing starts at once
tp_trigger_pricelimit, market (optional)Take profit. When the order closes with fills, a market order for what it filled is placed at this trigger (buy: above the price, sell: below)
sl_trigger_pricelimit, market (optional)Stop loss (buy: below the price, sell: above). With a take profit, one cancels the other

The answer is {"id": "...", "ids": [...], "oco_id": ...}: an OCO returns both order ids and the shared oco_id. A refused order answers 422 with the reason under errors (for example a fill-or-kill order that can't fill completely, or a post-only order that would trade). Cancel with POST /api/v1/orders/cancel {"uuid": "..."}; cancelling either order of an OCO cancels both. Open orders (GET /api/v1/orders/open) include oco_id, time_in_force, post_only, tp_trigger_price, sl_trigger_price, parent_order_id (set on the TP/SL orders an order created) and, for orders waiting for a price, trigger_price and trigger_condition. Trailing stops (type: trailing_stop) also carry trailing_delta, activation_price, trail_extreme (highest / lowest price since it started) and activated; TP/SL orders have type: stop_market. Trailing stops and TP/SL aren't available for margin orders (see Spot trading).

jsonc
// Sell 0.5 BTC with a 2% trailing stop that starts trailing at 85,000
{"market": "BTC-USDT", "side": "sell", "type": "trailing_stop", "quantity": "0.5", "trailing_delta": "2", "activation_price": "85000"}

// Buy 0.1 BTC at 70,000; once it fills, take profit at 77,000 or stop the loss at 66,500
{"market": "BTC-USDT", "side": "buy", "type": "limit", "price": "70000", "quantity": "0.1", "tp_trigger_price": "77000", "sl_trigger_price": "66500"}

Public futures data ​

EndpointReturns
GET /api/v1/futures/mark?market=BTC-USDTmark, index, last, mode (index, own, or last when the mark is stale) and updated_at (ms). Without market: every futures market
GET /api/v1/futures/insurance-fundInsurance fund balance per coin with its 30-day daily history

Open positions (GET /api/v1/orders/futures/open) include mark_price, and their PnL is calculated at the mark price. See Futures.

API reference ​

The full, interactive reference is at https://yourdomain.com/docs/api, linked as API Documentation in the site footer. It's generated from the platform's code, so it always matches the installed version, and anyone can open it.

  • With HIDE_CMC_GECKO=true (the default in .env.example), internal endpoints (gateway callbacks, server tools, payment providers) are left out of the reference.
  • The version shown comes from API_VERSION (default 1.2).

Merchants have their own documentation at /merchant/docs (see Merchant payments).

Owner documentation for the CryptoTech exchange platform.