Base URLs
Mailgun supports both US and EU regions. Use the appropriate base URL depending on where your domain is hosted:
Service | US Endpoint | EU Endpoint |
---|---|---|
REST API | api.mailgun.net | api.eu.mailgun.net |
Authentication
Authentication is handled via HTTP Basic Auth. Here's how it works:
Username: api
Password: Your API Key
How to Obtain an API Key
Log in to your Mailgun Dashboard.
Navigate to Account Settings > API Keys.
Copy your Private API Key. Keep it secure, as it won’t be displayed again.
Example: Authentication with cURL
curl --user 'api:YOUR_API_KEY'
Example: Submitting an Accessibility Test**
Send a POST request with the HTML content of your email for accessibility analysis.
curl --user 'api:YOUR_API_KEY' \
-X POST https://api.mailgun.net/v1/inspect/accessibility \
-H "Content-Type: application/json" \
-d '{
"html": "<html>Your email HTML content here</html>",
"encoded": false
}'