Mailgun
Mailgun is a transactional email API service for sending, receiving, and tracking emails at scale. It provides REST endpoints for domain management, event and analytics tracking, suppression list management, and message delivery, letting you integrate email operations into your data flows.
Power end-to-end data operations for your Mailgun API with Nexla. Our bi-directional Mailgun connector is purpose-built for Mailgun, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Mailgun or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Mailgun workflows fast, secure, and fully governed.
Features
Type: API
- Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
- Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
- API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
- Request optimization with intelligent batching, retry, and caching to minimize API calls and costs
Prerequisites
Before creating a Mailgun credential, you need a Mailgun account and your account's private API key. Mailgun authenticates every API request using HTTP Basic Auth, where the username is api and the password is your private API key.
To obtain your Mailgun API key, follow these steps:
-
Sign in to your Mailgun account at app.mailgun.com.
-
Click your account menu in the upper-right corner and select API Keys, or navigate to Account Settings > API Keys.
-
Locate the Private API key and click the eye icon to reveal it, then copy the key and store it securely. The private key grants access to account and domain operations, so it should be kept confidential.
-
Determine the correct base URL for your account region. Use
https://api.mailgun.netif your account is hosted in the US region, orhttps://api.eu.mailgun.netif your account is hosted in the EU region. Your account region is shown in your Mailgun dashboard.
Mailgun issues two categories of keys: account API keys, which can view and modify most aspects of your account and domains, and domain sending keys, which are limited to sending messages for a single domain. The connector uses HTTP Basic Auth for all endpoints, so an account API key is required for management and reporting endpoints.
For complete information about API keys, authentication, and base URLs, see the Mailgun Authentication documentation.
Authenticate
Credentials required
HTTP Basic Authentication using your Mailgun API key. The API key is passed as the username; password is left empty.
| Field | Required | Secret | Description |
|---|---|---|---|
| Username Or API Key | Yes | Yes | Your username or personal API Key |
| Password | Yes | Yes | Your password |
| Base URL | Yes | No | The base URL for the Mailgun API. Use https://api.mailgun.net for US region or https://api.eu.mailgun.net for EU region. |
Create a credential in Nexla
-
After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.
-
Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.
-
Enter your Mailgun API credentials in the Username Or API Key and Password fields. Following Mailgun's HTTP Basic Auth scheme, enter
apias the username and your private API key as the password. Both values are stored securely and used to authenticate all requests to the Mailgun API. -
Enter the Base URL for your account region. Use
https://api.mailgun.netfor the US region orhttps://api.eu.mailgun.netfor the EU region. This URL is used as the prefix for all endpoint requests. -
Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.
Use as a data source
To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Mailgun connector tile, then select the credential that will be used to connect to Mailgun, and click Next; or, create a new Mailgun credential for use in this flow.
Endpoint templates
Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Mailgun endpoints. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below.
Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.
Manual configuration
Mailgun data sources can also be manually configured to ingest data from any valid Mailgun API endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.
Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Mailgun data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.
Use as a destination
Click the + icon on the Nexset that will be sent to the Mailgun destination, and select the Send to Destination option from the menu. Select the Mailgun connector from the list of available destination connectors, then select the credential that will be used to connect to Mailgun, and click Next; or, create a new Mailgun credential for use in this flow.
Endpoint templates
Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common Mailgun endpoints. Select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.
Manual configuration
Mailgun destinations can also be manually configured to send data to any valid Mailgun API endpoint. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, data format, endpoint URL, request headers, attribute exclusions, record batching, and response webhooks.
Mailgun APIs expect specific field formats for each operation. Ensure the records in your Nexset include all fields required by the target endpoint, such as recipient, sender, and message content for message sending.
Save & activate
Once all endpoint settings have been configured, click the Done button in the upper right corner of the screen to save and create the destination. To send the data to the configured Mailgun endpoint, open the destination resource menu, and select Activate.
The Nexset data will not be sent to the Mailgun endpoint until the destination is activated. Destinations can be activated immediately or at a later time, providing full control over data movement.