Logs

Mailgun keeps track of every inbound and outbound message event and stores this log data. This data can be queried and filtered to provide insights into the health of your email infrastructure.

List logs

post/v1/analytics/logs

Gets customer event logs for an account

SecuritybasicAuth
Request
Request Body schema: application/json
required
start
string

The start date (default: 1 day before current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14

end
string

The end date (default: current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14

events
Array of strings

The set of events to include.

metric_events
Array of strings

Optional set of analytics metric events. Will be converted into corresponding events.

object

Filters to apply to the query.

include_subaccounts
boolean

Include logs from all subaccounts.

include_totals
boolean

Include total number of log entries.

Responses
200

A 200 response

Response Schema: application/json
start
required
string
end
required
string
required
Array of objects
required
object
object
400

A 400 response

Request samples
application/json
{
  • "start": "Mon, 08 Jul 2024 00:00:00 -0000",
  • "end": "Fri, 12 Jul 2024 00:00:00 -0000",
  • "filter": {
    • "AND": [
      ]
    },
  • "include_subaccounts": true
}
Response samples
application/json
{
  • "start": "Mon, 08 Jul 2024 00:00:00 -0000",
  • "end": "Fri, 12 Jul 2024 00:00:00 -0000",
  • "items": [
    • {
      }
    ],
  • "pagination": {
    • "previous": "cjsijbijewbu78t678tVTYUYU76754fyuiksi23h75",
    • "next": "cjsijbijewbu78t678tVTYUYU76754fyuiksin98hh",
    • "first": "cjsijbijewbu78t678tVTYUYU76754fyuiksin865g",
    • "last": "875bunjnWkmis75bjklnsdk0s7jksnjknlknc64aTR",
    • "total": 1000
    },
  • "aggregates": { }
}