Skip to main content
It is easy to miss parameter changes that break compatibility when you check vendor changelogs and documentation pages by hand. You can also waste time on layout changes that do not matter. The Monitor API gets the content at your target URLs on a schedule that runs on the server. It compares the normalized text with the saved baseline for each page. It uses your goal to filter changes and saves the diffs for substantive changes in the run history.

What you will build

The daily Page monitor checks the Perplexity API changelog, the pricing page, and the Agent API quickstart. It checks for API releases, deprecations, changes to prices, and updates to parameters or endpoints.
  • Create the monitor.
  • Poll the run history until the baseline run finishes.
  • Start a manual check.
  • Pause or delete the monitor when you finish.
This example uses three Page targets without a webhook. Use webhooks to receive change notifications without polling for results. You get the result of the first run as monitor.created only if you subscribe.
See the Page guide for the target options and how the monitor compares pages.

Prerequisites

Use a Perplexity API key. Install the Perplexity Python library (perplexityai>=0.47.0) or @perplexity-ai/perplexity_ai (>=0.42.0), or use curl and jq. Review Monitor API pricing before you start. API organizations that require zero data retention cannot create or resume monitors and cannot start manual runs.

Set up your API key

Set PERPLEXITY_API_KEY in your shell environment. The perplexityai and @perplexity-ai/perplexity_ai libraries read this variable automatically.

Create the monitor

When you create the monitor, the first run is due immediately. The Monitor API schedules daily checks until you pause or delete the monitor. The monitor saves a baseline for each URL the first time it gets the content at that URL. It does not report changes for that URL on that run. It compares the content with the baseline on later runs. See Understand the first run for details. To check different pages, replace name, targets, and goal.
Export the id that the create request returns. The next steps use this ID for your monitor.

Check the monitor’s status

Get the saved monitor. Check its configuration, status, last_run, and next_run_at. If a monitor pauses unexpectedly, check pause_reason. See Automatic pausing for details.

Read the findings

The first run starts asynchronously after you create the monitor. Poll the run history with a retry limit until the newest run has a status other than queued or running. Check target_errors to make sure the monitor got each page. Do this even if the run has a status of succeeded. The Monitor API keeps the run history for 90 days. See Run status and history for the run statuses and the history rules. See Set a relevance goal for how the monitor evaluates Page changes and gives them a score in confidence.
Later runs return differences relevant to your goal in changes. Each change has type: "page_change" and a unified diff of 24 KiB (24,576 UTF-8 bytes) or less. The truncated field shows if the monitor shortened the diff at a UTF-8 character boundary. See Read page changes for details.

Run a check now

After the first run finishes, you can request a manual check before the next scheduled check. The same Monitor API pricing applies to manual and scheduled runs that succeed. Perplexity does not charge for runs that fail or that the Monitor API skips.
  • If the Monitor API returns 202, get the run with the id in the response.
  • If the Monitor API returns 409 run_in_progress, get the run with the ID in error.current_run_id instead.
  • If the Monitor API returns 409 invalid_state, resume the monitor before you try again.

Pause when finished

Pause the monitor to stop scheduled checks. The monitor keeps its state and saved history. See Pause and resume for details.

Optionally delete it

When you delete the monitor, the Monitor API removes it, its run history, and its saved baselines. Export any findings you want to keep before you delete the monitor.

Limits

A Page monitor supports up to 10 different public HTTP or HTTPS URLs. You cannot mix Page targets with a Search target. Scheduled checks continue after your shell exits. Pause or delete the monitor when you finish.