Ingest a usage event

Record a single usage event for metering and analytics.

This endpoint only records the event without checking quotas or rate limits. For quota enforcement and rate limiting, use POST /v1/track instead.

When to use this endpoint:

  • Recording events for analytics only
  • Post-event tracking after successful operations
  • Bulk ingestion without enforcement

When to use /v1/track instead:

  • Need quota enforcement before processing
  • Need rate limit checking
  • Want all-in-one tracking with enforcement
POST
/events
AuthorizationBearer <token>

Project API key

In: header

Request Body

application/json

customerId*string

Your customer's identifier (e.g., user ID, tenant ID)

Length1 <= length
eventType*string

Type of event (e.g., "model_call", "embedding", "tool_call")

Length1 <= length
model?string

Model used (e.g., "gpt-4", "claude-3-opus", "gpt-3.5-turbo")

provider?string

Provider name (e.g., "openai", "anthropic", "google")

inputTokens?integer

Number of input tokens consumed

Range0 <= value
outputTokens?integer

Number of output tokens generated

Range0 <= value
totalTokens?integer

Total tokens (auto-calculated if not provided)

Range0 <= value
latencyMs?integer

Request latency in milliseconds

Range0 <= value
costCents?integer

Cost in cents (e.g., 25 = $0.25)

Range0 <= value
properties?

Custom dimensions for filtering and grouping (e.g., user_id, team_id, feature)

idempotencyKey?string

Unique key for deduplication (prevents duplicate events)

timestamp?string

ISO 8601 timestamp (defaults to current time if not provided)

Formatdate-time

Response Body

application/json

application/json

application/json

curl -X POST "https://api.limitry.com/v1/events" \  -H "Content-Type: application/json" \  -d '{    "customerId": "cust_123",    "eventType": "model_call",    "model": "gpt-4",    "provider": "openai",    "inputTokens": 150,    "outputTokens": 50,    "totalTokens": 200,    "latencyMs": 1200,    "costCents": 25,    "properties": {      "user_id": "user_456",      "team_id": "team_eng",      "feature": "chat"    },    "idempotencyKey": "req_abc123",    "timestamp": "2024-01-15T10:30:00Z"  }'
{
  "id": "evt_abc123"
}
{
  "error": "Invalid request"
}
{
  "error": "Invalid or missing API key"
}