Submit an order

Submits a buy or sell order on behalf of an agent. Before sending to
Alpaca, the fund checker validates that:

  • The agent has enough available cash for buys.
  • The agent actually holds the shares being sold.
  • The agent is active (not paused or disabled).

If any check fails, the order is rejected with 422 before touching
Alpaca.

Order types

TypeDescription
marketExecutes immediately at the best available price
limitExecutes only at limit_price or better

The reasoning field

Pass a string explaining why the agent is making this trade. It is
stored on the order record and surfaced in the dashboard and run logs.
Useful for auditing agent decisions.

# Market buy
curl -X POST https://api.usetradecraft.io/v1/agents/momentum-trader/orders \
  -H "Authorization: Bearer al_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "AAPL",
    "side": "buy",
    "qty": 5,
    "order_type": "market",
    "reasoning": "AAPL broke above 50-day MA on high volume"
  }'

# Limit sell
curl -X POST https://api.usetradecraft.io/v1/agents/momentum-trader/orders \
  -H "Authorization: Bearer al_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "AAPL",
    "side": "sell",
    "qty": 5,
    "order_type": "limit",
    "limit_price": 195.00,
    "reasoning": "Taking profit at resistance level"
  }'
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required

The agent's unique name (lowercase, no spaces).

Body Params
string
required

Ticker symbol (case-insensitive, normalized to uppercase).

string
enum
required
Allowed:
number
required
≥ 0.001

Number of shares.

string
enum
Defaults to market
Allowed:
number | null

Required when order_type is limit.

string

Why the agent is making this trade. Stored on the order record
and surfaced in dashboards and run logs. Highly recommended for
auditability.

Responses

Language
Credentials
Bearer
tc_...
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json