/v1/apps/{app_id}/roles/assignAuthAssign a role to a user
Path parameters
app_id*stringId of the app.
Request body
account_id*stringAccount ID of the user
Example: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f"
role*stringRole name to assign
Example: "admin"
Response · 200 Membership updated.
id*stringUnique identifier of the app membership.
app_id*stringApp UUID.
account_id*stringAccount UUID.
role_id*stringRole UUID.
joined_at*string · date-timeWhen the member joined the tenant (ISO 8601).
Example
Request
POST https://api.auth.productcraft.co/v1/apps/{app_id}/roles/assign
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"account_id": "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
"role": "admin"
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const appMembership = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.assign({ account_id: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", role: "admin" });auth.admin.app(…).roles.assign(params, options?): Auth.AppMembership
Response
{
"id": "string",
"app_id": "string",
"account_id": "string",
"role_id": "string",
"joined_at": "2026-01-01T00:00:00.000Z"
}