API Keys
The Middlewr API uses API keys for authentication. Every request must include a valid API key in theAuthorization header as a Bearer token.
There are two types of API keys:
User API Keys
User API Keys are scoped to your user account. They grant access to all workspaces you are a member of, using your own permissions in each workspace.- Created from your account settings in the dashboard
- Inherit your role and permissions in each workspace
- Ideal for personal scripts, CLI tools, or development
Workspace API Keys
Workspace API Keys are scoped to a specific workspace. They can only access resources within that workspace.- Created from the workspace settings page in the dashboard
- Limited to a single workspace
- Ideal for integrations, CI/CD pipelines, or third-party services that only need access to one workspace
Creating API Keys
1
Navigate to settings
For User API Keys, go to Account Settings > API Keys.For Workspace API Keys, go to Workspace Settings > API Keys.
2
Create a new key
Click Create API Key, give it a descriptive name, and click Create.
3
Copy your key
Copy the API key immediately. For security, the full key is only shown once and cannot be retrieved later.
Using Your API Key
Include the API key in theAuthorization header of every request:
Example Request
Security Best Practices
- Use environment variables to store API keys in your applications
- Use Workspace API Keys when possible to limit the blast radius of a compromised key
- Rotate keys regularly and revoke any keys that are no longer in use
- Use descriptive names for your keys so you can easily identify and manage them