API Reference
Complete reference for the SnipeRoute REST API
Base URL
https://api.sniperoute.ioAuthentication
All API requests require authentication via API key in the Authorization header:
Authorization: Bearer sk_live_your_api_key_hereLearn how to generate and manage API keys
API Versioning
The current API version is v1. The version is included in the URL path:
https://api.sniperoute.io/api/v1/intentsRequest Format
- Content-Type:
application/json - Accept:
application/json
All request bodies must be valid JSON.
Response Format
All responses are returned as JSON with the following structure:
Success Response (200/201)
{
"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",
"created_at": "2025-11-30T10:29:59Z",
"updated_at": "2025-11-30T10:29:59Z"
}Error Response (4xx/5xx)
{
"detail": "Error message describing what went wrong",
"error_code": "specific_error_code",
"request_id": "req_abc123"
}Rate Limits
| Tier | Requests/Minute | Intents/Month |
|---|---|---|
| Free | 60 | 100 |
| Pro | 300 | 1,000 |
| Enterprise | Custom | Custom |
Rate limits are enforced per API key. If exceeded, you'll receive a 429 Too Many Requests response.
Rate Limit Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1638316800Pagination
List endpoints support pagination via query parameters:
GET /api/v1/intents?page=2&page_size=50| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number (1-indexed) |
page_size | integer | 20 | Items per page (max 100) |
Pagination Response
{
"items": [...],
"page": 2,
"page_size": 50,
"total_items": 150,
"total_pages": 3
}Timestamps
All timestamps are in ISO 8601 format with UTC timezone:
2025-11-30T10:29:59ZIdempotency
Use the intent_id field as an idempotency key. Submitting the same intent_id twice will result in a 409 Conflict error.
# First submission
POST /api/v1/intents
{
"intent_id": "trade_001",
...
}
# 201 Created
# Duplicate submission
POST /api/v1/intents
{
"intent_id": "trade_001",
...
}
# 409 ConflictEndpoints Overview
Trade Intents
| Method | Endpoint | Description |
|---|---|---|
POST | /api/v1/intents | Create a new Trade Intent |
GET | /api/v1/intents/:id | Get Trade Intent by internal ID |
GET | /api/v1/intents/by-external-id/:intent_id | Get Trade Intent by your intent_id |
GET | /api/v1/intents | List all Trade Intents (paginated) |
Webhooks
Webhooks are configured via the dashboard. See Webhook Setup for details.
Error Codes
See the Error Reference for a complete list of error codes and how to handle them.
Code Examples
import asyncio
from sniperoute import SnipeRouteClient
from sniperoute.models import TradeIntentRequest, OrderSide, OrderType
from decimal import Decimal
async def main():
client = SnipeRouteClient()
intent = TradeIntentRequest(
intent_id="trade_001",
symbol="AAPL",
side=OrderSide.BUY,
quantity=Decimal("10"),
order_type=OrderType.MARKET,
broker_id="my_broker"
)
response = await client.create_intent(intent)
print(f"Created: {response.intent_id}")
asyncio.run(main())