/v1/apps/{app_id}/end-users/{user_id}/roleAuthAssign an end-user a role.
Path parameters
app_id*stringId of the app.
user_id*stringId of the user.
Request body
role_name*stringName of the role to assign
Example: "admin"
Response · 200 Membership updated.
user_id*stringAccount UUID of the end-user whose role changed.
role_name*stringRole name now bound to the app membership.
Example: "admin"
Example
Request
PATCH https://api.auth.productcraft.co/v1/apps/{app_id}/end-users/{user_id}/role
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"role_name": "admin"
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const endUserRoleAssignment = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.updateRole("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });auth.admin.app(…).endUsers.updateRole(userId, params, options?): Auth.EndUserRoleAssignment
Response
{
"user_id": "string",
"role_name": "admin"
}