User API
UserClient manages n8n users — list, get, create, delete, and change roles.
Access
const user = client.users();
Methods
list(params?)
List users with optional filters.
const { data, nextCursor } = await client.users().list({
limit: 10,
offset: 0,
includeRole: true,
projectId: 'proj-1',
});
get(id, params?)
Get a user by ID.
const user = await client.users().get('user-123', { includeRole: true });
create(data)
Create one or more users.
const result = await client.users().create([
{ email: 'alice@example.com', role: 'global:member' },
{ email: 'bob@example.com', role: 'global:admin' },
]);
// result.user contains the created user info
delete(id)
Delete a user.
await client.users().delete('user-123');
changeRole(id, newRoleName)
Change a user's global role.
await client.users().changeRole('user-123', 'global:admin');
UserResource
Use getResource() or listResources() to get a bound UserResource instance.
const resource = await client.users().getResource('user-123', { includeRole: true });
Properties
| Property | Type | Description |
|---|---|---|
id | string | User ID |
email | string | User email |
Methods
| Method | Returns | Description |
|---|---|---|
refresh() | this | Re-fetch the user from the API (preserves original includeRole param) |
delete() | void | Delete the user |
changeRole(newRoleName) | this | Change the user's global role — merges role into snapshot locally |
Snapshot management
refresh() calls replaceSnapshot(). changeRole() merges the new role into the local snapshot without re-fetching the full user.