DELETE /instance/delete/:instanceName
Permanently delete a WhatsApp instance. This will log out the instance, disconnect from WhatsApp, remove all stored data, and deactivate all integrations associated with the instance.Authentication
This endpoint requires authentication via theapikey header.
Path Parameters
Name of the instance you want to delete. This is the
instanceName you specified when creating the instance.Response
Status of the deletion operation:
SUCCESSIndicates if an error occurred:
false on successWhat Gets Deleted
When you delete an instance, the following data and configurations are permanently removed:- WhatsApp session: Instance is logged out from WhatsApp
- Instance data: All database records for the instance
- Messages and chats: All message history and chat data
- Contacts: All contact information
- Media files: All stored media (images, videos, documents)
- Settings: All instance-specific settings
- Integrations: All configured integrations (webhooks, Chatwoot, etc.)
- Event subscriptions: All webhook and event system subscriptions
- Cached data: All Redis/cache entries for the instance
Examples
Response Examples
Success Response
Error - Instance Not Found
Error - Unauthorized
Deletion Process
When you call this endpoint, the following steps are executed:- Validate instance exists - Check that the instance exists and you have permission
- Check connection state - Determine if instance is connected
- Logout from WhatsApp - If connected or connecting, perform logout
- Clear cache - Remove all cached data (Redis, Chatwoot cache)
- Send webhook notification - Trigger
INSTANCE_DELETEwebhook event - Remove from registry - Remove instance from active instances list
- Delete database records - Remove all instance data from database
- Delete files - Remove stored media and session files
- Return confirmation - Confirm successful deletion
Webhook Notification
If you have webhooks configured, you’ll receive anINSTANCE_DELETE event:
INSTANCE_DELETE Event
The webhook is sent before final deletion, so your webhook handler can perform cleanup tasks or logging.
Error Handling
The API returns standard HTTP status codes:200- Success (instance deleted)400- Bad request (instance doesn’t exist or deletion failed)401- Unauthorized (invalid API key or no permission)500- Internal server error
- Instance doesn’t exist: The specified instance name is not found
- Permission denied: Your API key doesn’t have access to this instance
- Deletion in progress: Another deletion request is already being processed
- Database error: Temporary issue with database connection
Best Practices
Always confirm before deletion: Implement a confirmation step in your UI to prevent accidental deletions.
Export data first: If you need to preserve any data, export it before deleting the instance.
Update your records: Remove the instance from your application’s database or configuration after successful deletion.
Revoke webhooks: The instance will no longer send webhooks after deletion, so update your webhook handlers accordingly.
Alternative: Logout Without Deletion
If you want to disconnect from WhatsApp without deleting the instance, use the logout endpoint instead:- Disconnect from WhatsApp
- Preserve all instance data and settings
- Allow you to reconnect later
Recovery Options
Rate Limiting
To prevent accidental mass deletions:- Maximum 10 deletions per minute
- Maximum 100 deletions per hour
Security Considerations
- API key security: Use instance-specific tokens when possible to limit deletion scope
- Audit logging: Log all deletion requests for security and compliance
- Two-factor confirmation: Consider implementing additional verification for deletion in production
- Role-based access: Restrict deletion permissions to administrators only