Apikee

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

FieldTypeDescription
idstringTemplate ID (use when assigning to a client)
namestringDisplay name
rateLimitHourinteger | nullMax requests per hour. null = unlimited.
rateLimitDayinteger | nullMax requests per day. null = unlimited.
rateLimitWeekinteger | nullMax requests per week. null = unlimited.
rateLimitMonthinteger | nullMax requests per month. null = unlimited.
maxClientsinteger | nullMax 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
)

On this page