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

# Context.dev: Contextdev Create Monitor

> Create a monitor. Context.dev Contextdev Create Monitor reference includes SDK V2 and CLI requests, input constraints, response fields, and Deepline cost.

Create a monitor.

<Info>
  Tool ID: `contextdev_create_monitor`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'contextdev_create_monitor',
  {
    "name": "Example",
    "target": {
      "type": "page",
      "url": "https://example.com/resource"
    }
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute contextdev_create_monitor --input '{
  "name": "Example",
  "target": {
    "type": "page",
    "url": "https://example.com/resource"
  }
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "mode": "web",
    "id": "id_123",
    "name": "Example",
    "target": {},
    "change_detection": {},
    "schedule": {},
    "status": "active",
    "created_at": "2026-01-15T12:00:00Z",
    "updated_at": "2026-01-15T12:00:00Z",
    "initial_run_id": "initial_run_123"
  }
}
```

Use `deepline tools get contextdev_create_monitor --json` for the latest machine-readable contract.

## Input reference

Creates a web monitor. `mode` is the constant `web`; the behavior is described by `target` (page, sitemap, or extract) and `change_detection` (exact or semantic). Supported combinations: page + exact, page + semantic, sitemap + exact, extract + semantic. `change_detection` is optional; page targets with `instructions` infer semantic detection, while page targets without them infer exact detection. Other targets default to their supported detection type. `schedule` is optional and defaults to once per day.

| Name                       | Type     | Required | Default | Details                                                                                                                                               |
| -------------------------- | -------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.mode`             | `"web"`  | No       | —       | Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. Allowed: `web`.                |
| `payload.name`             | `string` | Yes      | —       | Minimum length: 1. Maximum length: 200.                                                                                                               |
| `payload.tags`             | `array`  | No       | —       | User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. Maximum items: 20. Items must be unique.             |
| `payload.target`           | `object` | Yes      | —       | Discriminated union describing what the monitor watches.                                                                                              |
| `payload.change_detection` | `object` | No       | —       | Discriminated union describing how changes are detected.                                                                                              |
| `payload.schedule`         | `object` | No       | —       | Discriminated union describing how the monitor is scheduled. Only `interval` is supported today; `cron` and `exact_time` are reserved for future use. |
| `payload.webhook`          | `object` | No       | —       | —                                                                                                                                                     |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Creates a web monitor. `mode` is the constant `web`; the behavior is described by `target` (page, sitemap, or extract) and `change_detection` (exact or semantic). Supported combinations: page + exact, page + semantic, sitemap + exact, extract + semantic. `change_detection` is optional; page targets with `instructions` infer semantic detection, while page targets without them infer exact detection. Other targets default to their supported detection type. `schedule` is optional and defaults to once per day.",
    "properties": {
      "mode": {
        "type": "string",
        "description": "Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.",
        "enum": [
          "web"
        ]
      },
      "name": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
      },
      "tags": {
        "type": "array",
        "description": "User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed.",
        "maxItems": 20,
        "uniqueItems": true,
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        }
      },
      "target": {
        "description": "Discriminated union describing what the monitor watches.",
        "anyOf": [
          {
            "type": "object",
            "description": "Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "page"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "instructions": {
                "type": "string",
                "description": "Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred.",
                "minLength": 1,
                "maxLength": 2000
              },
              "normalize_whitespace": {
                "type": "boolean",
                "description": "Normalize whitespace before comparing or analyzing text.",
                "default": true
              }
            },
            "required": [
              "type",
              "url"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "sitemap"
                ]
              },
              "url": {
                "type": "string",
                "description": "Sitemap URL to monitor.",
                "format": "uri"
              },
              "include": {
                "type": "array",
                "description": "URL path patterns to include (max 50).",
                "maxItems": 50,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                }
              },
              "exclude": {
                "type": "array",
                "description": "URL path patterns to exclude (max 50).",
                "maxItems": 50,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                }
              },
              "max_urls": {
                "type": "integer",
                "description": "Maximum number of sitemap URLs to track (capped at 10,000).",
                "default": 5000,
                "minimum": 1,
                "maximum": 10000
              }
            },
            "required": [
              "type",
              "url"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "extract"
                ]
              },
              "url": {
                "type": "string",
                "description": "Root URL to extract structured data from.",
                "format": "uri"
              },
              "schema": {
                "type": "object",
                "description": "JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used.",
                "additionalProperties": {}
              },
              "instructions": {
                "type": "string",
                "description": "Natural-language instructions guiding which pages and facts to track and which changes to report.",
                "minLength": 1,
                "maxLength": 2000
              },
              "max_pages": {
                "type": "integer",
                "description": "Maximum number of pages to track.",
                "default": 10,
                "minimum": 1,
                "maximum": 50
              },
              "max_depth": {
                "type": "integer",
                "description": "Optional maximum link depth from the starting URL (0 = only the starting page).",
                "minimum": 0,
                "maximum": 10
              },
              "follow_subdomains": {
                "type": "boolean",
                "default": false
              }
            },
            "required": [
              "type",
              "url",
              "instructions"
            ],
            "additionalProperties": false
          }
        ]
      },
      "change_detection": {
        "description": "Discriminated union describing how changes are detected.",
        "anyOf": [
          {
            "type": "object",
            "description": "Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "exact"
                ]
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "semantic"
                ]
              },
              "confidence_threshold": {
                "type": "number",
                "default": 0.75,
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          }
        ]
      },
      "schedule": {
        "description": "Discriminated union describing how the monitor is scheduled. Only `interval` is supported today; `cron` and `exact_time` are reserved for future use.",
        "anyOf": [
          {
            "type": "object",
            "description": "Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "interval"
                ]
              },
              "frequency": {
                "type": "integer",
                "description": "Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days).",
                "minimum": 1,
                "maximum": 525600
              },
              "unit": {
                "type": "string",
                "enum": [
                  "minutes",
                  "hours",
                  "days"
                ]
              }
            },
            "required": [
              "type",
              "frequency",
              "unit"
            ],
            "additionalProperties": false
          }
        ]
      },
      "webhook": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "Webhook URL events are delivered to.",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "description": "Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `[\"change.detected\"]` when omitted.",
            "minItems": 1,
            "maxItems": 2,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "change.detected",
                "run.completed"
              ]
            }
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "name",
      "target"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name                                               | Type                                             | Required | Default | Details                                                   |
| -------------------------------------------------- | ------------------------------------------------ | -------- | ------- | --------------------------------------------------------- |
| `result.data`                                      | `object`                                         | Yes      | —       | —                                                         |
| `result.data.mode`                                 | `"web"`                                          | Yes      | —       | Allowed: `web`.                                           |
| `result.data.id`                                   | `string`                                         | Yes      | —       | —                                                         |
| `result.data.name`                                 | `string`                                         | Yes      | —       | —                                                         |
| `result.data.target`                               | `record`                                         | Yes      | —       | —                                                         |
| `result.data.change_detection`                     | `record`                                         | Yes      | —       | —                                                         |
| `result.data.schedule`                             | `record`                                         | Yes      | —       | —                                                         |
| `result.data.webhook`                              | `object \| null`                                 | No       | —       | —                                                         |
| `result.data.webhook.url`                          | `string`                                         | Yes      | —       | Format: `uri`.                                            |
| `result.data.webhook.events`                       | `array`                                          | No       | —       | Minimum items: 1. Maximum items: 2. Items must be unique. |
| `result.data.status`                               | `"active" \| "paused" \| "failed"`               | Yes      | —       | Allowed: `active`, `paused`, `failed`.                    |
| `result.data.last_run_at`                          | `string \| null`                                 | No       | —       | Format: `date-time`.                                      |
| `result.data.last_change_at`                       | `string \| null`                                 | No       | —       | Format: `date-time`.                                      |
| `result.data.next_run_at`                          | `string \| null`                                 | No       | —       | Format: `date-time`.                                      |
| `result.data.last_error`                           | `object \| null`                                 | No       | —       | —                                                         |
| `result.data.last_error.code`                      | `string`                                         | Yes      | —       | —                                                         |
| `result.data.last_error.message`                   | `string`                                         | Yes      | —       | —                                                         |
| `result.data.webhook_failure`                      | `object \| null`                                 | No       | —       | —                                                         |
| `result.data.webhook_failure.consecutive_failures` | `integer`                                        | Yes      | —       | Minimum: 1.                                               |
| `result.data.webhook_failure.last_status`          | `"rejected" \| "failed" \| "skipped_unsafe_url"` | Yes      | —       | Allowed: `rejected`, `failed`, `skipped_unsafe_url`.      |
| `result.data.webhook_failure.last_message`         | `string`                                         | Yes      | —       | —                                                         |
| `result.data.webhook_failure.last_failed_at`       | `string`                                         | Yes      | —       | Format: `date-time`.                                      |
| `result.data.created_at`                           | `string`                                         | Yes      | —       | Format: `date-time`.                                      |
| `result.data.updated_at`                           | `string`                                         | Yes      | —       | Format: `date-time`.                                      |
| `result.data.tags`                                 | `array`                                          | No       | —       | Maximum items: 20. Items must be unique.                  |
| `result.data.baseline`                             | `record`                                         | No       | —       | —                                                         |
| `result.data.initial_run_id`                       | `string \| null`                                 | Yes      | —       | —                                                         |
| `result.meta`                                      | `object`                                         | No       | —       | —                                                         |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "web"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "target": {
            "type": "object",
            "additionalProperties": true
          },
          "change_detection": {
            "type": "object",
            "additionalProperties": true
          },
          "schedule": {
            "type": "object",
            "additionalProperties": true
          },
          "webhook": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "events": {
                "type": "array",
                "minItems": 1,
                "maxItems": 2,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "enum": [
                    "change.detected",
                    "run.completed"
                  ]
                }
              }
            },
            "required": [
              "url"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "failed"
            ]
          },
          "last_run_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_change_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "next_run_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          },
          "webhook_failure": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "consecutive_failures": {
                "type": "integer",
                "minimum": 1
              },
              "last_status": {
                "type": "string",
                "enum": [
                  "rejected",
                  "failed",
                  "skipped_unsafe_url"
                ]
              },
              "last_message": {
                "type": "string"
              },
              "last_failed_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "consecutive_failures",
              "last_status",
              "last_message",
              "last_failed_at"
            ],
            "additionalProperties": false
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 50
            }
          },
          "baseline": {
            "type": "object",
            "additionalProperties": true
          },
          "initial_run_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "mode",
          "id",
          "name",
          "target",
          "change_detection",
          "schedule",
          "status",
          "created_at",
          "updated_at",
          "initial_run_id"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Context.dev provider guide](/docs/providers/contextdev/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
