Unkey · Schema

V2KeysAddPermissionsRequestBody

API KeysRate LimitingAuthenticationDeveloper PlatformAccess ControlIdentityAnalytics

Properties

Name Type Description
keyId string Specifies which key receives the additional permissions using the database identifier returned from `keys.createKey`. Do not confuse this with the actual API key string that users include in requests.
permissions array Grants additional permissions to the key through direct assignment or automatic creation. Duplicate permissions are ignored automatically, making this operation idempotent. Adding permissions never re
View JSON Schema on GitHub

JSON Schema

unkey-v2keysaddpermissionsrequestbody-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/V2KeysAddPermissionsRequestBody",
  "title": "V2KeysAddPermissionsRequestBody",
  "type": "object",
  "required": [
    "keyId",
    "permissions"
  ],
  "properties": {
    "keyId": {
      "type": "string",
      "minLength": 3,
      "maxLength": 255,
      "pattern": "^[a-zA-Z0-9_]+$",
      "description": "Specifies which key receives the additional permissions using the database identifier returned from `keys.createKey`.\nDo not confuse this with the actual API key string that users include in requests.\n",
      "example": "key_2cGKbMxRyIzhCxo1Idjz8q"
    },
    "permissions": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "description": "Grants additional permissions to the key through direct assignment or automatic creation.\nDuplicate permissions are ignored automatically, making this operation idempotent.\n\nAdding permissions never removes existing permissions or role-based permissions.\n\nAny permissions that do not exist will be auto created if the root key has permissions, otherwise this operation will fail with a 403 error.\n",
      "items": {
        "type": "string",
        "minLength": 3,
        "pattern": "^[a-zA-Z0-9_:\\-\\.\\*]+$",
        "description": "Specify the permission by its slug."
      }
    }
  },
  "additionalProperties": false
}