Create a quota

Create a new usage quota with dimension filters.

Quotas allow you to limit usage based on metrics like total tokens, cost, or event count. You can apply quotas to specific customers, models, event types, or any combination using dimension filters.

POST
/quotas
AuthorizationBearer <token>

Project API key

In: header

Request Body

application/json

name*string

Human-readable name for the quota

Length1 <= length
dimensionFilters?

Dimension filters that determine which events match this quota

Default{}
metric*string

Metric being tracked

Value in"total_tokens" | "total_events" | "total_cost_cents"
limitValue*integer

Quota limit value

Range0 < value
period*string

Time period for the quota

Value in"hour" | "day" | "week" | "month"

Response Body

application/json

application/json

application/json

curl -X POST "https://api.limitry.com/v1/quotas" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "metric": "total_tokens",    "limitValue": 0,    "period": "hour"  }'
{
  "id": "qta_abc123",
  "projectId": "proj_xyz",
  "name": "Daily Token Limit",
  "dimensionFilters": {
    "customer_id": "cust_123"
  },
  "metric": "total_tokens",
  "limitValue": 100000,
  "period": "day",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}
{
  "error": "Invalid request"
}
{
  "error": "Invalid or missing API key"
}