Quickstart

Quickstart

Route your first Trade Intent in 5 minutes.

Before you start, make sure you have:

Step 1: Get Your API Key

  1. Log in to app.sniperoute.io (opens in a new tab)
  2. Navigate to Settings → API Keys
  3. Click Generate API Key
  4. 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 sniperoute

Step 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?

1

Intent Created

You created a Trade Intent with all execution parameters specified (symbol, side, quantity, order type).

2

Validated

SnipeRoute validated the intent structure and broker connectivity.

3

Routed

The intent was routed to the mock broker adapter (in production, this would be your real broker account).

4

Executed

The mock broker executed the order immediately and returned fill details.

Next Steps

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_here
409 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.