Wacht Bench is live — AI-assisted development for Wacht

addWorkspaceMember()

Creates a workspace membership for a user with assigned role ids.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function addWorkspaceMember(workspaceId: string, userId: string, roleId: string) {  const client = await wachtClient();  return client.workspaces.addWorkspaceMember(workspaceId, {    user_id: userId,    role_ids: [roleId],  });}

Signature

function addWorkspaceMember(  workspaceId: string,  request: AddWorkspaceMemberRequest,): Promise<WorkspaceMember>

AddWorkspaceMemberRequest

workspaceId?: string | undefined;
Target workspace id.
user_id?: string | undefined;
User id to add to the workspace.
role_ids?: string[] | undefined;
Workspace role ids assigned to this membership.

Behavior

  • Creates a workspace membership binding a user to one or more workspace roles.
  • Returns the created membership object.

On this page