Skip to content

Multi Instance Configuration

Aziel edited this page Dec 16, 2025 · 2 revisions

AZ-WAP supports managing multiple WhatsApp sessions in a single server deployment. Each instance is identified by a unique token.

Creating an Instance

POST /instances
Content-Type: application/json

{
  "name": "my-sales-bot"
}

Response:

{
  "id": "abc123",
  "name": "my-sales-bot",
  "token": "your-secret-token",
  "status": "CREATED"
}

⚠️ Important: Save the token immediately. It's only shown once at creation time.

Using the Token

All API requests must include the instance token:

# Header method (recommended)
X-Instance-Token: your-secret-token

# Or query parameter
GET /app/login?token=your-secret-token

Instance Statuses

Status Description
CREATED Instance created but not connected
ONLINE WhatsApp session active
OFFLINE Disconnected or logged out

Instance Configuration Options

Each instance can be configured independently:

Webhook Configuration

PUT /instances/{id}/webhook
{
  "urls": ["https://your-webhook.com/endpoint"],
  "secret": "webhook-secret",
  "insecure_skip_verify": false
}

Bot Assignment

PUT /instances/{id}/bot
{
  "bot_id": "bot-uuid"
}

Chatwoot Integration

See Chatwoot-Integration for detailed configuration.

Storage Structure

Each instance maintains isolated storage:

storages/
├── instances.db          # Instance registry
├── wa-{instanceID}.db    # WhatsApp session data
└── chat-{instanceID}.db  # Chat storage (optional)

Best Practices

  1. Token Security: Treat tokens like API keys - never expose them in client-side code
  2. Instance Naming: Use descriptive names for easy identification
  3. Resource Management: Disconnect unused instances to free resources
  4. Monitoring: Check instance status regularly via GET /instances