API Key Authentication
The Moorcheh API uses API key authentication. You must include your API key in the request headers to access any endpoint.Getting Your API Key
1
Sign Up
Create a Moorcheh account at console.moorcheh.ai
2
Navigate to API Keys
Go to the API Keys section in your console
3
Generate Key
Generate a new API key or copy an existing one
4
Store Securely
Keep your API key secure and never share it publicly
Using Your API Key
Include your API key in thex-api-Key header with every request:
Security Best Practices
Store API keys securely
Store API keys securely
- Use environment variables instead of hardcoding
- Never commit API keys to version control
- Use secret management services in production
Rotate keys regularly
Rotate keys regularly
- Generate new API keys periodically
- Revoke old keys after rotation
- Monitor key usage in your console
Use different keys per environment
Use different keys per environment
- Separate keys for development, staging, and production
- Easier to track usage and debug issues
- Limit blast radius if a key is compromised
Revoke compromised keys immediately
Revoke compromised keys immediately
- If a key is exposed, revoke it in the console
- Generate a new key and update your applications
- Monitor for unauthorized usage
Authentication Errors
401 Unauthorized
Error Response:- Invalid or expired API key
- Missing
x-api-Keyheader - Incorrect header name (case-sensitive)
- API key has been revoked
- Verify your API key is correct
- Ensure you’re using
x-api-Key(note the capital K) - Check that the key hasn’t been disabled in the console
403 Forbidden
Error Response:- API key doesn’t have required permissions
- Account limits exceeded
- Check your account tier and limits
- Contact support if you need increased limits
Environment Variables
- Python
- Node.js
- .env File