Events & logs

Every state change a message goes through is recorded as an event.

Query history through the API or stream events in realtime via webhooks.

How far back the log reaches

Event history follows your plan’s data-retention window: 30 days on Free, 12 months on paid plans (the free workspace inside a paid organisation inherits the organisation’s 12 months). A since older than your window simply returns no earlier events — nothing errors. Suppression and unsubscribe records are kept indefinitely regardless of plan, and webhooks deliver every event in realtime if you want your own permanent archive. The same numbers are listed on the Limits page.

Need the log as a file instead of pages? Export events generates a full CSV of any window within retention — warehouse syncs, audits and data portability without a pagination loop.

GET /v3/events

Query parameters

ParameterTypeRequiredDescription
eventstringOptionalFilter by type: queued, sent, delivered, opened, clicked, bounced, complained, unsubscribed, resubscribed, delayed, rejected, failed, duplicate (an Idempotency-Key replay recorded on the original message).
recipientstringOptionalFilter by recipient address (exact match).
tagstringOptionalOnly return events carrying this tag (event or parent message).
message_idstringOptionalAll events for a single message.
domainstringOptionalOnly events of messages sent FROM this domain (the From address domain). Case-insensitive, exact match — shop.example.com does not include mail.shop.example.com. A domain you have not sent from simply returns no events; a value that is not a hostname is rejected with 400. Combines with all other filters.
metadata[key]stringOptionalMetadata search: metadata[order_id]=1234 matches events whose message carries that metadata key/value (attached at send). Up to 3 filters per request; keys ≤64 chars (letters, digits, dot, dash, underscore), values ≤200 chars, exact match. Combines with all other filters.
sinceISO-8601OptionalOnly events at or after this timestamp.
untilISO-8601OptionalOnly events at or before this timestamp.
limitintegerOptionalPage size, 1–300. Default 25.
cursorstringOptionalPass the next_cursor from a previous response to fetch the next page.

Cursor pagination

Results are ordered newest-first and paginated with an opaque keyset cursor rather than page numbers, so pages stay stable while new events stream in. Each response returns items, has_more, next_cursor (or null on the last page) and total_count (the total matching the filters, independent of the cursor). Keep requesting with cursor=next_cursor until has_more is false.

Retention

Events follow your plan’s data retention: 30 days on Free, 12 months on paid plans. The same window applies to webhook delivery history — if a webhook consumer missed events, you don’t need to re-derive them from this feed: resend the deliveries themselves (up to 90 days back) and your endpoint receives the original payloads again.

Responses

StatusDescription
200OK. A cursor-paginated page of events with items, has_more, next_cursor and total_count.
400Invalid query parameters.
401Missing or invalid API key.

Code examples

cURL
curl -G https://api.wemail.io/v3/events \
  -H "Authorization: Bearer afn_live_…" \
  --data-urlencode "tag=welcome" \
  --data-urlencode "event=delivered" \
  --data-urlencode "since=2026-05-01"
Node.js
import { WemailClient } from "@wemailio/sdk";
const wemail = new WemailClient(process.env.WEMAIL_API_KEY);

const page = await wemail.events.listEvents({
  tag: "welcome",
  event: "delivered",
  since: new Date("2026-05-01T00:00:00Z"),
});
for (const e of page.items) console.log(e.recipient, e.timestamp);
// next page: pass page.nextCursor as { cursor } while page.hasMore
Python
import os
from datetime import datetime, timezone
from wemail import WemailClient

wemail = WemailClient(api_key=os.environ["WEMAIL_API_KEY"])

page = wemail.events.list_events(
    tag="welcome",
    event="delivered",
    since=datetime(2026, 5, 1, tzinfo=timezone.utc),
)
for e in page.items:
    print(e.recipient, e.timestamp)
PHP
<?php
$wemail = new \Wemail\WemailClient(getenv('WEMAIL_API_KEY'));
// listEvents($event, $recipient, $tag, $message_id, $since, $until, $limit, $cursor)
$page = $wemail->events()->listEvents('delivered', null, 'welcome', null, '2026-05-01T00:00:00Z');
foreach ($page->getItems() as $e) {
    echo $e->getRecipient(), ' ', $e->getTimestamp()->format('c'), PHP_EOL;
}
Ruby
wemail = Wemail::Client.new(api_key: ENV["WEMAIL_API_KEY"])
page = wemail.events.list_events(tag: "welcome", event: "delivered", since: "2026-05-01T00:00:00Z")
page.items.each { |e| puts "#{e.recipient} #{e.timestamp}" }
Go
client, _ := wemail.NewClient(os.Getenv("WEMAIL_API_KEY"))
// Generated layer (client.API.*): pass the key in the context.
ctx := context.WithValue(context.Background(), wemail.ContextAccessToken, os.Getenv("WEMAIL_API_KEY"))
since, _ := time.Parse(time.RFC3339, "2026-05-01T00:00:00Z")
page, _, err := client.API.EventsAPI.ListEvents(ctx).
    Tag("welcome").Event("delivered").Since(since).Execute()
for _, e := range page.Items {
    fmt.Println(e.GetRecipient(), e.Timestamp)
}
Java
WemailClient wemail = new WemailClient(System.getenv("WEMAIL_API_KEY"));
// listEvents(event, recipient, tag, messageId, since, until, limit, cursor, metadata)
EventListPage page = wemail.events().listEvents("delivered", null, "welcome", null,
    OffsetDateTime.parse("2026-05-01T00:00:00Z"), null, null, null, null);
for (Event e : page.getItems()) System.out.println(e.getRecipient() + " " + e.getTimestamp());
.NET
var wemail = new WemailClient(Environment.GetEnvironmentVariable("WEMAIL_API_KEY"));
var page = await wemail.Events.ListEventsAsync(
  varEvent: "delivered", tag: "welcome", since: DateTime.Parse("2026-05-01T00:00:00Z").ToUniversalTime());
foreach (var e in page.Items) Console.WriteLine(
quot;{e.Recipient} {e.Timestamp}");
ResponseExample response
{
  "items": [
    {
      "id": "evt_01HBYE7Q…",
      "type": "delivered",
      "message_id": "msg_01HBYE7K9Z4PMQDR3W",
      "recipient": "alex@example.com",
      "timestamp": "2026-05-10T09:42:21.000Z",
      "tags": ["welcome", "v2"],
      "metadata": null,
      "created_at": "2026-05-10T09:42:21.412Z"
    }
  ],
  "has_more": true,
  "next_cursor": "2026-05-10T09:42:21.000Z|evt_01HBYE7Q…",
  "total_count": 1842
}