id. To make one, see Create a monitor.
Choose how to read
Poll for new results
Polling needs one piece of state: theid of the newest result you’ve already read. Results come newest first, so each poll reads until it reaches that id. This sample keeps the id in last_seen.txt, reads only results with importance 4 or higher, and prints the new ones oldest first:
id. Each later poll prints only what arrived since, one line per result:
Example output · results vary
last_seen.txt as it was.
Page through results
Every list in the Monitors API returnsdata, has_more and next_cursor. To get the next page, pass next_cursor as cursor. The last id on a page is its next_cursor. These parameters apply to List results:
Use the same
min_importance on every poll. A saved id from an unfiltered poll may not appear in a filtered one, and the poll then reads back through all 500 results.
Read the results of a run
If the monitor has a schedule, each run holds the results found since the previous run. This request returns the latest run:data. Its status is queued, running, completed, failed or cancelled. Its results is a list when the run completed, [] if it found nothing new, and null before it completes. A run returns at most the monitor’s search.max_results, and the results past that limit stay in List results.
To get a digest now instead of at the next scheduled time, call Run a monitor now. It returns a run with status queued. Read it a few seconds later with Get a run.
Read results from the CLI
With the CLI installed andkeenable login done, this command prints a monitor’s important results in a readable view:
More: add --cursor <id>.
Common mistakes
API reference
- List results: every parameter and result field.
- List runs and Get a run: a run’s
results,outputanderror. - Result fields:
summary,importance,same_storyand the rest. - Webhook payload: the same result fields, pushed to your endpoint.