Skip to content

List logs

Request

Gets customer event logs for an account

Security
basicAuth or basicAuth
Bodyapplication/jsonrequired
startstring

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

endstring

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

durationstringrequired

A duration in the format of '1d' '2h'. If duration is provided then it is calculated from the end date and overwrites the start date.

eventsArray of strings

The set of events to include.

metric_eventsArray of strings

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

filterobject(github.com-mailgun-logs-api-pkg-api-model-FilterPredicateGroup)

Filters to apply to the query.

include_subaccountsboolean

Include logs from all subaccounts.

include_totalsboolean

Include total number of log entries.

paginationobject(github.com-mailgun-logs-api-pkg-api-model-Pagination)
curl -i -X POST \
  -u '<username>:<password>' \
  https://api.mailgun.net/v1/analytics/logs \
  -H 'Content-Type: application/json' \
  -d '{
    "start": "Mon, 08 Jul 2024 00:00:00 -0000",
    "end": "Fri, 12 Jul 2024 00:00:00 -0000",
    "filter": {
      "AND": [
        {
          "attribute": "domain",
          "comparator": "=",
          "values": [
            {
              "label": "example.com",
              "value": "example.com"
            }
          ]
        }
      ]
    },
    "include_subaccounts": true,
    "pagination": {
      "sort": "timestamp:asc",
      "token": "cjsijbijewbu78t678tVTYUYU76754fyuiksin865g",
      "limit": 50
    }
  }'

Responses

A 200 response

Bodyapplication/json
startstringrequired
endstringrequired
itemsArray of objects(github.com-mailgun-logs-api-pkg-api-model-LogEvent)required
paginationobject(github.com-mailgun-logs-api-pkg-api-model-PagingResponse)required
aggregatesobject(github.com-mailgun-logs-api-pkg-api-model-Aggregates)
Response
{ "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": 100 }, "aggregates": {} }