/{app_slug}/v1/admin/roles/{role_name}/permissionsAuthReplace a role's permission set
Destructive — the role's permission set is replaced wholesale with the supplied array. Caller-narrowed: the caller must hold every permission in the request, otherwise 403 `Cannot grant actions you don't have: ...`. For EndUser callers the caller-held set is their app-membership role's effective permissions. For M2M callers the held set is the token's `scopes[]` claim — the M2M cannot grant a role any verb that wasn't configured on the M2M credential. Unknown permission strings return 400.
Path parameters
app_slug*stringSlug of the app.
role_name*stringName of the role (e.g. `admin`).
Request body
permissions*arrayArray of permission strings in resource.action format
Example: ["user.read","role.create"]
Response · 200 Permissions updated. Returns the set the role now holds — the write is caller-narrowed, so the resulting set is what the caller needs to see.
Array of object
id*stringUnique identifier of the role permission.
resource*stringResource half of the permission key (`resource.action`).
Example: "user"
action*stringAction half of the permission key (`resource.action`).
Example: "read"
description*stringFree-text description of the role permission, or `null`.
Example
Request
PUT https://api.auth.productcraft.co/{app_slug}/v1/admin/roles/{role_name}/permissions
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"permissions": [
"user.read",
"role.create"
]
}Response
[
{
"id": "string",
"resource": "user",
"action": "read",
"description": "string"
}
]