POST
/
v1
/
keys.setPermissions
Set key permissions
curl --request POST \
  --url https://api.unkey.dev/v1/keys.setPermissions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "keyId": "<string>",
  "permissions": [
    {
      "id": "perm_123"
    },
    {
      "name": "dns.record.create"
    },
    {
      "name": "dns.record.delete",
      "create": true
    }
  ]
}'
[
  {
    "id": "perm_123",
    "name": "dns.record.create"
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
keyId
string
required

The id of the key.

Minimum length: 1
permissions
object[]
required

The permissions you want to set for this key. This overwrites all existing permissions. Setting permissions requires the rbac.*.add_permission_to_key permission.

Minimum length: 1
Example:
[
{ "id": "perm_123" },
{ "name": "dns.record.create" },
{
"name": "dns.record.delete",
"create": true
}
]

Response

All currently connected permissions

id
string
required

The id of the permission. This is used internally

Example:

"perm_123"

name
string
required

The name of the permission

Example:

"dns.record.create"