Skip to main content

Authentication Overview

Evolution API uses API key authentication to secure all endpoints. There are two types of authentication:
  1. Global API Key - Full access to all instances and administrative operations
  2. Instance Token - Restricted access to a specific instance only
All API requests require an apikey header with either a global key or instance-specific token.
API keys are passed via the apikey HTTP header (not Authorization). This allows you to use standard authentication schemes like JWT for your own application layer.

Global API Key

The global API key grants full administrative access to your Evolution API installation.

Setting the Global Key

Configure in your .env file:
Generate a strong, random API key for production. Use at least 32 characters with mixed alphanumeric characters. Never use the example key above.

Generate a Secure Key

Global Key Capabilities

With the global API key, you can:
  • Create new instances
  • Delete any instance
  • Fetch information about all instances
  • Access any instance’s endpoints
  • Modify system-wide configurations

Instance Tokens

Each instance has its own unique authentication token, providing scoped access to that instance only.

How Instance Tokens Work

When you create an instance, Evolution API generates a unique token:

Custom Instance Tokens

You can specify a custom token during instance creation:
Custom tokens must be unique across all instances. The API will reject duplicate tokens.
From the source code (src/api/services/auth.service.ts:7):

Using Instance Tokens

Instance tokens restrict API access to only that instance:
Attempting to access a different instance with this token will fail:

Authentication Flow

Here’s how Evolution API validates requests:
1

Extract API Key

The API extracts the apikey header from your request:
2

Check Global Key

First, check if the key matches the global API key:
3

Check Instance Token

If not a global key, verify it’s a valid instance token:
4

Reject Invalid Keys

If neither match, reject the request:

Security Best Practices

Always use HTTPS to encrypt API keys in transit:
Configure SSL in your .env:
Implement a key rotation policy:
  1. Generate a new global API key
  2. Update your .env file
  3. Restart Evolution API
  4. Update all client applications
For instance tokens, delete and recreate instances with new tokens:
Never hardcode API keys in your application:
Use environment variables, secret managers, or encrypted configuration files.
For customer-facing applications, always use instance tokens instead of the global key:
Track failed authentication attempts:
Restrict API access by IP address at the network level:
Or use a firewall/VPC to limit access to your Evolution API server.

Authentication in Different Languages

Expose Instances Configuration

Control which instances are visible in fetch requests:
  • true - All instances are returned in fetch requests
  • false - Instances are hidden, only explicitly requested instances are returned
This adds privacy for multi-tenant deployments where customers shouldn’t see other instances.

Common Authentication Errors

Cause: No apikey header providedSolution: Add the header to your request:
Cause: Wrong API key or tokenSolution: Verify you’re using the correct key:
  • Check .env file for global key
  • Confirm instance token from creation response
  • Ensure no extra spaces or newlines in the key
Cause: Using instance token for a different instanceSolution: Use the correct token for each instance or use the global API key
Cause: Trying to create instance with a token that’s already in useSolution: Choose a unique token or let Evolution API generate one automatically

Next Steps

Instances

Learn how to create and manage instances

Webhooks

Configure webhooks for real-time event notifications

Multi-Tenant

Build secure multi-tenant applications

API Reference

Explore all available API endpoints