Skip to content

Events

Mailgun keeps track of every inbound and outbound message event and stores this data for at least 3 days.

WARNING: This API is deprecated in favor of our Logs API.

Retrieves a paginated list of events

Request

Mailgun tracks every inbound and outbound message event and retains this data for at least 3 days. See Filter expression for details about filtering expressions

Security
basicAuth
Path
domain_namestringrequired

Filter by sending domain

Query
beginstring

The beginning of the search time range in epoch seconds

endstring

The end of the search time range in epoch seconds

ascendingstring

Sort direction by time. Must be provided if the range end time is not specified. Can be either yes or no

Enum ValueDescription
yes

Sort by ascending time

no

Do not sort

limitinteger, <= 300

The number of entries to return (300 max)

eventstring

Filter by event type

liststring

Filter by mailing list email address that message was originally sent to

attachmentstring

Filter by the name of an attached file

fromstring

Filter by email address mentioned in the From MIME header

message-idstring

Filter by Mailgun message id returned by the messages API

subjectstring

Filter by subject line

tostring

Filter by email address mentioned in the To MIME header

sizestring

Filter by message size. Mostly intended to be used with range filtering expressions

recipientstring

Filter by email address of a recipient. While messages are addressable to one or more recipients, each event (with one exception) tracks one recipient. See stored events for use of recipients

recipientsstring

Specific to stored events, this field tracks all of the potential message recipients.

tagsstring

Filter by user defined tags

severitystring(EventSeverityType)

Filter by event severity, if exists. Currently for failed events only. See Tracking Failures

Enum ValueDescription
temporary

Mailgun could not deliver the email to the recipient email server, but will retry

permanent

Mailgun could not deliver the email to the recipient email server, and will drop the message without retrying sending.

curl -i -X GET \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v3/{domain_name}/events?begin=string&end=string&ascending=yes&limit=300&event=string&list=string&attachment=string&from=string&message-id=string&subject=string&to=string&size=string&recipient=string&recipients=string&tags=string&severity=temporary'

Responses

OK

Bodyapplication/json
itemsArray of objects(EventResponse)
pagingobject
Response
{ "items": [ {} ], "paging": { "next": "https://api.mailgun.net/v3/samples.mailgun.org/events/W3siY...", "previous": "https://api.mailgun.net/v3/samples.mailgun.org/events/Lkawm..." } }