API Keys
Migma.ai uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure! Do not share your API keys in publicly accessible areas such as GitHub, client-side code, etc.Creating an API Key
1
Navigate to Settings
Log in to migma.ai and go to Settings → Developers → API Keys
2
Create New Key
Click Create API Key in the API Keys tab
3
Configure Permissions
Give your key a name and select the permissions it needs
4
Save Securely
Copy the key immediately - it won’t be shown again!
Using Your API Key
Include your API key in theAuthorization header of every request:
Example Request
Node.js SDK
cURL
JavaScript
Python
API Key Permissions
When creating an API key, you can grant specific permissions to limit what the key can access.Audience Permissions
Environment-Specific Keys
Use different API keys for different environments:Development
Production
Test keys start with
sk_test_ and production keys start with sk_live_Security best practices
- Never hardcode keys — use environment variables:
const migma = new Migma(process.env.MIGMA_API_KEY) - Least privilege — only grant the permissions your integration actually needs
- Rotate periodically — create a new key, update your app, then revoke the old one
- Monitor usage — check last-used dates in Settings → Developers → API Keys and revoke anything unexpected
Key Management
Viewing Your Keys
Navigate to Settings → Developers → API Keys to see:- Key name and ID (first 8 characters)
- Permissions granted
- Creation date
- Last used date
- Usage statistics
Revoking a Key
If a key is compromised or no longer needed:1
Find the Key
Go to Settings → Developers → API Keys
2
Delete
Click the delete icon next to the key
3
Confirm
Confirm the deletion - this action cannot be undone
Error Responses
401 Unauthorized
Your API key is invalid or missing:- API key not included in Authorization header
- Wrong format (must be
Bearer YOUR_KEY) - Key has been revoked
- Using test key in production environment
403 Forbidden
Your API key doesn’t have permission for this action:Rate Limiting
API keys are subject to rate limits based on your plan:
Rate limit headers are included in every response:
429 Too Many Requests response:
Need help?
Quickstart
Get started with your first API call
Node.js SDK
SDK handles authentication automatically
CLI
migma login to authenticate the CLIAPI Reference
Full endpoint documentation