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

# API Reference - Monitoring

All endpoints live under `https://api.hasdata.com/monitors` and take your key in the `x-api-key` header. Answers wrap the payload in `data`; lists add `meta`.

## Endpoints

| Method | Path | Purpose |
| - | - | - |
| `GET` | `/monitors/endpoints` | The APIs a monitor can watch, with their params, options, defaults, typical credits, and suggested and default fields. |
| `GET` | `/monitors` | Your monitors, newest first. `page`, `perPage` (≤ 100), `q` (name or resource params), `status`, `endpoint`, `sort` (`created`, `lastChange`, `lastCheck`, `name`), `direction`. |
| `POST` | `/monitors` | Create a monitor; the first check is queued at once. `201`. |
| `GET` | `/monitors/{id}` | One monitor. |
| `PUT` | `/monitors/{id}` | Change only the fields sent. New resource params start a new baseline with a check right away; new tracked fields take theirs from the saved responses for free. |
| `DELETE` | `/monitors/{id}` | Stop and hide the monitor. `204`. |
| `POST` | `/monitors/{id}/pause` | Stop scheduled checks. |
| `POST` | `/monitors/{id}/resume` | Schedule the next run from now; also clears a pause for failures or missing credits. |
| `POST` | `/monitors/{id}/check` | Check now, all resources or `resourceIds`. `202` with the queued check. |
| `GET` | `/monitors/{id}/checks` | The latest checks with their results. `page`, `perPage`. |
| `GET` | `/monitors/{id}/checks/{checkId}` | One check with its results. |
| `GET` | `/monitors/changes` | The changes feed across monitors. `after`, `before`, `limit` (≤ 100), `matters`. |
| `GET` | `/monitors/{id}/changes` | The same for one monitor. |
| `POST` | `/monitors/{id}/resources` | Add a resource: `{ "resource": { "params": { … } }, "test": true }`. With `test`, the request runs once first and the resource is saved only if it worked; its response becomes the first snapshot. |
| `PUT` | `/monitors/{id}/resources/{resourceId}` | Change a resource's params, the same body. |
| `DELETE` | `/monitors/{id}/resources/{resourceId}` | Remove a resource; a monitor keeps at least one. |
| `GET` | `/monitors/{id}/resources/{resourceId}/snapshot` | The latest snapshot of a resource. |
| `GET` | `/monitors/{id}/resources/{resourceId}/response` | The API's last successful answer for a resource, as it came. |
| `GET` | `/monitors/{id}/deliveries` | Webhook and email deliveries with their attempts. |
| `POST` | `/monitors/test` | Run one resource once without a monitor: `{ "endpoint", "sharedParams"?, "resource": { "params" } }`. Charged like a request. |

## Objects

### Monitor

```json theme={null}
{
  "id": "fe452d1e-…",
  "name": "AirPods price",
  "endpoint": "amazon_product",
  "sharedParams": {},
  "fields": [{ "path": "product.price.currentPrice" }],
  "goal": null,
  "resources": [{ "id": "3f1c…", "params": { "asin": "B0D1XD1ZV3" }, "position": 0, "lastResponseAt": "2026-11-12T12:00:04.000Z" }],
  "schedule": { "preset": "6h", "cron": "17 0-23/6 * * *", "timezone": "UTC", "nextRunAt": "2026-11-12T18:17:00.000Z" },
  "status": "active",
  "pauseReason": null,
  "consecutiveFailures": 0,
  "delivery": { "webhook": { "url": "https://yourdomain.com/webhook", "hasSecret": true }, "email": null },
  "activity": { "lastCheckAt": "2026-11-12T12:00:05.000Z", "lastChangeAt": "2026-11-12T12:00:05.000Z", "creditsSpent": 20 },
  "createdAt": "2026-11-12T11:00:00.000Z",
  "updatedAt": "2026-11-12T12:00:05.000Z"
}
```

`status` is `active` or `paused`; `pauseReason` is `user`, `no_credits` or `failures`. The webhook secret is write-only. `schedule.preset` is `null` for a cron schedule.

### Tracked field

```json theme={null}
{ "path": "properties", "list": { "keys": ["id"], "fields": ["price", "status"] } }
```

`path`: dot-separated names into the response. `list`, for a list of objects: `keys` tell items apart (empty: by content), `fields` are compared (empty: the whole item). See [Fields to Track](https://docs.hasdata.com/apis/monitoring/fields-to-track.md).

### Check

```json theme={null}
{
  "id": "0c3b…",
  "monitorId": "fe452d1e-…",
  "trigger": "schedule",
  "status": "done",
  "scheduledFor": "2026-11-12T12:00:00.000Z",
  "startedAt": "2026-11-12T12:00:01.000Z",
  "finishedAt": "2026-11-12T12:00:05.000Z",
  "creditsSpent": 20,
  "resourceIds": null,
  "results": [ … ]
}
```

`trigger` is `schedule` or `manual`; `status` is `queued`, `running`, `done` or `failed` (every resource errored). `resourceIds` lists the resources a manual check was limited to.

### Result

```json theme={null}
{
  "id": 4812,
  "monitorId": "fe452d1e-…",
  "resourceId": "3f1c…",
  "checkId": "0c3b…",
  "status": "changed",
  "diff": { "kind": "fields", "changes": [ … ], "lists": [ … ] },
  "patch": [{ "oldStart": 1, "oldLines": 5, "newStart": 1, "newLines": 5, "lines": [" {", "-  \"currentPrice\": 249.99,", "+  \"currentPrice\": 198.16,", " }"] }],
  "error": null,
  "judge": { "matters": true, "reason": "The price dropped by 21%.", "model": "gpt-4.1-mini", "credits": 2 },
  "createdAt": "2026-11-12T12:00:04.000Z"
}
```

`status` is `baseline`, `unchanged`, `changed` or `error`. `diff` and `patch` are set for `changed`; `error` for `error`; `judge` for `changed` when the monitor has a goal.

## Errors

| Status | `code` | When |
| - | - | - |
| `400` | `E_INVALID_PARAMS` | A param is missing, unknown or malformed; `errors` lists `{ param, message }` for each. Also a resource param the endpoint does not take, or tracked fields that contradict each other. |
| `400` | `E_RESOURCE_LIMIT` | More resources than your plan's concurrency allows; `limit` says how many. |
| `400` | `E_MONITOR_LIMIT` | More than 100 monitors in the workspace. |
| `401` | | No or invalid API key. |
| `404` | `E_NOT_FOUND` | No such monitor, resource or check in your workspace. |

```json theme={null}
{
  "code": "E_INVALID_PARAMS",
  "errors": [{ "param": "fields", "message": "properties has two different keys: [id] and [zpid]; use one" }]
}
```


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