delete-user
Remove a user from your n8n instance by providing their client ID and email or user ID. This tool helps manage user access and maintain security.
Instructions
Delete a user from your instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| idOrEmail | Yes |
Implementation Reference
- src/index.ts:1361-1391 (handler)Handler function that executes the delete-user tool by retrieving the N8nClient instance and invoking its deleteUser method with the provided idOrEmail.case "delete-user": { const { clientId, idOrEmail } = args as { clientId: string; idOrEmail: string }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { await client.deleteUser(idOrEmail); return { content: [{ type: "text", text: `Successfully deleted user: ${idOrEmail}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:603-614 (registration)Registration of the 'delete-user' tool in the ListToolsRequestSchema response, specifying name, description, and input schema.{ name: "delete-user", description: "Delete a user from your instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, idOrEmail: { type: "string" } }, required: ["clientId", "idOrEmail"] } },
- src/index.ts:245-249 (helper)Helper method in N8nClient class that sends the DELETE request to the n8n API endpoint /users/{idOrEmail} to delete the user.async deleteUser(idOrEmail: string): Promise<void> { return this.makeRequest<void>(`/users/${idOrEmail}`, { method: 'DELETE', }); }