---
title: "Apply a monitors-as-code file (desired state)"
method: PUT
path: "/api/v1/config"
tags: ["config"]
---

# Apply a monitors-as-code file (desired state)

`PUT /api/v1/config`

## Request

- Base URL: `https://puzaricloud.in` (the document declares no server; this is the origin it was published from)
- URL: `https://puzaricloud.in/api/v1/config`
- Auth: none declared

**Monitors as code.** Send the YAML (`Content-Type: application/x-yaml`) or JSON (`application/json`) document from
`GET /api/v1/config`, edited to the state you want. Monitors are matched by `name`:

* missing monitors are **created**,
* existing monitors get the fields present in the file **updated** (keys you leave out are untouched),
* with `?prune=1`, monitors not in the file are **deleted** (channels are never deleted),
* `?dry_run=1` returns the plan without writing.

Every entry is validated first (same rules as the UI: plan limits, URL policy, cron syntax, assertion syntax, channel
names). If anything fails the response is `422` with `errors: [{name, error}]` and **nothing is applied**.

Response: `{"created": [...], "updated": [...], "deleted": [...], "unchanged": [...], "errors": [...], "dry_run": bool}`.
Requires a Business or Enterprise plan. Ideal for CI: run with `dry_run=1` on pull requests, apply on merge.

## Query parameters

- `dry_run` boolean: Validate and report the plan without writing anything
- `prune` boolean: Delete monitors that are not listed in the file

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/puzaricloud/apis/vigil-api.md) · [All operations](https://skmtc.dev/puzaricloud/apis/vigil-api/llms.txt) · [OpenAPI document](https://skmtc.dev/puzaricloud/apis/vigil-api/revisions/1cb93f81f1a7?raw)
