> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Targets

> Choose what a monitor watches: a list of pages, a site section found again on each check, or a search. Add a goal so a model judges each change.

`targets` holds 1 to 50 entries. Each has a `type` of `scrape` (fixed URLs), `crawl` (pages found under a start page on every check) or `search` (new results for queries). One monitor can mix types, and every check reads every target. Pages in a check name their target by `id`, which you can set (1 to 64 characters) or let Stophy make.

```json theme={null}
{
  "targets": [
    { "type": "scrape", "id": "pricing", "urls": ["https://example.com/pricing"] },
    { "type": "crawl", "url": "https://example.com/blog", "crawlOptions": { "limit": 20, "maxDepth": 1 } },
    { "type": "search", "queries": ["example launch"], "searchWindow": "7d", "maxResults": 3 }
  ],
  "goal": "Tell me about price changes and launches."
}
```

Send this in the create request on [Monitors](https://docs.stophy.dev/monitors/overview). A search target needs the `goal` here.

## Scrape targets

| Field | Default | Effect |
| - | - | - |
| `urls` | none | Required. 1 to 100 public addresses. An address sent twice is read once. |
| `scrapeOptions` | `{}` | How each page is read. Takes the options of [Scrape](https://docs.stophy.dev/scrape/overview) except `url`. |

A monitor always reads live, so `maxAge` and `minAge` are ignored. `zeroDataRetention` is refused, because a monitor keeps a snapshot to compare.

`formats` says what to compare. The first of `markdown`, `html`, `rawHtml` and `links` is compared, with `markdown` as the default. A page is `changed` when that text differs from the last read. To compare fields instead, add a `json` format with a `schema` or `prompt`, or a `changeTracking` format as in [Change tracking](https://docs.stophy.dev/scrape/change-tracking.md). `changeTracking` modes are `git-diff` (the text diff) and `json` (each field before and after). With only `json`, a page whose text changed but whose fields did not is `same`.

## Crawl targets

`url` is the start page (required). Every check finds the pages under it again and reads each one, so a page that appears later is a `new` change. A check that finds no pages fails, with the reason in `error`. A crawl target takes `scrapeOptions` too.

| `crawlOptions` | Default | Effect |
| - | - | - |
| `limit` | 100 | Most pages per check, 1 to 500. You are billed for the pages found, up to this. |
| `maxDepth` | 3 | Path levels below the start page, 0 to 10. `maxDiscoveryDepth` is the same. |
| `includePaths`, `excludePaths` | `[]` | Up to 100 regular expressions each. A page is kept when its path matches an include pattern (or none are set) and no exclude pattern. |
| `regexOnFullURL` | `false` | Match the whole address instead of the path. |
| `crawlEntireDomain` | `false` | Also follow pages outside the start page's path. |
| `allowSubdomains` | `false` | Include subdomains. |
| `ignoreQueryParameters` | `true` | Addresses that differ only by query string are one page. |
| `sitemap` | `include` | `skip` ignores the sitemap, `only` uses only the sitemap. |

## Search targets

A search target has no baseline: a meaningful result is reported the first time it is found.

| Field | Default | Effect |
| - | - | - |
| `queries` | none | Required. 1 to 12 queries of up to 256 characters. |
| `searchWindow` | `24h` | Only results published within `5m`, `15m`, `1h`, `6h`, `24h` or `7d`. Under `24h` returns the past day's results. |
| `maxResults` | 10 | Results to look at per check, 1 to 50, merged across queries. |
| `includeDomains`, `excludeDomains` | `[]` | Up to 50 each, such as `example.com`. A domain includes its subdomains. |

A search target needs a `goal`, or `judgeEnabled: false`. A result the judge finds meaningful is `new`. One it finds not meaningful is marked `ignored` and not looked at again. A result you were already told about is `already_seen`. See [search results](https://docs.stophy.dev/monitors/checks-and-changes.md#search-results).

## Goal and judge

`goal` is up to 2,000 characters of plain words. With a goal, a model judges every changed page against it. `judgeEnabled: false` keeps the goal and turns the judge off.

Read `judgment` on the page result or webhook: `meaningful`, `confidence` (`high`, `medium`, `low`), `reason`, and `meaningfulChanges` with `type`, `before`, `after` and `reason`. A change judged not meaningful is still recorded and sent with `meaningful: false`. If the judge cannot decide, `judgment` is `null` and that judging is free. Pricing is on [Pricing](https://docs.stophy.dev/account/pricing.md).

## Update targets

`PATCH /v1/monitor/{id}` replaces `targets` as a whole, so send every target you keep. `goal` and `judgeEnabled` can change in the same call.

* A kept page stays compared with its last snapshot.
* A page you add is `new` on the next check and sends no event.
* A removed page is no longer read or billed.

## Limits and errors

Account limits are on [Monitors](https://docs.stophy.dev/monitors/overview#limits). Codes are on [Errors](https://docs.stophy.dev/api-reference/errors.md). All are `400 invalidRequest`.

* `targets.0.urls.0: Expected a public website URL`: the address is not public.
* `targets.0.scrapeOptions.zeroDataRetention: zeroDataRetention is not available for monitors, which keep a snapshot to compare`.
* `goal: a search target needs a goal to judge results against, or judgeEnabled set to false`.
* The older `url`, `urls`, `interval`, `formats` and `changeTracking` fields work only without `targets` and `schedule`. Mixing them returns this error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.