The connector only reads data. It never sends messages and never changes domains, lists, templates or suppressions.
Configuring Mailgun as a Source
In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the Mailgun option from the list of connectors. Click Next and you’ll be prompted to add your access.1. Add account access
In Mailgun, open Account settings and then API security. Create or copy a Private API key. If your account uses roles for API keys, a key with the Analyst (read-only) role reads most tables; the Users table may need a higher role. A Domain Sending key cannot read data. The following configurations are available:- Private API Key: Your Mailgun Private API key.
- Region: The region your Mailgun account and domains were created in: US or EU. You can see it in the Mailgun dashboard; EU accounts use
api.eu.mailgun.net. - Start Date: Events and daily metrics are read from this date on. Mailgun keeps event logs for 30 days at most (less on some plans) and daily metrics for one year, so an older date only brings what Mailgun still keeps. The other tables are read in full on every sync.
- Domains (advanced): The sending domains to sync, separated by commas, exactly as listed in Mailgun (for example
mg.example.com). Leave it empty to sync every domain of your account. The events and metrics are filtered to these domains too.
2. Select streams
Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.Tip: The stream can be found more easily by typing its name.Select the streams and click Next.
3. Configure data streams
Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.- Layer: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
- Folder: a folder can be created inside the selected layer to group all tables being created from this new data source.
- Table name: we suggest a name, but feel free to customize it. You have the option to add a prefix to all tables at once and make this process faster!
- Sync Type: you can choose between INCREMENTAL and FULL_TABLE.
- Incremental: every time the extraction happens, we’ll get only the new data, which is good if, for example, you want to keep every record ever fetched.
- Full table: every time the extraction happens, we’ll get the current state of the data, which is good if, for example, you don’t want to have deleted data in your catalog.
4. Configure data source
Describe your data source for easy identification within your organization, not exceeding 140 characters. To define your Trigger, consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times). Because Mailgun keeps events for a limited time, sync at least once a week (daily is recommended) so no event expires before it is read. Optionally, you can define some additional settings:- Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource here.
- Determine when to execute an Additional Full Sync. Do not use it for Events, Daily Metrics or Daily Tag Metrics (see the warning above).
5. Check your new source
You can view your new source on the Sources page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.Good to know
- Dates are in UTC.
- The first load of Events can be long. On accounts that send a lot, the first sync reads up to 30 days of events and is only saved when it completes; the sync log tells you when it may take an hour or more. A later Start Date makes it shorter. Later syncs save their progress day by day.
- Shorter event retention. If your plan keeps event logs for fewer than 30 days, the first sync of Events starts from the period Mailgun still keeps and the log says which older events are no longer available. Later syncs run normally.
- Recent events arrive with the next sync. Mailgun records events out of order and considers the last half hour not final, so each sync reads events up to 30 minutes before it started, and starts one hour before the last event read to catch late ones.
- Today’s metrics are partial. Daily metrics of the current day are updated by the next syncs, which read the last three days again.
- Only your main account is read. Data of subaccounts (their domains, events and metrics) is not included; the Subaccounts table lists them.
- Nested values are JSON text. Columns such as
delivery_status,message,client_infoorvarshold the original JSON. - The SMTP password and API keys are never loaded.
Streams and Fields
Available streams
The table below lists every stream, its slug (the exact identifier to pass when creating the source via API) and a short description.Fields by stream
Domains
Domains
Primary key:
name · Sync: Full tablename- Fully qualified domain name registered with Mailgunid- Unique identifier of the domainstate- Verification state of the domain (active, unverified or disabled)type- Classification of the domain: custom or sandboxcreated_at- Date and time the domain was created (UTC)is_disabled- Whether the domain is currently disableddisabled- Why and until when the domain is disabled (JSON object with code, note, permanently, reason, until), when it isrequire_tls- Whether Mailgun only sends messages of this domain over a TLS connectionskip_verification- Whether Mailgun skips certificate and hostname verification on TLS connectionssmtp_login- SMTP login of the domain, when one was set (the password is never loaded)spam_action- Action taken when a message is flagged as spam: disabled, tag or blocksubaccount_id- ID of the subaccount the domain belongs to, when it belongs to onetracking_host- Custom tracking host used for open and click tracking, when configureduse_automatic_sender_security- Whether Mailgun manages DKIM keys and DNS records automaticallywebhooks_redact_pii- Whether personal data is redacted from the webhooks posted for this domainweb_prefix- Subdomain prefix used for open and click trackingweb_scheme- Protocol scheme used for tracking (http or https)wildcard- Whether the domain can receive email for any subdomainencrypt_incoming_message- Whether incoming messages to this domain are encryptedmessage_ttl- Time-to-live in seconds for retrieving incoming and outgoing messagesarchive_to- URL a copy of each delivered message is posted to, when configured
Domain Tracking
Domain Tracking
Primary key:
domain · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toopen_active- Whether open tracking is enabledopen_place_at_the_top- Whether the open tracking pixel is placed at the top of the emailclick_active- Whether click tracking is enabledunsubscribe_active- Whether unsubscribe tracking is enabledunsubscribe_html_footer- HTML footer added for the unsubscribe linkunsubscribe_text_footer- Text footer added for the unsubscribe linkweb_scheme- Web scheme used by the tracking links (http or https)
Domain Webhooks
Domain Webhooks
Primary key:
domain, event_type · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toevent_type- Event that triggers the webhook (accepted, delivered, opened, clicked, unsubscribed, complained, temporary_fail, permanent_fail)urls- URLs Mailgun posts the event to
Events
Events
Primary key:
id, timestamp · Sync: Incremental (by timestamp)id- Unique identifier of the eventtimestamp- Date and time the event happened (UTC), used as the incremental replication keyevent- Event type: accepted, delivered, failed, rejected, opened, clicked, unsubscribed, complained, stored, email_validation…log_level- Severity class of the event: info, warn or errorseverity- For failed events: temporary (will be retried) or permanentreason- Reason Mailgun gives for a failure or rejectionmethod- How the message was submitted (HTTP or SMTP)domain- Sending domain of the messagerecipient- Email address of the recipient the event refers torecipient_domain- Domain of the recipient’s email addressrecipient_provider- Inbox provider of the recipient, when known (e.g. Gmail)message_id- Message-ID header of the messagesubject- Subject of the messagemessage_from- From header of the messagemessage_to- To header of the messagemessage_size- Size of the message in bytesdelivery_status_code- SMTP status code received from the recipient’s server, for delivery and failure eventsdelivery_status_message- SMTP message received from the recipient’s serverdelivery_status_description- Description of the delivery statusbounce_type- Bounce classification of a failure, when Mailgun gives onedelivery_attempt_no- Delivery attempt number of the eventdelivery_session_seconds- Duration of the SMTP session with the recipient’s server, in secondstags- Tags set on the messageurl- Clicked URL, for click eventsip- IP address of the recipient that opened or clicked, for engagement eventsoriginating_ip- IP address the message was submitted fromapi_key_id- ID of the API key the message was sent withdelivered_at- When the message was delivered, as Mailgun reports it (delivery events)primary_dkim- Domain of the primary DKIM signature of the messagei_delivery_optimizer- Delivery optimizer applied to the message, when anyaccount_id- ID of the Mailgun account (or subaccount) the event belongs toparent_account_id- ID of the parent account, for subaccount eventsaccount- Account of the event (JSON object with id and parent-id)campaigns- Campaigns the message belongs to (JSON array of objects with id and name)user_variables- Custom variables attached to the message when it was sent (JSON)delivery_status- Full delivery status reported for the event (JSON object: code, message, attempt number, MX host, TLS…)envelope- SMTP envelope of the message (JSON object: sender, targets, transport, sending IP, IP pool)message- Message details (JSON object: headers, attachments, recipients, size, scheduled time)flags- Flags of the event (JSON object: authenticated, routed, test mode, delayed bounce…)geolocation- Location of the recipient for engagement events (JSON object: country, region, city, timezone)client_info- Client used by the recipient for engagement events (JSON object: client name, OS, device type, user agent, bot)storage- Where Mailgun stored the message, for stored and delivered events (JSON object: region, key, url)template- Template the message was rendered from (JSON object: name, version, is-text)routes- Inbound route that matched the message (JSON object)mailing_list- Mailing list the message was sent to (JSON object: address, list-id, sid)
Daily Metrics
Daily Metrics
Primary key:
domain, date · Sync: Incremental (by date)date- Day the metrics refer to (start of the day, UTC), used as the incremental replication keydomain- Sending domain the metrics refer toaccepted_incoming_count- Incoming messages accepted by Mailgunaccepted_outgoing_count- Outgoing messages accepted by Mailgunaccepted_count- Messages accepted by Mailgun (incoming and outgoing)delivered_smtp_count- Messages delivered over SMTPdelivered_http_count- Messages delivered over HTTP (to a webhook or route)delivered_optimized_count- Messages delivered by the delivery optimizerdelivered_count- Messages deliveredprocessed_count- Messages processedsent_count- Messages sentopened_count- Opens (every open counts)clicked_count- Clicks (every click counts)unique_opened_count- Unique opens (first open of each recipient)unique_clicked_count- Unique clicks (first click of each recipient)unsubscribed_count- Unsubscribescomplained_count- Spam complaintsfailed_count- Failed deliveries (temporary and permanent)temporary_failed_count- Temporary failures (will be retried)permanent_failed_count- Permanent failurestemporary_failed_esp_block_count- Temporary failures caused by an inbox provider blockpermanent_failed_esp_block_count- Permanent failures caused by an inbox provider blockwebhook_count- Webhook deliveriesrate_limit_count- Messages delayed by rate limitspermanent_failed_optimized_count- Permanent failures by the delivery optimizerpermanent_failed_old_count- Permanent failures because the message got too old to retrybounced_count- Bounces (hard and soft)hard_bounces_count- Hard bouncessoft_bounces_count- Soft bouncesdelayed_bounce_count- Delayed bouncessuppressed_bounces_count- Messages not sent because the recipient is on the bounce listsuppressed_unsubscribed_count- Messages not sent because the recipient is on the unsubscribe listsuppressed_complaints_count- Messages not sent because the recipient is on the complaint listdelivered_first_attempt_count- Messages delivered on the first attemptdelayed_first_attempt_count- Messages delayed on the first attemptdelivered_two_plus_attempts_count- Messages delivered after two or more attemptsdelivered_rate- Delivered rate (fraction of 1)opened_rate- Open rate (fraction of 1)clicked_rate- Click rate (fraction of 1)unique_opened_rate- Unique open rate (fraction of 1)unsubscribed_rate- Unsubscribe rate (fraction of 1)complained_rate- Complaint rate (fraction of 1)bounce_rate- Bounce rate (fraction of 1)permanent_fail_rate- Permanent failure rate (fraction of 1)temporary_fail_rate- Temporary failure rate (fraction of 1)delayed_rate- Delayed rate (fraction of 1)delayed_first_attempt_rate- Rate of messages delayed on the first attempt (fraction of 1)
Daily Tag Metrics
Daily Tag Metrics
Primary key:
tag, date · Sync: Incremental (by date)date- Day the metrics refer to (start of the day, UTC), used as the incremental replication keytag- Message tag the metrics refer toaccepted_incoming_count- Incoming messages accepted by Mailgunaccepted_outgoing_count- Outgoing messages accepted by Mailgunaccepted_count- Messages accepted by Mailgun (incoming and outgoing)delivered_smtp_count- Messages delivered over SMTPdelivered_http_count- Messages delivered over HTTP (to a webhook or route)delivered_optimized_count- Messages delivered by the delivery optimizerdelivered_count- Messages deliveredprocessed_count- Messages processedsent_count- Messages sentopened_count- Opens (every open counts)clicked_count- Clicks (every click counts)unique_opened_count- Unique opens (first open of each recipient)unique_clicked_count- Unique clicks (first click of each recipient)unsubscribed_count- Unsubscribescomplained_count- Spam complaintsfailed_count- Failed deliveries (temporary and permanent)temporary_failed_count- Temporary failures (will be retried)permanent_failed_count- Permanent failurestemporary_failed_esp_block_count- Temporary failures caused by an inbox provider blockpermanent_failed_esp_block_count- Permanent failures caused by an inbox provider blockwebhook_count- Webhook deliveriesrate_limit_count- Messages delayed by rate limitspermanent_failed_optimized_count- Permanent failures by the delivery optimizerpermanent_failed_old_count- Permanent failures because the message got too old to retrybounced_count- Bounces (hard and soft)hard_bounces_count- Hard bouncessoft_bounces_count- Soft bouncesdelayed_bounce_count- Delayed bouncessuppressed_bounces_count- Messages not sent because the recipient is on the bounce listsuppressed_unsubscribed_count- Messages not sent because the recipient is on the unsubscribe listsuppressed_complaints_count- Messages not sent because the recipient is on the complaint listdelivered_first_attempt_count- Messages delivered on the first attemptdelayed_first_attempt_count- Messages delayed on the first attemptdelivered_two_plus_attempts_count- Messages delivered after two or more attemptsdelivered_rate- Delivered rate (fraction of 1)opened_rate- Open rate (fraction of 1)clicked_rate- Click rate (fraction of 1)unique_opened_rate- Unique open rate (fraction of 1)unsubscribed_rate- Unsubscribe rate (fraction of 1)complained_rate- Complaint rate (fraction of 1)bounce_rate- Bounce rate (fraction of 1)permanent_fail_rate- Permanent failure rate (fraction of 1)temporary_fail_rate- Temporary failure rate (fraction of 1)delayed_rate- Delayed rate (fraction of 1)delayed_first_attempt_rate- Rate of messages delayed on the first attempt (fraction of 1)
Bounces
Bounces
Primary key:
domain, address · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toaddress- Email address that bouncedcode- SMTP error code of the bounceerror- SMTP error message of the bouncecreated_at- Date and time the address was added to the bounce list (UTC)
Unsubscribes
Unsubscribes
Primary key:
domain, address · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toaddress- Email address that unsubscribedtags- Tags the address unsubscribed from (a ’*’ means from every message of the domain)created_at- Date and time the address was added to the unsubscribe list (UTC)
Complaints
Complaints
Primary key:
domain, address · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toaddress- Email address that marked a message as spamcreated_at- Date and time the address was added to the complaint list (UTC)
Allowlist
Allowlist
Primary key:
domain, value · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs tovalue- The allowlisted email address or domaintype- Type of the entry: address or domainreason- Reason given when the entry was createdcreated_at- Date and time the entry was created (UTC)
Mailing Lists
Mailing Lists
Primary key:
address · Sync: Full tableaddress- Email address of the mailing list (its identifier)name- Name of the mailing listdescription- Description of the mailing listaccess_level- Who can post to the list: readonly, members or everyonereply_preference- Where replies go: list or sendercreated_at- Date and time the list was created (UTC)members_count- Number of members of the list when it was read
Mailing List Members
Mailing List Members
Primary key:
list_address, address · Sync: Full tablelist_address- Email address of the mailing list the member belongs toaddress- Email address of the membername- Name of the membersubscribed- Whether the member is subscribed to the listvars- Custom variables of the member (JSON object)
Templates
Templates
Primary key:
domain, name · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs toname- Name of the template (its identifier)id- Unique identifier of the templatedescription- Description of the templatecreated_at- Date and time the template was created (UTC)created_by- Who created the template
Template Versions
Template Versions
Primary key:
domain, template_name, tag · Sync: Full tabledomain- Name of the Mailgun sending domain the record belongs totemplate_name- Name of the template the version belongs totag- Tag of the version, unique within the templateid- Unique identifier of the versionactive- Whether this is the template’s active version (the one used when sending)engine- Rendering engine of the version (e.g. handlebars)comment- Comment of the versioncreated_at- Date and time the version was created (UTC)template- Content of the version (HTML or text), when Mailgun returns it in the listmjml- MJML source of the version, when it has oneheaders- Headers stored with the version (JSON object, header name to value)
Account Templates
Account Templates
Primary key:
name · Sync: Full tablename- Name of the template (its identifier)id- Unique identifier of the templatedescription- Description of the templatecreated_at- Date and time the template was created (UTC)created_by- Who created the template
Account Template Versions
Account Template Versions
Primary key:
template_name, tag · Sync: Full tabletemplate_name- Name of the template the version belongs totag- Tag of the version, unique within the templateid- Unique identifier of the versionactive- Whether this is the template’s active version (the one used when sending)engine- Rendering engine of the version (e.g. handlebars)comment- Comment of the versioncreated_at- Date and time the version was created (UTC)template- Content of the version (HTML or text), when Mailgun returns it in the listmjml- MJML source of the version, when it has oneheaders- Headers stored with the version (JSON object, header name to value)
Routes
Routes
Primary key:
id · Sync: Full tableid- Unique identifier of the routepriority- Priority of the route; smaller numbers are handled firstdescription- Description of the routeexpression- Filtering rule that selects the messages the route handlesactions- Actions executed when the expression matches (forward, store, stop)created_at- Date and time the route was created (UTC)
IPs
IPs
Primary key:
ip · Sync: Full tableip- The IP addressdedicated- Whether the IP is dedicated to the account (when Mailgun reports it)enabled- Whether the IP is enabled (when Mailgun reports it)is_on_warmup- Whether the IP is in a warm-up schedule (when Mailgun reports it)assignable_to_pool- Whether the IP can be assigned to a dedicated IP pool (only reported when the account has dedicated IP pools)
IP Pools
IP Pools
Primary key:
pool_id · Sync: Full tablepool_id- Unique identifier of the dedicated IP poolname- Short name of the pooldescription- Description of the poolips- IP addresses in the poolis_linked- Whether the pool is linked to any domainis_inherited- Whether the pool is inherited from the parent accountmetadata- Pool metadata (JSON object; assignments keyed by IP with the date each was linked)
Subaccounts
Subaccounts
Primary key:
id · Sync: Full tableid- Unique identifier of the subaccountname- Name of the subaccountstatus- Status of the subaccount: open, disabled or closedcreated_at- Date and time the subaccount was created (UTC)updated_at- Date and time the subaccount was last updated (UTC)features- Features enabled on the subaccount (JSON object)
Users
Users
Primary key:
id · Sync: Full tableid- Unique identifier of the username- Full name of the useremail- Email address of the userrole- Role of the user on the account (basic/analyst, billing, support, developer, admin)account_id- ID of the account the user belongs toactivated- Whether the user is activatedis_disabled- Whether the user is disabledis_master- Whether the user is the account ownertfa_enabled- Whether two-factor authentication is enabled for the usertfa_active- Whether two-factor authentication is active for the usertfa_created_at- Date and time two-factor authentication was activated (UTC)password_updated_at- Date and time the user’s password was last changed (UTC)migration_status- Status of the user’s migration to Sinch ID, when applicableemail_details- Parsed email address of the user (JSON object: address, is_valid, parts)preferences- User preferences (JSON object: time zone, time format, programming language)metadata- Optional metadata of the user (JSON object)
Account Webhooks
Account Webhooks
Primary key:
webhook_id · Sync: Full tablewebhook_id- Unique identifier of the webhookdescription- Description of the webhookurl- URL the events are posted toevent_types- Event types that trigger the webhookcreated_at- Date and time the webhook was created (UTC)exclude_subaccounts- Whether the webhook applies only to this account’s domains and not to its subaccounts’
Implementation notes
- Events come from the Mailgun Logs API (the older Events API is deprecated), read one day at a time and checked against the total Mailgun reports for each day.
- Daily Metrics and Daily Tag Metrics come from the Mailgun Metrics API (the older Stats API is deprecated). Rates are fractions of 1 (
0.83= 83%). - Snapshot tables (every table except Events and the daily metrics) are read in full before they are loaded, so a failed sync never leaves a partial table.
- Permissions: the API key must be a Private API key. Keys with roles: Analyst reads most tables; Users may need a higher role. Subaccounts, account-level templates, dedicated IP pools and account webhooks depend on your Mailgun plan.