Master key
The master key grants full control over your Meilisearch instance. It is the only key with access to endpoints for creating and deleting API keys by default. Since the master key is not an API key, it cannot be listed or configured through the/keys endpoints.
Setting the master key
Launch Meilisearch with a master key to protect your instance:- Command line
- Environment variable
Your master key must be at least 16 bytes. Use a secure, randomly generated string.
Resetting the master key
If your master key is compromised, reset it by relaunching your instance with a new value:API keys
API keys grant access to a specific set of indexes, routes, and endpoints. You can configure them to expire after a certain date. Use the/keys route to create, configure, and delete API keys.
Use API keys for all API operations except API key management. This includes:
- Searching documents
- Adding and updating documents
- Configuring index settings
- Managing indexes
Default API keys
When you launch Meilisearch with a master key, four default API keys are automatically created:| Key | Purpose | Permissions |
|---|---|---|
| Default Search API Key | Frontend search queries | Search only, all indexes |
| Default Admin API Key | Backend operations | Full access except key management |
| Default Read-Only Admin API Key | Read-only access | Read-only access to all indexes, documents, and settings |
| Default Chat API Key | Frontend conversational search | Search and chat completions, all indexes |
- Use the Default Search API Key for client-side search
- Use the Default Admin API Key for server-side operations (do not expose on a public frontend)
- Use the Default Read-Only Admin API Key for read-only access to all indexes, documents, and settings (do not expose on a public frontend)
- Use the Default Chat API Key for conversational search (can be safely used from the frontend)
Creating custom API keys
Create custom API keys for more granular control:Best practices
- Never expose the master key in client-side code or public repositories
- Use API keys for all regular operations
- Limit API key permissions to only what’s needed
- Set expiration dates on API keys when appropriate
- Rotate keys regularly in production environments
Related resources
API keys reference
Full API documentation for key management
Security overview
Learn about Meilisearch security model