This action performs a hard delete and all deleted data will be lost permanently and cannot be recovered. Use this feature only when absolutely necessary.
Admin-Only Feature
User deletion can only be performed by admin users through the API or Console. Regular users cannot delete other users or themselves through the SDK.
API Parameters
The delete user operation accepts the following parameters to control what data gets deleted:Parameter | Type | Required | Description |
---|---|---|---|
userId | string | Yes | The unique identifier of the user to delete |
deleteAll | boolean | No | Delete all personal data including profile, images, files, messages, posts, and comments |
markMessageDeleted | boolean | No | Delete all message channels and messages created by the user |
hardDeletePost | boolean | No | Delete posts, comments, reactions, and child content |
hardDeleteComment | boolean | No | Delete all comments and reactions made by the user |
Deletion Scope
Profile Data
User profile, photos, images, and files
Content Data
Messages, channels, posts, and comments
What Happens When a User is Deleted?
Account Status
Account Status
- User cannot be reactivated: Once deleted, the account cannot be restored under any circumstances
- System ID preserved: The user’s system ID remains in the database for referential integrity
- Display name changed: Username is replaced with “Deleted User” to protect identity
- Account marked as deleted: All queries will show the user as deleted
Content & Data
Content & Data
- Personal data removed: Profile, photos, videos, images, and files are permanently deleted
- Messages deleted: All conversation channels and messages created by the user are removed
- Posts and comments: All posts, comments, and associated content are marked as deleted
- File attachments: All uploaded files and attachments are permanently removed
Community Impact
Community Impact
- Channel membership updated: User is removed from all channels and member counts are updated
- Reaction counts updated: All reactions by the deleted user are removed and counts updated
- Conversation channels deleted: All channels created by the user are permanently removed
- No access restoration: No other user can reactivate or access the deleted account
Implementation
User deletion is typically performed through the Admin Console or server-side API calls, not directly through client SDKs for security reasons. Refer to the API Reference introduction for endpoint availability.
Best Practices
Before Deletion
Before Deletion
- Verify admin permissions: Always check that the requesting user has admin privileges
- User confirmation: Implement confirmation dialogs for irreversible actions
- Data backup: Export critical user data if needed for compliance or business purposes
- Notification: Inform the user about the deletion if applicable and legally required
- Audit logging: Log all deletion requests for security and compliance tracking
During Deletion
During Deletion
- Progress tracking: For bulk operations, implement progress indicators
- Error resilience: Handle network failures and retry logic appropriately
- Rate limiting: Don’t overwhelm the server with too many concurrent deletions
- Transaction safety: Ensure deletion operations are atomic where possible
- Resource cleanup: Monitor server resources during large deletion operations
After Deletion
After Deletion
- Verification: Confirm all selected data has been properly removed
- Cache invalidation: Clear any cached user data in your application
- UI updates: Remove deleted users from all relevant displays and lists
- Reference cleanup: Update any application-specific references to deleted users
- Compliance documentation: Maintain records for regulatory compliance (GDPR, etc.)
Performance Considerations
Batch Processing: When deleting multiple users, process them in small batches (5-10 users) to avoid overwhelming the server and ensure better error handling.
Large Datasets: Users with extensive content (thousands of posts, messages, or files) may take longer to delete. Consider implementing progress indicators for better user experience.
Alternative Approaches
Consider these alternatives before permanent deletion:User Suspension
Temporarily ban user access without data loss. Users can be unbanned later if needed.
Content Moderation
Remove problematic content while preserving the user account and other data.
Compliance & Legal Considerations
When implementing user deletion, ensure compliance with applicable data protection regulations such as GDPR, CCPA, and other privacy laws in your jurisdiction.