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.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
SetPERPLEXITY_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, replacename, targets, and goal.
Response
Response
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 thanqueued 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.
Response
Response
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.Response
Response
- If the Monitor API returns
202, get the run with theidin the response. - If the Monitor API returns
409 run_in_progress, get the run with the ID inerror.current_run_idinstead. - 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.Response
Response
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.Response
Response
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.- See Monitor API limits for the quotas on requests and active monitors.
- See Manage monitors to update or resume a monitor.
- See Create a monitor for the full schema for requests and responses.