Skip to main content
This guide takes you from your API key to a filled order in five requests. The sandbox has the same endpoints as the live API, but it has its own host and keys, uses test money, and doesn’t connect to the exchange.

Before you begin

The sandbox is at https://gateway-sandbox.matambaintelligence.com. The live host comes with your live keys. When we set up your sandbox access, we send you a sandbox API key and two account codes: one to trade with, and one ending in 99 that has a zero balance, so you can test a rejected order. The examples use these placeholders: Each step shows the request, and a curl command that sends it. The commands read the placeholders as shell variables, so set them once, such as KEY=mgw_test_..., and each command runs as written. Send every request with the Authorization: Bearer $KEY header. Request and response bodies are JSON. Amounts are integers in kobo, so ₦475.00 is 47500, and a field ending in _kobo_decimal is a decimal string of kobo.

Place your first order

1

List your accounts

Confirm that your key works and see which accounts you can trade for.
Response
2

Estimate the cost

Get an estimate before you place the order. An estimate doesn’t place or store anything.
Response
A market order is priced at the day’s price limit: the upper limit for a buy, the lower limit for a sell. In the sandbox, the limits are 10% either side of the listed price, and charges are a flat 1.5%. This estimate works out as follows:The sandbox then fills the order at ₦475.00, so the account pays 482125 kobo: 10 × 47500, plus 1.5%. A sell estimate is priced at the lower limit and is what you’d receive after charges. In live, the estimate is the broker’s figure: it includes the consideration, statutory charges and commission, and it’s indicative.
3

Place the order

Use a unique Idempotency-Key for each order. If a request times out, retry it with the same key and you’ll get the original order back instead of a duplicate. Each run of this guide needs a new key, such as my-first-order-2: sent again, my-first-order returns your first order with 200 OK, and with a different order 409 duplicate_order.
Response
The pending state means the order is open at the exchange.To see a rejected order, place the same order on $ACCOUNT_99 with a new key. It returns 422 order_rejected with reject_reason insufficient_funds.
4

Check the order status

The sandbox fills market orders immediately. We check the broker for fills about every 30 seconds. If you’ve registered a webhook endpoint, we send it an order.filled event. Either way, the event is in GET /v1/events. Wait 30 seconds, then retrieve the order. If it still reads pending, retrieve it again a few seconds later.
Response
5

View the position

The filled order now appears as a position on the account.
Response
The order is filled and the position shows it. Every endpoint is in the API reference, and every error code in the error reference.

Run this guide in Postman

Import the Postman collection and the sandbox environment, then fill in api_key, account and account_99 in the environment. Its base_url is already the sandbox’s address. The collection runs these five requests in order, then requests for common errors. It refuses to run with anything but a sandbox key. To generate a client in your own language, use the OpenAPI file.

Rehearse errors and rare outcomes

The sandbox reference lists how the sandbox behaves, a request for each error it can show, and the test values that make rare outcomes happen on demand.