p202 campaign check-urls

Find offer URLs whose host is dead, without sending clicks

All commands

01Run it

Straight from the command's own help.

p202 campaign check-urls
p202 campaign check-urls --url-contains g2afse.com --slot 1 --timeout 10s
p202 campaign check-urls --ids 279,281 --json

02What 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
$ 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.
Real output · p202 1.9.77 · demo dataexit 5

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 campaign check-urls

Set flags below; the command updates as you type.

04Flags

7 flags, plus the global flags every command takes.

FlagWhat it does
--aff-network-idstringOnly campaigns in this affiliate network (ids from p202 aff-network list)
--force, -fboolSkip the --http confirmation prompt
--httpboolAlso send a HEAD request per URL and report its status; affiliate networks may count it as a click
--idsstringOnly these campaign IDs (comma-separated)
--slotstring · default allURL slots to check: 1-5, comma-separated, or all
--timeoutduration · default 5sTime allowed per host for DNS, connect and TLS together (and per --http request)
--url-containsstringOnly 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, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands campaign check-urls --json
{
  "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
    }
  ]
}