ratelimit

Create ratelimit namespace

Changed on

Create a rate limit namespace before you rate limit against it.

ratelimit.limit also creates a namespace the first time you use its name, when your root key can create namespaces. Use this endpoint when you want the namespace to exist up front, for example to set overrides before the first request.

Important: Names are unique within your workspace, deleted namespaces included. A name that is in use or was deleted returns 409.

Required Permissions

Your root key must have the following permission:

  • unkey:v1:<workspace_id>:projects/*/ratelimits/namespaces/*#write
post/v2/ratelimit.createNamespace

Request

  • Base URL
    https://api.unkey.com
  • URL
    https://api.unkey.com/v2/ratelimit.createNamespace
  • Auth
    HTTP bearer

Request body

namestring required

The name of the namespace, unique within your workspace. Names are case-sensitive. Pass it as namespace to ratelimit.limit and the override endpoints.

Example request

{
  "name": "email.outbound"
}

Response

Namespace created successfully.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": {
    "id": "rlns_1234abcd",
    "name": "api.requests",
    "createdAt": 1704067200000,
    "updatedAt": 1704153600000
  }
}

Changes