API Reference
Introduction

API Reference

Complete reference for the SnipeRoute REST API

Base URL

https://api.sniperoute.io

Authentication

All API requests require authentication via API key in the Authorization header:

Authorization: Bearer sk_live_your_api_key_here
Get Your API Key

Learn 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/intents

Request 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

TierRequests/MinuteIntents/Month
Free60100
Pro3001,000
EnterpriseCustomCustom

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: 1638316800

Pagination

List endpoints support pagination via query parameters:

GET /api/v1/intents?page=2&page_size=50
ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed)
page_sizeinteger20Items 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:59Z

Idempotency

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 Conflict

Endpoints Overview

Trade Intents

MethodEndpointDescription
POST/api/v1/intentsCreate a new Trade Intent
GET/api/v1/intents/:idGet Trade Intent by internal ID
GET/api/v1/intents/by-external-id/:intent_idGet Trade Intent by your intent_id
GET/api/v1/intentsList 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())

Next Steps