# Apply a plan

`POST /api/v1/projects/{projectId}/config/apply`

Applies a stored plan of this project, all of it or nothing. Applying it again answers the first result. A plan whose resources changed since it was made is refused: plan again.

Sign-in: a dashboard session, any API token or the `monitorly` CLI's sign-in.

Section: Config plan and apply. Operation id in openapi.json: `apply_config`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `projectId` | path | yes | string (uuid) | The project's id. |

## Request body

Required: yes.

`application/json`: ConfigApplyInput

| Field | Type | Required | Description |
|---|---|---|---|
| `planId` | string (uuid) | yes |  |

Example:

```json
{
  "planId": "PLAN_ID"
}
```

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 200

What was created, changed and deleted.

`application/json`: ConfigApplyView

| Field | Type | Required | Description |
|---|---|---|---|
| `appliedAt` | string | yes |  |
| `changes` | array of ConfigChange | yes |  |
| `created` | array of CreatedResource | yes |  |
| `planId` | string (uuid) | yes |  |
| `summary` | PlanSummary | yes |  |

Example:

```json
{
  "appliedAt": "2026-11-27T16:01:00Z",
  "changes": [
    {
      "action": "update",
      "diff": [
        {
          "after": 30,
          "before": 60,
          "path": "/intervalSecs"
        }
      ],
      "id": "CHECK_ID",
      "ref": "payments-health",
      "resourceType": "check",
      "warnings": []
    }
  ],
  "created": [],
  "planId": "PLAN_ID",
  "summary": {
    "create": 0,
    "delete": 0,
    "unchanged": 0,
    "update": 1
  }
}
```

### 400

Bad Request.

- `request.malformed`: the body or a parameter is not of the expected shape
- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.scope_missing`: the token lacks the scope this needs; `detail` names it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`

### 404

Not Found.

- `request.not_found`: it does not exist, or you cannot see it

### 409

Conflict.

- `config.plan_stale`: plan resources changed after `plan`: build the plan again

### 410

Gone.

- `config.plan_expired`: plan is older than 15 minutes and was not applied

### 413

Payload Too Large.

- `request.too_large`: the body is larger than 256 KiB

### 422

Unprocessable Entity.

- `field.required`, `field.too_long`, `field.invalid`: a field breaks a rule; `errors` points at it

### 429

Too Many Requests.

- `token.rate_limited`: more than 10 requests a second with this token
- `session.rate_limited`: more than 5 changes a second from your sessions
- `token.create_limited`: more than 30 resources created within an hour from one token; `Retry-After` in seconds

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
