Monitor with events
After this guide an agent can ask “what changed since I last looked?” instead of reading every report again, and know when to use a webhook instead.
Poll the log
Section titled “Poll the log”events_list returns events oldest first. Each has a seq, a number that only goes up within the workspace.
- First call:
{ "limit": 100 }. Withoutafteryou get the oldest events still kept. - Handle the items. Store
nextAfter. - Next call:
{ "after": <nextAfter>, "limit": 100 }. You get only what is newer. - When
itemsis empty,nextAfteris theafteryou sent. Wait and ask again.
| Fact | Value |
|---|---|
| Page size | At most 100 per call |
| Kept for | 30 days. Past that, an old after skips what was cleared. |
| What you see | Only events whose reading tool your key holds the scope for: a deposit needs wallet:read, a clip needs clips:read. |
| Order | By seq. A reader that has seen seq n has seen everything that will ever get a smaller number. |
| Budget | Reads are 600 per minute per key, so polling every 30 to 60 seconds is cheap. |
Use it for outcomes the agent is waiting on: campaign.activated, campaign.budget_added, approval.rejected, approval.expired, deposit.credited, clip.submitted. The types are in the Event reference.
Or receive them
Section titled “Or receive them”events_list |
Webhook | |
|---|---|---|
| Needs a public server | No | Yes, https on port 443 |
| Latency | Your polling interval | Seconds |
| Order | Strict by seq |
Not guaranteed |
| Duplicates | None | Possible: dedupe by id |
| If you are down | Read from your last nextAfter |
Retried over about 45 hours, then dead |
Use a webhook to be woken, and events_list to catch up after downtime. The id is the same in both.
Setup: Receive events. Signatures: Verify signatures.