/v1/apps/{app_id}/roles/{role_name}/permissionsAuthSet permissions for a role (caller-narrowed: caller must hold every requested permission)
Path parameters
app_id*stringId 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/v1/apps/{app_id}/roles/{role_name}/permissions
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"permissions": [
"user.read",
"role.create"
]
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.updatePermissions("admin", { permissions: ["user.read", "role.create"] });auth.admin.app(…).roles.updatePermissions(roleName, params, options?): Auth.AppScopedRoleUpdatePermissionsResponse
Response
[
{
"id": "string",
"resource": "user",
"action": "read",
"description": "string"
}
]