Authentication
MoMail uses API keys to authenticate requests. You can create and manage API keys from your dashboard.
API Key Authentication
Section titled “API Key Authentication”All API requests must include your API key in the X-API-Key header. API keys are tied to your account and determine your rate limits and access permissions.
X-API-Key: mk_xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxCreating an API Key
Section titled “Creating an API Key”- Log in to your MoMail Dashboard
- Navigate to Settings > API Keys
- Click Create New Key
- Enter a descriptive name
- Optionally set an expiration date
- Copy the key immediately
API Key Format
Section titled “API Key Format”MoMail API keys follow this format:
mk_{prefix}_{secret}mk_— Fixed prefix identifying MoMail keys{prefix}— 8-character identifier shown in the dashboard{secret}— 24-character secret (only shown once)
Example: mk_a1b2c3d4_e5f6g7h8i9j0k1l2m3n4o5p6
Using API Keys
Section titled “Using API Keys”curl -X GET https://api.momail.io/v1/domains \ -H "X-API-Key: mk_a1b2c3d4_e5f6g7h8i9j0k1l2m3n4o5p6"const response = await fetch('https://api.momail.io/v1/domains', { headers: { 'X-API-Key': 'mk_a1b2c3d4_e5f6g7h8i9j0k1l2m3n4o5p6' }});import requests
response = requests.get( 'https://api.momail.io/v1/domains', headers={'X-API-Key': 'mk_a1b2c3d4_e5f6g7h8i9j0k1l2m3n4o5p6'})Security Best Practices
Section titled “Security Best Practices”- Never expose API keys in client-side code — Use environment variables or secure key management
- Rotate keys regularly — Set expiration dates and create new keys periodically
- Use separate keys for different environments — Create distinct keys for development, staging, and production
- Revoke unused keys — Delete keys that are no longer needed
Revoking an API Key
Section titled “Revoking an API Key”To revoke an API key:
- Go to Settings > API Keys in your dashboard
- Find the key you want to revoke
- Click Delete
- Confirm the deletion
Once revoked, the key will immediately stop working and cannot be restored.
Authentication Errors
Section titled “Authentication Errors”If your API key is missing, invalid, or expired, you will receive a 401 Unauthorized response:
{ "success": false, "error": { "code": "UNAUTHORIZED", "message": "Invalid or missing API key" }}See Error Codes for a complete list of authentication errors.