openapi: 3.1.0 info: description: "Unkey's API provides programmatic access for all resources within our platform.\n\n\n### Authentication\n#\nThis API uses HTTP Bearer authentication with root keys. Most endpoints require specific permissions associated with your root key. When making requests, include your root key in the `Authorization` header:\n```\nAuthorization: Bearer unkey_xxxxxxxxxxx\n```\n\nAll responses follow a consistent envelope structure that separates operational metadata from actual data. This design provides several benefits:\n- Debugging: Every response includes a unique requestId for tracing issues\n- Consistency: Predictable response format across all endpoints\n- Extensibility: Easy to add new metadata without breaking existing integrations\n- Error Handling: Unified error format with actionable information\n\n### Success Response Format:\n```json\n{\n \"meta\": {\n \"requestId\": \"req_123456\"\n },\n \"data\": {\n // Actual response data here\n }\n}\n```\n\nThe meta object contains operational information:\n- `requestId`: Unique identifier for this request (essential for support)\n\nThe data object contains the actual response data specific to each endpoint.\n\n### Paginated Response Format:\n```json\n{\n \"meta\": {\n \"requestId\": \"req_123456\"\n },\n \"data\": [\n // Array of results\n ],\n \"pagination\": {\n \"cursor\": \"next_page_token\",\n \"hasMore\": true\n }\n}\n```\n\nThe pagination object appears on list endpoints and contains:\n- `cursor`: Token for requesting the next page\n- `hasMore`: Whether more results are available\n\n### Error Response Format:\n```json\n{\n \"meta\": {\n \"requestId\": \"req_2c9a0jf23l4k567\"\n },\n \"error\": {\n \"detail\": \"The resource you are attempting to modify is protected and cannot be changed\",\n \"status\": 403,\n \"title\": \"Forbidden\",\n \"type\": \"https://unkey.com/docs/errors/unkey/application/protected_resource\"\n }\n}\n```\n\nError responses include comprehensive diagnostic information:\n- `title`: Human-readable error summary\n- `detail`: Specific description of what went wrong\n- `status`: HTTP status code\n- `type`: Link to error documentation\n- `errors`: Array of validation errors (for 400 responses)\n\nThis structure ensures you always have the context needed to debug issues and take corrective action." title: Unkey analytics ratelimit API version: 2.0.0 servers: - url: https://api.unkey.com security: - rootKey: [] tags: - description: Rate limiting operations name: ratelimit paths: /v2/ratelimit.deleteOverride: post: description: 'Permanently remove a rate limit override. Affected identifiers immediately revert to the namespace default. Use this to remove temporary overrides, reset identifiers to standard limits, or clean up outdated rules. **Important:** Deletion is immediate and permanent. The override cannot be recovered and must be recreated if needed again. **Permissions:** Requires `ratelimit.*.delete_override` or `ratelimit..delete_override` ' operationId: ratelimit.deleteOverride requestBody: content: application/json: examples: specific: summary: Delete specific override value: identifier: premium_user_123 namespace: api.requests wildcard: summary: Delete wildcard pattern override value: identifier: premium_* namespace: api.requests schema: $ref: '#/components/schemas/V2RatelimitDeleteOverrideRequestBody' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/V2RatelimitDeleteOverrideResponseBody' description: Override successfully deleted. Affected identifiers now use default limits. '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: examples: missingPermission: summary: Missing required permission value: error: detail: Your root key requires the 'ratelimit.*.delete_override' permission to perform this operation status: 403 title: Forbidden type: forbidden meta: requestId: req_0uVwX4yZaAbCdEfGhIjKl schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden - Insufficient permissions (requires `ratelimit.*.delete_override`) '404': content: application/json: examples: overrideNotFound: summary: Override not found value: error: detail: No override found for the specified identifier in this namespace. status: 404 title: Not Found type: not_found meta: requestId: req_2wXyZaAbCdEfGhIjKlMnOp schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found - Override or namespace not found '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Internal Server Error security: - rootKey: [] summary: Delete Ratelimit Override tags: - ratelimit x-speakeasy-name-override: deleteOverride /v2/ratelimit.getOverride: post: description: 'Retrieve the configuration of a specific rate limit override by its identifier. Use this to inspect override configurations, audit rate limiting policies, or debug rate limiting behavior. **Important:** The identifier must match exactly as specified when creating the override, including wildcard patterns. **Permissions:** Requires `ratelimit.*.read_override` or `ratelimit..read_override` ' operationId: ratelimit.getOverride requestBody: content: application/json: examples: specific: summary: Get specific override value: identifier: premium_user_123 namespace: api.requests wildcard: summary: Get wildcard pattern override value: identifier: premium_* namespace: api.requests schema: $ref: '#/components/schemas/V2RatelimitGetOverrideRequestBody' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/V2RatelimitGetOverrideResponseBody' description: Override found and returned successfully. '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: examples: missingPermission: summary: Missing required permission value: error: detail: Your root key requires the 'ratelimit.*.read_override' permission to perform this operation status: 403 title: Forbidden type: forbidden meta: requestId: req_0uVwX4yZaAbCdEfGhIjKl schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden - Insufficient permissions (requires `ratelimit.*.read_override`) '404': content: application/json: examples: overrideNotFound: summary: Override not found value: error: detail: No override found for the specified identifier in this namespace. status: 404 title: Not Found type: not_found meta: requestId: req_2wXyZaAbCdEfGhIjKlMnOp schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found - Override or namespace not found '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Internal Server Error security: - rootKey: [] summary: Get Ratelimit Override tags: - ratelimit x-speakeasy-name-override: getOverride /v2/ratelimit.limit: post: description: 'Check and enforce rate limits for any identifier (user ID, IP address, API client, etc.). Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides. **Response Codes**: Rate limit checks return HTTP 200 regardless of whether the limit is exceeded — check the `success` field in the response to determine if the request should be allowed. A 429 may be returned if the workspace exceeds its API rate limit. Other 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors. **Required Permissions** Your root key must have one of the following permissions: - `ratelimit.*.limit` (to check limits in any namespace) - `ratelimit..limit` (to check limits in a specific namespace) ' operationId: ratelimit.limit requestBody: content: application/json: examples: basic: summary: Basic rate limit check value: duration: 60000 identifier: user_abc123 limit: 100 namespace: api.requests ipLimit: summary: IP-based rate limiting value: duration: 60000 identifier: 203.0.113.42 limit: 5 namespace: auth.login weightedCost: summary: Operation with variable cost value: cost: 5 duration: 3600000 identifier: user_def456 limit: 50 namespace: api.heavy_operations schema: $ref: '#/components/schemas/V2RatelimitLimitRequestBody' required: true responses: '200': content: application/json: examples: allowed: summary: Request allowed value: data: limit: 100 remaining: 99 reset: 1714582980000 success: true meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQX limitReached: summary: Rate limit exceeded value: data: limit: 100 remaining: 0 reset: 1714582980000 success: false meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQY withOverride: summary: With custom override applied value: data: limit: 1000 overrideId: ovr_2cGKbMxRyIzhCxo1Idjz8q remaining: 995 reset: 1714582980000 success: true meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQZ schema: $ref: '#/components/schemas/V2RatelimitLimitResponseBody' description: 'Rate limit check completed successfully. Check the `success` field to determine if the request is allowed. ' '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found '410': content: application/json: schema: $ref: '#/components/schemas/GoneErrorResponse' description: Gone - Namespace has been deleted '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Internal server error security: - rootKey: [] summary: Apply Rate Limiting tags: - ratelimit x-speakeasy-name-override: limit /v2/ratelimit.listOverrides: post: description: 'Retrieve a paginated list of all rate limit overrides in a namespace. Use this to audit rate limiting policies, build admin dashboards, or manage override configurations. **Important:** Results are paginated. Use the cursor parameter to retrieve additional pages when more results are available. **Permissions:** Requires `ratelimit.*.read_override` or `ratelimit..read_override` ' operationId: ratelimit.listOverrides requestBody: content: application/json: examples: basic: summary: List all overrides value: limit: 20 namespace: api.requests pagination: summary: Get next page value: cursor: cursor_eyJsYXN0SWQiOiJvdnJfM2RITGNOeVN6SnppRHlwMkpla2E5ciJ9 namespace: api.requests schema: $ref: '#/components/schemas/V2RatelimitListOverridesRequestBody' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/V2RatelimitListOverridesResponseBody' description: Overrides retrieved successfully. Includes pagination metadata if more results are available. '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: examples: missingPermission: summary: Missing required permission value: error: detail: Your root key requires the 'ratelimit.*.read_override' permission to perform this operation status: 403 title: Forbidden type: forbidden meta: requestId: req_0uVwX4yZaAbCdEfGhIjKl schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden - Insufficient permissions (requires `ratelimit.*.read_override`) '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Error security: - rootKey: [] summary: List Ratelimit Overrides tags: - ratelimit x-speakeasy-name-override: listOverrides /v2/ratelimit.multiLimit: post: description: 'Check and enforce multiple rate limits in a single request for any identifiers (user IDs, IP addresses, API clients, etc.). Use this to efficiently check multiple rate limits at once. Each rate limit check is independent and returns its own result with a top-level `passed` indicator showing if all checks succeeded. **Response Codes**: Rate limit checks return HTTP 200 regardless of whether limits are exceeded — check the `passed` field to see if all limits passed, or the `success` field in each individual result. A 429 may be returned if the workspace exceeds its API rate limit. Other 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors. **Required Permissions** Your root key must have one of the following permissions: - `ratelimit.*.limit` (to check limits in any namespace) - `ratelimit..limit` (to check limits in all specific namespaces being checked) ' operationId: ratelimit.multiLimit requestBody: content: application/json: examples: ipHashAndUserLimits: summary: Check both hashed IP and user rate limits value: - duration: 60000 identifier: sha256_8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4 limit: 10 namespace: auth.login - duration: 3600000 identifier: user_def456 limit: 1000 namespace: api.requests multipleChecks: summary: Multiple rate limit checks value: - duration: 60000 identifier: user_abc123 limit: 100 namespace: api.requests - duration: 60000 identifier: user_abc123 limit: 5 namespace: auth.login withWeightedCost: summary: Multiple checks with variable costs value: - cost: 1 duration: 60000 identifier: user_xyz789 limit: 100 namespace: api.light_operations - cost: 5 duration: 3600000 identifier: user_xyz789 limit: 50 namespace: api.heavy_operations schema: $ref: '#/components/schemas/V2RatelimitMultiLimitRequestBody' required: true responses: '200': content: application/json: examples: allAllowed: summary: All requests allowed value: data: limits: - identifier: user_abc123 limit: 100 namespace: api.requests remaining: 99 reset: 1714582980000 success: true - identifier: user_abc123 limit: 5 namespace: auth.login remaining: 4 reset: 1714582980000 success: true passed: true meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQX mixedResults: summary: Some limits exceeded value: data: limits: - identifier: sha256_8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4 limit: 10 namespace: auth.login remaining: 5 reset: 1714582980000 success: true - identifier: user_def456 limit: 1000 namespace: api.requests remaining: 0 reset: 1714583040000 success: false passed: false meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQY withOverride: summary: With custom override applied value: data: limits: - identifier: user_xyz789 limit: 100 namespace: api.light_operations remaining: 95 reset: 1714582980000 success: true - identifier: user_xyz789 limit: 1000 namespace: api.heavy_operations overrideId: ovr_2cGKbMxRyIzhCxo1Idjz8q remaining: 995 reset: 1714582980000 success: true passed: true meta: requestId: req_01H9TQPP77V5E48E9SH0BG0ZQZ schema: $ref: '#/components/schemas/V2RatelimitMultiLimitResponseBody' description: 'All rate limit checks completed successfully. Check the `success` field in each result to determine if the corresponding request is allowed. ' '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found '410': content: application/json: schema: $ref: '#/components/schemas/GoneErrorResponse' description: Gone - Namespace has been deleted '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Internal server error security: - rootKey: [] summary: Apply Multiple Rate Limit Checks tags: - ratelimit x-speakeasy-name-override: multiLimit /v2/ratelimit.setOverride: post: description: 'Create or update a custom rate limit for specific identifiers, bypassing the namespace default. Use this to create premium tiers with higher limits, apply stricter limits to specific users, or implement emergency throttling. **Important:** Overrides take effect immediately and completely replace the default limit for matching identifiers. Use wildcard patterns (e.g., `premium_*`) to match multiple identifiers. **Permissions:** Requires `ratelimit.*.set_override` or `ratelimit..set_override` ' operationId: ratelimit.setOverride requestBody: content: application/json: examples: premium: summary: Higher limit for premium user value: duration: 60000 identifier: premium_user_123 limit: 1000 namespace: api.requests wildcard: summary: Pattern for multiple identifiers value: duration: 60000 identifier: premium_* limit: 500 namespace: api.requests schema: $ref: '#/components/schemas/V2RatelimitSetOverrideRequestBody' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/V2RatelimitSetOverrideResponseBody' description: Override successfully created or updated and is now active. '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestErrorResponse' description: Bad request '401': content: application/json: schema: $ref: '#/components/schemas/UnauthorizedErrorResponse' description: Unauthorized '403': content: application/json: examples: missingPermission: summary: Missing required permission value: error: detail: Your root key requires the 'ratelimit.*.set_override' permission to perform this operation status: 403 title: Forbidden type: forbidden meta: requestId: req_0uVwX4yZaAbCdEfGhIjKl schema: $ref: '#/components/schemas/ForbiddenErrorResponse' description: Forbidden - Insufficient permissions (requires `ratelimit.*.set_override`) '404': content: application/json: examples: namespaceNotFound: summary: Namespace not found value: error: detail: This namespace does not exist. status: 404 title: Not Found type: not_found meta: requestId: req_2wXyZaAbCdEfGhIjKlMnOp schema: $ref: '#/components/schemas/NotFoundErrorResponse' description: Not Found - Namespace not found '429': content: application/problem+json: schema: $ref: '#/components/schemas/TooManyRequestsErrorResponse' description: Too Many Requests '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerErrorResponse' description: Internal Server Error security: - rootKey: [] summary: Set Ratelimit Override tags: - ratelimit x-speakeasy-name-override: setOverride components: schemas: V2RatelimitListOverridesRequestBody: additionalProperties: false properties: namespace: description: The id or name of the rate limit namespace to list overrides for. type: string minLength: 1 maxLength: 255 cursor: description: Pagination cursor from a previous response. Include this when fetching subsequent pages of results. Each response containing more results than the requested limit will include a cursor value in the pagination object that can be used here. type: string limit: description: 'Maximum number of override entries to return in a single response. Use this to control response size and loading performance. - Lower values (10-20): Better for UI displays and faster response times - Higher values (50-100): Better for data exports or bulk operations - Default (10): Suitable for most dashboard views Results exceeding this limit will be paginated, with a cursor provided for fetching subsequent pages.' type: integer default: 10 minimum: 1 maximum: 100 required: - namespace type: object V2RatelimitGetOverrideResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/RatelimitOverride' ValidationError: additionalProperties: false properties: location: description: 'JSON path indicating exactly where in the request the error occurred. This helps pinpoint the problematic field or parameter. Examples include: - ''body.name'' (field in request body) - ''body.items[3].tags'' (nested array element) - ''path.apiId'' (path parameter) - ''query.limit'' (query parameter) Use this location to identify exactly which part of your request needs correction.' type: string example: body.permissions[0].name message: description: Detailed error message explaining what validation rule was violated. This provides specific information about why the field or parameter was rejected, such as format errors, invalid values, or constraint violations. type: string example: Must be at least 3 characters long fix: description: A human-readable suggestion describing how to fix the error. This provides practical guidance on what changes would satisfy the validation requirements. Not all validation errors include fix suggestions, but when present, they offer specific remediation advice. type: string example: Ensure the name uses only alphanumeric characters, underscores, and hyphens required: - location - message type: object description: Individual validation error details. Each validation error provides precise information about what failed, where it failed, and how to fix it, enabling efficient error resolution. Meta: type: object required: - requestId properties: requestId: description: A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance. example: req_123 type: string additionalProperties: false description: Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team. BadRequestErrorDetails: allOf: - $ref: '#/components/schemas/BaseError' - type: object properties: errors: description: List of individual validation errors that occurred in the request. Each error provides specific details about what failed validation, where the error occurred in the request, and suggestions for fixing it. This granular information helps developers quickly identify and resolve multiple issues in a single request without having to make repeated API calls. items: $ref: '#/components/schemas/ValidationError' type: array required: - errors description: Extended error details specifically for bad request (400) errors. This builds on the BaseError structure by adding an array of individual validation errors, making it easy to identify and fix multiple issues at once. NotFoundErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when the requested resource cannot be found. This occurs when: - The specified resource ID doesn''t exist in your workspace - The resource has been deleted or moved - The resource exists but is not accessible with current permissions To resolve this error, verify the resource ID is correct and that you have access to it.' UnauthorizedErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when authentication has failed or credentials are missing. This occurs when: - No authentication token is provided in the request - The provided token is invalid, expired, or malformed - The token format doesn''t match expected patterns To resolve this error, ensure you''re including a valid root key in the Authorization header.' Pagination: type: object properties: cursor: type: string minLength: 1 maxLength: 1024 description: 'Opaque pagination token for retrieving the next page of results. Include this exact value in the cursor field of subsequent requests. Cursors are temporary and may expire after extended periods. ' example: eyJrZXkiOiJrZXlfMTIzNCIsInRzIjoxNjk5Mzc4ODAwfQ== hasMore: type: boolean description: 'Indicates whether additional results exist beyond this page. When true, use the cursor to fetch the next page. When false, you have reached the end of the result set. ' example: true required: - hasMore additionalProperties: false description: Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination. V2RatelimitLimitResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/V2RatelimitLimitResponseData' TooManyRequestsErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when the client has sent too many requests in a given time period. This occurs when you''ve exceeded a rate limit or quota for the resource you''re accessing. The rate limit resets automatically after the time window expires. To avoid this error: - Implement exponential backoff when retrying requests - Cache results where appropriate to reduce request frequency - Check the error detail message for specific quota information - Contact support if you need a higher quota for your use case' V2RatelimitSetOverrideRequestBody: description: 'Sets a new or overwrites an existing rate limit override. Overrides allow you to apply special rate limit rules to specific identifiers, providing custom limits that differ from the default. Overrides are useful for: - Granting higher limits to premium users or trusted partners - Implementing stricter limits for suspicious or abusive users - Creating tiered access levels with different quotas - Implementing temporary rate limit adjustments - Prioritizing important clients with higher limits' additionalProperties: false properties: namespace: description: The ID or name of the rate limit namespace. type: string minLength: 1 maxLength: 255 duration: description: 'The duration in milliseconds for the rate limit window. This defines how long the rate limit counter accumulates before resetting to zero. Considerations: - This can differ from the default duration for the namespace - Longer durations create stricter limits that take longer to reset - Shorter durations allow more frequent bursts of activity - Common values: 60000 (1 minute), 3600000 (1 hour), 86400000 (1 day)' format: int64 type: integer minimum: 1000 identifier: description: 'Identifier of the entity receiving this custom rate limit. This can be: - A specific user ID for individual custom limits - An IP address for location-based rules - An email domain for organization-wide policies - Any other string that identifies the target entity Wildcards (*) can be used to create pattern-matching rules that apply to multiple identifiers. For example: - ''premium_*'' would match all identifiers starting with ''premium_'' - ''*_admin'' would match all identifiers ending with ''_admin'' - ''*suspicious*'' would match any identifier containing ''suspicious'' More detailed information on wildcard pattern rules is available at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules' type: string minLength: 1 maxLength: 255 limit: description: 'The maximum number of requests allowed for this override. This defines the custom quota for the specified identifier(s). Special values: - Higher than default: For premium or trusted entities - Lower than default: For suspicious or abusive entities - 0: To completely block access (useful for ban implementation) This limit entirely replaces the default limit for matching identifiers.' format: int64 type: integer minimum: 0 required: - namespace - identifier - limit - duration type: object V2RatelimitSetOverrideResponseData: type: object properties: overrideId: description: 'The unique identifier for the newly created or updated rate limit override. This ID can be used to: - Reference this specific override in subsequent API calls - Delete or modify this override later - Track which override is being applied in rate limit responses - Associate override effects with specific rules in analytics Store this ID if you need to manage the override in the future.' type: string required: - overrideId GoneErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when the requested resource has been soft-deleted and is no longer available. This occurs when: - The resource has been marked as deleted but still exists in the database - The resource is intentionally unavailable but could potentially be restored - The resource cannot be restored through the API or dashboard To resolve this error, contact support if you need the resource restored.' RatelimitOverride: type: object additionalProperties: false properties: overrideId: description: The unique identifier of this specific rate limit override. This ID is generated when the override is created and can be used for management operations like updating or deleting the override. type: string minLength: 1 maxLength: 255 duration: description: The duration in milliseconds for this override's rate limit window. This may differ from the default duration for the namespace, allowing custom time windows for specific entities. After this duration elapses, the rate limit counter for affected identifiers resets to zero. format: int64 type: integer minimum: 1000 identifier: description: 'The identifier pattern this override applies to. This determines which entities receive the custom rate limit. This can be: - An exact identifier for a specific entity - A pattern with wildcards for matching multiple entities Wildcard examples: - ''admin_*'' matches any identifier starting with ''admin_'' - ''*_test'' matches any identifier ending with ''_test'' - ''*premium*'' matches any identifier containing ''premium'' More complex patterns can combine multiple wildcards. Detailed documentation on pattern matching rules is available at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules' type: string minLength: 1 maxLength: 255 limit: description: 'The maximum number of requests allowed for entities matching this override. This replaces the default limit for the namespace when applied. Common use cases: - Higher limits for premium customers - Reduced limits for abusive or suspicious entities - Zero limit to completely block specific patterns - Custom tier-based limits for different customer segments' format: int64 type: integer minimum: 0 required: - overrideId - duration - identifier - limit V2RatelimitMultiLimitCheck: type: object properties: namespace: description: The namespace this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits. type: string identifier: description: The identifier this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits. type: string limit: description: 'The maximum number of operations allowed within the time window. This reflects either the default limit specified in the request or an override limit if one exists for this identifier. This value helps clients understand their total quota for the current window.' format: int64 type: integer remaining: description: 'The number of operations remaining in the current window before the rate limit is exceeded. Applications should use this value to: - Implement client-side throttling before hitting limits - Display usage information to end users - Trigger alerts when approaching limits - Adjust request patterns based on available capacity When this reaches zero, requests will be rejected until the window resets.' format: int64 type: integer reset: description: 'The Unix timestamp in milliseconds when the rate limit window will reset and ''remaining'' will return to ''limit''. This timestamp enables clients to: - Calculate and display wait times to users - Implement intelligent retry mechanisms - Schedule requests to resume after the reset - Implement exponential backoff when needed The reset time is based on a sliding window from the first request in the current window.' format: int64 type: integer passed: description: 'Whether the request passed the rate limit check. If true, the request is allowed to proceed. If false, the request has exceeded the rate limit and should be blocked or rejected. You MUST check this field to determine if the request should proceed, as the endpoint always returns `HTTP 200` even when rate limited.' type: boolean overrideId: description: 'If a rate limit override was applied for this identifier, this field contains the ID of the override that was used. Empty when no override is in effect. This can be useful for: - Debugging which override rule was matched - Tracking the effects of specific overrides - Understanding why limits differ from default values' type: string x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer-with-omitzero: true required: - namespace - identifier - limit - remaining - reset - passed V2RatelimitMultiLimitResponseData: type: object description: Container for multi-limit rate limit check results required: - passed - limits properties: passed: type: boolean description: 'Overall success indicator for all rate limit checks. This is true if ALL individual rate limit checks passed (all have success: true), and false if ANY check failed. Use this as a quick indicator to determine if the request should proceed.' limits: type: array description: Array of individual rate limit check results, one for each rate limit check in the request items: $ref: '#/components/schemas/V2RatelimitMultiLimitCheck' BadRequestErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BadRequestErrorDetails' description: Error response for invalid requests that cannot be processed due to client-side errors. This typically occurs when request parameters are missing, malformed, or fail validation rules. The response includes detailed information about the specific errors in the request, including the location of each error and suggestions for fixing it. When receiving this error, check the 'errors' array in the response for specific validation issues that need to be addressed before retrying. V2RatelimitMultiLimitRequestBody: type: array description: Array of rate limit checks to perform minItems: 1 maxItems: 100 items: $ref: '#/components/schemas/V2RatelimitLimitRequestBody' V2RatelimitListOverridesResponseData: type: array items: $ref: '#/components/schemas/RatelimitOverride' V2RatelimitDeleteOverrideResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/V2RatelimitDeleteOverrideResponseData' ForbiddenErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when the provided credentials are valid but lack sufficient permissions for the requested operation. This occurs when: - The root key doesn''t have the required permissions for this endpoint - The operation requires elevated privileges that the current key lacks - Access to the requested resource is restricted based on workspace settings To resolve this error, ensure your root key has the necessary permissions or contact your workspace administrator.' V2RatelimitDeleteOverrideResponseData: type: object additionalProperties: false description: Empty response object. A successful response indicates the override was successfully deleted. The operation is immediate - as soon as this response is received, the override no longer exists and affected identifiers have reverted to using the default rate limit for the namespace. No other data is returned as part of the deletion operation. V2RatelimitSetOverrideResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/V2RatelimitSetOverrideResponseData' V2RatelimitDeleteOverrideRequestBody: description: 'Deletes an existing rate limit override. This permanently removes a custom rate limit rule, reverting affected identifiers back to the default rate limits for the namespace. Use this endpoint when you need to: - Remove special rate limit rules that are no longer needed - Reset entities back to standard rate limits - Clean up temporary overrides - Remove outdated tiering or custom limit rules - Fix misconfigured overrides Once deleted, the override cannot be recovered, and the operation takes effect immediately.' additionalProperties: false properties: namespace: description: The id or name of the namespace containing the override. type: string minLength: 1 maxLength: 255 identifier: description: 'The exact identifier pattern of the override to delete. This must match exactly as it was specified when creating the override. Important notes: - This is case-sensitive and must match exactly - Include any wildcards (*) that were part of the original pattern - For example, if the override was created for ''premium_*'', you must use ''premium_*'' here, not a specific ID After deletion, any identifiers previously affected by this override will immediately revert to using the default rate limit for the namespace.' type: string minLength: 1 maxLength: 255 required: - namespace - identifier type: object InternalServerErrorResponse: type: object required: - meta - error properties: meta: $ref: '#/components/schemas/Meta' error: $ref: '#/components/schemas/BaseError' description: 'Error response when an unexpected error occurs on the server. This indicates a problem with Unkey''s systems rather than your request. When you encounter this error: - The request ID in the response can help Unkey support investigate the issue - The error is likely temporary and retrying may succeed - If the error persists, contact Unkey support with the request ID' V2RatelimitListOverridesResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/V2RatelimitListOverridesResponseData' pagination: $ref: '#/components/schemas/Pagination' x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer-with-omitzero: true V2RatelimitLimitRequestBody: additionalProperties: false properties: namespace: type: string minLength: 1 maxLength: 255 description: The id or name of the namespace. example: sms.sign_up cost: type: integer format: int64 minimum: 0 default: 1 description: 'Sets how much of the rate limit quota this request consumes, enabling weighted rate limiting. Use higher values for resource-intensive operations and 0 for tracking without limiting. When accumulated cost exceeds the limit within the duration window, subsequent requests are rejected. Essential for implementing fair usage policies and preventing resource abuse through expensive operations. ' example: 5 duration: type: integer format: int64 minimum: 1000 maximum: 2592000000 description: 'Sets the rate limit window duration in milliseconds after which the counter resets. Shorter durations enable faster recovery but may be less effective against sustained abuse. Common values include 60000 (1 minute), 3600000 (1 hour), and 86400000 (24 hours). Balance user experience with protection needs when choosing window sizes. ' example: 60000 identifier: type: string minLength: 1 maxLength: 255 description: 'Defines the scope of rate limiting by identifying the entity being limited. Use user IDs for per-user limits, IP addresses for anonymous limiting, or API key IDs for per-key limits. Accepts letters, numbers, underscores, dots, colons, slashes, and hyphens for flexible identifier formats. The same identifier can be used across different namespaces to apply multiple rate limit types. Choose identifiers that provide appropriate granularity for your rate limiting strategy. ' example: user_12345 limit: type: integer format: int64 minimum: 1 description: 'Sets the maximum operations allowed within the duration window before requests are rejected. When this limit is reached, subsequent requests fail with `RATE_LIMITED` until the window resets. Balance user experience with resource protection when setting limits for different user tiers. Consider system capacity, business requirements, and fair usage policies in limit determination. ' example: 1000 required: - namespace - identifier - limit - duration type: object V2RatelimitMultiLimitResponseBody: type: object required: - meta - data properties: meta: $ref: '#/components/schemas/Meta' data: $ref: '#/components/schemas/V2RatelimitMultiLimitResponseData' V2RatelimitGetOverrideRequestBody: description: 'Gets the configuration of an existing rate limit override. Use this to retrieve details about custom rate limit rules that have been created for specific identifiers within a namespace. This endpoint is useful for: - Verifying override configurations - Checking current limits for specific entities - Auditing rate limit policies - Debugging rate limiting behavior - Retrieving override settings for modification' additionalProperties: false properties: namespace: description: The id or name of the namespace containing the override. type: string minLength: 1 maxLength: 255 identifier: description: 'The exact identifier pattern for the override you want to retrieve. This must match exactly as it was specified when creating the override. Important notes: - This is case-sensitive and must match exactly - Include any wildcards (*) that were part of the original pattern - For example, if the override was created for ''premium_*'', you must use ''premium_*'' here, not a specific ID like ''premium_user1'' This field is used to look up the specific override configuration for this pattern.' type: string minLength: 1 maxLength: 255 required: - namespace - identifier type: object BaseError: properties: detail: description: A human-readable explanation specific to this occurrence of the problem. This provides detailed information about what went wrong and potential remediation steps. The message is intended to be helpful for developers troubleshooting the issue. example: Property foo is required but is missing. type: string status: description: HTTP status code that corresponds to this error. This will match the status code in the HTTP response. Common codes include `400` (Bad Request), `401` (Unauthorized), `403` (Forbidden), `404` (Not Found), `409` (Conflict), and `500` (Internal Server Error). example: 404 format: int type: integer title: description: A short, human-readable summary of the problem type. This remains constant from occurrence to occurrence of the same problem and should be used for programmatic handling. example: Not Found type: string type: description: A URI reference that identifies the problem type. This provides a stable identifier for the error that can be used for documentation lookups and programmatic error handling. When followed, this URI should provide human-readable documentation for the problem type. example: https://unkey.com/docs/errors/unkey/resource/not_found type: string required: - title - detail - status - type type: object additionalProperties: false description: Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content. V2RatelimitLimitResponseData: type: object properties: limit: description: 'The maximum number of operations allowed within the time window. This reflects either the default limit specified in the request or an override limit if one exists for this identifier. This value helps clients understand their total quota for the current window.' format: int64 type: integer remaining: description: 'The number of operations remaining in the current window before the rate limit is exceeded. Applications should use this value to: - Implement client-side throttling before hitting limits - Display usage information to end users - Trigger alerts when approaching limits - Adjust request patterns based on available capacity When this reaches zero, requests will be rejected until the window resets.' format: int64 type: integer reset: description: 'The Unix timestamp in milliseconds when the rate limit window will reset and ''remaining'' will return to ''limit''. This timestamp enables clients to: - Calculate and display wait times to users - Implement intelligent retry mechanisms - Schedule requests to resume after the reset - Implement exponential backoff when needed The reset time is based on a sliding window from the first request in the current window.' format: int64 type: integer success: description: 'Whether the request passed the rate limit check. If true, the request is allowed to proceed. If false, the request has exceeded the rate limit and should be blocked or rejected. You MUST check this field to determine if the request should proceed, as the endpoint always returns `HTTP 200` even when rate limited.' type: boolean overrideId: description: 'If a rate limit override was applied for this identifier, this field contains the ID of the override that was used. Empty when no override is in effect. This can be useful for: - Debugging which override rule was matched - Tracking the effects of specific overrides - Understanding why limits differ from default values' type: string x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer-with-omitzero: true required: - limit - remaining - reset - success securitySchemes: rootKey: bearerFormat: root key description: 'Unkey uses API keys (root keys) for authentication. These keys authorize access to management operations in the API. To authenticate, include your root key in the Authorization header of each request: ``` Authorization: Bearer unkey_123 ``` Root keys have specific permissions attached to them, controlling what operations they can perform. Key permissions follow a hierarchical structure with patterns like `resource.resource_id.action` (e.g., `apis.*.create_key`, `apis.*.read_api`). Security best practices: - Keep root keys secure and never expose them in client-side code - Use different root keys for different environments - Rotate keys periodically, especially after team member departures - Create keys with minimal necessary permissions following least privilege principle - Monitor key usage with audit logs.' scheme: bearer type: http