Use the MailGun API to access the product’s features, such as sending E-Mails, webhooks, Email Validation etc.
Datatype | Description | Example |
---|---|---|
Datepicker | String which includes date and time | |
Map | String which includes latitude and longitude coma separated | |
List | Simple array | |
Select | String with predefined values | |
Array | Array of objects |
Sends an email.
Field | Type | Description |
---|---|---|
apiKey | Credentials | |
domain | String | |
from | String | |
to | List | |
cc | List | |
bcc | List | |
subject | String | |
text | String | |
html | String | |
inline | String | |
o:tag | List | |
o:campaign | String | |
o:dkim | Select | |
o:deliverytime | DatePicker | |
o:testmode | Select | |
o:tracking | Select | |
o:tracking-clicks | Select | |
o:tracking-opens | Select | |
o:require-tls | Boolean | |
o:skip-verification | Boolean | |
h:X-My-Header | String | |
v:my-var | JSON |
Posts a message in MIME format.
Field | Type | Description |
---|---|---|
apiKey | Credentials | |
domain | String | |
from | String | |
to | List | |
cc | List | |
bcc | List | |
subject | String | |
text | String | |
html | String | |
inline | String | |
o:tag | List | |
o:campaign | String | |
o:dkim | Select | |
o:deliverytime | DatePicker | |
o:testmode | Select | |
o:tracking | Select | |
o:tracking-clicks | Select | |
o:tracking-opens | Select | |
o:require-tls | Boolean | |
o:skip-verification | Boolean | |
h:X-My-Header | String | |
v:my-var | JSON |
Returns stored messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns accepted messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns rejected messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns delivered messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns failed messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns opened messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns clicked messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns unsubscribed messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns complained messages.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
begin | DatePicker | The beginning of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
end | DatePicker | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. |
ascending | Select | Defines the direction of the search time range and must be provided if the range end time is not specified. Can be either yes or no. |
limit | Number | Number of entries to return. (300 max) |
Returns total stats for a given domain.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Mailgun account contain email domain. |
event | String | The type of the event. |
start | DatePicker | The starting time. Should be in unix epoch format. |
end | DatePicker | The ending date. Should be in unix epoch format. |
resolution | Select | Can be either hour, day or month. Default: day |
duration | String | Period of time with resoluton encoded. Read more |
Returns a list of event stats items. Each record represents counts for one event per one day.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
limit | Number | Maximum number of records to return. (100 by default) |
skip | Number | Number of records to skip. |
event | String | Name of the event to receive the stats for. Note that you can specify this parameter multiple times to fetch stats for several events at the same time. |
startDate | String | The date to receive the stats starting from. Should have ISO8601 format (YYYY-MM-DD). |
Returns a list of tags for a domain. Provides with the pagination urls if the result set is to long to be returned in a single response.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
limit | Number | Maximum number of records to return. (100 by default) |
Returns info for a given tag.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
tag | String | Name of the tag. |
Updates a given tag with the information provided.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
tag | String | Name of the tag. |
description | String | Optional description of a tag. |
Returns statistics for a given tag.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
tag | String | Name of the tag. |
event | String | The type of the event. |
start | DatePicker | The starting time. Should be in unix epoch format. |
end | DatePicker | The ending date. Should be in unix epoch format. |
resolution | Select | Can be either hour, day or month. Default: day |
duration | String | Period of time with resoluton encoded. Read more |
Deletes the tag. The statistics for the tag are not destroyed.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
tag | String | Name of the tag. |
Paginate over a list of bounces for a domain.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
limit | Number | Maximum number of records to return (optional, default: 100, max: 10000) |
Fetch a single bounce event by a given email address. Useful to check if a given email address has bounced before.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
String | Email address |
Add a bounce record to the bounce list. Updates the existing record if the address is already there.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
code | String | Error code |
error | String | Error description (default: empty string) |
createdAt | String | Timestamp of a bounce event. |
Add multiple bounce records to the bounce list in a single API call.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
bounces | Array | Records to the bounce list. |
Clears a given bounce event. The delivery to the deleted email address resumes until it bounces again.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
Clears all bounced email addresses for a domain. Delivery to the deleted email addresses will no longer be suppressed.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
Paginate over a list of unsubscribes for a domain.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
limit | Number | Number of records to return (optional, default: 100, max: 10000). |
Fetch a single unsubscribe record. Can be used to check if a given address is present in the list of unsubscribed users.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
Add an address to the unsubscribe table.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
tag | String | Tag to unsubscribe from, use * to unsubscribe an address from all domain’s correspondence (optional, default: *) |
createdAt | String | Timestamp of a bounce event. |
Remove an address from the unsubscribes list. If tag parameter is not provided, completely removes an address from the list.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
tag | String | Specific tag to remove. |
Paginate over a list of complaints for a domain.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
limit | Number | Maximum number of records to return (optional, default: 100, max: 10000) |
Fetch a single spam complaint by a given email address. This is useful to check if a particular user has complained.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
Add an address to the complaints list.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
createdAt | String | Timestamp of a bounce event. |
Remove a given spam complaint.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
address | String | Valid email address |
Fetches the list of routes. Note that routes are defined globally, per account, not per domain as most of other API calls.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
limit | Number | Maximum number of records to return. (100 by default). |
skip | Number | Number of records to skip. (0 by default). |
Returns a single route object based on its ID.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
routeId | String | ID of the route. |
Creates a new route.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
priority | Number | Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0. |
description | String | An arbitrary string. |
expression | String | A filter expression like match_recipient(’.*@gmail.com’). |
action | String | Route action. This action is executed when the expression evaluates to True. Example: forward(‘alice@example.com’) |
Updates a given route by ID. All parameters are optional: this API call only updates the specified fields leaving others unchanged.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
routeId | String | ID of the route. |
priority | Number | Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0. |
description | String | An arbitrary string. |
expression | String | A filter expression like match_recipient(’.*@gmail.com’). |
action | String | Route action. This action is executed when the expression evaluates to True. Example: forward(‘alice@example.com’) |
Deletes a route based on the id.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
routeId | String | ID of the route. |
Returns a list of webhooks set for the specified domain.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
Returns details about a the webhook specified in the URL.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
webhookName | String | Name of the webhook. |
Creates a new webhook.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
id | String | Name of the webhook. |
url | String | URL for the webhook event. |
Updates an existing webhook.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
webhookName | String | Name of the webhook. |
id | String | Name of the webhook. |
url | String | URL for the webhook event. |
Deletes an existing webhook.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
domain | String | Name of the domain. |
webhookName | String | Name of the webhook. |
Paginate over mailing lists under your account.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
limit | Number | Maximum number of records to return (optional, default: 100, max: 10000) |
Returns a single mailing list by a given address.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | Valid email address |
Creates a new mailing list.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
name | String | Mailing list name, e.g. Developers. |
description | String | A description. |
accessLevel | String | List access level, one of: readonly (default), members, everyone |
Update mailing list properties, such as address, description or name
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net | |
address | String | New mailing list address, e.g. devs@mg.net |
name | String | Mailing list name, e.g. Developers. |
description | String | A description. |
accessLevel | String | List access level, one of: readonly (default), members, everyone |
Deletes a mailing list.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
Paginate over list members in the given mailing list
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
subscribed | Select | yes to lists subscribed, no for unsubscribed. list all if not set |
limit | Number | Maximum number of records to return (optional, default: 100, max: 10000) |
Retrieves a mailing list member.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
memberAddress | String | Member email-address |
Adds a member to the mailing list.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
name | String | Optional member name. |
vars | JSON | JSON-encoded dictionary string with arbitrary parameters, e.g. {‘gender’:‘female’,‘age’:27} |
subscribed | Select | yes to add as subscribed (default), no as unsubscribed |
upsert | Select | yes to update member if present, no to raise error in case of a duplicate member (default) |
Updates a mailing list member with given properties.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
memberAddress | String | Member email-address |
name | String | Optional member name. |
vars | JSON | JSON-encoded dictionary string with arbitrary parameters, e.g. {‘gender’:‘female’,‘age’:27} |
subscribed | Select | yes to add as subscribed (default), no as unsubscribed |
upsert | Select | yes to update member if present, no to raise error in case of a duplicate member (default) |
Delete a mailing list member.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | A valid email address for the mailing list, e.g. developers@mailgun.net, or Developers devs@mg.net |
memberAddress | String | Member email-address |
Given an arbitrary address, validates address based off defined checks.
Field | Type | Description |
---|---|---|
apiKey | Credentials | The api key obtained from MailGun. |
address | String | An email address to validate. (Maximum: 512 characters) |
mailboxVerification | Select | If set to true, a mailbox verification check will be performed against the address. |