Skip to main content
Who it’s for: teams putting LLM agents (Claude, GPT or your own models) into a trading or treasury workflow. What you build: an AI analyst that researches markets and proposes trades. A person, or a policy, approves each one, and the API executes it within limits you set.

Call sequence

1

Research on a read only key

Give the research agent a key with only the read scope. It can call List markets, Quote a market, Get a market orderbook and Get recent trades. An order attempt returns 403.
2

Propose with a preview

The agent writes a proposal and calls Preview an order. The preview is the “here’s exactly what would happen” for the approval step: legs, quantity, prices and whether it would_submit.
3

Execute on approval

An execution key with the trade scope and lowered limits calls Place an order with the client_order_id from the proposal, so a double approval never trades twice.
4

Close the loop

The stream and List fills feed results back to the agent. Pause order placement lets the agent, or a monitor, stop everything. A person signed in to Lean can revoke either key at any time with Revoke an API key; a revoked key gets 401.

Starter

Create both keys in Lean under Settings → API: one with only read, one with trade and low limits. Then:

Guardrails

  • Read only keys. A read key can research and preview, and is refused with 403 if it tries to place an order.
  • Spending caps. Per order and rolling 24 hour limits live on the execution key, and the key can only lower them.
  • Idempotency. The proposal’s client_order_id makes execution safe to retry.
  • Kill switch and revocation. Pause a key or the whole account in one call, and revoke a key from Lean at any time.