Templates
Rate limit templates — define usage plans and apply them to clients.
Templates
A template defines a rate-limiting plan. Assign a template to a client to automatically enforce usage caps on all that client's API keys.
Create a template
curl -X PUT "https://apikee.dev/api/v1/project/my-api-production" \
-H "x-api-key: sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"singleEnv": {
"templates": [
{
"name": "Starter",
"rateLimitHour": 100,
"rateLimitDay": 1000,
"rateLimitMonth": 20000,
"maxClients": 500
},
{
"name": "Pro",
"rateLimitHour": 2000,
"rateLimitDay": 50000,
"rateLimitMonth": 1000000,
"maxClients": null
}
]
}
}'Template fields
| Field | Type | Description |
|---|---|---|
id | string | Template ID (use when assigning to a client) |
name | string | Display name |
rateLimitHour | integer | null | Max requests per hour. null = unlimited. |
rateLimitDay | integer | null | Max requests per day. null = unlimited. |
rateLimitWeek | integer | null | Max requests per week. null = unlimited. |
rateLimitMonth | integer | null | Max requests per month. null = unlimited. |
maxClients | integer | null | Max clients using this template. null = unlimited. |
Rate limits are applied at the client level, not per key. A client with two active keys shares the same limit budget.
List templates
curl "https://apikee.dev/api/v1/client/templates?project_env=my-api-production" \
-H "x-api-key: sk_live_..."Assign to a client
curl -X PUT "https://apikee.dev/api/v1/client/{uuid}?project_env=my-api-production" \
-H "x-api-key: sk_live_..." \
-H "Content-Type: application/json" \
-d '{ "templateId": "tmpl_abc123" }'Or in the SDK:
key = apikee.create(
tenant="acme-corp",
template_id="tmpl_abc123", # from GET /client/templates
)
