01Run it
Straight from the command's own help.
p202 campaign check-urlsp202 campaign check-urls --url-contains g2afse.com --slot 1 --timeout 10sp202 campaign check-urls --ids 279,281 --json02What you get
Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.
$ p202 campaign check-urls aff_campaign_id aff_campaign_name field url host status detail --------------- ---------------------------- ---------------- ------------------------------------------ ------------------- ---------- ------------------------------------------ 7 Holiday Gift Cards / AU aff_campaign_url https://example.com/au/gift-cards example.com:443 ok TLS ok at 104.20.23.154:443; certificate … 6 Bakery Pre-orders / Local aff_campaign_url https://example.com/bakery/preorder example.com:443 ok TLS ok at 104.20.23.154:443; certificate … 5 Free Trial to Paid / CA aff_campaign_url https://app.example.com/signup?plan=trial app.example.com:443 dns_failed no such host: app.example.com does not re… 4 Project Tool Pro Annual / US aff_campaign_url https://app.example.com/pricing/pro-annual app.example.com:443 dns_failed no such host: app.example.com does not re… 3 Standing Desk Launch / UK aff_campaign_url https://example.com/uk/desks/standing-desk example.com:443 ok TLS ok at 104.20.23.154:443; certificate … 2 Coffee Subscription / US aff_campaign_url https://example.com/coffee/subscribe example.com:443 ok TLS ok at 104.20.23.154:443; certificate … 1 Spring Collection / US aff_campaign_url https://example.com/shop/spring-collection example.com:443 ok TLS ok at 104.20.23.154:443; certificate … Checked 2 host(s) for 7 offer URL(s), without sending any HTTP request: ok 5, dns_failed 2. Error [partial_failure]: 2 of 7 offer URL(s) did not pass the check Hint: Each row's detail says why. dns_failed (no such host) and tls_failed usually mean a retired link: rewrite it with `p202 campaign replace-url --match <host> --set <new url>`. timeout and connect_failed can be transient: re-run with a longer --timeout before retiring the link.
$ p202 campaign check-urls --json { "data": [ { "aff_campaign_id": "7", "aff_campaign_name": "Holiday Gift Cards / AU", "detail": "TLS ok at 104.20.23.154:443; certificate valid until 2026-11-08", "field": "aff_campaign_url", "host": "example.com:443", "status": "ok", "url": "https://example.com/au/gift-cards" }, { "aff_campaign_id": "6", "aff_campaign_name": "Bakery Pre-orders / Local", "detail": "TLS ok at 104.20.23.154:443; certificate valid until 2026-11-08", "field": "aff_campaign_url", "host": "example.com:443", "status": "ok", "url": "https://example.com/bakery/preorder" }, { "aff_campaign_id": "5", "aff_campaign_name": "Free Trial to Paid / CA", "detail": "no such host: app.example.com does not resolve", "field": "aff_campaign_url", "host": "app.example.com:443", "status": "dns_failed", "url": "https://app.example.com/signup?plan=trial" }, { "aff_campaign_id": "4", "aff_campaign_name": "Project Tool Pro Annual / US", "detail": "no such host: app.example.com does not resolve", "field": "aff_campaign_url", "host": "app.example.com:443", "status": "dns_failed", "url": "https://app.example.com/pricing/pro-annual" }, { "aff_campaign_id": "3", "aff_campaign_name": "Standing Desk Launch / UK", "detail": "TLS ok at 104.20.23.154:443; certificate valid until 2026-11-08", "field": "aff_campaign_url", "host": "example.com:443", "status": "ok", "url": "https://example.com/uk/desks/standing-desk" }, { "aff_campaign_id": "2", "aff_campaign_name": "Coffee Subscription / US", "detail": "TLS ok at 104.20.23.154:443; certificate valid until 2026-11-08", "field": "aff_campaign_url", "host": "example.com:443", "status": "ok", "url": "https://example.com/coffee/subscribe" }, { "aff_campaign_id": "1", "aff_campaign_name": "Spring Collection / US", "detail": "TLS ok at 104.20.23.154:443; certificate valid until 2026-11-08", "field": "aff_campaign_url", "host": "example.com:443", "status": "ok", "url": "https://example.com/shop/spring-collection" } ] } Checked 2 host(s) for 7 offer URL(s), without sending any HTTP request: ok 5, dns_failed 2. {"error":{"category":"partial_failure","command":"p202 campaign check-urls","exit_code":5,"hint":"Each row's detail says why. dns_failed (no such host) and tls_failed usually mean a retired link: rewrite it with `p202 campaign replace-url --match <host> --set <new url>`. timeout and connect_failed can be transient: re-run with a longer --timeout before retiring the link.","message":"2 of 7 offer URL(s) did not pass the check"}}
03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 campaign check-urlsSet flags below; the command updates as you type.
04Flags
7 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --aff-network-idstring | Only campaigns in this affiliate network (ids from p202 aff-network list) |
| --force, -fbool | Skip the --http confirmation prompt |
| --httpbool | Also send a HEAD request per URL and report its status; affiliate networks may count it as a click |
| --idsstring | Only these campaign IDs (comma-separated) |
| --slotstring · default all | URL slots to check: 1-5, comma-separated, or all |
| --timeoutduration · default 5s | Time allowed per host for DNS, connect and TLS together (and per --http request) |
| --url-containsstring | Only offer URLs containing this text (case-insensitive) |
05How it works
Checks campaign offer URL slots (aff_campaign_url, _2 to _5) and reports which point at a host that no longer works. Opening an affiliate link registers a click, so by default no HTTP request is sent: each unique host is resolved (DNS), connected to (TCP) and, for https, put through a TLS handshake with normal certificate verification, then the connection is closed.
status per URL: ok, invalid_url, dns_failed, connect_failed, timeout, tls_failed (and http_failed with --http); detail says why.
--http also sends one HEAD request per unique URL (GET only if HEAD answers 405), follows no redirect, and reports http_status and location. Affiliate networks may count these as clicks, so it asks first (--force skips). Tokens such as [[subid]] are sent as "p202check".
Like p202 rotator check, it exits 5 (partial_failure) when any URL's
status is not ok; every row is still printed on stdout.
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands campaign check-urls --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
{
"path": "p202 campaign check-urls",
"use": "check-urls",
"short": "Find offer URLs whose host is dead, without sending clicks",
"long": "Checks campaign offer URL slots (aff_campaign_url, _2 to _5) and reports which\npoint at a host that no longer works. Opening an affiliate link registers a\nclick, so by default no HTTP request is sent: each unique host is resolved\n(DNS), connected to (TCP) and, for https, put through a TLS handshake with\nnormal certificate verification, then the connection is closed.\n\nstatus per URL: ok, invalid_url, dns_failed, connect_failed, timeout,\ntls_failed (and http_failed with --http); detail says why.\n\n--http also sends one HEAD request per unique URL (GET only if HEAD answers\n405), follows no redirect, and reports http_status and location. Affiliate\nnetworks may count these as clicks, so it asks first (--force skips).\nTokens such as [[subid]] are sent as \"p202check\".\n\nLike `p202 rotator check`, it exits 5 (partial_failure) when any URL's\nstatus is not ok; every row is still printed on stdout.",
"runnable": true,
"example": "p202 campaign check-urls\n p202 campaign check-urls --url-contains g2afse.com --slot 1 --timeout 10s\n p202 campaign check-urls --ids 279,281 --json",
"flags": [
{
"name": "aff-network-id",
"type": "string",
"default": "",
"usage": "Only campaigns in this affiliate network (ids from p202 aff-network list)",
"required": false
},
{
"name": "force",
"shorthand": "f",
"type": "bool",
"default": "false",
"usage": "Skip the --http confirmation prompt",
"required": false
},
{
"name": "http",
"type": "bool",
"default": "false",
"usage": "Also send a HEAD request per URL and report its status; affiliate networks may count it as a click",
"required": false
},
{
"name": "ids",
"type": "string",
"default": "",
"usage": "Only these campaign IDs (comma-separated)",
"required": false
},
{
"name": "slot",
"type": "string",
"default": "all",
"usage": "URL slots to check: 1-5, comma-separated, or all",
"required": false
},
{
"name": "timeout",
"type": "duration",
"default": "5s",
"usage": "Time allowed per host for DNS, connect and TLS together (and per --http request)",
"required": false
},
{
"name": "url-contains",
"type": "string",
"default": "",
"usage": "Only offer URLs containing this text (case-insensitive)",
"required": false
}
]
}