Start with a limited key
An agent’s key is its only power, so give it the least it needs. On the account page, create a key for the agent alone:- Markets: only the markets it should trade.
- Max order and Max per 24 hours: amounts you are comfortable losing.
A loop that works
1
Learn what the key may do
GET /v1/api_key returns the key’s markets, its maximum order, and how much of its daily limit remains.2
Find the market
GET /v1/markets?q=tesla searches by name, symbol and common aliases. Use the symbol it returns in orders.3
Preview the order
POST /v1/orders/preview returns valid, every error at once, the estimated fill and the resulting position, without placing anything.4
Place the order
POST /v1/orders with a new client_order_id. After a timeout or a 503, send the identical request again with the same client_order_id: it never places a second order.5
Read the result
Report
summary to the user. Check status, and read any notes. If the order is still pending, read it again with GET /v1/orders/{id}.What agents can rely on
- Forgiving input. Numbers can be JSON numbers or strings (
25or"25.00"). Enum values can be in any case ("BUY"). A field with a near-miss name gets a suggestion:amountgives “Did you mean value?”. - Strict where it matters. Orders never guess a market. A near miss, such as
TESLA, is refused with the right symbol suggested. - Errors you can act on. Every error has a
code, amessagewith the numbers involved, and ahintwith one concrete fix. When several fields are wrong, all of them are reported at once. See Handling errors. - Plain-English results. Orders and positions have a
summarysentence written for people and models.notespoint out anything surprising, such as rounding or a flip. - A record of intent.
metadataon an order stores up to 20 values of the agent’s own, such as its reasoning. They are returned with the order, so a person reviewing the account later can see why each trade was made. - Nothing ambiguous.
valueis always US dollars of the asset bought or sold. There is no leverage, so it is also what the order costs.
A system prompt
Give your agent instructions like these, adjusted to your use:System prompt for an agent that trades with the Trading API
Docs for agents
These docs are available in forms agents can read:/llms.txtlists every page, and/llms-full.txthas all the content in one file.- Any page as Markdown: add
.mdto its URL. /skill.mddescribes what an agent can do with the Trading API, in the Agent Skills format. Install it into your agent:
Install the Trading API skill into your agent
- The OpenAPI spec describes every endpoint and field. Download it from the menu at the top of any page, which can also copy the page or open it in Claude, ChatGPT or Cursor.