/v1/workspaces/{workspace_slug}/roles/{role_id}AuthUpdate a role or replace its permission set. Cookie/JWT only — role authoring is a human-admin surface.
Path parameters
workspace_slug*stringSlug of the workspace. Platform routes name the workspace by slug, positionally in the SDK (`platform.workspaces.retrieve("acme")`); the product APIs bind `workspace_id` instead.
role_id*string · uuidId of the role.
Request body
namestringNew name of the role.
Example: "BillingAdmin"
descriptionstringNew description of the role.
Example: "Manages billing and reads invoices."
policyarrayReplaces the role policy if provided. Omit to leave policy unchanged.
Example: [{"effect":"allow","actions":["mail.*.read"],"resources":["*"]}]
policy_idstringBind / unbind the role to a managed policy. UUID → bind, null → unbind, omit → leave unchanged.
Example: "11111111-1111-1111-1111-111111111111"
Response · 200
id*string · uuidId of the role.
name*stringRole name. System role names are `owner`/`admin`/`member`.
description*stringWhat the role is for, when set.
is_system*booleanTrue for built-in system roles (owner/admin/member); false for custom roles.
policy*arrayEffective IAM-style policy. When `policy_id` is set this is the bound managed policy; otherwise it is the inline policy column.
policy_id*string · uuidManaged policy ID if the role is bound to one, else null.
Example
Request
PATCH https://api.platform-auth.productcraft.co/v1/workspaces/{workspace_slug}/roles/{role_id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "BillingAdmin",
"description": "Manages billing and reads invoices.",
"policy": [
{
"effect": "allow",
"actions": [
"mail.*.read"
],
"resources": [
"*"
]
}
],
"policy_id": "11111111-1111-1111-1111-111111111111"
}import { PlatformAuth } from "@productcraft/platform-auth";
// Reads PRODUCTCRAFT_API_KEY from the environment; administration
// calls take a person's session: { auth: { type: "bearer", token } }
const platform = new PlatformAuth();
const workspaceRole = await platform.workspaces.roles.update("acme", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "Manages billing and reads invoices." });platform.workspaces.roles.update(workspaceSlug, roleId, params?, options?): PlatformAuth.WorkspaceRole
Response
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"description": "string",
"is_system": false,
"policy": [
{
"effect": "allow",
"actions": [
"social.read",
"social.list"
],
"resources": [
"*"
]
}
],
"policy_id": "00000000-0000-0000-0000-000000000000"
}