What are Instances?
In Evolution API, an instance represents a single WhatsApp connection. Each instance operates independently with its own:- WhatsApp session and authentication state
- Connection status and QR code
- Configuration settings (webhooks, events, proxies)
- Database isolation (messages, contacts, chats)
- Event handlers and integrations
Each instance has a unique
instanceName that identifies it across all API operations. This name must be unique within your Evolution API installation.Instance Architecture
Evolution API uses theWAMonitoringService to manage instance lifecycle and state. When you create an instance, the system:
- Generates a unique
instanceId(UUID) - Creates a database record with connection metadata
- Initializes the WhatsApp channel (Baileys, Business API, or Evolution)
- Stores authentication state (Redis, database, or provider storage)
- Sets up event listeners and webhook configurations
Creating an Instance
To create a new instance, send a POST request to/instance/create:
Create with Webhook Configuration
You can configure webhooks during instance creation:Create with Settings
Configure instance behavior at creation time:Connecting to WhatsApp
After creating an instance, you need to connect it to WhatsApp:Using QR Code (Baileys)
Request QR Code
If you set
qrcode: true during creation, the QR code is returned immediately. Otherwise, connect manually:Scan QR Code
The response contains a base64-encoded QR code:Display this QR code in your application or scan it directly with WhatsApp.
Using Phone Number (Business API)
For WhatsApp Business API integration:Business API instances connect automatically without QR codes, using Meta’s authentication system.
Instance Lifecycle Management
Evolution API provides complete instance lifecycle control:Check Connection State
close- Not connectedconnecting- QR code displayed, waiting for scanopen- Connected and ready
Restart Instance
Restart a connected instance without logging out:Restarting refreshes the connection without destroying the session. Useful for applying configuration changes or recovering from connection issues.
Logout Instance
Disconnect from WhatsApp while preserving the instance:Delete Instance
Permanently remove an instance and all its data:src/api/services/monitor.service.ts:452):
Instance Isolation
Evolution API ensures complete isolation between instances:Database Isolation
Every database query includes theinstanceId to prevent data leakage:
Memory Isolation
Each instance runs in its own context:Authentication Isolation
Instances can use different authentication methods:- Global API Key: Access all instances
- Instance Token: Access only specific instance
Auto-Cleanup and Expiration
Evolution API can automatically remove disconnected instances:src/api/services/monitor.service.ts:45:
Fetching Instance Information
Retrieve detailed information about your instances:Fetch All Instances
Fetch Specific Instance
Best Practices
Use Descriptive Instance Names
Use Descriptive Instance Names
Choose clear, meaningful names that identify the purpose:
- ✅
sales-brazil,support-team-1,customer-bot - ❌
instance1,test,my-instance
Store Instance Tokens Securely
Store Instance Tokens Securely
Each instance receives a unique authentication token. Store these securely:Never commit tokens to version control.
Monitor Connection Status
Monitor Connection Status
Implement health checks to monitor instance connectivity:
Handle Instance Events
Handle Instance Events
Subscribe to instance lifecycle events via webhooks:
INSTANCE_CREATE- New instance createdINSTANCE_DELETE- Instance deletedCONNECTION_UPDATE- Connection state changedQRCODE_UPDATED- New QR code availableREMOVE_INSTANCE- Instance auto-removed
Plan for Scaling
Plan for Scaling
Design your architecture to support multiple instances:
- Use unique names per tenant/customer
- Store instance metadata in your database
- Implement connection pooling for database access
- Consider using Redis for session storage at scale
Next Steps
Authentication
Learn how to secure your instances with API keys
Webhooks
Configure webhooks to receive real-time events
Multi-Tenant
Build multi-tenant applications with instance isolation
Send Messages
Start sending messages with your instance