Skip to main content

Documentation Index

Fetch the complete documentation index at: https://stabyl.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The exchange routes let approved Stabyl accounts automate trading activity that would otherwise be performed in the product interface. Build against them like a trading API: discover markets first, validate amounts and precision locally, submit order intents with idempotency, then reconcile from order and fill reads until the order reaches a terminal state.

Core Objects

ObjectDescription
MarketA tradable pair such as USD/NGN, with supported order rules and precision
TickerCurrent best bid/ask and 24h market statistics for a pair
Order bookAggregated price levels available for a pair at a point in time
TradeA recent public market execution
FillAn execution linked to your account’s order history
OrderYour instruction to buy or sell a base asset against a quote asset
Use IDs and symbols exactly as returned by the API. Do not infer pair names, decimal precision, minimum sizes, or route availability from hardcoded configuration. Today, the supported exchange pair is USD/NGN. As new pairs are added, they will appear in GET /partner/exchange/markets; build against discovery rather than assuming this list is permanent.

Market Data

Market data routes are read-only and should be used before order submission and during reconciliation:
NeedEndpoint family
Discover tradable productsGET /partner/exchange/markets
Show a current quoteGET /partner/exchange/ticker/24h
Inspect depth before placing a limit orderGET /partner/exchange/orderbook/{pair_id}/snapshot
Draw charts or backfill candlesGET /partner/exchange/candles
Reconcile recent executionsGET /partner/exchange/trades and GET /partner/exchange/fills
Market data changes frequently. Treat responses as snapshots, cache only for short intervals, and refresh before sending price-sensitive orders.

Orders

An order request is an instruction, not a guarantee that the order has fully executed. The create route validates the request, records the intent, and returns an order that may still be pending. Matching and final settlement are asynchronous.
Order typeUse whenRequired price
limitYou want execution at a specific price or betterYes
marketYou prefer immediate execution against available liquidityNo
SideMeaning
buySpend quote currency to acquire base currency
sellSell base currency for quote currency
For example, on USD/NGN, USD is the base currency and NGN is the quote currency.

Order Lifecycle

Orders can move through the following statuses:
StatusMeaning
pendingRequest accepted for processing
acceptedOrder is live or eligible for matching
partially_filledSome quantity has executed
filledFull quantity has executed
cancelledRemaining quantity was cancelled
rejectedOrder was not accepted
Only filled, cancelled, rejected should be treated as terminal. A partially_filled order still has remaining quantity unless the order later moves to a terminal state.

Reconciliation Pattern

  1. Generate an Idempotency-Key and store it with the local order intent.
  2. Submit the order with POST /partner/exchange/orders.
  3. If the create response is uncertain, retry with the same Idempotency-Key.
  4. Read GET /partner/exchange/orders/{order_id} until the status is terminal.
  5. Use fills and wallet transactions to reconcile execution and balance movement.
Never assume a network timeout means an order did not exist. Query the order state before creating a replacement. Authenticated exchange endpoints require X-Api-Key. Order write routes also require Idempotency-Key.