Quickstart
Route your first Trade Intent in 5 minutes.
Before you start, make sure you have:
- A SnipeRoute account (sign up here (opens in a new tab))
- An API key from your dashboard
- A connected broker account (we'll use mock broker for this example)
Step 1: Get Your API Key
- Log in to app.sniperoute.io (opens in a new tab)
- Navigate to Settings → API Keys
- Click Generate API Key
- Copy your key (you won't see it again!)
export SNIPEROUTE_API_KEY="your_api_key_here"Step 2: Install the Python SDK
pip install sniperouteStep 3: Create Your First Trade Intent
import asyncio
from sniperoute import SnipeRouteClient
from sniperoute.models import TradeIntentRequest, OrderSide, OrderType
from decimal import Decimal
async def main():
# Initialize client
client = SnipeRouteClient(
base_url="https://api.sniperoute.io",
api_key="your_api_key_here"
)
# Create a market buy order
intent = TradeIntentRequest(
intent_id="quickstart_001",
symbol="AAPL",
side=OrderSide.BUY,
quantity=Decimal("10"),
order_type=OrderType.MARKET,
broker_id="mock"
)
# Submit to SnipeRoute
response = await client.create_intent(intent)
print(f"Intent created: {response.intent_id}")
print(f" Status: {response.status}")
print(f" ID: {response.id}")
asyncio.run(main())Step 4: Check Intent Status
# Get intent status
status = await client.get_intent_by_external_id("quickstart_001")
print(f"Symbol: {status.symbol}")
print(f"Status: {status.status}")
print(f"Orders: {len(status.orders)}")
for order in status.orders:
print(f" - Order {order.broker_order_id}: {order.status}")
for fill in order.fills:
print(f" Fill: {fill.quantity} @ {fill.price}")Expected Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"intent_id": "quickstart_001",
"symbol": "AAPL",
"side": "buy",
"quantity": 10,
"order_type": "market",
"status": "filled",
"broker_id": "mock",
"orders": [
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"broker_order_id": "mock_order_123",
"status": "filled",
"fills": [
{
"quantity": 10,
"price": 175.50,
"filled_at": "2025-11-30T10:30:00Z"
}
]
}
],
"created_at": "2025-11-30T10:29:59Z",
"updated_at": "2025-11-30T10:30:00Z"
}What Just Happened?
Intent Created
You created a Trade Intent with all execution parameters specified (symbol, side, quantity, order type).
Validated
SnipeRoute validated the intent structure and broker connectivity.
Routed
The intent was routed to the mock broker adapter (in production, this would be your real broker account).
Executed
The mock broker executed the order immediately and returned fill details.
Next Steps
Link your Alpaca, IBKR, or Schwab account
Learn about limit orders and time-in-force options
Receive real-time status updates via webhooks
Handle errors and retry failed intents
Common Issues
401 Unauthorized
Your API key is invalid or missing. Make sure you're passing it in the Authorization header:
Authorization: Bearer your_api_key_here409 Conflict - Duplicate intent_id
Each intent_id must be unique. If you get this error, you're trying to submit an intent with an ID that already exists. Use a different intent_id.
400 Bad Request - Missing limit_price
For limit orders (order_type: "limit"), you must provide a limit_price. Add it to your request:
{
"order_type": "limit",
"limit_price": 175.00
}Ready for production? Replace broker_id: "mock" with your real broker connection ID from the dashboard.