This guide walks you through creating your first monitor and webhook using the PageCrawl API. By the end, you will have a page being monitored with change notifications delivered to your endpoint.
API access requires a paid plan (Standard or above). Get your API token from Settings > API.
Step 1: Get Your API Token
Go to Settings > API > API Tokens and click Create Token. Copy the token immediately (it will not be shown again).
All API requests use this token in the Authorization header:
Authorization: Bearer YOUR_API_TOKENFor the full API reference with all endpoints and schemas, visit pagecrawl.io/developers.
Step 2: Create a Monitor
The simplest way to start monitoring is the /api/track-simple endpoint. It only requires a URL.
curl
curl -X POST "https://pagecrawl.io/api/track-simple" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/pricing",
"tracking_mode": "fullpage",
"frequency": 60
}'Python
import requests
response = requests.post(
"https://pagecrawl.io/api/track-simple",
headers={"Authorization": "Bearer YOUR_API_TOKEN"},
json={
"url": "https://example.com/pricing",
"tracking_mode": "fullpage",
"frequency": 60,
},
)
page = response.json()
print(f"Monitoring: {page['name']} (ID: {page['id']})")Node.js
const response = await fetch("https://pagecrawl.io/api/track-simple", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://example.com/pricing",
tracking_mode: "fullpage",
frequency: 60,
}),
});
const page = await response.json();
console.log(`Monitoring: ${page.name} (ID: ${page.id})`);Tracking modes:
fullpage- all visible text (default)content_only- text without navigation, headers, footersreader- reader mode content onlyprice- auto-detect and track pricesspecific_text- specific element (requiresselector)specific_number- numeric value from element (requiresselector)
Frequency is in minutes. Use 1440 for daily, 60 for hourly, 15 for every 15 minutes (depends on your plan).
Step 3: Set Up a Webhook
Create a webhook to receive notifications when changes are detected.
curl
curl -X POST "https://pagecrawl.io/api/hooks" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_url": "https://your-server.com/webhook",
"match_type": "all",
"events": ["change_detected"]
}'Python
response = requests.post(
"https://pagecrawl.io/api/hooks",
headers={"Authorization": "Bearer YOUR_API_TOKEN"},
json={
"target_url": "https://your-server.com/webhook",
"match_type": "all",
"events": ["change_detected"],
},
)
hook = response.json()
print(f"Webhook created (ID: {hook['id']})")Match types: all (every page), monitors (specific pages), tags (by tag), folders (by folder), domains (by domain).
Events: change_detected, error, price_change_detected.
Step 4: Handle Webhook Payloads
When a change is detected, PageCrawl POSTs a JSON payload to your webhook URL. Here is an example handler:
Python (Flask)
from flask import Flask, request
app = Flask(__name__)
@app.route("/webhook", methods=["POST"])
def handle_change():
data = request.json
print(f"Change detected: {data['title']}")
print(f"New content: {data['contents']}")
print(f"Difference: {data['human_difference']}")
if data.get("ai_summary"):
print(f"AI Summary: {data['ai_summary']}")
return "", 200Node.js (Express)
app.post("/webhook", (req, res) => {
const data = req.body;
console.log(`Change detected: ${data.title}`);
console.log(`New content: ${data.contents}`);
console.log(`Difference: ${data.human_difference}`);
if (data.ai_summary) {
console.log(`AI Summary: ${data.ai_summary}`);
}
res.sendStatus(200);
});Key payload fields:
title- Page namecontents- Current value of the tracked elementdifference- Text difference percentage (0-100)human_difference- Human-readable change descriptionai_summary- AI-generated plain-language summary of the changeai_priority_score- 0-100 importance scoremarkdown_difference- Change diff in markdown formatpage_screenshot_image- Signed URL to the page screenshot
You can customize which fields are included when creating the webhook via the payload_fields parameter.
Other Useful Endpoints
| Endpoint | Description |
|---|---|
GET /api/pages |
List all monitored pages |
GET /api/pages/{id} |
Get page details and latest values |
PUT /api/pages/{id} |
Update page settings |
DELETE /api/pages/{id} |
Delete a page |
PUT /api/pages/{id}/check |
Trigger an immediate check |
PUT /api/pages/{id}/status |
Enable or disable monitoring |
GET /api/pages/{id}/history |
Get full check history |
GET /api/pages/{id}/checks/{checkId}/diff.markdown |
Get text diff as markdown |
Download the OpenAPI Spec
The full API specification is available as an OpenAPI 3.0 YAML file. Import it into Postman, Insomnia, or any API client:
https://pagecrawl.io/api/openapi.yaml