curl --request POST \
--url https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"mode": "web",
"id": "mon_123",
"name": "Acme pricing monitor",
"target": {
"type": "page",
"url": "https://acme.com/pricing",
"instructions": "Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.",
"normalize_whitespace": true
},
"change_detection": {
"type": "exact"
},
"schedule": {
"type": "interval",
"frequency": 6,
"unit": "hours"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"webhook": {
"url": "https://example.com/webhook",
"events": [
"change.detected",
"run.completed"
],
"retry": {
"delays_seconds": [
10,
60,
300,
1800,
7200,
21600,
57600
]
},
"secret": "whsec_8f3a…"
},
"last_run_at": "2023-11-07T05:31:56Z",
"last_change_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"last_error": {
"code": "fetch_failed",
"message": "The target URL could not be fetched."
},
"webhook_failure": {
"consecutive_failures": 3,
"last_status": "rejected",
"last_message": "Webhook endpoint returned HTTP 429.",
"last_failed_at": "2023-11-07T05:31:56Z"
},
"tags": [
"pricing",
"competitor"
],
"baseline": {
"text": "Acme Pricing\nStarter $9/mo…",
"captured_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Rotate a Monitor Webhook Secret
Generate a new signing secret for a monitor’s webhook. The previous secret stops signing deliveries immediately.
curl --request POST \
--url https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/monitors/{monitor_id}/webhook/rotate-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"mode": "web",
"id": "mon_123",
"name": "Acme pricing monitor",
"target": {
"type": "page",
"url": "https://acme.com/pricing",
"instructions": "Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.",
"normalize_whitespace": true
},
"change_detection": {
"type": "exact"
},
"schedule": {
"type": "interval",
"frequency": 6,
"unit": "hours"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"webhook": {
"url": "https://example.com/webhook",
"events": [
"change.detected",
"run.completed"
],
"retry": {
"delays_seconds": [
10,
60,
300,
1800,
7200,
21600,
57600
]
},
"secret": "whsec_8f3a…"
},
"last_run_at": "2023-11-07T05:31:56Z",
"last_change_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"last_error": {
"code": "fetch_failed",
"message": "The target URL could not be fetched."
},
"webhook_failure": {
"consecutive_failures": 3,
"last_status": "rejected",
"last_message": "Webhook endpoint returned HTTP 429.",
"last_failed_at": "2023-11-07T05:31:56Z"
},
"tags": [
"pricing",
"competitor"
],
"baseline": {
"text": "Acme Pricing\nStarter $9/mo…",
"captured_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}webhook.url configured can be rotated; monitors without a webhook return 409 MONITOR_NO_WEBHOOK — add a webhook first with Update a Monitor.
The 200 response returns the full monitor with the new value at webhook.secret. Store it and use it to verify webhook deliveries.Authorizations
Bearer authentication header of the form Bearer <API_KEY>, where <API_KEY> is your api key.
Path Parameters
"mon_123"
Response
Monitor with the rotated webhook secret
A web monitor. mode is the constant web; behavior is described by target (page/sitemap/extract) and change_detection (exact/semantic).
Top-level monitor category. Always web today; the concrete behavior is described by target and change_detection.
web "mon_123"
"Acme pricing monitor"
Discriminated union describing what the monitor watches.
- Page target
- Sitemap target
- Extract target
Show child attributes
Show child attributes
Discriminated union describing how changes are detected.
- Exact
- Semantic
Show child attributes
Show child attributes
Discriminated union describing how the monitor is scheduled. Only interval is supported today; cron and exact_time are reserved for future use.
Show child attributes
Show child attributes
Monitor lifecycle status. failed means the most recent run failed (see the monitor's last_error); failed monitors keep running on schedule and flip back to active on the next successful run. Monitors are auto-paused after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to active.
active, paused, failed Show child attributes
Show child attributes
When the next scheduled run is due.
Error from the most recent failed run; null when the last run succeeded.
Show child attributes
Show child attributes
Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes.
Show child attributes
Show child attributes
User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed.
201 - 50["pricing", "competitor"]
Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows target.type (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline).
- Page baseline
- Sitemap baseline
- Extract baseline
Show child attributes
Show child attributes
Was this page helpful?