Skip to main content
The Trading API is designed to be used by AI agents as well as by people. The inputs forgive the mistakes models commonly make. Every response says what happened in plain English, and every error says how to fix the request.

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.
The key cannot withdraw money or change its own limits, whatever the agent does. Revoke it on the account page at any time; it stops working on its next request.

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 (25 or "25.00"). Enum values can be in any case ("BUY"). A field with a near-miss name gets a suggestion: amount gives “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, a message with the numbers involved, and a hint with 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 summary sentence written for people and models. notes point out anything surprising, such as rounding or a flip.
  • A record of intent. metadata on 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. value is 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.txt lists every page, and /llms-full.txt has all the content in one file.
  • Any page as Markdown: add .md to its URL.
  • /skill.md describes 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

Open in Cursor
  • 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.