For the complete documentation index, see llms.txt. This page is also available as Markdown.

List email logs

Returns a paginated list of email logs (messages) for the account. Results are restricted to domains the authenticated token has access to. Invalid or unknown filters are ignored. Results are ordered by sent_at descending.

get
Authorizations
Api-TokenstringRequired

API token in Api-Token header

Query parameters
search_afterstring · uuidOptional

Cursor for the next page (message_id UUID from previous response next_page_cursor).

Responses
200

Success

application/json
total_countintegerRequired

Total number of messages matching the filters (before pagination).

next_page_cursorstring · uuid · nullableRequired

Message UUID to use as search_after for the next page. Null if no more pages.

get/api/email_logs
curl -X GET -g 'https://mailtrap.io/api/email_logs?filters[sent_after]=2025-01-01T00:00:00Z&filters[sent_before]=2025-01-31T23:59:59Z&filters[to][operator]=ci_equal&filters[to][value]=recipient@example.com&filters[domain_id][operator]=equal&filters[domain_id][value][]=3938&filters[domain_id][value][]=3939' \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "messages": [
    {
      "message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "status": "delivered",
      "subject": "Welcome to our service",
      "from": "sender@example.com",
      "to": "recipient@example.com",
      "sent_at": "2025-01-15T10:30:00Z",
      "client_ip": "203.0.113.42",
      "category": "Welcome Email",
      "custom_variables": {},
      "sending_stream": "transactional",
      "domain_id": 3938,
      "template_id": 100,
      "template_variables": {},
      "opens_count": 2,
      "clicks_count": 1
    },
    {
      "message_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "status": "delivered",
      "subject": "Your order confirmation",
      "from": "orders@example.com",
      "to": "customer@example.com",
      "sent_at": "2025-01-15T11:00:00Z",
      "client_ip": null,
      "category": "Order Confirmation",
      "custom_variables": {
        "order_id": "12345"
      },
      "sending_stream": "transactional",
      "domain_id": 3938,
      "template_id": null,
      "template_variables": {},
      "opens_count": 0,
      "clicks_count": 0
    }
  ],
  "total_count": 150,
  "next_page_cursor": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}

Last updated

Was this helpful?