Docs / Events and sinks

Polling for events

Read the event log on your schedule with an API key and a position cursor.

Overview

Datum records every announced event in a log. Your existing API key can read this log. Polling returns the same events and payloads as a destination, in their recorded order.

Polling suits these cases:

  • Your system cannot accept incoming requests or sits behind a firewall.
  • Your instance does not have event delivery enabled. The log remains complete.
  • Your nightly job, warehouse load, or script processes events in batches.
  • Your system needs to recover events after an outage.

Reading the log requires the read scope. A key that can read members can also read events.

Configure

Your existing API key can read events without additional setup.

curl -H "Authorization: Bearer $OCMGR_API_KEY" "$OCMGR_URL/v1/events?limit=100"

This request returns the newest events first. Pass each page’s nextCursor as cursor to request the next page. Stop when the response has no nextCursor.

Each event has a stable id. Use this ID to skip events that your consumer already processed. Use after for scheduled polling, as described below.

Enabling delivery later

Before webhook delivery has ever started, events remain pending without a failure reason. A successful service probe registers the delivery start time. Earlier events then become unpublished. Their lastError field explains why. Polling still returns these events.

An owner can explicitly send earlier events to destinations. See Send older history.

Basics

The first read

Start at position 0 with after:

curl "$OCMGR_URL/v1/events?after=0&limit=100" \
  -H "Authorization: Bearer $OCMGR_API_KEY"

The after parameter returns events in order, starting with the oldest. Each event has a position.

Pass each page’s nextCursor as after to request the next page. Stop when the response has no nextCursor.

Every read after that

Save the position of the last event you processed. Pass that position as after on your next request.

The response contains everything recorded after that position. It skips no events and repeats none, even when Datum records an event late.

Read the newest event to start polling from now:

curl "$OCMGR_URL/v1/events?limit=1" -H "Authorization: Bearer $OCMGR_API_KEY"

Use its position for subsequent requests.

What each event carries

Field Meaning
id The stable event ID for deduplication.
topic One of the catalogue topics.
payload The same body that a webhook subscriber receives.
position An opaque position in the log. Store it for subsequent requests. Do not construct positions.
occurredAt The time when the change happened.
publishedAt When the delivery service accepted the event; omitted before publication.
status The publishing status: pending, published, failed, or unpublished.
attempts How many times Datum has tried to publish the event to the delivery service.
lastError The reason for a publishing failure or an unpublished event. Present only when there is one.

The status field describes publishing to the delivery service. It does not confirm delivery to a destination. Polling returns every event regardless of its publishing status.

Filters and paging

Parameter Use
after Return events after this position, starting with the oldest. Use 0 for the beginning.
cursor Continue a page that lists newest events first, using its nextCursor. Do not combine with after.
topic Return one topic only.
status Return events with one publishing status.
since Filter events that occurred after this ISO 8601 instant. This parameter does not provide a polling cursor.
limit Default 50, maximum 500.

Without after, the log returns the newest events first. Recent events in Settings → Destinations uses this order.

From your terminal or agent

ocmgr events list --after 0 --limit 100 --json
ocmgr events list --topic member.merged --json

See list_events for every parameter.

FAQ

Do I need the events profile to poll?

No. Datum records every event whether or not you enable delivery. Polling returns the same log in either case.

Why does Datum reject my old poller's cursor after an upgrade?

The endpoint can reject cursors from older versions. A time filter cannot safely recover missing events. The since parameter compares occurrence times, so it can miss earlier events that Datum recorded after your last poll.

Read the complete log again with after=0. Skip events with IDs that you already processed. Save the new position cursor for subsequent requests.

Processing each ID once prevents duplicate actions during recovery.

Can I poll and use webhooks at the same time?

Yes. Polling reads the log without changing it. Destinations continue to receive events.

How long are events kept?

The log has no expiry. Erasure retains the person’s events but removes their payload data except IDs, times, and a redacted_at stamp.

eventsDeliverySince is the workspace’s automatic-delivery boundary. Earlier recorded events need an explicit publish with since; polling can still read them. A publish dry run includes already accepted events in alreadyPublished. The publication summary’s configured flag reports configuration, not a live reachability check.