> **Building with AI coding agents?** If you're using an AI coding agent, install the official Scalekit plugin. It gives your agent full awareness of the Scalekit API — reducing hallucinations and enabling faster, more accurate code generation.
>
> - **Claude Code**: `/plugin marketplace add scalekit-inc/claude-code-authstack` then `/plugin install <auth-type>@scalekit-auth-stack`
> - **GitHub Copilot CLI**: `copilot plugin marketplace add scalekit-inc/github-copilot-authstack` then `copilot plugin install <auth-type>@scalekit-auth-stack`
> - **Codex**: run the bash installer, restart, then open Plugin Directory and enable `<auth-type>`
> - **Skills CLI** (Windsurf, Cline, 40+ agents): `npx skills add scalekit-inc/skills --list` then `--skill <skill-name>`
>
> `<auth-type>` / `<skill-name>`: `agent-auth`, `full-stack-auth`, `mcp-auth`, `modular-sso`, `modular-scim` — [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Delete users and organizations

Properly deleting users and organizations is essential for security and regulatory compliance. Whether a user departs or an entire organization must be removed, it's important to have reliable deletion processes in place. This guide shows you how to implement deletion for both users and organizations.

Provide a feature for administrators to permanently delete a user account. This is useful for handling user account closures, GDPR deletion requests, or cleaning up test accounts.
**Note:** Before permanent deletion, confirm this is the intended action. If you only need to revoke a user's access to an organization while preserving their account, [remove the user from the organization](/authenticate/manage-organizations/remove-users-from-organization/) instead.

1. ## Delete a user

   Call the `deleteUser` method with the user's ID:

   ```javascript title="Delete a user permanently" wrap
   // Use case: User account closure, GDPR deletion requests, or cleaning up test accounts
   await scalekit.user.deleteUser("usr_123");
   ```

     ```python title="Delete a user permanently" wrap
   # Use case: User account closure, GDPR deletion requests, or cleaning up test accounts
   scalekit_client.users.delete_user(
       user_id="usr_123"
   )
   ```

     ```go title="Delete a user permanently" wrap
   // Use case: User account closure, GDPR deletion requests, or cleaning up test accounts
   if err := scalekitClient.User().DeleteUser(ctx, "usr_123"); err != nil {
       panic(err)
   }
   ```

     ```java title="Delete a user permanently" wrap
   // Use case: User account closure, GDPR deletion requests, or cleaning up test accounts
   scalekitClient.users().deleteUser("usr_123");
   ```

     When you delete a user, Scalekit performs the following actions:
    - Terminates all of the user's active sessions.
    - Removes all of the user's organization memberships.
    - Permanently deletes the user account.

2. ## Delete an organization

   Provide a feature for users to delete organizations they own. This is useful for company closures, account restructuring, or removing test organizations.

   Call the `deleteOrganization` method with the organization's ID:

   ```javascript title="Delete an organization permanently" wrap
   // Use case: Company closure, account restructuring, or removing test organizations
   await scalekit.organization.deleteOrganization(organizationId);
   ```

     ```python title="Delete an organization permanently" wrap
   # Use case: Company closure, account restructuring, or removing test organizations
   scalekit_client.organization.delete_organization(organization_id)
   ```

     ```go title="Delete an organization permanently" wrap
   // Use case: Company closure, account restructuring, or removing test organizations
   err := scalekitClient.Organization().DeleteOrganization(
     ctx,
     organizationId
   )
   if err != nil {
       panic(err)
   }
   ```

     ```java title="Delete an organization permanently" wrap
   // Use case: Company closure, account restructuring, or removing test organizations
   scalekitClient.organizations().deleteById(organizationId);
   ```

     When you delete an organization, Scalekit performs the following actions:
    - Terminates active sessions for all organization members.
    - Removes all user memberships from the organization.
    - Permanently removes all organization data and settings.
    - **Cascading deletion**: If a user is a member of only this organization, their account is also permanently deleted.
    - Users who are members of other organizations retain their accounts and access.
**Permanent deletion cannot be undone:** - Ensure you have appropriate backups and audit trails in your system before deleting a user.
    - If your organization has data retention policies, consider implementing a soft delete. Schedule the permanent deletion for a future date (e.g., 30-60 days) to allow for data backup and user notifications.

---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
