Skip to main content

Mailgun

Prefer guided AI setup?

Instead of following these steps manually, you can use the AI Credential Assistant — describe what you want to connect and the AI will walk you through the setup step by step, tailored to your account.

Overview​

Connect your Mailgun account to Nirvai to automate email sending, manage campaigns, and track email delivery.

Supported Authentication Methods​

  • API Key - With region and domain configuration

Prerequisites​

  • A Mailgun account
  • A verified sending domain
  • API Key from Mailgun dashboard

Setup Instructions​

API Key Configuration​

  1. Log in to your Mailgun Dashboard
  2. Go to Settings > API Keys (or API Security)
  3. Copy your Private API key (or create a new one)
  4. Note your verified sending domain (e.g., mg.yourdomain.com)
  5. Identify your API region:
    • US Region: api.mailgun.net (default)
    • EU Region: api.eu.mailgun.net
  6. In Nirvai, enter:
    • API Key: Your Mailgun Private API key
    • API Region: Select US or EU based on your account
    • Email Sending Domain: Your verified domain

Creating an API Key​

If you need a new API key:

  1. Go to Settings > API Keys
  2. Click Create API Key
  3. Add a description (e.g., "Nirvai Integration")
  4. Select key type and permissions
  5. Copy the key immediately

Configuration Fields​

FieldDescriptionExample
API KeyMailgun Private API keykey-xxxxx...
API RegionUS or EU regionapi.mailgun.net
Email DomainVerified sending domainmg.yourdomain.com

Region Selection​

Your Mailgun account is tied to a specific region:

  • US Region: api.mailgun.net - Most common
  • EU Region: api.eu.mailgun.net - For EU data residency

Check your dashboard URL to identify your region:

  • US: app.mailgun.com
  • EU: app.eu.mailgun.com

Available Operations​

With Mailgun credentials, you can:

  • Send transactional emails
  • Manage mailing lists
  • Track email delivery
  • Handle bounces and complaints
  • Access sending statistics
  • Validate email addresses

Troubleshooting​

Common Issues​

  • 401 Unauthorized: API key is invalid. Double-check the key.
  • 403 Forbidden: Domain not verified or key lacks permissions.
  • Domain Error: Ensure you're using a verified sending domain.
  • Region Mismatch: Using US key with EU endpoint or vice versa.

Domain Verification​

Your sending domain must be verified:

  1. Go to Sending > Domains
  2. Select your domain
  3. Follow DNS verification steps
  4. Wait for verification (can take 24-48 hours)

Sandbox Domain​

For testing, Mailgun provides a sandbox domain:

  • Limited to 5 authorized recipients
  • Good for development and testing
  • Not suitable for production

Key Types​

Mailgun has different key types:

  • Private API Key: Full access (use this)
  • Domain Sending Key: Limited to specific domain
  • Validations API Key: Only for email validation

Adapted from n8n documentation for Nirvai platform


Next Steps​

Got your credential? Connect it to an agent

Use the AI Tool Creator to turn this credential into agent-callable tools. Describe what your agent should be able to do and the AI investigates the API, configures the endpoints, and gives you a reviewable toolkit before saving anything.