API Reference
Trade Intents
Create Intent

Create Trade Intent

Submit a fully specified Trade Intent for execution

API: POST https://api.sniperoute.io/api/v1/intents

Request

Headers

HeaderValueRequired
AuthorizationBearer your_api_keyYes
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
intent_idstringYesUnique identifier from upstream platform (idempotency key)
symbolstringYesTrading symbol (e.g., "AAPL", "TSLA")
sidestringYesOrder side: "buy" or "sell"
quantitynumberYesNumber of shares/units to trade
order_typestringYesOrder type: "market", "limit", "stop", "stop_limit"
broker_idstringYesID of the user's connected broker account
limit_pricenumberConditionalRequired when order_type is "limit" or "stop_limit"
stop_pricenumberConditionalRequired when order_type is "stop" or "stop_limit"
time_in_forcestringNo"day", "gtc", "ioc", "fok" (default: "day")
extended_hoursbooleanNoAllow trading in extended hours (default: false)

Response

Success (201 Created)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "intent_id": "trade_001",
  "symbol": "AAPL",
  "side": "buy",
  "quantity": 10,
  "order_type": "market",
  "status": "pending",
  "broker_id": "alpaca_abc123",
  "orders": [],
  "created_at": "2025-11-30T10:29:59Z",
  "updated_at": "2025-11-30T10:29:59Z"
}

Error (4xx/5xx)

{
  "detail": "Error message",
  "error_code": "specific_error_code",
  "request_id": "req_abc123"
}

Examples

Market Buy Order

curl -X POST https://api.sniperoute.io/api/v1/intents \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_live_abc123..." \
  -d '{
    "intent_id": "trade_001",
    "symbol": "AAPL",
    "side": "buy",
    "quantity": 10,
    "order_type": "market",
    "broker_id": "alpaca_abc123"
  }'

Limit Sell Order

curl -X POST https://api.sniperoute.io/api/v1/intents \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_live_abc123..." \
  -d '{
    "intent_id": "trade_002",
    "symbol": "TSLA",
    "side": "sell",
    "quantity": 5,
    "order_type": "limit",
    "limit_price": 250.00,
    "time_in_force": "gtc",
    "broker_id": "alpaca_abc123"
  }'

Stop-Limit Order

curl -X POST https://api.sniperoute.io/api/v1/intents \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_live_abc123..." \
  -d '{
    "intent_id": "trade_003",
    "symbol": "NVDA",
    "side": "buy",
    "quantity": 20,
    "order_type": "stop_limit",
    "stop_price": 500.00,
    "limit_price": 505.00,
    "time_in_force": "day",
    "broker_id": "alpaca_abc123"
  }'

Validation Rules

intent_id Must Be Unique

Each intent_id must be unique across all Trade Intents for a given user. Duplicate intent_id will result in 409 Conflict.

{
  "detail": "Trade Intent with this intent_id already exists"
}
Limit Orders Require limit_price

If order_type is "limit" or "stop_limit", you must provide limit_price.

{
  "detail": "limit_price is required for limit orders"
}
Stop Orders Require stop_price

If order_type is "stop" or "stop_limit", you must provide stop_price.

{
  "detail": "stop_price is required for stop orders"
}
Quantity Must Be Positive

The quantity must be greater than 0.

{
  "detail": "quantity must be greater than 0"
}
Broker Must Be Connected

The broker_id must correspond to a connected broker account.

{
  "detail": "Broker connection not found"
}

Error Codes

Status CodeError CodeDescription
400validation_errorInvalid request parameters
401unauthorizedInvalid or missing API key
404broker_not_foundBroker connection not found
409duplicate_intent_idTrade Intent with this intent_id already exists
422unprocessable_entityValidation error (e.g., missing limit_price)
429rate_limit_exceededToo many requests
500internal_server_errorServer error

Next Steps