POST /api/v1/orders answers as soon as the order is accepted. To follow it to the end, read it at the statusUrl the answer gives: GET /api/v1/orders/{id}. The read answers the same envelope as the order answer, for Basic and Advanced orders alike, so one parser reads both.
The API may change until launch. Every change is listed in the Changelog.
statusUrl. The key needs Read orders. Any member or key of the order’s workspace with that permission can read it, not only the one that placed it. An order that does not exist, or that belongs to another workspace, answers 404 ORDER_NOT_FOUND.
The envelope
Statuses
An order can skip statuses: act on
terminal, not on a particular sequence. More values may be added: treat one you do not recognise as “other” and keep following terminal.
When an order ends failed or refunded, read it in the trade history to see why: its settlement.failureReason is a sentence for a person (Read one trade).
While it is not final
next says what to do while the order is not final:
Without
next, poll every 10 to 15 seconds until terminal is true.
Output on test networks
What the order did
Every order also says what it actually did, in the same keys on Basic and Advanced orders. These are recorded facts, never the quote carried forward.
A fee’s
kind is trading (the venue’s fee), relayer, forwarding, transfer, network (gas the order’s wallet paid) or platform (the TetraFi fee). New kinds may be added: show one you do not recognise generically.
Output on test networks
List your orders
GET /api/v1/orders lists your workspace’s orders, newest first, each in the same envelope as GET /api/v1/orders/{id}. The key needs Read orders.
A page with a
status filter keeps reading until it has limit orders or your orders end, up to a limit on how many orders it examines. When it stops at that limit, the page can hold fewer than limit orders, even none, with scanLimitReached: true and a nextCursor: more orders remain to examine. A filter that matches nothing answers one page with nextCursor null. Either way, keep following nextCursor until it is null. A cursor belongs to the key and the exact filters it came with; any other answers 400 INVALID_CURSOR. The script samples/http/orders-list.sh lists the last 30 days:
Output on test networks (shortened)