---
title: "API 레퍼런스"
description: "API v1의 모든 작업을 메서드, 경로, 스코프, 역할, 매개변수, 요청 본문, 예제와 함께 정리한 문서입니다. 서버의 OpenAPI 설명에서 생성됩니다."
url: https://vigiora.com/ko/docs/developers/api-reference
updated: 2026-12-02T10:45:23.000Z
---

# API 레퍼런스

> API v1의 모든 작업을 메서드, 경로, 스코프, 역할, 매개변수, 요청 본문, 예제와 함께 정리한 문서입니다. 서버의 OpenAPI 설명에서 생성됩니다.

이 레퍼런스는 API v1의 OpenAPI 설명(버전 1.129.0, Vigiora Server 1.14.4에서 제공)에서 생성됩니다. 각 서버는 자신의 정확한 버전에 맞는 설명을 `/api/v1/openapi.yaml`과 `/api/v1/openapi.json`에서 제공합니다. OpenAPI 뷰어에서 열거나 클라이언트를 생성하는 데 사용하세요. 현재 릴리스의 같은 설명은 [/openapi.json](https://vigiora.com/openapi.json)과 [/openapi.yaml](https://vigiora.com/openapi.yaml)에 공개되어 있습니다.

각 작업에는 키에 필요한 **스코프**, 허용되는 **역할**, 최소 **카메라 권한**이 표시됩니다. [인증과 스코프](https://vigiora.com/docs/developers/api-authentication)를 참고하세요. [Human in the loop](https://vigiora.com/docs/developers/human-in-the-loop)가 켜져 있을 때 AI 에이전트가 사용자에게 먼저 물어봐야 하는 작업은 **AI agents** 행에 그 내용이 표시됩니다. 예제에서는 `yourname.vigiora.com`과 가상의 키를 사용하며, 예제 응답은 설명을 위한 것입니다. 오류, 페이지네이션, `Idempotency-Key`, 요청 한도는 모든 곳에서 같은 방식으로 작동합니다. [규칙](https://vigiora.com/docs/developers/api-conventions)을 참고하세요.

## Me

The caller's identity and scopes.

### Who am I

`GET /api/v1/me`

The authenticated user and the credential used, with its effective scopes (`null` for a session).

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/me" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The caller.

```json
{
  "user": {
    "id": 1,
    "username": "automation",
    "role": "admin"
  },
  "auth": {
    "type": "api_key",
    "key_id": 1,
    "scoped": true,
    "scopes": [
      "cameras:read"
    ]
  }
}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Human-in-the-loop policy for AI agents

`GET /api/v1/agent-policy`

Whether AI agents using this credential must ask the user before risky operations (human in the loop), what decided it (`server`: the server setting; `api_key` or `connected_app`: this credential's override) and the operations that need approval while it is on. Informative on REST (REST calls are never prompted); the MCP endpoint enforces it.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/agent-policy" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The caller's effective policy.

```json
{
  "human_in_the_loop": false,
  "source": "server",
  "override": "inherit",
  "server_human_in_the_loop": false,
  "confirm_operations": [
    "confirm-operation"
  ],
  "note": "note"
}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Server identity

`GET /api/v1/server`

This server's stable id, name, public address, version, edition, time zone, API version and the optional features it has (`features`, for feature detection). Any valid credential may read it; it holds no secrets. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/server" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The server.

```json
{
  "id": "id",
  "name": "Front door",
  "site_address": "site-address",
  "version": "version",
  "edition": "self_hosted",
  "install": "native",
  "timezone": "timezone",
  "api_version": "api-version",
  "camera_catalog_version": "camera-catalog-version",
  "features": [
    "feature"
  ],
  "time": "2026-10-30T14:05:00Z",
  "ai": {
    "status": "ok",
    "first_failure_at": "2026-10-30T14:05:00Z",
    "route": "gateway",
    "reason": "reason",
    "resumes_at": "2026-10-30T14:05:00Z",
    "since": "2026-10-30T14:05:00Z",
    "retry_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Cameras

Cameras (called monitors in the web app's internal API), live snapshots and AI switch.

### List cameras

`GET /api/v1/cameras`

Cameras the caller may view, in the Monitors page order (`sort_order`, set with `POST /cameras/actions/reorder`), then the cameras never ordered by ascending id; until someone reorders, that is ascending id. Camera credentials in `stream_url` are always redacted. API 1.102.0 (the order).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `enabled` | query | boolean | No | Only enabled (`true`) or disabled (`false`) cameras. |
| `site_id` | query | integer | No | Only cameras of this site. (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of cameras.

```json
{
  "data": [
    {
      "speaker": {
        "kind": "voice",
        "siren": false,
        "checked_at": "2026-10-30T14:05:00Z"
      },
      "id": 1,
      "name": "Front door",
      "enabled": true,
      "status": "online",
      "source_type": "rtsp",
      "connection_type": "local",
      "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
      "width": 1920,
      "height": 1080,
      "fps": 15,
      "recording_enabled": true,
      "retention_days": 7,
      "ai_enabled": true,
      "ai_guardian_enabled": false,
      "ai_live_enabled": false,
      "has_ptz": false,
      "has_speaker": false,
      "talk": {
        "available": false,
        "reason": "no_speaker"
      },
      "has_audio": false,
      "site_id": 1,
      "client_id": null,
      "client_name": null,
      "client_status": null,
      "tags": [
        "entrance"
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "sub_stream_name": "sub-stream-name",
      "record_sub_stream": false,
      "record_hd_on_motion": false,
      "onvif_url": "onvif-url",
      "hardware_id": "hardware-id",
      "audio_monitoring_enabled": false,
      "wake_word_enabled": false,
      "ptz_manual": false,
      "onvif_enabled": false,
      "sort_order": 1,
      "brand": "brand",
      "model": "model",
      "brand_source": "camera",
      "body_type": "bullet",
      "ptz_zoom": "ptz-zoom",
      "ptz_settle_seconds": 0.5,
      "ai_guardian_prompt": "ai-guardian-prompt",
      "ai_live_env": "ai-live-env",
      "stt_languages": [
        "stt-language"
      ],
      "stt_prompt": "stt-prompt",
      "lat": 0.5,
      "lon": 0.5,
      "source_error": "source-error",
      "guardian_use_detections": false,
      "guardian_use_detections_set": false,
      "guardian_clip_preroll_sec": 1,
      "ai_services": [
        "ai-service"
      ],
      "warnings": [
        "warning"
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a camera

`POST /api/v1/cameras`

Adds an RTSP (or iframe) camera on this server's network, or a camera (`client_id`, optionally `remote_stream_name`) or USB microphone (`source_type: usb_audio`, `client_id`, `audio_device`) relayed by a vigiora-client (see `GET /cameras/available-streams`). New cameras get AI automatically while the plan allows it (see `ai_enabled`). `sub_stream_url` (same host as `stream_url`) adds the low-resolution stream live view and motion detection use; `onvif_url` sets the PTZ address by hand (same rules as on update); `hardware_id` records the camera's MAC (user sessions only, `403 api_key_not_allowed` otherwise; camera following sends the stream credentials to the device with that MAC). URLs pass the same source checks as the web app; credentials come back `REDACTED`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_camera`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `stream_url` | string | Yes | RTSP URL (credentials allowed), or the page URL of an iframe camera. |
| `source_type` | string: `rtsp`, `iframe`, `usb_audio` | No | (default `"rtsp"`) |
| `width` | integer | No | (16–7680) |
| `height` | integer | No | (16–4320) |
| `fps` | integer | No | (1–120) |
| `enabled` | boolean | No | (default `true`) |
| `recording_enabled` | boolean | No | (default `false`) |
| `site_id` | integer | No | (≥ 1) |
| `tags` | array of string | No | (max 32 items) |
| `sub_stream_url` | string | No | RTSP URL of the camera's sub stream, on the same IPv4 address as `stream_url`. |
| `onvif_url` | string | No | (max 2048 characters) |
| `hardware_id` | string | No | The camera's MAC (`aa:bb:cc:dd:ee:ff`). User sessions only. |
| `client_id` | string | No | The vigiora-client that relays the camera (then `stream_url` is optional). |
| `remote_stream_name` | string | No | The stream name on the client. (max 128 characters) |
| `audio_device` | string | No | usb_audio only: the microphone on the client. (max 256 characters) |
| `stt_languages` | array of string | No | (max 8 items) |
| `ai_guardian_enabled` | boolean | No |  |
| `ai_live_enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","stream_url":"rtsp://viewer:example-password@192.0.2.20:554/stream1","recording_enabled":true}'
```

**Response** `201`: The new camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera

`GET /api/v1/cameras/{camera_id}`

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a camera

`PATCH /api/v1/cameras/{camera_id}`

Changes only the fields sent. A `stream_url` (or `onvif_url`) read back with `REDACTED` markers keeps the stored credentials (a marked URL pointing at a different host is refused). `client_id` and `hardware_id` are user sessions only (`403 api_key_not_allowed`): they decide where the camera's credentials go. Per-service AI settings are under `/cameras/{camera_id}/ai-services`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_camera`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 128 characters) |
| `stream_url` | string | No |  |
| `enabled` | boolean | No |  |
| `recording_enabled` | boolean | No |  |
| `retention_days` | integer | No | (1–3650) |
| `width` | integer | No | (16–7680) |
| `height` | integer | No | (16–4320) |
| `fps` | integer | No | (1–120) |
| `site_id` | integer or null | No | `null` removes the camera from its site. |
| `tags` | array of string | No | (max 32 items) |
| `sub_stream_url` | string | No | Sets the sub stream (cameras on this server's network; same IPv4 address as the main stream). |
| `onvif_url` | string or null | No | The ONVIF address PTZ uses; `null` clears it. On this server's network it must be the camera's own host (or carry its own credentials). Sending back a `REDACTED` value keeps the stored credentials. (max 2048 characters) |
| `hardware_id` | string or null | No | The camera's MAC; `null` forgets it (learned again while the stream works). User sessions only. |
| `client_id` | string or null | No | Moves the camera to another vigiora-client (`null`, this server). User sessions only. |
| `record_sub_stream` | boolean | No |  |
| `record_hd_on_motion` | boolean | No | Also keep the main (HD) stream while there is movement (needs `record_sub_stream`). API 1.100.0. |
| `has_ptz` | boolean | No | Set by hand (pins it; `ptz_manual: false` hands it back to detection). |
| `ptz_manual` | boolean | No |  |
| `onvif_enabled` | boolean | No | "Use ONVIF". `false`: Vigiora sends nothing to the camera over ONVIF (PTZ over ONVIF, presets, patrols, camera events, exposure, clock); the stored PTZ settings are kept. `true` turns it back on and checks the camera's PTZ again. API 1.101.0. |
| `ptz_zoom` | string: `optical`, `digital`, `null` or null | No |  |
| `ptz_settle_seconds` | number or null | No | API 1.53.0. Seconds motion stays ignored after Vigiora moves the camera; `null` = 3 s. (0–30) |
| `has_speaker` | boolean | No |  |
| `ai_guardian_enabled` | boolean | No |  |
| `ai_guardian_prompt` | string or null | No | (max 4096 characters) |
| `ai_live_enabled` | boolean | No | AI Live (the `hal-live` service). |
| `ai_live_env` | string: `retail`, `security`, `reception`, `home`, `custom` | No |  |
| `audio_monitoring_enabled` | boolean | No |  |
| `wake_word_enabled` | boolean | No |  |
| `stt_languages` | array of string | No | (max 8 items) |
| `stt_prompt` | string or null | No | (max 1024 characters) |
| `lat` | number or null | No | (-90–90) |
| `lon` | number or null | No | (-180–180) |
| `guardian_use_detections` | boolean or null | No | "Use object detections in descriptions"; `null` = automatic. |
| `guardian_clip_preroll_sec` | integer or null | No | Seconds before the triggering motion the camera's Guardian clips start; `null` = the server's setting. API 1.24.0. (0–10) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","retention_days":14}'
```

**Response** `200`: The updated camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a camera

`DELETE /api/v1/cameras/{camera_id}`

Deletes the camera and its recordings index; the owning vigiora-client drops it on its next heartbeat.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_camera`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Enable a camera

`POST /api/v1/cameras/{camera_id}/actions/enable`

Starts streaming (and recording, if `recording_enabled`).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `enable_camera`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/enable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disable a camera

`POST /api/v1/cameras/{camera_id}/actions/disable`

Stops streaming and recording. Recorded footage is kept.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disable_camera`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/disable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch AI on for a camera

`POST /api/v1/cameras/{camera_id}/actions/enable-ai`

Turns on the per-camera AI (detections, alerts, Guardian). Guardian looks at a camera when motion detection triggers it, so on a video camera without a motion trigger this also switches on the free `motion-detect` service; `services_enabled` lists what the call switched on, and `warnings` keeps `no_motion_trigger` when no trigger could be added. Past the plan's AI camera limit this is `402 limit_reached`; with `details.pending = true` the server is checking the plan and switches AI on by itself if it covers the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `enable_camera_ai`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/enable-ai" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ],
  "services_enabled": [
    "services-enabled"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch AI off for a camera

`POST /api/v1/cameras/{camera_id}/actions/disable-ai`

Refused with `409 dependent_service_assigned` while another AI service on the camera depends on it; motion detection stays on (motion recording and other services may use it); switch it off with `POST /cameras/{camera_id}/ai-services/motion-detect/actions/disable`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disable_camera_ai`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/disable-ai" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change several cameras at once

`POST /api/v1/cameras/actions/bulk-update`

Applies the same change (`enabled`, `recording_enabled`, `ai_enabled`) to up to 100 cameras, each with the rules of the single-camera operations (manager permission on the camera; the plan's AI camera limit). Each camera is reported separately: one failing does not undo the others, and the answer is `200` even when every camera failed. A camera whose AI is already in the requested state is left alone (and reported `ok`). Duplicate ids are reported once.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `bulk_update_cameras`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_ids` | array of integer | Yes | (max 100 items) |
| `enabled` | boolean | No |  |
| `recording_enabled` | boolean | No |  |
| `ai_enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/bulk-update" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"camera_ids":[3]}'
```

**Response** `200`: What happened to each camera.

```json
{
  "succeeded_count": 2,
  "failed_count": 2,
  "results": [
    {
      "camera_id": 3,
      "ok": false,
      "warnings": [
        {
          "code": "validation_error",
          "message": "This API key lacks the cameras:write scope.",
          "details": {}
        }
      ],
      "error": null
    }
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reorder the cameras

`POST /api/v1/cameras/actions/reorder`

Sets the order of the cameras on the Monitors page (and of `GET /cameras`), one order for the whole server and every user. `camera_ids` are cameras the caller can view, in the new order: they come first, the other cameras the caller can view follow in their current order, and the cameras the caller cannot view keep their places. Every camera's `sort_order` is rewritten (1..N) at once. `404 not_found`: an id the caller cannot view (nothing changed). Admins and operators. API 1.102.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_ids` | array of integer | Yes | Distinct ids (a repeated id is `400 validation_error`). (max 5000 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/reorder" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_ids":[3]}'
```

**Response** `200`: The new order of the cameras the caller can view.

```json
{
  "camera_ids": [
    3
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Recording transcription progress

`GET /api/v1/cameras/{camera_id}/actions/transcribe-recordings`

The progress of this camera's most recent recording-transcription run (API 1.71): whether it is still running, how many recording segments are done of the total, and how many transcripts it has added. Returns a zeroed body (`running: false`) when no run has ever started for the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/actions/transcribe-recordings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The run's progress.

```json
{
  "monitor_id": 1,
  "running": false,
  "segments_total": 1,
  "segments_done": 1,
  "transcripts_added": 1,
  "segments_failed": 1,
  "error": null
}
```

Errors: `401`, `403`, `404`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find objects in a camera frame

`POST /api/v1/cameras/{camera_id}/actions/detect-objects`

Runs open-vocabulary object recognition on one frame of the camera — live (`at` omitted) or the recorded frame at `at` — on this server's object recognition runner (the `hal-objects` Vision Engine service, a GPU module), and returns what it found: label, confidence and a box normalised to the frame. `prompts` lists what to look for in plain words (at most 20, 40 characters each, e.g. `["person", "red t-shirt", "parcel"]`); without prompts the runner uses the camera's own prompt list. With `annotate` (default true) the frame with the boxes drawn is kept for 15 minutes at `annotated_image_url`, readable by the same credential only. A recorded `at` also needs the `recordings:read` scope (`403 insufficient_scope`). Read-only: nothing is stored as a detection. `503 no_detector` when no runner is online, `504 detector_timeout` when it does not answer within 10 s, `502 detector_failed`; `422 clip_no_recordings` when no recording covers `at`; `503 snapshot_unavailable` when the camera gives no live frame. Limits per credential: 20 a minute and 2 AI operations at once (`429 rate_limited`).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `at` | string (RFC 3339) | No | The recorded frame at this time (RFC 3339 with an offset); omit for the live frame. |
| `prompts` | array of string | No | What to look for, in plain words (at most 40 characters each). Default the camera's list. (max 20 items) |
| `min_confidence` | number | No | Default 0.25 (the runner's). (0.01–0.99) |
| `annotate` | boolean | No | Keep the frame with the boxes drawn for 15 minutes. (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/detect-objects" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"at":"2026-10-30T14:05:00Z","prompts":["prompt"],"min_confidence":0.5,"annotate":true}'
```

**Response** `200`: The objects found.

```json
{
  "camera_id": 3,
  "objects": [
    {
      "label": "person",
      "confidence": 0.5,
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      }
    }
  ],
  "frame_time": "2026-10-30T14:05:00Z",
  "model": "model",
  "annotated_image_url": "annotated-image-url"
}
```

Errors: `400`, `401`, `403`, `404`, `413`, `422`, `429`, `502`, `503`, `504`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Annotated object recognition image

`GET /api/v1/object-images/{image_id}`

The frame or image with the found objects' boxes drawn, for 15 minutes after the request that made it, readable only by the credential that made it (the same user for a session); a camera frame also needs viewer permission on the camera still. Not served through a Cloudflare Tunnel origin (media is served by the media origin).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `image_id` | path | string | Yes | From `annotated_image_url`. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/object-images/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Live snapshot

`GET /api/v1/cameras/{camera_id}/snapshot`

A current JPEG frame. When the camera cannot produce one, a frame up to 2 minutes old may be served (`Age` header in seconds); otherwise `503 snapshot_unavailable`. A camera that gave no frame moments ago is not asked again for a while (30 s, growing to 5 minutes while it stays silent), and the answer is then immediate (the kept frame or the 503). Not served through a Cloudflare Tunnel origin (media is served by the media origin).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/snapshot" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A camera's panorama

`GET /api/v1/cameras/{camera_id}/panorama`

API 1.63.0. The running panorama capture (`phase`: `queued`, `sweeping`, `stitching`, `done`, `failed`) or, when none ran since the server started, the last stored panorama. In `done` the `scan` holds the picture's size, how it was joined (`stitch_status`: `stitched`, or `fallback` = the frames laid side by side), the per-frame pan position and the picture at `image_url`. Angles are relative to the sweep (`angle_basis: relative`, `pan_fraction` 0 = left end stop, 1 = right end stop); this is a scanned estimate, not a measurement. `404` until the first capture.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/panorama" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "job_id": "job-id",
  "camera_id": 3,
  "phase": "queued",
  "message": "This API key lacks the cameras:write scope.",
  "done": 1,
  "total": 1,
  "scan": {
    "id": 1,
    "camera_id": 3,
    "kind": "panorama",
    "angular_start_deg": 0.5,
    "angular_end_deg": 0.5,
    "angle_basis": "relative",
    "frames": [
      {
        "index": 1,
        "pan_fraction": 0.5,
        "pan_deg": 0.5,
        "path": "path"
      }
    ],
    "stitch_status": "stitched",
    "confidence": 0.5,
    "width": 1920,
    "height": 1080,
    "created_at": "2026-10-30T14:05:00Z"
  },
  "image_url": "image-url",
  "started_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Capture a panorama

`POST /api/v1/cameras/{camera_id}/panorama`

API 1.63.0. Starts a panorama capture in the background (`202`, poll `GET .../panorama`). A camera that pans sweeps its pan range (about a minute: it finds the end stops, stops at overlapping positions, then returns to where it started) and the frames are joined into one wide picture; Vigiora picks the number of frames. A camera that does not pan gives its single frame (`kind: single`). Nothing is judged by AI and no AI credits are used. A person moving the camera stops the sweep. `409` while a patrol, a patrol setup or another panorama runs on the camera, or for a camera behind a theia-client.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_camera_panorama`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/panorama" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: Started.

```json
{
  "job_id": "job-id",
  "camera_id": 3,
  "phase": "queued",
  "message": "This API key lacks the cameras:write scope.",
  "done": 1,
  "total": 1,
  "scan": {
    "id": 1,
    "camera_id": 3,
    "kind": "panorama",
    "angular_start_deg": 0.5,
    "angular_end_deg": 0.5,
    "angle_basis": "relative",
    "frames": [
      {
        "index": 1,
        "pan_fraction": 0.5,
        "pan_deg": 0.5,
        "path": "path"
      }
    ],
    "stitch_status": "stitched",
    "confidence": 0.5,
    "width": 1920,
    "height": 1080,
    "created_at": "2026-10-30T14:05:00Z"
  },
  "image_url": "image-url",
  "started_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A camera's panorama picture

`GET /api/v1/cameras/{camera_id}/panorama/image`

API 1.63.0. The latest stored panorama as a JPEG (at most 1280 px per frame wide).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/panorama/image" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: OK. (`image/jpeg`)

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disk the camera's recordings take

`GET /api/v1/cameras/{camera_id}/storage`

API 1.94.0. How much disk the camera's recordings take per day and over its retention. `measured` is what the camera really wrote: its finished recordings of the last 7 days, when there is at least an hour of them; `estimate` is the figure from the stream geometry (H.264 at ~0.1 bit per pixel per frame for the main stream, a D1 sub-stream when `record_sub_stream` is on, a flat 0.65 GB a day for a microphone). `bytes_per_day` and `projected_bytes` (over `retention_days`) use the measurement when there is one and the estimate otherwise; `source` says which. `used_bytes` is what the camera's recordings take right now. The query may describe a geometry other than the saved one (`width`, `height`, `fps`, `sub_stream`, `retention_days`), as a settings form does before saving: a different stream gets the estimate, since the measurement is for the other one. Feature `camera_storage`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `width` | query | integer | No | (≥ 1) |
| `height` | query | integer | No | (≥ 1) |
| `fps` | query | integer | No | (≥ 1) |
| `sub_stream` | query | boolean | No | Record the sub-stream instead of the main stream. |
| `hd_on_motion` | query | boolean | No | Also keep the main stream while there is movement (`record_hd_on_motion`). API 1.100.0. |
| `retention_days` | query | integer | No | (1–365) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/storage" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The figures.

```json
{
  "camera_id": 3,
  "measured": {
    "bytes_per_day": 0.5,
    "sample_seconds": 0.5,
    "since": "2026-10-30T14:05:00Z"
  },
  "estimate": {
    "bytes_per_day": 0.5,
    "basis": "main"
  },
  "bytes_per_day": 0.5,
  "source": "measured",
  "retention_days": 7,
  "projected_bytes": 0.5,
  "used_bytes": 0.5,
  "hd_bytes_per_day": 0.5,
  "hd_source": "measured"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Move a camera to its MAC's current address

`POST /api/v1/cameras/{camera_id}/actions/relocate`

For a LAN camera whose hardware id (MAC) the server has learned, finds the address that MAC has now (as `GET /network/lookup`) and, when it changed, rewrites the host of the camera's stream (and PTZ) URL through the same path automatic camera following uses: the go2rtc source and recorder follow and a `camera.moved` event is emitted. Before switching, the device at the new address must accept the camera's stored login (RTSP Digest, with a wrong-password control), so the credentials only go to the right camera. `dry_run: true` only reports what would change. An unchanged address answers `changed: false`. Refusals are `409 conflict` with `details.reason`: `no_hardware_id`, `not_lan_camera`, `device_not_found`, `ambiguous`, `shared_mac`, `ip_in_use`, `old_address_alive` (something still answers at the camera's current address), `mac_mismatch` (the new address does not answer with the camera's MAC when poked right before the login check; no login is sent then), `verify_failed`, `camera_changed`, `apply_failed`; `409 network_unavailable` when discovery cannot work on this server; `503 network_busy` (see Network). Counts against the lookup limit (30 a minute per credential). Residual risk: a device that impersonates the camera's MAC while the camera is offline passes the address checks; it receives only an RTSP Digest response (never the password) and must accept the stored login and refuse a wrong one before the camera is moved to it.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `relocate_camera`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dry_run` | boolean | No | Only report what would change (default false). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/relocate" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"dry_run":false}'
```

**Response** `200`: The result (applied, would apply, or unchanged).

```json
{
  "camera_id": 3,
  "mac": "mac",
  "old_ip": "old-ip",
  "new_ip": "new-ip",
  "changed": false,
  "applied": false,
  "dry_run": false,
  "source": "neighbor"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Name a camera from its picture

`POST /api/v1/cameras/actions/suggest-name`

API 1.36.0. The AI names a camera ` – <position>` ("Living room – TV side", "Kitchen – sink", "Carport – pool side") from a frame: the room it watches and where it is mounted or what it faces, chosen so the name fits the other cameras the caller can see (same style and language, a position that tells it apart from cameras in the same room, never a repeat). Give either `snapshot_jpeg_base64` (the thumbnail `POST /cameras/actions/detect` returned, for a camera being added) or `camera_id` (an existing camera: its latest cached snapshot is used, `503 snapshot_unavailable` when none was served yet). `site_id` picks the site whose cameras the name must fit (default: the existing camera's site, else all the caller sees); `vendor`, `model`, `current_name` and `language` are hints. The answer has the name, its room and position, up to three alternatives, a one-line reason and the names it was fitted to. One AI call with the frame and the latest frames of up to 6 other cameras, charged like a Guardian chat (feature `camera_name` in `GET /server` features). `503 ai_unavailable` when the server has no AI or the AI gave no usable name, `402 insufficient_credits` when out of credits. Nothing is renamed: the caller decides.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `snapshot_jpeg_base64` | string or null | No | A JPEG of the camera (base64), e.g. the detection's thumbnail. Either this or `camera_id`. (max 8400000 characters) |
| `camera_id` | integer or null | No | An existing camera; its latest cached snapshot is used. (≥ 1) |
| `site_id` | integer or null | No | The site whose cameras the name must fit. (≥ 1) |
| `vendor` | string or null | No | The maker (a hint, never put in the name). (max 64 characters) |
| `model` | string or null | No | The model (a hint, never put in the name). (max 100 characters) |
| `ip` | string or null | No | (max 64 characters) |
| `current_name` | string or null | No | The name the user has now (the default or what they typed). (max 100 characters) |
| `language` | string or null | No | BCP 47 UI language, used when no other camera names set one. (max 16 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/suggest-name" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"snapshot_jpeg_base64":"snapshot-jpeg-base64","camera_id":3,"site_id":1,"vendor":"vendor","model":"model","ip":"ip","current_name":"current-name","language":"language"}'
```

**Response** `200`: The suggested name.

```json
{
  "name": "Front door",
  "room": "room",
  "position": "position",
  "alternatives": [
    "alternative"
  ],
  "reason": "reason",
  "others": [
    "other"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Detect a camera's streams

`POST /api/v1/cameras/actions/detect`

Connects to the camera at `ip` with its login and finds its stream addresses, so nobody has to type an RTSP URL. ONVIF first (GetCapabilities, GetProfiles, GetStreamUri for the main and sub profiles, WS-Security digest), then the camera catalogue's stream templates for the brand (or the picked `model`, API 1.31.0) and a curated table of per-maker RTSP paths (Hikvision, EZVIZ, Dahua, Amcrest, Reolink, TP-Link Tapo, Uniview, Axis, Foscam, Wyze, eufy, Hanwha, VIVOTEK, XMEye, generic), each checked with a short RTSP DESCRIBE, over TLS for `rtsps://` (API 1.96.0: Wyze RTSPS on 322, Foscam on 88, a maker's fixed port; 8554 when 554 is closed and no `port` was given; at most 24 paths); `vendor` (or the maker the last network scan found for the address) is tried first. API 1.96.0: a UniFi Protect console (UniFi OS on HTTPS 443) is recognised and read with the user's UniFi login: `method: console`, `console: unifi_protect`, and `cameras` lists its cameras, each with its own `detection_id` (a camera whose RTSP is off in Protect too: `add-detected` turns RTSP on for it with the same login, or fails with `409 conflict`, `details.reason: console_rtsp_off`, saying which camera to turn it on for in Protect); the top-level `detection_id` is the first ready camera's. Answers within about 20 seconds with `ok: true`, the stream URLs **without credentials**, codec, size, frame rate and a JPEG thumbnail, and a `detection_id` (valid 30 minutes, for you only) to pass to `POST /cameras/actions/add-detected`; or `ok: false` with `failure` (`auth_failed`, `onvif_auth_failed`, `rtsp_closed`, `unreachable`, `no_stream`, `timeout`, `no_local_stream`), a message and a hint; `catalog` says what the camera catalogue knows about the camera. Cameras lock their account after a few failed logins, so: the login is sent only to `ip`, only when the camera asks for it; an RTSP refusal ends the detection at once and that login is not sent to that camera again for 30 minutes; an ONVIF refusal (API 1.96.0: for every brand, as many keep ONVIF users apart from the camera login) is followed by the stream paths with the same login, `onvif_login_refused: true` when one answered, and a refusal there counts as two; until an RTSP DESCRIBE with the login answered 200 (or 404: the camera checked the login, then found no such path), only one stream path gets it (paths are first checked without credentials); and after 3 refused logins in a sliding 30 minutes a camera gets no login at all (`429 rate_limited`, `details.reason: camera_login_budget`, `Retry-After`). `attempts_left` says how many refusals remain before then: warn the user. `ip` must be on a private subnet this server is connected to (as for network scans: RFC 1918 on a physical interface, never link-local, CGNAT or VPN interfaces; `400` with `details.connected_subnets`) and `port` one of the camera ports; where network discovery is unavailable (hosted servers, containers without host networking) this answers `409 network_unavailable`. Credentials are never logged or returned. This is active: it connects to the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `detect_camera`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | string | Yes | The camera's private (LAN) IPv4 address. (max 64 characters) |
| `port` | integer: `80`, `88`, `322`, `443`, `554`, `2020`, `7441`, `7447`, `8000`, `8080`, `8554`, `8899`, `9000`, `34567`, `37777`, `null` or null | No | Its RTSP port (default 554), one of the camera ports. ONVIF is looked for on the usual ports by itself. |
| `username` | string or null | No | (max 64 characters) |
| `password` | string or null | No | Never logged, stored only inside the detection on the server, never returned. (max 128 characters) |
| `vendor` | string or null | No | The maker (`Hikvision`, `Dahua`, `Reolink`, `TP-Link`, …), a vendor table id or a camera catalogue brand id (`GET /cameras/catalog/brands`); its paths are tried first. Default: the maker the last network scan found for the address. (max 64 characters) |
| `model` | string or null | No | API 1.31.0. A camera catalogue model (`model` of `GET /cameras/catalog`, e.g. `Tapo C230`), as the user picked it: its stream templates are tried first, and a model with no local stream fails with `no_local_stream`. (max 100 characters) |
| `unlock` | boolean or null | No | API 1.36.0. `true` sends the login once more although the camera refused it in the last 30 minutes or its failure budget is spent (the user fixed the camera's account, or knows the password is right). The refusal count restarts, so a login that is still wrong may lock the camera's account. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/detect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ip":"ip"}'
```

**Response** `200`: The detection (look at `ok`).

```json
{
  "ok": false,
  "detection_id": "detection-id",
  "expires_at": "2026-10-30T14:05:30Z",
  "ip": "ip",
  "port": 1,
  "method": "onvif",
  "vendor": "vendor",
  "vendor_name": "vendor-name",
  "main_url": "main-url",
  "sub_url": "sub-url",
  "codec": "codec",
  "width": 1920,
  "height": 1080,
  "fps": 0.5,
  "snapshot_jpeg_base64": "snapshot-jpeg-base64",
  "onvif": false,
  "auth_attempts": 1,
  "attempts_left": 1,
  "duration_ms": 1,
  "failure": {
    "code": "auth_failed",
    "message": "This API key lacks the cameras:write scope.",
    "hint": "hint"
  },
  "manufacturer": "manufacturer",
  "model": "model",
  "firmware": "firmware",
  "serial": "serial",
  "device_name": "device-name",
  "ptz": false,
  "audio_in": false,
  "audio_out": false,
  "has_audio": false,
  "vendor_source": "hint",
  "credential_hint": "credential-hint",
  "suggested_name": "suggested-name",
  "hal_objects_available": false,
  "catalog": {
    "brand_id": "brand-id",
    "brand": "brand",
    "model": "model",
    "name": "Front door",
    "matched_by": "model",
    "rtsp": "yes",
    "verified": false,
    "source": "source",
    "notes": "notes",
    "credential_hint": "credential-hint",
    "default_username": "default-username",
    "type": "type",
    "ptz": false,
    "likely_brands": [
      "likely-brand"
    ],
    "templates": [
      {
        "id": "id",
        "label": "person",
        "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
        "main": false,
        "kind": "video",
        "protocol": "rtsp",
        "verified": false,
        "notes": "notes"
      }
    ]
  },
  "tls": false,
  "onvif_login_refused": false,
  "console": "unifi_protect",
  "cameras": [
    {
      "id": "id",
      "name": "Front door",
      "model": "model",
      "mac": "mac",
      "connected": false,
      "rtsp_enabled": false,
      "main_url": "main-url",
      "sub_url": "sub-url",
      "tls": false,
      "width": 1920,
      "height": 1080,
      "fps": 0.5,
      "detection_id": "detection-id",
      "expires_at": "2026-10-30T14:05:30Z",
      "note": "note"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Detect several cameras with one login

`POST /api/v1/cameras/actions/detect-batch`

"Apply to all from this maker": runs `detectCamera` with one login for 1–32 addresses in the background and answers `202` with the batch to poll (`GET /cameras/detect-batches/{batch_id}`). Each camera is probed on its own (3 at a time, never two probes of one camera at once) with the same per-camera login budget; a camera whose budget is spent is not tried (`rate_limited: true`). One running batch per user (`409 conflict`, `details.reason: batch_running`) and at most 3 on the server (`details.reason: server_busy`). Every address must be valid, on a connected subnet, and listed once; `409 network_unavailable` as for `detectCamera`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `detect_camera_batch`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ips` | array of string | Yes | (max 32 items) |
| `port` | integer: `80`, `88`, `322`, `443`, `554`, `2020`, `7441`, `7447`, `8000`, `8080`, `8554`, `8899`, `9000`, `34567`, `37777`, `null` or null | No |  |
| `username` | string or null | No | (max 64 characters) |
| `password` | string or null | No | Never logged or returned. (max 128 characters) |
| `vendor` | string or null | No | (max 64 characters) |
| `model` | string or null | No | API 1.31.0, as for `detectCamera`. (max 100 characters) |
| `unlock` | boolean or null | No | API 1.36.0. `true` sends the login once more although the camera refused it in the last 30 minutes or its failure budget is spent (the user fixed the camera's account, or knows the password is right). The refusal count restarts, so a login that is still wrong may lock the camera's account. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/detect-batch" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ips":["ip"]}'
```

**Response** `202`: The batch started.

```json
{
  "id": "id",
  "status": "running",
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "items": [
    {
      "ip": "ip",
      "status": "pending",
      "result": {
        "ok": false,
        "detection_id": "detection-id",
        "expires_at": "2026-10-30T14:05:30Z",
        "ip": "ip",
        "port": 1,
        "method": "onvif",
        "vendor": "vendor",
        "vendor_name": "vendor-name",
        "main_url": "main-url",
        "sub_url": "sub-url",
        "codec": "codec",
        "width": 1920,
        "height": 1080,
        "fps": 0.5,
        "snapshot_jpeg_base64": "snapshot-jpeg-base64",
        "onvif": false,
        "auth_attempts": 1,
        "attempts_left": 1,
        "duration_ms": 1,
        "failure": {
          "code": null,
          "message": null,
          "hint": null
        },
        "manufacturer": "manufacturer",
        "model": "model",
        "firmware": "firmware",
        "serial": "serial",
        "device_name": "device-name",
        "ptz": false,
        "audio_in": false,
        "audio_out": false,
        "has_audio": false,
        "vendor_source": "hint",
        "credential_hint": "credential-hint",
        "suggested_name": "suggested-name",
        "hal_objects_available": false,
        "catalog": {
          "brand_id": null,
          "brand": null,
          "model": null,
          "name": null,
          "matched_by": null,
          "rtsp": null,
          "verified": null,
          "source": null,
          "notes": null,
          "credential_hint": null,
          "default_username": null,
          "type": null,
          "ptz": null,
          "likely_brands": null,
          "templates": null
        },
        "tls": false,
        "onvif_login_refused": false,
        "console": "unifi_protect",
        "cameras": [
          {
            "id": null,
            "name": null,
            "model": null,
            "mac": null,
            "connected": null,
            "rtsp_enabled": null,
            "main_url": null,
            "sub_url": null,
            "tls": null,
            "width": null,
            "height": null,
            "fps": null,
            "detection_id": null,
            "expires_at": null,
            "note": null
          }
        ]
      },
      "rate_limited": false,
      "retry_after_seconds": 1
    }
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera detection batch

`GET /api/v1/cameras/detect-batches/{batch_id}`

The batch's status (`running`, `done`) and each camera's (`pending`, `running`, `done`) with its detection once done. Yours only; the last 10 batches are kept in memory, not across restarts.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `batch_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/detect-batches/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The batch.

```json
{
  "id": "id",
  "status": "running",
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "items": [
    {
      "ip": "ip",
      "status": "pending",
      "result": {
        "ok": false,
        "detection_id": "detection-id",
        "expires_at": "2026-10-30T14:05:30Z",
        "ip": "ip",
        "port": 1,
        "method": "onvif",
        "vendor": "vendor",
        "vendor_name": "vendor-name",
        "main_url": "main-url",
        "sub_url": "sub-url",
        "codec": "codec",
        "width": 1920,
        "height": 1080,
        "fps": 0.5,
        "snapshot_jpeg_base64": "snapshot-jpeg-base64",
        "onvif": false,
        "auth_attempts": 1,
        "attempts_left": 1,
        "duration_ms": 1,
        "failure": {
          "code": null,
          "message": null,
          "hint": null
        },
        "manufacturer": "manufacturer",
        "model": "model",
        "firmware": "firmware",
        "serial": "serial",
        "device_name": "device-name",
        "ptz": false,
        "audio_in": false,
        "audio_out": false,
        "has_audio": false,
        "vendor_source": "hint",
        "credential_hint": "credential-hint",
        "suggested_name": "suggested-name",
        "hal_objects_available": false,
        "catalog": {
          "brand_id": null,
          "brand": null,
          "model": null,
          "name": null,
          "matched_by": null,
          "rtsp": null,
          "verified": null,
          "source": null,
          "notes": null,
          "credential_hint": null,
          "default_username": null,
          "type": null,
          "ptz": null,
          "likely_brands": null,
          "templates": null
        },
        "tls": false,
        "onvif_login_refused": false,
        "console": "unifi_protect",
        "cameras": [
          {
            "id": null,
            "name": null,
            "model": null,
            "mac": null,
            "connected": null,
            "rtsp_enabled": null,
            "main_url": null,
            "sub_url": null,
            "tls": null,
            "width": null,
            "height": null,
            "fps": null,
            "detection_id": null,
            "expires_at": null,
            "note": null
          }
        ]
      },
      "rate_limited": false,
      "retry_after_seconds": 1
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add detected cameras

`POST /api/v1/cameras/actions/add-detected`

Creates a camera for each detection (`detection_id` from `detectCamera` or a batch) through `POST /cameras`: the same validation, plan limits, events and streaming setup, with the stream URL (and its credentials) kept on the server, so they never pass through the client. Size and frame rate come from the detection; the recording default applies unless `recording_enabled` is given; a sub stream is set up automatically where the camera has one. Answers `201` when at least one camera was created (else `200`) with `created` (the cameras) and `failed` (each detection's v1 error, e.g. `not_found` for an expired detection, `limit_reached`, `validation_error`; API 1.96.0: `conflict` with `details.reason: console_rtsp_off` for a console camera whose RTSP could not be turned on). A console camera (API 1.96.0) whose RTSP is off is turned on in the console first, with the console login the detection keeps; without a `name` it is named as in the console. At most 32 at a time.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `add_detected_cameras`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cameras` | array of AddDetectedCamera | Yes | (max 32 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/add-detected" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"cameras":[{"detection_id":"detection-id","name":"Front door","enabled":true,"recording_enabled":true,"site_id":1,"tags":["entrance"],"width":1920,"height":1080,"fps":15,"ai_guardian_enabled":false,"hal_objects":false}]}'
```

**Response** `200`: No camera was created (see `failed`).

```json
{
  "created": [
    {
      "speaker": {
        "kind": "voice",
        "siren": false,
        "checked_at": "2026-10-30T14:05:00Z"
      },
      "id": 1,
      "name": "Front door",
      "enabled": true,
      "status": "online",
      "source_type": "rtsp",
      "connection_type": "local",
      "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
      "width": 1920,
      "height": 1080,
      "fps": 15,
      "recording_enabled": true,
      "retention_days": 7,
      "ai_enabled": true,
      "ai_guardian_enabled": false,
      "ai_live_enabled": false,
      "has_ptz": false,
      "has_speaker": false,
      "talk": {
        "available": false,
        "reason": "no_speaker"
      },
      "has_audio": false,
      "site_id": 1,
      "client_id": null,
      "client_name": null,
      "client_status": null,
      "tags": [
        "entrance"
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "sub_stream_name": "sub-stream-name",
      "record_sub_stream": false,
      "record_hd_on_motion": false,
      "onvif_url": "onvif-url",
      "hardware_id": "hardware-id",
      "audio_monitoring_enabled": false,
      "wake_word_enabled": false,
      "ptz_manual": false,
      "onvif_enabled": false,
      "sort_order": 1,
      "brand": "brand",
      "model": "model",
      "brand_source": "camera",
      "body_type": "bullet",
      "ptz_zoom": "ptz-zoom",
      "ptz_settle_seconds": 0.5,
      "ai_guardian_prompt": "ai-guardian-prompt",
      "ai_live_env": "ai-live-env",
      "stt_languages": [
        "stt-language"
      ],
      "stt_prompt": "stt-prompt",
      "lat": 0.5,
      "lon": 0.5,
      "source_error": "source-error",
      "guardian_use_detections": false,
      "guardian_use_detections_set": false,
      "guardian_clip_preroll_sec": 1,
      "ai_services": [
        "ai-service"
      ],
      "warnings": [
        "warning"
      ]
    }
  ],
  "failed": [
    {
      "detection_id": "detection-id",
      "error": null
    }
  ]
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List streams vigiora-clients offer

`GET /api/v1/cameras/available-streams`

The camera streams and USB microphones online vigiora-clients publish, for `POST /cameras` with `client_id` (`remote_stream_name` = `stream`, or `audio_device` for a microphone). One page.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/available-streams" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The streams.

```json
{
  "data": [
    {
      "type": "camera",
      "name": "Front door",
      "stream": "stream",
      "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
      "client": "client",
      "client_ip": "client-ip",
      "audio_device": "audio-device"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Search the camera catalogue

`GET /api/v1/cameras/catalog`

API 1.31.0. Searches the embedded Vigiora camera catalogue for the "pick the model" box of the add-camera flow: `q` is a model, an alias, a brand or both (`Tapo C230`, `2047`, `ring doorbell`, `reolink`). Models match exactly (with or without the brand name), by prefix, then by substring of the model, alias or family; a brand name lists the brand (an entry with `model: null`) and its models. Best first, at most `limit`. Each entry says whether it streams locally (`rtsp`, `no` = app/cloud only), whether its facts were checked on the manufacturer's page (`verified`, `source`), the login advice, and its stream URL templates with `{host}` left for the camera's address (and `{user}` / `{pass}` in a query string; an rtsp URL carries no login: add it URL-encoded). One page. The catalogue's data is CC BY-SA 4.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | Yes | What to look for, 1-100 characters. (max 100 characters) |
| `limit` | query | integer | No | At most this many entries (default 20). (1–50, default `20`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/catalog" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The entries, best first.

```json
{
  "data": [
    {
      "brand_id": "brand-id",
      "brand": "brand",
      "model": "model",
      "name": "Front door",
      "aliases": [
        "aliase"
      ],
      "family": "family",
      "type": "type",
      "resolution": "resolution",
      "connectivity": "poe",
      "rtsp": "yes",
      "onvif_profile": "onvif-profile",
      "ptz": false,
      "audio": "mic",
      "verified": false,
      "source": "source",
      "notes": "notes",
      "credential_hint": "credential-hint",
      "default_username": "default-username",
      "rtsp_port": 1,
      "templates": [
        {
          "id": "id",
          "label": "person",
          "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
          "main": false,
          "kind": "video",
          "protocol": "rtsp",
          "verified": false,
          "notes": "notes"
        }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the camera catalogue's brands

`GET /api/v1/cameras/catalog/brands`

API 1.31.0. Every brand of the embedded camera catalogue with its local-stream support, default ports, login advice and model count. One page. Its version is `camera_catalog_version` of `GET /server`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/catalog/brands" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The brands.

```json
{
  "data": [
    {
      "id": "id",
      "name": "Front door",
      "aliases": [
        "aliase"
      ],
      "website": "website",
      "rtsp": "yes",
      "rtsp_port": 1,
      "onvif_port": 1,
      "onvif": false,
      "default_username": "default-username",
      "credential_hint": "credential-hint",
      "notes": "notes",
      "verified": false,
      "source": "source",
      "models": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's hardware id

`GET /api/v1/cameras/{camera_id}/hardware-id`

The MAC addresses learned for the camera's stream hosts and the latest thing camera following did (moved, not found, cleared, …). Change it with `PATCH /cameras/{camera_id}` `hardware_id` (user sessions).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Camera permission | at least manager |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/hardware-id" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The hardware id.

```json
{
  "mac": "mac",
  "vendor": "vendor",
  "last_ip": "last-ip",
  "last_seen_at": "last-seen-at",
  "sources": [
    {
      "source": "source",
      "mac": "mac",
      "vendor": "vendor",
      "last_ip": "last-ip",
      "learned_at": "learned-at",
      "last_seen_at": "last-seen-at"
    }
  ],
  "last_event": {
    "kind": "kind",
    "old_ip": "old-ip",
    "new_ip": "new-ip",
    "detail": "detail",
    "created_at": "created-at"
  }
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's AI services

`GET /api/v1/cameras/{camera_id}/ai-services`

Every AI service the server has (Core AI, motion detection, speech-to-text, AI Live, scene alerts, counters, …) with whether it is on for the camera, its dependencies, its per-camera settings (`config`, and the settings it accepts in `config_fields`) and warnings: the `core-ai` entry carries `no_motion_trigger` when AI is on but motion detection is off (Guardian then never looks at the camera). API keys see only per-camera settings. One page.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ai-services" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The services.

```json
{
  "data": [
    {
      "service_name": "service-name",
      "label": "person",
      "description": "description",
      "kind": "kind",
      "enabled": true,
      "plan_limited": false,
      "requires_any": [
        "requires-any"
      ],
      "dependency_met": false,
      "missing_dependencies": [
        "missing-dependencie"
      ],
      "soft_requires": [
        "soft-require"
      ],
      "soft_dependencies_missing": [
        "soft-dependencies-missing"
      ],
      "config": {},
      "config_fields": [
        {
          "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
          "type": "type",
          "label": "person",
          "help": "help",
          "min": 0.5,
          "max": 0.5,
          "default": null
        }
      ],
      "warnings": [
        "warning"
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch an AI service on for a camera

`POST /api/v1/cameras/{camera_id}/ai-services/{ai_service_id}/actions/enable`

Plan-limited services (`plan_limited`) count against the plan (`402 limit_reached`); a service whose `requires_any` is not on is `409 dependency_not_met`. `core-ai` behaves as `POST /cameras/{camera_id}/actions/enable-ai`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `enable_camera_ai_service`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `ai_service_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ai-services/42/actions/enable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The service.

```json
{
  "service_name": "service-name",
  "label": "person",
  "description": "description",
  "kind": "kind",
  "enabled": true,
  "plan_limited": false,
  "requires_any": [
    "requires-any"
  ],
  "dependency_met": false,
  "missing_dependencies": [
    "missing-dependencie"
  ],
  "soft_requires": [
    "soft-require"
  ],
  "soft_dependencies_missing": [
    "soft-dependencies-missing"
  ],
  "config": {},
  "config_fields": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "type": "type",
      "label": "person",
      "help": "help",
      "min": 0.5,
      "max": 0.5,
      "default": null
    }
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch an AI service off for a camera

`POST /api/v1/cameras/{camera_id}/ai-services/{ai_service_id}/actions/disable`

Refused with `409 dependent_service_assigned` while another service on the camera needs it.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disable_camera_ai_service`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `ai_service_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ai-services/42/actions/disable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The service.

```json
{
  "service_name": "service-name",
  "label": "person",
  "description": "description",
  "kind": "kind",
  "enabled": true,
  "plan_limited": false,
  "requires_any": [
    "requires-any"
  ],
  "dependency_met": false,
  "missing_dependencies": [
    "missing-dependencie"
  ],
  "soft_requires": [
    "soft-require"
  ],
  "soft_dependencies_missing": [
    "soft-dependencies-missing"
  ],
  "config": {},
  "config_fields": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "type": "type",
      "label": "person",
      "help": "help",
      "min": 0.5,
      "max": 0.5,
      "default": null
    }
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change a camera's AI service settings

`PATCH /api/v1/cameras/{camera_id}/ai-services/{ai_service_id}`

Sets the service's per-camera settings: only the keys in its `config_fields`, within their bounds (`null` = back to the default). Free-form service configuration stays in the web app.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_camera_ai_service`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `ai_service_id` | path | string | Yes | (max 64 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `config` | object | Yes | Setting key → value (`null` = default). Keys from `config_fields`. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/ai-services/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"config":{}}'
```

**Response** `200`: The service.

```json
{
  "service_name": "service-name",
  "label": "person",
  "description": "description",
  "kind": "kind",
  "enabled": true,
  "plan_limited": false,
  "requires_any": [
    "requires-any"
  ],
  "dependency_met": false,
  "missing_dependencies": [
    "missing-dependencie"
  ],
  "soft_requires": [
    "soft-require"
  ],
  "soft_dependencies_missing": [
    "soft-dependencies-missing"
  ],
  "config": {},
  "config_fields": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "type": "type",
      "label": "person",
      "help": "help",
      "min": 0.5,
      "max": 0.5,
      "default": null
    }
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's reference frame

`GET /api/v1/cameras/{camera_id}/reference-frame`

The stored picture `compare` checks the live view against.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/reference-frame" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The JPEG. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a reference frame

`DELETE /api/v1/cameras/{camera_id}/reference-frame`

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_reference_frame`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/reference-frame" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Capture a reference frame

`POST /api/v1/cameras/{camera_id}/reference-frame/actions/capture`

Stores the camera's current picture as its reference frame (replacing the previous one).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/reference-frame/actions/capture" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Captured.

```json
{
  "camera_id": 3,
  "size_bytes": 7340032
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read QR codes now

`POST /api/v1/cameras/{camera_id}/actions/read-qr`

Reads the QR codes in the camera's live picture now (API 1.84.0), looking harder than the motion reads (the quarters of the picture upscaled too), on the server CPU: no AI credits. Each code found is recorded like a motion read (an alert `qr:<payload>` and a QR code read; the same code is recorded once a minute per camera, `recorded: false` otherwise). With `image_base64` (a JPEG, PNG or WebP still, at most 10 MB; operator permission on the camera) that picture is read instead of the live one, as if the camera had seen it. 503 when the camera gives no picture.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `image_base64` | string or null | No | A still to read instead of the live picture (base64, or a data URL). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/read-qr" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"image_base64":"image-base64"}'
```

**Response** `200`: The codes found.

```json
{
  "camera_id": 3,
  "codes": [
    {
      "payload": "payload",
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "corners": [
        [
          0.5
        ]
      ],
      "frame_width": 1,
      "frame_height": 1,
      "recorded": false,
      "read_id": 1,
      "alert_id": 1
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's current object counts

`GET /api/v1/cameras/{camera_id}/objects`

People, vehicles, faces, plates and weapons the detectors see now.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/objects" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The counts.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's stream pipeline health

`GET /api/v1/cameras/{camera_id}/pipeline`

Each hop of the camera's video (camera, client, mesh, server, recorder, viewers) with its state and bitrate, as the web app's pipeline panel shows it.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/pipeline" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The pipeline.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's audio capture health

`GET /api/v1/cameras/{camera_id}/audio-status`

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/audio-status" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The audio status.

```json
{
  "state": "state",
  "enabled": true,
  "speech_today": {
    "date": "date",
    "clips_cut": 1,
    "skipped_quiet": 1,
    "skipped_other_microphone": 1,
    "backfill_clips": 1,
    "backfill_silent": 1,
    "whisper_calls": 1,
    "deepgram_calls": 1,
    "gemini_calls": 1,
    "gemini_audio_seconds": 0.5,
    "voice_match_calls": 1,
    "no_text": 1,
    "kept": 1
  },
  "room_speech": {
    "room_id": 1,
    "room_name": "room-name",
    "mode": "mode",
    "transcribed": false,
    "microphone_camera_id": 3,
    "microphone_name": "microphone-name",
    "reason": "reason",
    "reason_code": "reason-code",
    "values": {}
  }
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Measure a camera's audio level

`GET /api/v1/cameras/{camera_id}/audio-level`

Listens to the stream for about 2 seconds and reports `mean_db` and `max_db` (per-credential limits as for AI operations).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/audio-level" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The level.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Re-send a microphone to its client

`POST /api/v1/cameras/{camera_id}/actions/repush`

Queues a USB microphone camera to its vigiora-client again, when the client lost it.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/repush" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Queued.

```json
{
  "camera_id": 3,
  "queued": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's privacy masks

`GET /api/v1/cameras/{camera_id}/privacy-masks`

API 1.108.0. A camera's privacy masks, oldest first: up to 8 polygons in picture coordinates (0..1 from the top left). The server paints them black on every still picture of the camera it sends or gives an AI (snapshots, frames, alert, push and email pictures, Guardian and cloud AI frames, add-on frames, thumbnails), re-encodes clip exports, mosaics and public clip links of the camera with them burned in, and drops detections whose box centre is inside one. The web player draws them over live view and playback. NOT masked: the recording files on disk and the camera's stream read directly over RTSP or go2rtc (including add-ons and AI runners that read the stream); only a privacy mask set on the camera itself masks at the source. A camera without masks answers an empty list.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/privacy-masks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The masks.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "points": [
        [
          0.5
        ]
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "max_masks": 1
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a privacy mask to a camera

`POST /api/v1/cameras/{camera_id}/privacy-masks`

API 1.108.0. Adds a black polygon (3 to 12 `points`, each `[x, y]` between 0 and 1 from the top left of the picture; an optional `name` of at most 64 characters). It applies at once to every picture and export the server makes (see `listPrivacyMasks` for what is and is not masked). At most 8 per camera: a ninth is `409 conflict`. Adding a mask only hides more, so it needs no confirmation.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `points` | array of array of number | Yes | (max 12 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/privacy-masks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"points":[[0.5]]}'
```

**Response** `201`: The new mask.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a privacy mask

`GET /api/v1/cameras/{camera_id}/privacy-masks/{mask_id}`

API 1.108.0. One of the camera's privacy masks; a mask of another camera is `404`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `mask_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/privacy-masks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The mask.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename or reshape a privacy mask

`PATCH /api/v1/cameras/{camera_id}/privacy-masks/{mask_id}`

API 1.108.0. Changes a mask's `name` and/or `points` (same rules as `createPrivacyMask`; at least one field). Reshaping can uncover part of the picture, so it asks for confirmation when human in the loop is on.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_privacy_mask`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `mask_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `points` | array of array of number | No | (max 12 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/privacy-masks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","points":[[0.5]]}'
```

**Response** `200`: The mask.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a privacy mask

`DELETE /api/v1/cameras/{camera_id}/privacy-masks/{mask_id}`

API 1.108.0. Removes a mask: the part of the picture it hid shows again in every picture, export and the player from then on (pictures and exports made before keep it).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_privacy_mask`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `mask_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/privacy-masks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Removed.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's motion zones

`GET /api/v1/cameras/{camera_id}/motion-zones`

API 1.119.0. A camera's motion zones, oldest first (up to 8 polygons in picture coordinates, 0..1 from the top left), and its `mode`. In mode `ignore` (the default) movement inside the zones does not count as motion; in mode `only` only movement inside them counts. Movement that does not count starts nothing that motion starts: no motion event (`motion.started`), no Guardian analysis, no motion or HD-on-motion recording, no AI Live tick, no patrol hold or follow. The motion detector leaves the pixels out before it looks for a moving area; a person, vehicle or animal detection that would start a Guardian analysis is judged by its box centre. Zones never hide or change the picture, recordings, snapshots or streams (that is `listPrivacyMasks`). NOT affected: the camera's own ONVIF motion events (they carry no position), object detections as such (still stored, label alert rules still apply), audio and alerts sent in through `createAlert`. A camera without zones answers an empty list and behaves as before.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/motion-zones" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The zones and the mode.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "points": [
        [
          0.5
        ]
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "mode": "ignore",
  "max_zones": 1
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a motion zone to a camera

`POST /api/v1/cameras/{camera_id}/motion-zones`

API 1.119.0. Adds a polygon (3 to 12 `points`, each `[x, y]` between 0 and 1 from the top left of the picture; an optional `name` of at most 64 characters). It applies to motion within seconds (see `listMotionZones`). At most 8 per camera: a ninth is `409 conflict`. A zone can stop motion from starting recordings, alerts and AI, so it asks for confirmation when human in the loop is on.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_motion_zone`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `points` | array of array of number | Yes | (max 12 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/motion-zones" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"points":[[0.5]]}'
```

**Response** `201`: The new zone.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a motion zone

`GET /api/v1/cameras/{camera_id}/motion-zones/{zone_id}`

API 1.119.0. One of the camera's motion zones; a zone of another camera is `404`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `zone_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/motion-zones/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The zone.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename or reshape a motion zone

`PATCH /api/v1/cameras/{camera_id}/motion-zones/{zone_id}`

API 1.119.0. Changes a zone's `name` and/or `points` (same rules as `createMotionZone`; at least one field). Reshaping changes which motion counts, so it asks for confirmation when human in the loop is on.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_motion_zone`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `zone_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `points` | array of array of number | No | (max 12 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/motion-zones/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","points":[[0.5]]}'
```

**Response** `200`: The zone.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "points": [
    [
      0.5
    ]
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a motion zone

`DELETE /api/v1/cameras/{camera_id}/motion-zones/{zone_id}`

API 1.119.0. Removes a zone. Without zones left the camera counts all movement again, as before.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_motion_zone`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `zone_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/motion-zones/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Removed.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's motion zone mode

`GET /api/v1/cameras/{camera_id}/motion-zone-settings`

API 1.119.0. The camera's motion zone `mode`: `ignore` (default; movement inside the zones does not count) or `only` (only movement inside the zones counts). It does nothing while the camera has no zones.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/motion-zone-settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The mode.

```json
{
  "mode": "ignore"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set a camera's motion zone mode

`PATCH /api/v1/cameras/{camera_id}/motion-zone-settings`

API 1.119.0. Sets `mode` to `ignore` or `only`. Switching changes which motion counts, so it asks for confirmation when human in the loop is on.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `patch_motion_zone_settings`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `ignore`, `only` | Yes |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/motion-zone-settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"ignore"}'
```

**Response** `200`: The mode.

```json
{
  "mode": "ignore"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's clock check

`GET /api/v1/cameras/{camera_id}/clock`

API 1.45.0. A camera keeps its own clock: one that is hours off, or back in 1970 because it has no time server, burns the wrong time into its picture and stamps its events wrongly. This is the latest check of the camera's own date, time, time zone and time sync against the server's: `status` `ok`, `drift` (more than 60 s from the server's UTC; `offset_seconds` is the camera's UTC minus the server's, negative = behind), `timezone` (the camera's local offset differs from the server's zone), `no_ntp` (right now, but the camera does not sync with a time server) or `unknown` (the clock could not be read; `message` says why), with a plain `message` ("Camera clock is 15 h behind the server"). The camera is read over ONVIF `GetSystemDateAndTime` (anonymous first, then with the camera login from its stream address) or, when ONVIF does not answer, Hikvision/EZVIZ ISAPI `/ISAPI/System/time`. A Reolink camera (API 1.48.0; known by its stream path or its ONVIF maker) is read over Reolink's own API instead (`method: reolink`: its HTTP API, else the Reolink app port 9000), because over ONVIF it reports time sync off while it is on. The camera is compared with its site zone (API 1.50.0, `site_timezone`: the camera's own setting, its client's, or the server's). A camera behind a vigiora-client is read through the client (client 1.16.0 or newer on the Vigiora network; an older client answers `unknown` with "needs client 1.16.0" in `message`). Cameras are checked when added, every 6 hours, and every 10 minutes while their clock cannot be read; with `camera_clock_autofix_enabled` a bad clock is then fixed automatically (`auto_fix`). When the camera was never checked, or with `refresh=true`, it is checked now (a check younger than 20 seconds is reused). A camera that is not an IP camera (a microphone) is `409 conflict`. Fix a bad clock with `POST /cameras/{camera_id}/actions/set-clock`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `refresh` | query | boolean | No | `true`: read the camera now instead of answering the stored check. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/clock" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The clock check.

```json
{
  "site_timezone": "site-timezone",
  "site_utc_offset_seconds": 1,
  "site_timezone_source": "camera",
  "timezone_setting": "timezone-setting",
  "auto_fix": {
    "at": "2026-10-30T14:05:00Z",
    "ok": false,
    "message": "This API key lacks the cameras:write scope."
  },
  "status": "ok",
  "offset_seconds": 1,
  "camera_time": "2026-10-30T14:05:00Z",
  "camera_timezone": "camera-timezone",
  "camera_utc_offset_seconds": 1,
  "server_timezone": "server-timezone",
  "server_utc_offset_seconds": 1,
  "ntp": false,
  "method": "onvif",
  "checked_at": "2026-10-30T14:05:00Z",
  "message": "This API key lacks the cameras:write scope."
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set the time zone a camera's clock should be in

`PATCH /api/v1/cameras/{camera_id}/clock`

API 1.50.0. Sets (`null` clears) the camera's own site zone: the zone its clock is compared with and set to. Without it a camera behind a vigiora-client uses its client's zone (`PATCH /clients/{client_id}`, else the one the client reports) and other cameras the server's. The camera is then read again (and, with `camera_clock_autofix_enabled`, fixed in the background); the answer is the new check. Audited (`camera.clock.timezone`).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_camera_clock`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timezone` | string or null | Yes | An IANA zone (`Europe/Rome`); `null` or `""` = the client's or the server's. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/clock" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"timezone":"timezone"}'
```

**Response** `200`: The clock check against the new zone.

```json
{
  "site_timezone": "site-timezone",
  "site_utc_offset_seconds": 1,
  "site_timezone_source": "camera",
  "timezone_setting": "timezone-setting",
  "auto_fix": {
    "at": "2026-10-30T14:05:00Z",
    "ok": false,
    "message": "This API key lacks the cameras:write scope."
  },
  "status": "ok",
  "offset_seconds": 1,
  "camera_time": "2026-10-30T14:05:00Z",
  "camera_timezone": "camera-timezone",
  "camera_utc_offset_seconds": 1,
  "server_timezone": "server-timezone",
  "server_utc_offset_seconds": 1,
  "ntp": false,
  "method": "onvif",
  "checked_at": "2026-10-30T14:05:00Z",
  "message": "This API key lacks the cameras:write scope."
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set a camera's clock to the server's

`POST /api/v1/cameras/{camera_id}/actions/set-clock`

API 1.45.0. Sets the camera's clock to the server's UTC now and, when the camera takes them, its time zone to the camera's site zone (API 1.50.0: `site_timezone` of the clock check; before, always the server's) (as a POSIX TZ string) and time sync (NTP) on, keeping a time server the camera already has, else `pool.ntp.org`. Uses ONVIF `SetSystemDateAndTime` / `SetNTP` (WS-Security with the camera login, dated on the camera's own clock however wrong it is) or Hikvision ISAPI; on a Reolink camera (API 1.48.0) Reolink's own API, which also sets its time zone, daylight-saving rule and time sync (Reolink ignores them over ONVIF). It never leaves the camera worse: a refused time zone is retried without it, a refused time sync leaves the manual time, and a time sync that leaves the clock wrong (the camera cannot reach a time server) is undone back to the manual time. Then the clock is read again: `ok` says whether it is right now, `before` and `after` are the checks, `notes` what the camera refused. What the camera reports afterwards decides: some firmwares (Reolink over ONVIF) accept a time zone or time sync and keep their own, which `timezone_set` / `ntp_enabled` false and `notes` say. A camera that refuses the new time, or keeps its own time zone, answers `200` with `ok: false` and the reason in `message`. The camera login must be in the camera's stream address. `409 conflict` for a camera not on this server's network, or while a set is already running for it.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_camera_clock`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/set-clock" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What was set (look at `ok`).

```json
{
  "ok": false,
  "message": "This API key lacks the cameras:write scope.",
  "time_set": false,
  "timezone_set": false,
  "ntp_enabled": false,
  "notes": [
    "note"
  ],
  "before": {
    "site_timezone": "site-timezone",
    "site_utc_offset_seconds": 1,
    "site_timezone_source": "camera",
    "timezone_setting": "timezone-setting",
    "auto_fix": {
      "at": "2026-10-30T14:05:00Z",
      "ok": false,
      "message": "This API key lacks the cameras:write scope."
    },
    "status": "ok",
    "offset_seconds": 1,
    "camera_time": "2026-10-30T14:05:00Z",
    "camera_timezone": "camera-timezone",
    "camera_utc_offset_seconds": 1,
    "server_timezone": "server-timezone",
    "server_utc_offset_seconds": 1,
    "ntp": false,
    "method": "onvif",
    "checked_at": "2026-10-30T14:05:00Z",
    "message": "This API key lacks the cameras:write scope."
  },
  "after": {
    "site_timezone": "site-timezone",
    "site_utc_offset_seconds": 1,
    "site_timezone_source": "camera",
    "timezone_setting": "timezone-setting",
    "auto_fix": {
      "at": "2026-10-30T14:05:00Z",
      "ok": false,
      "message": "This API key lacks the cameras:write scope."
    },
    "status": "ok",
    "offset_seconds": 1,
    "camera_time": "2026-10-30T14:05:00Z",
    "camera_timezone": "camera-timezone",
    "camera_utc_offset_seconds": 1,
    "server_timezone": "server-timezone",
    "server_utc_offset_seconds": 1,
    "ntp": false,
    "method": "onvif",
    "checked_at": "2026-10-30T14:05:00Z",
    "message": "This API key lacks the cameras:write scope."
  }
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check the clock of a camera being added

`POST /api/v1/cameras/actions/check-clock`

API 1.45.0. The clock check of `GET /cameras/{camera_id}/clock` for a camera found by `POST /cameras/actions/detect` and not added yet (`detection_id`, yours and unexpired; `404` otherwise). Reads the camera now; nothing is stored or changed.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detection_id` | string | Yes | From `POST /cameras/actions/detect`. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/check-clock" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"detection_id":"detection-id"}'
```

**Response** `200`: The clock check.

```json
{
  "site_timezone": "site-timezone",
  "site_utc_offset_seconds": 1,
  "site_timezone_source": "camera",
  "timezone_setting": "timezone-setting",
  "auto_fix": {
    "at": "2026-10-30T14:05:00Z",
    "ok": false,
    "message": "This API key lacks the cameras:write scope."
  },
  "status": "ok",
  "offset_seconds": 1,
  "camera_time": "2026-10-30T14:05:00Z",
  "camera_timezone": "camera-timezone",
  "camera_utc_offset_seconds": 1,
  "server_timezone": "server-timezone",
  "server_utc_offset_seconds": 1,
  "ntp": false,
  "method": "onvif",
  "checked_at": "2026-10-30T14:05:00Z",
  "message": "This API key lacks the cameras:write scope."
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set the clock of a camera being added

`POST /api/v1/cameras/actions/set-clock`

API 1.45.0. `POST /cameras/{camera_id}/actions/set-clock` for a camera found by `POST /cameras/actions/detect` and not added yet (`detection_id`, yours and unexpired; `404` otherwise): the Add camera flow's "Fix". Same rules: time, then zone and time sync when the camera takes them, verified, never left worse.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_detected_camera_clock`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detection_id` | string | Yes | From `POST /cameras/actions/detect`. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/actions/set-clock" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"detection_id":"detection-id"}'
```

**Response** `200`: What was set (look at `ok`).

```json
{
  "ok": false,
  "message": "This API key lacks the cameras:write scope.",
  "time_set": false,
  "timezone_set": false,
  "ntp_enabled": false,
  "notes": [
    "note"
  ],
  "before": {
    "site_timezone": "site-timezone",
    "site_utc_offset_seconds": 1,
    "site_timezone_source": "camera",
    "timezone_setting": "timezone-setting",
    "auto_fix": {
      "at": "2026-10-30T14:05:00Z",
      "ok": false,
      "message": "This API key lacks the cameras:write scope."
    },
    "status": "ok",
    "offset_seconds": 1,
    "camera_time": "2026-10-30T14:05:00Z",
    "camera_timezone": "camera-timezone",
    "camera_utc_offset_seconds": 1,
    "server_timezone": "server-timezone",
    "server_utc_offset_seconds": 1,
    "ntp": false,
    "method": "onvif",
    "checked_at": "2026-10-30T14:05:00Z",
    "message": "This API key lacks the cameras:write scope."
  },
  "after": {
    "site_timezone": "site-timezone",
    "site_utc_offset_seconds": 1,
    "site_timezone_source": "camera",
    "timezone_setting": "timezone-setting",
    "auto_fix": {
      "at": "2026-10-30T14:05:00Z",
      "ok": false,
      "message": "This API key lacks the cameras:write scope."
    },
    "status": "ok",
    "offset_seconds": 1,
    "camera_time": "2026-10-30T14:05:00Z",
    "camera_timezone": "camera-timezone",
    "camera_utc_offset_seconds": 1,
    "server_timezone": "server-timezone",
    "server_utc_offset_seconds": 1,
    "ntp": false,
    "method": "onvif",
    "checked_at": "2026-10-30T14:05:00Z",
    "message": "This API key lacks the cameras:write scope."
  }
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Sound a camera's siren

`POST /api/v1/cameras/{camera_id}/actions/siren`

API 1.105.0. Sounds the camera's own built-in siren now. THIS MAKES A LOUD NOISE IN A REAL BUILDING: people nearby will hear it. Use it only when the user asked for the siren. `seconds` (default 10) is the wanted length; Vigiora limits it centrally: at most 15 s per run and at most 60 s of siren per camera in any 10 minutes (more is `429 rate_limited`). The camera's self-ending mode (it plays a few cycles and stops by itself) is always tried first; a camera that only knows on/off is switched off by Vigiora at the end, retried on a new login until the camera confirms. The siren is stored before it sounds, so a restart does not leave it on. Answers as soon as the siren is on; the result has `run_id` and `stop_state` (see GET /sounds/active). Stop it any time with POST /cameras/\{camera_id\}/actions/stop-siren or POST /sounds/actions/stop-all (always safe). Works for Reolink and Hikvision cameras on the local network with a built-in siren; any other camera is `422 speaker_not_supported`; a camera already playing a sound is `409 conflict`; a camera whose last siren was not confirmed off yet is `409 conflict` with `reason: siren_not_off` (stop or dismiss that one first). The self-ending play is one cycle, whose length the camera decides (`length_set_by_device` in GET /sounds/active). Not blocked by the 10-minute pause after Stop all sounds (that pause holds automatic alert sounds only). The same safe path serves POST /alert-speaker/actions/test with `sound: siren` (a 3 s test). Admins and operators with operator permission on the camera; asks for confirmation while human in the loop is on. Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_camera_siren`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seconds` | integer | No | Wanted length (default 10). Vigiora plays at most 15 s, and at most 60 s per camera in 10 minutes. (1–600) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/siren" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"seconds":1}'
```

**Response** `200`: The outcome (`result` failed when the camera did not take the siren).

```json
{
  "id": 1,
  "camera_id": 3,
  "sound": "announcement",
  "via": "backchannel",
  "result": "played",
  "reason": "reason",
  "duration_ms": 1,
  "run_id": 1,
  "stop_state": "sounding",
  "stop_attempts": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch a camera's siren off

`POST /api/v1/cameras/{camera_id}/actions/stop-siren`

API 1.105.0. Switches the camera's siren off now: every siren run Vigiora started on it gets its off on a new login (retried until the camera confirms); with none, a Reolink siren still gets one off (the camera's own alarm may be sounding). `confirmed` tells whether the camera confirmed it. Always safe to call, also when nothing sounds or the camera has no siren (200); it never makes a sound. Open to every role that can see the camera. Needs no confirmation.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/stop-siren" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What was stopped.

```json
{
  "camera_id": 3,
  "confirmed": false,
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "entity_id": "entity-id",
      "name": "Front door",
      "way": "reolink",
      "mode": "mode",
      "source": "source",
      "state": "starting",
      "started_at": "2026-10-30T14:05:00Z",
      "stop_by": "2026-10-30T14:05:00Z",
      "attempts": 1,
      "last_error": "last-error",
      "stopped_at": "2026-10-30T14:05:00Z",
      "length_set_by_device": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check a camera's speaker now

`POST /api/v1/cameras/{camera_id}/actions/check-speaker`

API 1.54.0. Checks the camera's speaker now (its audio backchannel, then the camera's own API for a siren) and stores the result, as the background check does; a camera with a voice speaker gets its automatic speaker output. Contacts the camera; plays nothing. Operator permission on the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/check-speaker" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The camera's speaker.

```json
{
  "kind": "voice",
  "siren": false,
  "checked_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Live video link

`POST /api/v1/cameras/{camera_id}/actions/stream-url`

A short-lived signed link to the camera's live video as HLS (`hls_url`, relative to the server's base URL), for players that cannot send an API key (Home Assistant, VLC, a browser `<video>`). The link carries no credential: it is valid until `expires_at` (`ttl_seconds`, 60–3600, default 600) and ends at once when the key that made it is revoked or expires, its user is disabled, or the user loses the camera. Ask for a new link before it expires. `quality`: `main` (default) or `sub` (the camera's substream, when it has one); `format`: `mpegts` (default) or `fmp4` (needed for H.265). Never exposes the camera's address or credentials: the server proxies its own stream. `rtsp_url` and `webrtc` are null (not offered to third parties). No live stream on this server is `503 stream_unavailable`. 60 links a minute per credential; each is audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ttl_seconds` | integer | No | (60–3600, default `600`) |
| `quality` | string: `main`, `sub` | No | (default `"main"`) |
| `format` | string: `mpegts`, `fmp4` | No | (default `"mpegts"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/stream-url" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ttl_seconds":600,"quality":"main","format":"mpegts"}'
```

**Response** `200`: The link.

```json
{
  "camera_id": 3,
  "hls_url": "hls-url",
  "rtsp_url": null,
  "webrtc": null,
  "quality": "main",
  "format": "mpegts",
  "expires_at": "2026-10-30T14:05:30Z",
  "ttl_seconds": 1
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Snapshot link

`POST /api/v1/cameras/{camera_id}/actions/snapshot-url`

A short-lived signed link to the camera's live snapshot (JPEG), for clients that show images without sending an API key (notifications, dashboards). Same rules as the live video link. Events carry such links too (`data.snapshot_url`). API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ttl_seconds` | integer | No | (60–3600, default `600`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/snapshot-url" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ttl_seconds":600}'
```

**Response** `200`: The link.

```json
{
  "camera_id": 3,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "expires_at": "2026-10-30T14:05:30Z",
  "ttl_seconds": 1
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Speak through a camera

`POST /api/v1/cameras/{camera_id}/actions/speak`

Says `text` aloud (text to speech) through this camera's own speaker output (Settings → Speakers), played by the server or by the camera's vigiora-client; no room needed. `volume` 0–1 (default: the output's). Needs the admin or operator role and operator permission on the camera. A camera with no speaker output is `404 not_found`; when the speaker check found no audio backchannel, `422 speaker_not_supported`; a speaker that refused or did not answer is `502 ptz_failed`. 12 a minute per credential; audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `speak_on_camera`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | (max 1000 characters) |
| `volume` | number or null | No | (0–1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/speak" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"text":"text"}'
```

**Response** `200`: Spoken.

```json
{
  "ok": false,
  "camera_id": 3,
  "output_id": 1
}
```

Errors: `400`, `401`, `403`, `404`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## PTZ

Pan/tilt/zoom control. Every move is bounded in time; the server stops the camera at the end.

### Move the camera

`POST /api/v1/cameras/{camera_id}/ptz/actions/move`

Moves at the given velocities for `duration_ms` (default 400, at most 5000), then stops. A move sent while another is running for the same camera is dropped (`status: coalesced`). With `hold: true` (API 1.46.0) the camera keeps moving (`status: holding`) until `…/ptz/actions/stop`, or until this call is not repeated within ~1.2 s (the server stops it: a dead-man, so a lost client never leaves a camera turning). Repeat the hold call every ~400 ms to keep moving; a repeat with the same velocities sends nothing to the camera, new velocities change direction. A camera behind a theia-client moves 600 ms per hold call.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `move_ptz`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `pan` | number | No | Negative left, positive right. (-1–1, default `0`) |
| `tilt` | number | No | Negative down, positive up. (-1–1, default `0`) |
| `zoom` | number | No | Negative out, positive in. (-1–1, default `0`) |
| `duration_ms` | integer | No | Not allowed with `hold`. (1–5000, default `400`) |
| `hold` | boolean | No | API 1.46.0: move until `…/ptz/actions/stop` or until this call is not repeated within ~1.2 s. Needs a non-zero pan, tilt or zoom. (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/actions/move" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"pan":0.5,"tilt":0,"zoom":0,"duration_ms":400}'
```

**Response** `200`: The command ran.

```json
{
  "status": "done"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop the camera

`POST /api/v1/cameras/{camera_id}/ptz/actions/stop`

Stops the camera now and ends a hold move (`hold` on …/ptz/actions/move); a camera behind a theia-client gets a zero-velocity move ending in a stop. A camera without PTZ (`has_ptz` false) is `409 ptz_not_supported`, as for every PTZ operation, and a camera whose PTZ needs ONVIF while its `onvif_enabled` is off is `409 onvif_disabled`; `502 ptz_failed` means a PTZ camera refused or did not answer. Timed moves always end at their duration anyway; use this to cut one short.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The command ran.

```json
{
  "status": "done"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop a robot camera

`POST /api/v1/cameras/{camera_id}/robot/actions/stop`

API 1.121.0. Stops a robot camera (`body_type` robot, the Vigiora Robot) now. It ends a hold move and sends a PTZ stop, as `…/ptz/actions/stop` does, then calls the robot's own stop, which also cancels a route it is driving. A camera that is not a robot is `409 not_a_robot`; `502 ptz_failed` means the robot refused or did not answer. A robot behind a theia-client gets the PTZ stop only. Safe to call any time and repeatedly.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The robot was told to stop.

```json
{
  "status": "done"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Headlight of a robot camera

`GET /api/v1/cameras/{camera_id}/robot/light`

API 1.123.0. Reads the robot's headlight from its own state (`on`, `level` 1..120, `remaining_s` before it switches itself off). `409 not_a_robot` for other cameras, `409 light_unsupported` for firmware without a light, `502 ptz_failed` when the robot does not answer.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/light" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The headlight.

```json
{
  "on": false,
  "level": 1,
  "remaining_s": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch a robot camera's headlight

`POST /api/v1/cameras/{camera_id}/robot/actions/light`

API 1.123.0. `on` is required. When on, the light stays lit for `ttl_s` seconds (1..600, default 120) at `level` (1..120, default 60) and then switches itself off, so a client that wants it on keeps renewing it. `409 not_a_robot` for other cameras, `409 light_unsupported` for firmware without a light, `502 ptz_failed` when the robot does not answer. Safe to repeat.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | Yes |  |
| `level` | integer | No | (1–120, default `60`) |
| `ttl_s` | integer | No | (1–600, default `120`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/light" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"on":false}'
```

**Response** `200`: The headlight now.

```json
{
  "on": false,
  "level": 1,
  "remaining_s": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Wi-Fi movement sensed by a robot camera

`GET /api/v1/cameras/{camera_id}/robot/wifi-motion`

API 1.124.0. The robot hears movement in the room from how people disturb its Wi-Fi signal (no picture involved). `valid` is false while the robot is moving, for a second after, and on a route (then `score`, `baseline`, `threshold` and `rssi` are null); `warming_up` while it learns the room. `history` is the last 30 scores, oldest first, one per `1/history_hz` seconds, null where not valid. `409 not_a_robot`, `409 robot_unsupported` (firmware without it), `502 ptz_failed`. Movement also arrives as the `robot.wifi_motion` event.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/wifi-motion" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The reading.

```json
{
  "enabled": true,
  "valid": false,
  "motion": false,
  "score": 0.5,
  "baseline": 0.5,
  "threshold": 0.5,
  "threshold_auto": false,
  "since_ms": 1,
  "warming_up": false,
  "packets_per_s": 0.5,
  "rssi": 1,
  "history_hz": 1,
  "history": [
    0.5
  ],
  "camera": {
    "on": false,
    "paused_reason": "paused-reason",
    "resolution": "resolution",
    "fps": 0.5,
    "resumes_in_s": 1
  }
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch the robot's Wi-Fi movement sensor

`PATCH /api/v1/cameras/{camera_id}/robot/wifi-motion`

API 1.124.0. `enabled` switches the sensor; `threshold` sets the movement score above which it reports movement (0 = automatic). Answers the new reading.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `threshold` | number | No | (≥ 0) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/robot/wifi-motion" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"threshold":0.5}'
```

**Response** `200`: The reading now.

```json
{
  "enabled": true,
  "valid": false,
  "motion": false,
  "score": 0.5,
  "baseline": 0.5,
  "threshold": 0.5,
  "threshold_auto": false,
  "since_ms": 1,
  "warming_up": false,
  "packets_per_s": 0.5,
  "rssi": 1,
  "history_hz": 1,
  "history": [
    0.5
  ],
  "camera": {
    "on": false,
    "paused_reason": "paused-reason",
    "resolution": "resolution",
    "fps": 0.5,
    "resumes_in_s": 1
  }
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch a robot camera's picture on or off

`POST /api/v1/cameras/{camera_id}/robot/actions/camera`

API 1.124.0. Turns the robot's camera off (it then streams nothing; the camera shows `paused`, not `offline`) or back on. The robot also pauses its camera itself while Bluetooth or a deep scan runs (`paused_reason` `ble`, `deep_scan`, `manual`). `409 not_a_robot`, `409 robot_unsupported`, `502 ptz_failed`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_robot_camera`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/camera" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"on":false}'
```

**Response** `200`: The camera now.

```json
{
  "on": false,
  "paused_reason": "paused-reason",
  "resolution": "resolution",
  "fps": 0.5,
  "resumes_in_s": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Scan the room with a robot camera

`POST /api/v1/cameras/{camera_id}/robot/actions/sense`

API 1.124.0. The robot listens for `seconds` (3..10, default 5) and reports the Wi-Fi networks it hears, the Bluetooth devices around it and the movement it measured. The call lasts about `seconds` + 3 s and the robot's own web server is busy meanwhile. The result is stored (the last 20 per robot) and answered. Wi-Fi and Bluetooth names stay on this server and are never logged. `409 robot_busy` when the robot is moving or on a route, `409 not_a_robot`, `409 robot_unsupported`, `502 ptz_failed`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `sense_robot`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seconds` | integer | No | (3–10, default `5`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/sense" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"seconds":5}'
```

**Response** `200`: The stored scan.

```json
{
  "taken_at": "2026-10-30T14:05:00Z",
  "seconds": 1,
  "took_ms": 1,
  "result": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Bluetooth of a robot camera

`GET /api/v1/cameras/{camera_id}/robot/bluetooth`

API 1.127.0. What the robot's Bluetooth jobs found, namely the last scan and the last keyboard search (stored on this server, the last 20 results per robot are kept), the MIDI keyboard the robot remembers, whether it has Bluetooth at all, and, while it is away on a job, `away.until` and `away.remaining_s`. The robot is offline for about 20 s per job; that is a planned pause, so its stream shows `paused`, not `idle`, and no camera.offline is sent. `restart` says why the robot last restarted (diagnostics; `after_bluetooth_job` marks a normal job restart). `low_battery` is true while the robot is too low on power for a job. `melodies` are the built-in melody names for `play-melody`. While the robot is away, `GET …/robot/wifi-motion` answers `camera.paused_reason` `ble` and `resumes_in_s`. Bluetooth names and addresses stay on this server and are never logged. `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/bluetooth" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The robot's Bluetooth.

```json
{
  "low_battery": false,
  "available": false,
  "keyboard": {
    "address": "address",
    "name": "Front door"
  },
  "away": {
    "until": "2026-10-30T14:05:00Z",
    "remaining_s": 1
  },
  "scan": {
    "job_id": "job-id",
    "taken_at": "2026-10-30T14:05:00Z",
    "ok": false,
    "took_ms": 1,
    "devices": [
      {
        "address": "address",
        "rssi": 1,
        "name": "Front door",
        "appearance": 1,
        "manufacturer_id": 1,
        "services": [
          "service"
        ]
      }
    ],
    "error": null
  },
  "keyboards": {
    "job_id": "job-id",
    "taken_at": "2026-10-30T14:05:00Z",
    "ok": false,
    "took_ms": 1,
    "devices": [
      {
        "address": "address",
        "rssi": 1,
        "name": "Front door",
        "appearance": 1,
        "manufacturer_id": 1,
        "services": [
          "service"
        ]
      }
    ],
    "error": null
  },
  "melodies": [
    "melodie"
  ],
  "restart": {
    "reason": "reason",
    "detail": "detail",
    "last_step": "last-step",
    "prev_uptime_s": 1,
    "boots": 1,
    "brownouts": 1,
    "crashes": 1,
    "after_bluetooth_job": false
  }
}
```

Errors: `401`, `403`, `404`, `409`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Scan Bluetooth with a robot camera

`POST /api/v1/cameras/{camera_id}/robot/actions/bluetooth-scan`

API 1.127.0. The robot listens for Bluetooth devices for `seconds` (2..15, default 5). It then goes offline for about 20 s (its Wi-Fi is off; the camera shows `paused`, with no alert) and comes back with the result (read `GET …/robot/jobs/{job_id}` (or `GET …/robot/bluetooth` for the stored scan) after `ready_after_s`). `409 robot_busy` when the robot is moving, on a route or already away, `409 ble_unsupported` (firmware or build without Bluetooth), `409 battery_low` (charge the robot first), `409 not_a_robot`, `502 ptz_failed`. Takes the robot offline, so an AI agent asks first.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `scan_robot_bluetooth`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seconds` | integer | No | (2–15, default `5`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/bluetooth-scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"seconds":5}'
```

**Response** `202`: The job started; the robot is away until it is done.

```json
{
  "job_id": "job-id",
  "ready_after_s": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find Bluetooth MIDI keyboards with a robot camera

`POST /api/v1/cameras/{camera_id}/robot/actions/find-keyboards`

API 1.127.0. Like `bluetooth-scan`, but lists only Bluetooth MIDI keyboards. The robot is away for about 20 s. The result (`devices`) is stored and read from `GET …/robot/jobs/{job_id}` or `GET …/robot/bluetooth` (`keyboards`). Errors as for `bluetooth-scan`. Takes the robot offline, so an AI agent asks first.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `find_robot_keyboards`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seconds` | integer | No | (2–15, default `5`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/find-keyboards" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"seconds":5}'
```

**Response** `202`: The job started; the robot is away until it is done.

```json
{
  "job_id": "job-id",
  "ready_after_s": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Play a melody on a Bluetooth keyboard with a robot camera

`POST /api/v1/cameras/{camera_id}/robot/actions/play-melody`

API 1.127.0. The robot connects to a Bluetooth MIDI keyboard and plays a melody (about 20 s away from Wi-Fi, shown as `paused`). Send `melody` (text such as `C4:300 E4:300 R:200 G4:600`, a note with `#` or `b` and an octave, `:` and its length in ms, `R` for a rest; or the name of a built-in melody from `GET …/robot/bluetooth` `melodies`) or `notes` (a list of `n` 0..127, `v` 1..127, `ms` and `at`); at most 256 notes and 30 s. The keyboard is `keyboard_address`, or a part of its name in `keyboard_name`; without either, the keyboard the robot remembers, else the first one it finds. `409 robot_busy`, `409 ble_unsupported`, `400 validation_error` (not a playable melody, or the robot did not know the keyboard). The outcome (`ok`, `events`, `sent`, or an `error` such as `keyboard not found`) is in `GET …/robot/jobs/{job_id}`. Makes sound in a real room and takes the robot offline, so an AI agent asks first.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `play_robot_melody`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `melody` | string | No | (max 4000 characters) |
| `notes` | array of object | No | (max 256 items) |
| `keyboard_address` | string | No | (max 40 characters) |
| `keyboard_name` | string | No | (max 80 characters) |
| `velocity` | integer | No | (1–127) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/actions/play-melody" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"melody":"melody","notes":[{"n":1,"v":1,"ms":1,"at":1}],"keyboard_address":"keyboard-address","keyboard_name":"keyboard-name","velocity":1}'
```

**Response** `202`: The job started; the robot is away until it is done.

```json
{
  "job_id": "job-id",
  "ready_after_s": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A robot's Bluetooth job

`GET /api/v1/cameras/{camera_id}/robot/jobs/{job_id}`

API 1.127.0. `status` is `pending` until the robot is back and has answered (`ready_after_s` after the start, up to 30 s more), then `done` or `failed` (`error`; `battery_low` when the robot ran out of power starting the job). `result` is the robot's own answer, for `scan` and `midi_devices` `{ok, devices, took_ms}` (each device `{address, rssi, name, services}`), for `midi_play` `{ok, address, name, events, sent, encrypted, subscribed, took_ms}` (`encrypted` false means the keyboard may ignore the notes). Jobs are kept in memory (a server restart forgets them; the stored scans stay in `GET …/robot/bluetooth`). `404` for an unknown job.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `job_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/jobs/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The job.

```json
{
  "job_id": "job-id",
  "kind": "scan",
  "status": "pending",
  "ready_after_s": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "result": {},
  "error": null
}
```

Errors: `401`, `403`, `404`, `409`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### AI patrol status of a robot camera

`GET /api/v1/cameras/{camera_id}/robot/patrol`

API 1.122.0. The robot's current or last AI patrol (`running`, `step`, the last move and why, what it sees, how it ended) and, before any run, the defaults with the estimated AI credits. Kept in memory (a server restart forgets the last run).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/patrol" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "camera_id": 3,
  "running": false,
  "goal": "goal",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_reason": "last-reason",
  "scene": "scene",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "credits_used": 1,
  "estimated_credits": 1
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start an AI patrol of a robot camera

`POST /api/v1/cameras/{camera_id}/robot/patrol/actions/start`

API 1.122.0. The robot drives around the room on its own, avoiding obstacles from its camera picture (it has no distance sensors). Each step reads a fresh frame, asks the vision model for one short move (one metered AI call, about 1 AI credit) and drives it as a timed burst (forward at most 600 ms, turns and back at most 400 ms, speed at most 0.6). `minutes` (default 5, at most 30) and 20 steps a minute bound a run; `goal` is optional ("check the kitchen and come back"). It stops on Stop robot, any manual drive, a lost or late picture, the robot not answering, weak Wi-Fi (below -80 dBm), AI unavailable or no credits, and always ends with the robot's own stop. `409 not_a_robot` for other cameras, `409 conflict` while one runs, `402 insufficient_credits`, `503 ai_unavailable`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_robot_patrol`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `minutes` | integer | No | Run time limit. (1–30, default `5`) |
| `goal` | string | No | Optional, e.g. "check the kitchen and come back". (max 300 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/patrol/actions/start" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"minutes":5,"goal":"goal"}'
```

**Response** `202`: The AI patrol started.

```json
{
  "camera_id": 3,
  "running": false,
  "goal": "goal",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_reason": "last-reason",
  "scene": "scene",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "credits_used": 1,
  "estimated_credits": 1
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop an AI patrol

`POST /api/v1/cameras/{camera_id}/robot/patrol/actions/stop`

API 1.122.0. Ends the robot's AI patrol; the robot gets its own stop. Answers the final status (or the idle one when nothing ran). Safe to repeat.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/patrol/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The final status.

```json
{
  "camera_id": 3,
  "running": false,
  "goal": "goal",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_reason": "last-reason",
  "scene": "scene",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "credits_used": 1,
  "estimated_credits": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List PTZ presets

`GET /api/v1/cameras/{camera_id}/ptz/presets`

The camera's stored positions, read from the camera (cameras on this server's network only; otherwise `409 ptz_not_supported`). One page; `next_cursor` is always `null`. Needs `cameras:control` because it talks to the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The presets.

```json
{
  "data": [
    {
      "token": "preset-1",
      "name": "Front door",
      "name_in_vigiora": false,
      "dwell_seconds": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Save a PTZ preset

`POST /api/v1/cameras/{camera_id}/ptz/presets`

Stores the camera's current position as a new preset, or over the preset `token` (cameras on this server's network). To rename a preset without moving it use `PATCH /api/v1/cameras/{camera_id}/ptz/presets/{preset_token}`; to delete one, `DELETE` on the same path (API 1.51.0).

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `save_ptz_preset`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 64 characters) |
| `token` | string | No | Overwrite this preset. (max 64 characters) |
| `dwell_seconds` | integer | No | API 1.56.0. Seconds a patrol stays here. (3–3600) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `201`: The preset.

```json
{
  "token": "preset-1",
  "name": "Front door",
  "name_in_vigiora": false,
  "dwell_seconds": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a PTZ preset

`GET /api/v1/cameras/{camera_id}/ptz/presets/{preset_token}`

API 1.51.0. One preset, read from the camera. `404` when the camera has no such preset.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `preset_token` | path | string | Yes | The preset's `token`. (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets/preset-1" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The preset.

```json
{
  "token": "preset-1",
  "name": "Front door",
  "name_in_vigiora": false,
  "dwell_seconds": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename or move a PTZ preset

`PATCH /api/v1/cameras/{camera_id}/ptz/presets/{preset_token}`

API 1.51.0. `name` renames the preset without moving it (an empty `name` clears the name). Reolink cameras store the name themselves (over the Reolink app port, TCP 9000). Other cameras cannot rename a preset without also saving the current position into it (ONVIF SetPreset, Hikvision ISAPI), so the camera is not asked and Vigiora keeps the name instead (`name_in_vigiora: true`; it shows in Vigiora only). `position: "current"` stores the camera's current position into the preset, keeping its name (the same as `POST /api/v1/cameras/{camera_id}/ptz/presets` with its `token`). Give `name`, `position` or both. `dwell_seconds` (API 1.56.0, 3-3600) sets how long a patrol stays on the preset (kept by Vigiora). Confirm-class because it can overwrite a preset's position. `404` when the camera has no such preset.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_ptz_preset`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `preset_token` | path | string | Yes | The preset's `token`. (max 64 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | The new name; empty clears it. The preset does not move. (max 64 characters) |
| `position` | string: `current` | No | `current`: store the camera's current position into the preset (its name is kept). |
| `dwell_seconds` | integer | No | API 1.56.0. Seconds a patrol stays here. (3–3600) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets/preset-1" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","position":"current","dwell_seconds":3}'
```

**Response** `200`: The renamed preset.

```json
{
  "token": "preset-1",
  "name": "Front door",
  "name_in_vigiora": false,
  "dwell_seconds": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a PTZ preset

`DELETE /api/v1/cameras/{camera_id}/ptz/presets/{preset_token}`

API 1.51.0. Removes the preset from the camera (ONVIF RemovePreset, Hikvision ISAPI DELETE), and the name Vigiora kept for it.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_ptz_preset`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `preset_token` | path | string | Yes | The preset's `token`. (max 64 characters) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets/preset-1" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Running patrols

`GET /api/v1/ptz/patrols/active`

API 1.56.0. The patrols running now, on the cameras the caller can see (the camera grid marks them "Patrolling").

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ptz/patrols/active" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "data": [
    {
      "active": false,
      "camera_id": 3,
      "patrol_id": 1,
      "patrol_name": "patrol-name",
      "all_presets": false,
      "once": false,
      "state": "moving",
      "pause_reason": "user",
      "step": 1,
      "steps": 1,
      "preset_token": "preset-token",
      "preset_name": "preset-name",
      "next_at": "2026-10-30T14:05:00Z",
      "paused_until": "2026-10-30T14:05:00Z",
      "started_at": "2026-10-30T14:05:00Z",
      "last_error": "last-error"
    }
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's patrols

`GET /api/v1/cameras/{camera_id}/ptz/patrols`

API 1.56.0. Patrol mode: named tours of the camera's presets. The one-click patrol over every preset (`all_presets: true`) comes first once it was used.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrols" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "all_presets": false,
      "loop": false,
      "random_order": false,
      "home_preset_token": "home-preset-token",
      "manual_pause_seconds": 1,
      "activity_behavior": "continue",
      "pause_on_activity": false,
      "activity_quiet_seconds": 1,
      "activity_source": "auto",
      "schedule": {
        "days": [
          1
        ],
        "start": "start",
        "end": "end"
      },
      "steps": [
        {
          "preset_token": "preset-token",
          "dwell_seconds": 3,
          "speed": 0.5,
          "ai_label": "ai-label"
        }
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrols`

API 1.56.0. A named patrol: ordered steps (a preset, an optional dwell time overriding the preset's own, an optional move speed 0-1), loop or once, random order, a home preset, a schedule, pause on activity and after a person moves the camera (`manual_pause_seconds`, default 120). Creating does not move the camera.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `loop` | boolean | No |  |
| `random_order` | boolean | No |  |
| `home_preset_token` | string | No | Empty clears it. (max 64 characters) |
| `manual_pause_seconds` | integer | No | (0–3600) |
| `activity_behavior` | string: `continue`, `pause`, `follow` | No | On activity: continue, pause, or follow the action. |
| `pause_on_activity` | boolean | No | Legacy; activity_behavior takes precedence when both are sent. |
| `activity_quiet_seconds` | integer | No | (1–600) |
| `activity_source` | string: `auto`, `motion`, `onvif` | No | Where activity comes from (default auto). Since 1.75.0. |
| `schedule` | PTZPatrolSchedule | No | When the patrol moves (server time). Outside it the camera goes to the home preset and waits. |
| `clear_schedule` | boolean | No |  |
| `steps` | array of PTZPatrolStep | No | (max 64 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrols" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","loop":false,"random_order":false,"home_preset_token":"home-preset-token","manual_pause_seconds":1,"activity_behavior":"continue","pause_on_activity":false,"activity_quiet_seconds":1,"activity_source":"auto","schedule":{"days":[1],"start":"start","end":"end"},"clear_schedule":false,"steps":[{"preset_token":"preset-token","dwell_seconds":3,"speed":0.5,"ai_label":"ai-label"}]}'
```

**Response** `201`: OK.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "all_presets": false,
  "loop": false,
  "random_order": false,
  "home_preset_token": "home-preset-token",
  "manual_pause_seconds": 1,
  "activity_behavior": "continue",
  "pause_on_activity": false,
  "activity_quiet_seconds": 1,
  "activity_source": "auto",
  "schedule": {
    "days": [
      1
    ],
    "start": "start",
    "end": "end"
  },
  "steps": [
    {
      "preset_token": "preset-token",
      "dwell_seconds": 3,
      "speed": 0.5,
      "ai_label": "ai-label"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a patrol

`GET /api/v1/cameras/{camera_id}/ptz/patrols/{patrol_id}`

API 1.56.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `patrol_id` | path | integer | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrols/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "all_presets": false,
  "loop": false,
  "random_order": false,
  "home_preset_token": "home-preset-token",
  "manual_pause_seconds": 1,
  "activity_behavior": "continue",
  "pause_on_activity": false,
  "activity_quiet_seconds": 1,
  "activity_source": "auto",
  "schedule": {
    "days": [
      1
    ],
    "start": "start",
    "end": "end"
  },
  "steps": [
    {
      "preset_token": "preset-token",
      "dwell_seconds": 3,
      "speed": 0.5,
      "ai_label": "ai-label"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a patrol

`PATCH /api/v1/cameras/{camera_id}/ptz/patrols/{patrol_id}`

API 1.56.0. Fields given replace the stored ones; `steps` replaces every step in the order given (reordering is an update). A running patrol keeps its steps until it is started again.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `patrol_id` | path | integer | Yes |  |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `loop` | boolean | No |  |
| `random_order` | boolean | No |  |
| `home_preset_token` | string | No | Empty clears it. (max 64 characters) |
| `manual_pause_seconds` | integer | No | (0–3600) |
| `activity_behavior` | string: `continue`, `pause`, `follow` | No | On activity: continue, pause, or follow the action. |
| `pause_on_activity` | boolean | No | Legacy; activity_behavior takes precedence when both are sent. |
| `activity_quiet_seconds` | integer | No | (1–600) |
| `activity_source` | string: `auto`, `motion`, `onvif` | No | Where activity comes from (default auto). Since 1.75.0. |
| `schedule` | PTZPatrolSchedule | No | When the patrol moves (server time). Outside it the camera goes to the home preset and waits. |
| `clear_schedule` | boolean | No |  |
| `steps` | array of PTZPatrolStep | No | (max 64 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrols/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","loop":false,"random_order":false,"home_preset_token":"home-preset-token","manual_pause_seconds":1,"activity_behavior":"continue","pause_on_activity":false,"activity_quiet_seconds":1,"activity_source":"auto","schedule":{"days":[1],"start":"start","end":"end"},"clear_schedule":false,"steps":[{"preset_token":"preset-token","dwell_seconds":3,"speed":0.5,"ai_label":"ai-label"}]}'
```

**Response** `200`: OK.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "all_presets": false,
  "loop": false,
  "random_order": false,
  "home_preset_token": "home-preset-token",
  "manual_pause_seconds": 1,
  "activity_behavior": "continue",
  "pause_on_activity": false,
  "activity_quiet_seconds": 1,
  "activity_source": "auto",
  "schedule": {
    "days": [
      1
    ],
    "start": "start",
    "end": "end"
  },
  "steps": [
    {
      "preset_token": "preset-token",
      "dwell_seconds": 3,
      "speed": 0.5,
      "ai_label": "ai-label"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a patrol

`DELETE /api/v1/cameras/{camera_id}/ptz/patrols/{patrol_id}`

API 1.56.0. Stops it first when it runs. The presets stay.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_ptz_patrol`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `patrol_id` | path | integer | Yes |  |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrols/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Done.

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### What the camera's patrol is doing

`GET /api/v1/cameras/{camera_id}/ptz/patrol`

API 1.56.0. `active: false` when no patrol runs. `state`: `moving`, `dwelling`, `paused` (`pause_reason`: `user`, `manual_move`, `activity`), `outside_schedule`, `unreachable` (retried with a back-off), `no_presets`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "active": false,
  "camera_id": 3,
  "patrol_id": 1,
  "patrol_name": "patrol-name",
  "all_presets": false,
  "once": false,
  "state": "moving",
  "pause_reason": "user",
  "step": 1,
  "steps": 1,
  "preset_token": "preset-token",
  "preset_name": "preset-name",
  "next_at": "2026-10-30T14:05:00Z",
  "paused_until": "2026-10-30T14:05:00Z",
  "started_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start a patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrol/actions/start`

API 1.56.0. Starts `patrol_id`, or with `all_presets: true` the one-click patrol over every preset (each preset's own dwell time). One patrol runs per camera: a running one is replaced. Runs survive a server restart. The camera moves; motion detection ignores Vigiora's moves. Cameras reached through a client answer `409`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_ptz_patrol`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `patrol_id` | integer | No |  |
| `all_presets` | boolean | No | Start the one-click patrol over every preset instead. |
| `once` | boolean | No | One pass, then the home preset. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol/actions/start" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"patrol_id":1,"all_presets":false,"once":false}'
```

**Response** `200`: OK.

```json
{
  "active": false,
  "camera_id": 3,
  "patrol_id": 1,
  "patrol_name": "patrol-name",
  "all_presets": false,
  "once": false,
  "state": "moving",
  "pause_reason": "user",
  "step": 1,
  "steps": 1,
  "preset_token": "preset-token",
  "preset_name": "preset-name",
  "next_at": "2026-10-30T14:05:00Z",
  "paused_until": "2026-10-30T14:05:00Z",
  "started_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop the patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrol/actions/stop`

API 1.56.0. The camera stays where it is. `409` when no patrol runs.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "active": false,
  "camera_id": 3,
  "patrol_id": 1,
  "patrol_name": "patrol-name",
  "all_presets": false,
  "once": false,
  "state": "moving",
  "pause_reason": "user",
  "step": 1,
  "steps": 1,
  "preset_token": "preset-token",
  "preset_name": "preset-name",
  "next_at": "2026-10-30T14:05:00Z",
  "paused_until": "2026-10-30T14:05:00Z",
  "started_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Pause the patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrol/actions/pause`

API 1.56.0. Holds the patrol where it is until resume.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol/actions/pause" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "active": false,
  "camera_id": 3,
  "patrol_id": 1,
  "patrol_name": "patrol-name",
  "all_presets": false,
  "once": false,
  "state": "moving",
  "pause_reason": "user",
  "step": 1,
  "steps": 1,
  "preset_token": "preset-token",
  "preset_name": "preset-name",
  "next_at": "2026-10-30T14:05:00Z",
  "paused_until": "2026-10-30T14:05:00Z",
  "started_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Resume the patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrol/actions/resume`

API 1.56.0. Continues a paused patrol (also ends a pause after a manual move). The camera moves.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `resume_ptz_patrol`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol/actions/resume" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "active": false,
  "camera_id": 3,
  "patrol_id": 1,
  "patrol_name": "patrol-name",
  "all_presets": false,
  "once": false,
  "state": "moving",
  "pause_reason": "user",
  "step": 1,
  "steps": 1,
  "preset_token": "preset-token",
  "preset_name": "preset-name",
  "next_at": "2026-10-30T14:05:00Z",
  "paused_until": "2026-10-30T14:05:00Z",
  "started_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set a patrol up automatically

`POST /api/v1/cameras/{camera_id}/ptz/patrol-scans`

API 1.56.0. Starts the automatic patrol setup (`202`, poll `GET .../patrol-scans/{scan_id}`): Vigiora reads what the camera can do (`phase: limits`), finds its pan range by moving to the end stops (cameras without absolute positions), takes a picture at each of up to 12 positions across it and at the existing presets (`looking`; each position is saved as a preset), asks Vigiora AI what each view shows, how important it is and how long to stay there (`deciding`; at most 20 pictures, charged to AI credits), and proposes a patrol (`proposal`). Accept or cancel it. A person moving the camera stops the scan (`failed`, `reason: manual_move`); without AI it fails with `reason: ai_not_connected` (this server is not connected to a Vigiora account: checked first, before the camera moves, `failed_phase: precheck`), `ai_unavailable` (temporary) or `no_credits` (set the patrol up by hand). The camera moves; motion detection ignores it. `409` while a patrol or another setup runs.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_ptz_patrol_scan`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol-scans" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: OK.

```json
{
  "id": "id",
  "camera_id": 3,
  "phase": "limits",
  "reason": "no_movement",
  "failed_phase": "precheck",
  "message": "This API key lacks the cameras:write scope.",
  "limits": {
    "method": "method",
    "pan_tilt": false,
    "zoom": false,
    "absolute": false,
    "max_presets": 1,
    "pan_seconds": 0.5,
    "positions": 1,
    "ai_cap": 1,
    "strategy": "sweep"
  },
  "done": 1,
  "total": 1,
  "candidates": [
    {
      "index": 1,
      "preset_token": "preset-token",
      "existing": false,
      "preset_name": "preset-name",
      "has_picture": false,
      "judged": false,
      "label": "person",
      "importance": 1,
      "zones": [
        "zone"
      ],
      "watch": false,
      "dwell_seconds": 1,
      "reason": "reason"
    }
  ],
  "proposal": {
    "name": "Front door",
    "steps": [
      {
        "index": 1,
        "dwell_seconds": 3,
        "label": "person"
      }
    ],
    "total_seconds": 1
  },
  "patrol_id": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Automatic patrol setup progress

`GET /api/v1/cameras/{camera_id}/ptz/patrol-scans/{scan_id}`

API 1.56.0. The phase, the views found so far (with the AI's label, importance, zones and dwell as they are judged) and, in `proposal`, the proposed steps. Kept for an hour after it ends.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `scan_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol-scans/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "id": "id",
  "camera_id": 3,
  "phase": "limits",
  "reason": "no_movement",
  "failed_phase": "precheck",
  "message": "This API key lacks the cameras:write scope.",
  "limits": {
    "method": "method",
    "pan_tilt": false,
    "zoom": false,
    "absolute": false,
    "max_presets": 1,
    "pan_seconds": 0.5,
    "positions": 1,
    "ai_cap": 1,
    "strategy": "sweep"
  },
  "done": 1,
  "total": 1,
  "candidates": [
    {
      "index": 1,
      "preset_token": "preset-token",
      "existing": false,
      "preset_name": "preset-name",
      "has_picture": false,
      "judged": false,
      "label": "person",
      "importance": 1,
      "zones": [
        "zone"
      ],
      "watch": false,
      "dwell_seconds": 1,
      "reason": "reason"
    }
  ],
  "proposal": {
    "name": "Front door",
    "steps": [
      {
        "index": 1,
        "dwell_seconds": 3,
        "label": "person"
      }
    ],
    "total_seconds": 1
  },
  "patrol_id": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A picture from the automatic setup

`GET /api/v1/cameras/{camera_id}/ptz/patrol-scans/{scan_id}/pictures/{picture_id}`

API 1.56.0. The view at candidate `index` (JPEG, 640 px wide). Dropped when the setup is accepted or cancelled.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `scan_id` | path | string | Yes | (max 64 characters) |
| `picture_id` | path | integer | Yes | The candidate index. (≥ 0) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol-scans/42/pictures/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: OK. (`image/jpeg`)

Errors: `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Save the proposed patrol

`POST /api/v1/cameras/{camera_id}/ptz/patrol-scans/{scan_id}/actions/accept`

API 1.56.0. Saves the proposal (or the edited `steps`: order, dwell, label) as a patrol whose steps are marked AI-suggested (`ai_label`). Views the scan made become presets named after what is in view, each with its dwell time; the scan's other presets are removed. `start: true` starts it.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `accept_ptz_patrol_scan`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `scan_id` | path | string | Yes | (max 64 characters) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `steps` | array of PTZPatrolScanStep | No | (max 64 items) |
| `start` | boolean | No | Start the patrol right away. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol-scans/42/actions/accept" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","steps":[{"index":1,"dwell_seconds":3,"label":"person"}],"start":false}'
```

**Response** `201`: OK.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "all_presets": false,
  "loop": false,
  "random_order": false,
  "home_preset_token": "home-preset-token",
  "manual_pause_seconds": 1,
  "activity_behavior": "continue",
  "pause_on_activity": false,
  "activity_quiet_seconds": 1,
  "activity_source": "auto",
  "schedule": {
    "days": [
      1
    ],
    "start": "start",
    "end": "end"
  },
  "steps": [
    {
      "preset_token": "preset-token",
      "dwell_seconds": 3,
      "speed": 0.5,
      "ai_label": "ai-label"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Cancel the automatic setup

`POST /api/v1/cameras/{camera_id}/ptz/patrol-scans/{scan_id}/actions/cancel`

API 1.56.0. Stops a running setup or drops its proposal: the presets it made are removed and the camera goes back to where it was.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `scan_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/patrol-scans/42/actions/cancel" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: OK.

```json
{
  "id": "id",
  "camera_id": 3,
  "phase": "limits",
  "reason": "no_movement",
  "failed_phase": "precheck",
  "message": "This API key lacks the cameras:write scope.",
  "limits": {
    "method": "method",
    "pan_tilt": false,
    "zoom": false,
    "absolute": false,
    "max_presets": 1,
    "pan_seconds": 0.5,
    "positions": 1,
    "ai_cap": 1,
    "strategy": "sweep"
  },
  "done": 1,
  "total": 1,
  "candidates": [
    {
      "index": 1,
      "preset_token": "preset-token",
      "existing": false,
      "preset_name": "preset-name",
      "has_picture": false,
      "judged": false,
      "label": "person",
      "importance": 1,
      "zones": [
        "zone"
      ],
      "watch": false,
      "dwell_seconds": 1,
      "reason": "reason"
    }
  ],
  "proposal": {
    "name": "Front door",
    "steps": [
      {
        "index": 1,
        "dwell_seconds": 3,
        "label": "person"
      }
    ],
    "total_seconds": 1
  },
  "patrol_id": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Go to a PTZ preset

`POST /api/v1/cameras/{camera_id}/ptz/presets/{preset_token}/actions/goto`

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `goto_ptz_preset`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `preset_token` | path | string | Yes | The preset's `token`. (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/presets/preset-1/actions/goto" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The camera moved.

```json
{
  "status": "done"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Detect PTZ again

`POST /api/v1/cameras/{camera_id}/ptz/actions/probe`

Probes the camera now (ONVIF, ISAPI; no movement) and stores what it found.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least manager |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/ptz/actions/probe" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What was found.

```json
{
  "method": "method",
  "pan_tilt": false,
  "zoom": "optical",
  "max_presets": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Move a room camera

`POST /api/v1/rooms/{room_id}/actions/move-ptz`

A bounded move of one of the room's PTZ cameras, logged as a room actuation. Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `move_ptz_in_room`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes |  |
| `pan` | number | No | (-1–1, default `0`) |
| `tilt` | number | No | (-1–1, default `0`) |
| `zoom` | number | No | (-1–1, default `0`) |
| `duration_ms` | integer | No | (1–5000, default `400`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/actions/move-ptz" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3}'
```

**Response** `200`: Moved.

```json
{
  "ok": false,
  "details": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Robot navigation

API 1.129.0. A robot camera remembers places (room level) and drives to a named one, or home, with the Robot navigation add-on (hal-robotnav, a GPU runner). Paths sit under /cameras/\{camera_id\}/robot.

### Robot navigation status

`GET /api/v1/cameras/{camera_id}/robot/nav`

API 1.129.0. Who controls the robot (`nav`, `patrol`, `manual` or none), the current or last go-to (place, step, last action, how it ended), a learning session, where the robot thinks it is, how many places and views it remembers, whether the Robot navigation add-on is online (the Wi-Fi movement reading is `GET .../robot/wifi-motion`). A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop robot navigation

`POST /api/v1/cameras/{camera_id}/robot/nav/actions/stop`

API 1.129.0. Ends a go-to, return home or place save; the robot gets its own stop and the light goes off. Safe to repeat. Stop robot (`POST .../robot/actions/stop`) ends navigation too. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The status.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send the robot home

`POST /api/v1/cameras/{camera_id}/robot/nav/actions/return-home`

API 1.129.0. Like go-to, to the Home place (the robot's base). `minutes` (default the robot's `max_minutes`, at most 30) bounds the run. `409 conflict` when it has no Home place, while another run, a patrol or a learning session holds the robot, or within 10 s of a manual drive. `503 addon_offline` when the Robot navigation add-on (hal-robotnav) is not online; nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `return_robot_home`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `minutes` | integer | No | Run time limit (default the robot's max_minutes). (1–30) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/actions/return-home" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"minutes":1}'
```

**Response** `202`: Started.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start learning the home

`POST /api/v1/cameras/{camera_id}/robot/nav/learn/actions/start`

API 1.129.0. `drive`: you drive the robot by hand and it keeps a view each time the wheels settle (it does not move by itself). `explore`: the AI patrol drives and each settled picture is kept (AI credits as for an AI patrol; `402 insufficient_credits`, `503 ai_unavailable`). Near-identical views are skipped; the first view becomes the Home place when there is none. `503 addon_offline` when the Robot navigation add-on (hal-robotnav) is not online; nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_robot_nav_learn`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `drive`, `explore` | Yes | `drive`: you drive, it keeps views. `explore`: the AI patrol drives. |
| `minutes` | integer | No | Session limit (default the robot's max_minutes). (1–30) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/learn/actions/start" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"mode":"drive"}'
```

**Response** `202`: Learning.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop learning

`POST /api/v1/cameras/{camera_id}/robot/nav/learn/actions/stop`

API 1.129.0. Ends a learning session (and the AI patrol of `explore`); what was learned stays. Safe to repeat. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/learn/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The status.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Export the robot's place memory

`GET /api/v1/cameras/{camera_id}/robot/nav/map`

API 1.129.0. Places, views (keyframes: rough position, Wi-Fi fingerprint, brightness; not the embeddings), the links between them and the motion calibration, as JSON. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/map" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The map.

```json
{
  "camera_id": 3,
  "places": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "kind": "home",
      "room_id": 1,
      "suggested_name": "suggested-name",
      "needs_name": false,
      "dark": false,
      "views": 2,
      "heading_keyframe_id": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "keyframes": [
    {
      "id": 1,
      "camera_id": 3,
      "place_id": 1,
      "view_index": 1,
      "x": 0.5,
      "y": 0.5,
      "theta": 0.5,
      "wifi": {},
      "brightness": 0.5,
      "light_used": false,
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "edges": [
    {
      "id": 1,
      "from_keyframe_id": 1,
      "to_keyframe_id": 1,
      "dx": 0.5,
      "dy": 0.5,
      "dtheta": 0.5,
      "source": "odometry",
      "successes": 1,
      "failures": 1
    }
  ],
  "calibration": {
    "deg_per_ms": 0.5,
    "cm_per_ms": 0.5
  }
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Forget everything the robot learned

`DELETE /api/v1/cameras/{camera_id}/robot/nav/map`

API 1.129.0. Deletes every place, view and picture of this robot and its run history. The robot must learn again. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| Camera permission | at least manager |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_robot_nav_map`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/map" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Forgotten.

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A learned view's picture

`GET /api/v1/cameras/{camera_id}/robot/nav/keyframes/{keyframe_id}/image`

API 1.129.0. The JPEG the robot saw when it learned this view. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `keyframe_id` | path | integer | Yes | A learned view of the robot. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/keyframes/42/image" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Robot navigation history

`GET /api/v1/cameras/{camera_id}/robot/nav/runs`

API 1.129.0. Go-to, return home and place-save runs, newest first, each with its step log. Kept 30 days. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/runs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of runs.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "kind": "kind",
      "place_id": 1,
      "place_name": "place-name",
      "started_at": "2026-10-30T14:05:00Z",
      "ended_at": "2026-10-30T14:05:30Z",
      "end_reason": "end-reason",
      "steps": 1,
      "log": [
        {
          "step": 1,
          "action": "action",
          "ms": 1,
          "note": "note",
          "at_keyframe_id": 1,
          "free_cm": 0.5
        }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Robot navigation settings

`GET /api/v1/cameras/{camera_id}/robot/nav/settings`

API 1.129.0. `movement_events` (Wi-Fi movement near the idle robot, the `robot.wifi_motion` event, starts one Guardian look at its camera; default on) and `max_minutes` (the default run limit, 10). A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "movement_events": false,
  "max_minutes": 1
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change robot navigation settings

`PATCH /api/v1/cameras/{camera_id}/robot/nav/settings`

API 1.129.0. Absent fields stay. Turning `movement_events` off stops the Guardian look that Wi-Fi movement starts (`robot.wifi_motion` itself is still published). A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_robot_nav_settings`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `movement_events` | boolean | No |  |
| `max_minutes` | integer | No | (1–30) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/robot/nav/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"movement_events":false,"max_minutes":1}'
```

**Response** `200`: The settings.

```json
{
  "movement_events": false,
  "max_minutes": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### The robot's places

`GET /api/v1/cameras/{camera_id}/robot/places`

API 1.129.0. Every place the robot learned (Home first). `needs_name` marks a place still waiting for a name; `suggested_name` comes only from the local vision model (hal-vision), never the cloud. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/places" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The places.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "kind": "home",
      "room_id": 1,
      "suggested_name": "suggested-name",
      "needs_name": false,
      "dark": false,
      "views": 2,
      "heading_keyframe_id": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Save the robot's current spot as a place

`POST /api/v1/cameras/{camera_id}/robot/places`

API 1.129.0. The robot turns on the spot in 8 steps of 45 degrees, keeping a view at each (so it can recognise the place from any side), then faces the first view again. Without `name` the place needs a name: the local vision model suggests one when it is online, otherwise ask the user (no picture goes to the cloud). `kind: home` makes it the robot's base (one per robot). Answers the place at once; the turn runs in the background (`GET .../robot/nav`). `409 conflict` for a second home or a busy robot. `503 addon_offline` when the Robot navigation add-on (hal-robotnav) is not online; nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_robot_place`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Empty or absent = ask later (needs_name). (max 60 characters) |
| `kind` | string: `home`, `place` | No | (default `"place"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/places" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","kind":"home"}'
```

**Response** `202`: Saving.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "kind": "home",
  "room_id": 1,
  "suggested_name": "suggested-name",
  "needs_name": false,
  "dark": false,
  "views": 2,
  "heading_keyframe_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A robot place

`GET /api/v1/cameras/{camera_id}/robot/places/{place_id}`

API 1.129.0. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `place_id` | path | integer | Yes | A place of the robot (Robot navigation). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/robot/places/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The place.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "kind": "home",
  "room_id": 1,
  "suggested_name": "suggested-name",
  "needs_name": false,
  "dark": false,
  "views": 2,
  "heading_keyframe_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Name or change a robot place

`PATCH /api/v1/cameras/{camera_id}/robot/places/{place_id}`

API 1.129.0. Absent fields stay. `room_id` links the place to a room of the floor plans (null clears it); naming the place clears `needs_name`. Nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `place_id` | path | integer | Yes | A place of the robot (Robot navigation). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 60 characters) |
| `kind` | string: `home`, `place` | No |  |
| `room_id` | integer or null | No | A room of the floor plans; null clears it. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/robot/places/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","kind":"home","room_id":1}'
```

**Response** `200`: The place.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "kind": "home",
  "room_id": 1,
  "suggested_name": "suggested-name",
  "needs_name": false,
  "dark": false,
  "views": 2,
  "heading_keyframe_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a robot place

`DELETE /api/v1/cameras/{camera_id}/robot/places/{place_id}`

API 1.129.0. The place goes; its views stay in the map as waypoints. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_robot_place`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `place_id` | path | integer | Yes | A place of the robot (Robot navigation). |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/robot/places/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send the robot to a place

`POST /api/v1/cameras/{camera_id}/robot/places/{place_id}/actions/goto`

API 1.129.0. Room level: the robot works out where it is from its camera (and Wi-Fi), plans over the places and views it learned, and drives there in short timed moves, checking a fresh still before each and the floor in front of it, with the AI patrol's limits (20 moves a minute, Wi-Fi above -80 dBm, battery). It switches its light on where it is dark. `minutes` (default the robot's `max_minutes`, at most 30). Follow it with `GET .../robot/nav` or the `robot.nav.*` events; it ends `arrived`, `stopped`, `manual` (someone drove it), `lost`, `blocked`, `no_route`, `too_dark`, `low_battery`, `weak_wifi`, `robot_unreachable`, `addon_offline`, `timeout` or `error`, always with the robot's own stop. `409 conflict` while something else drives it or the place has no views. `503 addon_offline` when the Robot navigation add-on (hal-robotnav) is not online; nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `goto_robot_place`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `place_id` | path | integer | Yes | A place of the robot (Robot navigation). |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `minutes` | integer | No | Run time limit (default the robot's max_minutes). (1–30) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/places/42/actions/goto" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"minutes":1}'
```

**Response** `202`: Started.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Tell the robot where it is

`POST /api/v1/cameras/{camera_id}/robot/places/{place_id}/actions/relocalise`

API 1.129.0. "I'm here": sets the robot's position to this place (its first view). The next go-to trusts it once instead of looking around. Nothing moves. A camera that is not a robot is `409 not_a_robot`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `place_id` | path | integer | Yes | A place of the robot (Robot navigation). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/robot/places/42/actions/relocalise" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The status.

```json
{
  "camera_id": 3,
  "addon_online": false,
  "controller": "controller",
  "running": false,
  "kind": "kind",
  "place_id": 1,
  "place_name": "place-name",
  "minutes": 1,
  "step": 1,
  "max_steps": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "ends_at": "2026-10-30T14:05:30Z",
  "ended_at": "2026-10-30T14:05:30Z",
  "last_action": "last-action",
  "last_note": "last-note",
  "end_reason": "end-reason",
  "end_message": "end-message",
  "learning": {
    "mode": "drive",
    "running": false,
    "keyframes": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "ends_at": "2026-10-30T14:05:30Z",
    "ended_at": "2026-10-30T14:05:30Z",
    "end_reason": "end-reason"
  },
  "here": {
    "keyframe_id": 1,
    "place_id": 1,
    "place_name": "place-name",
    "at": "2026-10-30T14:05:00Z",
    "told": false
  },
  "places": 1,
  "keyframes": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Alerts

Detections and alerts. `is_alert` marks a label promoted by the camera's alert rules.

### List what happened on cameras in a time range, folded for a timeline

`GET /api/v1/timeline/marks`

API 1.116.0. The marks a Playback timeline draws for up to 16 cameras in `[from, to)` (at most 7 days). Every event (detections and the reports of runners attached to the camera, Guardian entries, speech transcripts) gets a `kind`; events of one camera and kind that start less than `bucket_seconds` after the previous one ends are folded into one mark with their `count`, span (`start`, `end`) and up to 5 `labels` (most frequent first). Choose `bucket_seconds` as the time one pixel or one mark covers at your zoom (default: the range divided by 240). `rep` is the member to show: one with a picture first, an alert before others, then the highest confidence; `thumbnail_url` is a 160 px picture of it (null for speech or when it has none); `ids` are up to 50 ids of the members of `rep.type` (`detection` ids are alert ids). `alert` is true when a member raised an alert (the camera's alert rules promote its label, a Guardian alert rule fired, or kind `alert`: lines, zones, QR codes, weapons). `text` is the start of the Guardian description or of the speech. At most 3000 marks, oldest first (`truncated` says later ones were cut: ask for a shorter range or a larger bucket). Kinds: `person`, `vehicle`, `animal`, `face`, `plate`, `speech`, `sound`, `guardian`, `alert`, `other`. Door and other sensors are not listed (they are not linked to cameras).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_ids` | query | string | Yes | 1 to 16 camera ids, comma-separated. A camera you may not view is `404 not_found`. |
| `from` | query | string (RFC 3339) | Yes |  |
| `to` | query | string (RFC 3339) | Yes | After `from`, at most 7 days later. |
| `bucket_seconds` | query | integer | No | Fold events closer than this (1 to 86400; default the range divided by 240). (1–86400) |
| `kinds` | query | string | No | Only these kinds, comma-separated. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/timeline/marks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The marks.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "bucket_seconds": 1,
  "truncated": false,
  "data": [
    {
      "camera_id": 3,
      "kind": "person",
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "count": 2,
      "alert": false,
      "labels": [
        "person"
      ],
      "rep": {
        "type": "detection",
        "id": 1
      },
      "thumbnail_url": "thumbnail-url",
      "ids": [
        1
      ],
      "text": "text"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find recorded events (the Recordings page search)

`GET /api/v1/recordings/events`

API 1.117.0. Every detection and Guardian entry of the cameras you may view, newest first, filtered, with the total and the counts of each filter value. One result is one card: repeats of the same camera and label are one card, its newest detection, with `count` the detections it stands for and `pictures` their pictures. Repeats are detections of one track (the detector's `track_id`) each within 10 minutes of the next, or with no track, each within 3 minutes of the next. A Guardian entry is one card. `total` and the facets count cards. With `attention=true` every unacknowledged alert is its own card. Time: send `range` (as the app's address does) or `from`/`to`; with neither the search covers any time. The app's Recordings page sends `min_confidence=0.5` unless the person changes it; this API has no confidence default, so a call without `min_confidence` counts more than the page shows. Filters combine with AND; the values of one filter with OR; `camera_ids` and `room_ids` together are a union of places (a room stands for its cameras). On the first page (no `cursor`) the answer has `total` and `facets`: the count of each value of each filter with every other filter applied but not its own, so a count says what picking that value gives. Values with no results are left out. Later pages have `total` and `facets` null. A camera you may not view never matches (no error). Guardian entries need the `guardian:read` scope as well; without it only detections are returned. What each filter matches is listed in docs/recordings-page.md.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `show` | query | string: `all`, `events` | No | `all` (detections and Guardian entries) or `events` (detections only). (default `"all"`) |
| `labels` | query | string | No | Comma-separated `person` (people and faces), `vehicle` (vehicles and plates), `animal`, `other` (everything else: Guardian alerts, lines, zones, QR codes, sounds, weapons…). A Guardian entry has the label of the detection that started it, else `other`. |
| `person` | query | array of string | No | A recognised face's name (repeat for several); `unknown` is a face that matched nobody. Only detections. (max 100 items) |
| `plate` | query | string | No | Part of a licence plate; case, spaces and `-._·/` are ignored. Only plate reads. (max 64 characters) |
| `triggers` | query | string | No | Comma-separated: `motion` (a Guardian analysis motion started), `sound` (a sound detection), `doorbell`, `sensor` (an alert another system reported with `POST /alerts`), `line_zone` (a line crossing or a zone), `guardian` (every Guardian entry and Guardian alert), `addon` (reported by a community add-on). |
| `vehicle_types` | query | string | No | Comma-separated vehicle classes as the detector names them (`car`, `truck`, `bus`, `motorcycle`, `bicycle`…). |
| `camera_ids` | query | string | No | Comma-separated camera ids (at most 100). |
| `room_ids` | query | string | No | Comma-separated room ids (at most 100); a room stands for its cameras. |
| `range` | query | string: `1h`, `1d`, `1w`, `1m`, `all` | No | The last hour (`1h`), day (`1d`), week (`1w`) or 30 days (`1m`), or `all` (any time): the app's address names. `from` or `to`, when sent, win. Left out with no `from`/`to`: any time. |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No | Exclusive; after `from`. |
| `min_confidence` | query | number | No | 0 to 1; hides detections scored below it. Alerts (labels an alert rule of the camera promotes) and Guardian entries are always kept. No default here (the app's page sends 0.5). (0–1) |
| `attention` | query | boolean | No | Only alerts not acknowledged yet, each its own card: what the app's alert bell counts. The time (`range`, `from`, `to`) and `min_confidence` do not apply to it; the other filters do. `facets.attention` is this same number whatever the time. |
| `q` | query | string | No | Up to 6 words; each must be found in the label (a class, a face name, a plate), the camera's name, the name of a room the camera is in, or a Guardian description or what was heard. (max 200 characters) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings/events" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: One page of events.

```json
{
  "total": 1,
  "facets": {
    "show": {},
    "attention": 1,
    "labels": {},
    "people": [
      {
        "name": "Front door",
        "unknown": false,
        "count": 2
      }
    ],
    "triggers": {},
    "vehicle_types": {},
    "cameras": [
      {
        "id": 1,
        "name": "Front door",
        "count": 2
      }
    ],
    "rooms": [
      {
        "id": 1,
        "name": "Front door",
        "count": 2
      }
    ]
  },
  "data": [
    {
      "type": "detection",
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "at": "2026-10-30T14:05:00Z",
      "moment": "2026-10-30T14:05:00Z",
      "kind": "person",
      "label_group": "person",
      "label": "person",
      "person": "person",
      "plate": "plate",
      "vehicle_type": "vehicle-type",
      "triggers": [
        "motion"
      ],
      "confidence": 0.5,
      "is_alert": true,
      "severity": "normal",
      "acknowledged": false,
      "picture_url": "picture-url",
      "pictures": [
        {
          "alert_id": 1,
          "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
        }
      ],
      "count": 2,
      "track_id": 1,
      "addon": {
        "id": "id",
        "name": "Front door"
      },
      "description": "description",
      "trigger": "trigger"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark whole cards seen

`POST /api/v1/recordings/cards/actions/acknowledge`

API 1.117.0. Acts on whole Recordings cards (GET /recordings/events: a card stands for `count` repeats of one camera and label). `alert_ids` (at most 100) are any detection of each card, usually the card's `id`. The server takes each card as it is now, with the same grouping as the search: a repeat that arrived after the list was read is included, and the answer's `cards[].count` and `detection_count` say how many detections the cards hold now. Cards you cannot see are in `not_found_ids`; cards on cameras where you lack the camera permission in `forbidden_ids`. Every unacknowledged alert of the cards is acknowledged (`done_count`; alert.acknowledged is emitted for each).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alert_ids` | array of integer | Yes | (max 100 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/recordings/cards/actions/acknowledge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"alert_ids":[1]}'
```

**Response** `200`: What was acknowledged.

```json
{
  "detection_count": 2,
  "done_count": 2,
  "cards": [
    {
      "alert_id": 1,
      "count": 2,
      "done": 1
    }
  ],
  "not_found_ids": [
    1
  ],
  "forbidden_ids": [
    1
  ],
  "library_item_ids": [
    1
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete whole cards

`POST /api/v1/recordings/cards/actions/delete`

API 1.117.0. Acts on whole Recordings cards (GET /recordings/events: a card stands for `count` repeats of one camera and label). `alert_ids` (at most 100) are any detection of each card, usually the card's `id`. The server takes each card as it is now, with the same grouping as the search: a repeat that arrived after the list was read is included, and the answer's `cards[].count` and `detection_count` say how many detections the cards hold now. Cards you cannot see are in `not_found_ids`; cards on cameras where you lack the camera permission in `forbidden_ids`. Every detection of the cards and its picture is deleted for good (`done_count`), as DELETE /alerts/\{alert_id\} without `delete_recording` does for one: recordings are kept, audited. Guardian entries are deleted with deleteGuardianEntries (they go to Recently deleted).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_recording_cards`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alert_ids` | array of integer | Yes | (max 100 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/recordings/cards/actions/delete" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"alert_ids":[1]}'
```

**Response** `200`: What was deleted.

```json
{
  "detection_count": 2,
  "done_count": 2,
  "cards": [
    {
      "alert_id": 1,
      "count": 2,
      "done": 1
    }
  ],
  "not_found_ids": [
    1
  ],
  "forbidden_ids": [
    1
  ],
  "library_item_ids": [
    1
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Save whole cards to the media library

`POST /api/v1/recordings/cards/actions/save`

API 1.117.0. Acts on whole Recordings cards (GET /recordings/events: a card stands for `count` repeats of one camera and label). `alert_ids` (at most 100) are any detection of each card, usually the card's `id`. The server takes each card as it is now, with the same grouping as the search: a repeat that arrived after the list was read is included, and the answer's `cards[].count` and `detection_count` say how many detections the cards hold now. Cards you cannot see are in `not_found_ids`; cards on cameras where you lack the camera permission in `forbidden_ids`. Every picture of the cards is copied into the media library (`folder`), one item each, named after the card's `name` (else its label), the time and its place in the card (`library_item_ids`; `done_count` pictures). At most 500 pictures per request. Admins and operators; the camera needs viewer permission.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cards` | array of object | Yes | (max 100 items) |
| `folder` | string | No | Library folder (`/`-separated); empty = the top level. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/recordings/cards/actions/save" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"cards":[{"alert_id":1,"name":"Front door"}]}'
```

**Response** `200`: What was saved.

```json
{
  "detection_count": 2,
  "done_count": 2,
  "cards": [
    {
      "alert_id": 1,
      "count": 2,
      "done": 1
    }
  ],
  "not_found_ids": [
    1
  ],
  "forbidden_ids": [
    1
  ],
  "library_item_ids": [
    1
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List QR code reads

`GET /api/v1/qr-codes`

The QR codes the cameras read in their video (API 1.84.0), newest first, on cameras the caller may view. Every camera with server motion detection reads the codes it sees while there is motion (a pass held up, a parcel label at the door, an asset tag), on the server CPU, at most once a second, and records the same code once a minute per camera. A code needs about 75-100 px across in the picture: within 1-2 m of a 1080p wide camera. Each read is also an alert labelled `qr:<payload>` (the payload cut to the label's 64 characters; `alert_id`), so a label alert rule on `qr:<payload>` fires when that code is shown. Internal floor-plan walkthrough beacons (`vigiora-wt:…`) are not alerts and are listed only with `include_internal=true`.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `q` | query | string | No | Only codes whose text contains this (case-insensitive). (max 256 characters) |
| `include_internal` | query | boolean | No | Also list the internal walkthrough beacons (default false). |
| `from` | query | string (RFC 3339) | No | Seen at or after (inclusive). |
| `to` | query | string (RFC 3339) | No | Seen before (exclusive). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/qr-codes" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of QR code reads.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "payload": "payload",
      "seen_at": "2026-10-30T14:05:00Z",
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "corners": [
        [
          0.5
        ]
      ],
      "frame_width": 1,
      "frame_height": 1,
      "alert_id": 1,
      "internal": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List alerts

`GET /api/v1/alerts`

Detections on cameras the caller may view, newest first. Filter with `is_alert=true` for alerts only (labels promoted by the camera's alert rules).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `label` | query | string | No | Exact label (`person`, `car`, …). `face` matches every recognised face (`face:<name>`); `qr` every QR code read (`qr:<payload>`, API 1.84.0). (max 64 characters) |
| `acknowledged` | query | boolean | No |  |
| `is_alert` | query | boolean | No |  |
| `source` | query | string | No | Only alerts reported by this external system (`POST /alerts`). (max 64 characters) |
| `from` | query | string (RFC 3339) | No | Detected at or after (inclusive). |
| `to` | query | string (RFC 3339) | No | Detected before (exclusive). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of alerts.

```json
{
  "data": [
    {
      "addon": {
        "id": "id",
        "name": "Front door"
      },
      "speaker": {
        "result": "played",
        "sound": "announcement",
        "camera_ids": [
          3
        ],
        "at": "2026-10-30T14:05:00Z"
      },
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "label": "person",
      "confidence": 0.5,
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "track_id": 1,
      "acknowledged": false,
      "is_alert": true,
      "severity": "normal",
      "has_snapshot": true,
      "source": "source",
      "detected_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Report an alert

`POST /api/v1/alerts`

Ingests an alert from an external system (a sensor, an analytics product) on one of this server's cameras: operator permission on the camera. `source` names the reporting system and is returned on the alert (and filterable with `GET /alerts?source=`). The alert appears in lists, Briefing and the event stream (`alert.created`, and webhooks) like the server's own detections; the camera's alert rules decide `is_alert`. Labels starting `face:`, `plate:`, `qr:` or `analytics:` (any case for the last three) are reserved. Retry safely with `Idempotency-Key`. An alert whose `bbox` centre is inside one of the camera's privacy masks is not stored: the answer is 200 with `dropped: privacy_mask` (API 1.108.0).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_alert`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes | (≥ 1) |
| `label` | string | Yes | What was detected (`door_open`, `glass_break`, `person`, …), without control characters or line breaks. Not `face:…`. (max 64 characters) |
| `source` | string | Yes | The reporting system, lower-case letters, digits, `.`, `_` and `-` (`door-sensor`, `acme.analytics`). (max 64 characters) |
| `confidence` | number | No | Default 1. (0–1) |
| `bbox` | BBox or any or null | No |  |
| `detected_at` | string (RFC 3339) | No | When it happened (default now; from 7 days ago to 5 minutes in the future). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alerts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"label":"person","source":"source"}'
```

**Response** `200`: Not stored, because the box centre is inside a privacy mask of the camera.

```json
{
  "dropped": "privacy_mask"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Acknowledge alerts in bulk

`POST /api/v1/alerts/actions/acknowledge`

Either `ids` (at most 500; ids you cannot see are reported in `not_found_ids`, ids on cameras where you lack operator permission in `forbidden_ids`), or `before` (every unacknowledged alert detected before that time on cameras where you have operator permission, optionally one `camera_id`).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array of integer | No | (max 500 items) |
| `before` | string (RFC 3339) | No |  |
| `camera_id` | integer | No | With `before` only. (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alerts/actions/acknowledge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1201,1202,1203]}'
```

**Response** `200`: What was acknowledged.

```json
{
  "acknowledged_count": 2,
  "not_found_ids": [
    1
  ],
  "forbidden_ids": [
    1
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an alert

`GET /api/v1/alerts/{alert_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The alert.

```json
{
  "addon": {
    "id": "id",
    "name": "Front door"
  },
  "speaker": {
    "result": "played",
    "sound": "announcement",
    "camera_ids": [
      3
    ],
    "at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "label": "person",
  "confidence": 0.5,
  "bbox": {
    "x": 0.5,
    "y": 0.5,
    "w": 0.5,
    "h": 0.5
  },
  "track_id": 1,
  "acknowledged": false,
  "is_alert": true,
  "severity": "normal",
  "has_snapshot": true,
  "source": "source",
  "detected_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an alert

`DELETE /api/v1/alerts/{alert_id}`

Deletes the alert and its snapshot; with `delete_recording=true` also the recording segment that covers it (evidence: audited).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_alert`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |
| `delete_recording` | query | boolean | No | (default `false`) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/alerts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Alert snapshot

`GET /api/v1/alerts/{alert_id}/snapshot`

The JPEG saved with the detection (`has_snapshot`). Not served through a Cloudflare Tunnel origin. With `width`, a downscaled JPEG (aspect kept), cached by the browser (`private, max-age=604800, immutable`, with an `ETag`).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |
| `width` | query | string: `160`, `320`, `640`, `full` | No | Thumbnail width in pixels (160, 320 or 640); `full` or absent is the original. A source no wider than `width` is sent as is. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts/42/snapshot" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Acknowledge an alert

`POST /api/v1/alerts/{alert_id}/actions/acknowledge`

Needs operator permission on the alert's camera (alerts without a camera need an admin).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alerts/42/actions/acknowledge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The alert.

```json
{
  "addon": {
    "id": "id",
    "name": "Front door"
  },
  "speaker": {
    "result": "played",
    "sound": "announcement",
    "camera_ids": [
      3
    ],
    "at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "label": "person",
  "confidence": 0.5,
  "bbox": {
    "x": 0.5,
    "y": 0.5,
    "w": 0.5,
    "h": 0.5
  },
  "track_id": 1,
  "acknowledged": false,
  "is_alert": true,
  "severity": "normal",
  "has_snapshot": true,
  "source": "source",
  "detected_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reopen an alert

`POST /api/v1/alerts/{alert_id}/actions/unacknowledge`

Marks an acknowledged alert as not acknowledged again (`alert.unacknowledged`). Needs operator permission on the alert's camera (alerts without a camera need an admin).

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alerts/42/actions/unacknowledge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The alert.

```json
{
  "addon": {
    "id": "id",
    "name": "Front door"
  },
  "speaker": {
    "result": "played",
    "sound": "announcement",
    "camera_ids": [
      3
    ],
    "at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "label": "person",
  "confidence": 0.5,
  "bbox": {
    "x": 0.5,
    "y": 0.5,
    "w": 0.5,
    "h": 0.5
  },
  "track_id": 1,
  "acknowledged": false,
  "is_alert": true,
  "severity": "normal",
  "has_snapshot": true,
  "source": "source",
  "detected_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Camera speaker alert settings

`GET /api/v1/alert-speaker/settings`

API 1.54.0. The server-wide setting for alerts on camera speakers (see AlertSpeakerSettings), with the alarm panels shared with Vigiora, their state, whether announcements are available, and the built-in announcement per language.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alert-speaker/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The setting.

```json
{
  "enabled": true,
  "min_severity": "low",
  "sound": "announcement",
  "use_camera_siren": false,
  "language": "language",
  "message": "This API key lacks the cameras:write scope.",
  "volume": 0.5,
  "max_seconds": 3,
  "repeats": 1,
  "cooldown_seconds": 30,
  "quiet_hours": {
    "enabled": true,
    "start": "start",
    "end": "end"
  },
  "arm_mode": "any",
  "arm_entity": "arm-entity",
  "arm_state": {
    "state": "state",
    "entity": "entity"
  },
  "arm_panels": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "state": "state"
    }
  ],
  "tts_available": false,
  "default_messages": {}
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change camera speaker alert settings

`PATCH /api/v1/alert-speaker/settings`

API 1.54.0. Admins. Only the fields sent change. Turning alerts on camera speakers on, or the camera's own siren, makes cameras sound in the real world: agents confirm first. Emits settings.changed (resource alert_speaker).

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_alert_speaker_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `min_severity` | string: `low`, `normal`, `high` | No |  |
| `sound` | string: `announcement`, `chime`, `siren` | No |  |
| `use_camera_siren` | boolean | No |  |
| `language` | string | No | (max 12 characters) |
| `message` | string | No | (max 200 characters) |
| `volume` | number | No | (0–2) |
| `max_seconds` | integer | No | (3–15) |
| `repeats` | integer | No | (1–3) |
| `cooldown_seconds` | integer | No | (30–3600) |
| `quiet_hours` | AlertSpeakerQuietHours | No |  |
| `arm_mode` | string: `any`, `armed`, `away` | No |  |
| `arm_entity` | string or null | No | An `alarm_control_panel.` entity id; `null` = any shared panel. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/alert-speaker/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"min_severity":"low","sound":"announcement","use_camera_siren":false,"language":"language","message":"This API key lacks the cameras:write scope.","volume":0.5,"max_seconds":3,"repeats":1,"cooldown_seconds":30,"quiet_hours":{"enabled":true,"start":"start","end":"end"},"arm_mode":"any","arm_entity":"arm-entity"}'
```

**Response** `200`: The setting.

```json
{
  "enabled": true,
  "min_severity": "low",
  "sound": "announcement",
  "use_camera_siren": false,
  "language": "language",
  "message": "This API key lacks the cameras:write scope.",
  "volume": 0.5,
  "max_seconds": 3,
  "repeats": 1,
  "cooldown_seconds": 30,
  "quiet_hours": {
    "enabled": true,
    "start": "start",
    "end": "end"
  },
  "arm_mode": "any",
  "arm_entity": "arm-entity",
  "arm_state": {
    "state": "state",
    "entity": "entity"
  },
  "arm_panels": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "state": "state"
    }
  ],
  "tts_available": false,
  "default_messages": {}
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Cameras with a speaker

`GET /api/v1/alert-speaker/cameras`

API 1.54.0. The cameras this server streams that have a speaker Vigiora can use: `voice` (announcements, chime, siren sound) or `siren` (only the camera's own siren). Cameras the caller cannot view are left out.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alert-speaker/cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cameras.

```json
{
  "data": [
    {
      "camera_id": 3,
      "camera_name": "Front door",
      "kind": "voice",
      "voice": false,
      "siren": false,
      "siren_via": "reolink",
      "room_name": "room-name",
      "checked_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test a camera speaker

`POST /api/v1/alert-speaker/actions/test`

API 1.54.0. Plays `sound` on the camera now (no quiet hours, arm mode or cooldown; one play per camera at a time, an operator's live talk wins). Tests are short: one play, a siren 3 s. Without `message` the announcement is a built-in test sentence. Needs operator permission on the camera; a camera without a speaker Vigiora can use is 409. The outcome is recorded and audit-logged like an alert's.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `test_alert_speaker`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes | (≥ 1) |
| `sound` | string: `announcement`, `chime`, `siren` | Yes |  |
| `message` | string or null | No | (max 200 characters) |
| `volume` | number or null | No | (0–2) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alert-speaker/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"sound":"announcement"}'
```

**Response** `200`: The outcome (also when skipped or failed).

```json
{
  "id": 1,
  "camera_id": 3,
  "sound": "announcement",
  "via": "backchannel",
  "result": "played",
  "reason": "reason",
  "duration_ms": 1,
  "run_id": 1,
  "stop_state": "sounding",
  "stop_attempts": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Camera speaker plays

`GET /api/v1/alert-speaker/plays`

API 1.54.0. Every play on a camera speaker, skipped or failed one (alerts and tests), newest first. Only the caller's cameras.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `alert_id` | query | integer | No | (≥ 1) |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alert-speaker/plays" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of plays.

```json
{
  "data": [
    {
      "id": 1,
      "at": "2026-10-30T14:05:00Z",
      "alert_id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "rule_type": "label",
      "rule_id": 1,
      "sound": "announcement",
      "via": "backchannel",
      "result": "played",
      "reason": "reason",
      "duration_ms": 1,
      "test": false,
      "run_id": 1,
      "stop_state": "sounding",
      "stop_attempts": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Sounds playing now

`GET /api/v1/sounds/active`

API 1.105.0. Every siren Vigiora started that may still be sounding or is being switched off: camera sirens and Home Assistant sirens. `state`: `starting` (the "on" was sent, no answer yet), `sounding` (its off is due at `stop_by`), `self_ending` (the device stops by itself at about `stop_by`), `stopping` (an off was sent and not confirmed; it may still be sounding and Vigiora keeps retrying on a new login: 2, 5, 10, 30 s, then every minute for 24 hours), `stop_failed` (no confirmed off in 24 hours; shown for 48 hours until dismissed). `hushed_until`: Stop all sounds was used by an admin or operator and automatic sounds (alert rules) stay off until then. `length_set_by_device`: a self-ending play of one cycle, whose length the device decides (`stop_by` is an estimate). The web app shows its red Stop button while this list has a run in `starting`, `sounding`, `self_ending`, `stopping` or `stop_failed`. Only the caller's cameras; Home Assistant sirens and runs of deleted cameras only for admins and operators.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/sounds/active" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What may be sounding.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "entity_id": "entity-id",
      "name": "Front door",
      "way": "reolink",
      "mode": "mode",
      "source": "source",
      "state": "starting",
      "started_at": "2026-10-30T14:05:00Z",
      "stop_by": "2026-10-30T14:05:00Z",
      "attempts": 1,
      "last_error": "last-error",
      "stopped_at": "2026-10-30T14:05:00Z",
      "length_set_by_device": false
    }
  ],
  "hushed_until": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop all sounds

`POST /api/v1/sounds/actions/stop-all`

API 1.105.0. Makes everything quiet at once. Every role that can see alerts may call it; what it reaches depends on who calls. Everyone: every camera siren Vigiora started on a camera the caller can see gets its off now (on a new login), every other Reolink siren camera the caller can see gets one off too (an off is harmless), and announcements and chimes in progress on those cameras stop within half a second. Admins and operators (an API key also needs `cameras:control`) reach the whole house: also Home Assistant sirens (the ones Vigiora started and every siren shared for control), runs of deleted cameras and running light effects; and then automatic sounds (alert rules) stay off for 10 minutes, so the same alert does not start the noise again (`hushed_until`; null when this call did not start the pause). An explicit start by a person or an agent still works during the pause. Waits up to about 8 s for the first offs and answers the honest result: `stopped` were confirmed off (or ended by themselves), `stopping` are still being retried (they may be sounding; see GET /sounds/active). Always safe to call, also when nothing sounds (200 with zero counts); it never makes a sound. Needs no confirmation.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sounds/actions/stop-all" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What was stopped.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "entity_id": "entity-id",
      "name": "Front door",
      "way": "reolink",
      "mode": "mode",
      "source": "source",
      "state": "starting",
      "started_at": "2026-10-30T14:05:00Z",
      "stop_by": "2026-10-30T14:05:00Z",
      "attempts": 1,
      "last_error": "last-error",
      "stopped_at": "2026-10-30T14:05:00Z",
      "length_set_by_device": false
    }
  ],
  "stopped": 1,
  "stopping": 1,
  "ending": 1,
  "hushed_until": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Dismiss a siren that could not be switched off

`POST /api/v1/sounds/{sound_id}/actions/dismiss`

API 1.105.0. A person says a siren Vigiora could not switch off is quiet now (unplugged, silenced in the maker's app): Vigiora stops retrying the off and stops the "could not silence" notifications. Only for a sound in state `sounding`, `stopping` or `stop_failed` (else 409). Admins and operators with operator permission on the camera; asks for confirmation while human in the loop is on, because a wrong dismissal leaves a siren sounding with nobody trying to stop it.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `dismiss_sound`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sound_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sounds/42/actions/dismiss" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The sound, now dismissed.

```json
{
  "id": 1,
  "camera_id": 3,
  "entity_id": "entity-id",
  "name": "Front door",
  "way": "reolink",
  "mode": "mode",
  "source": "source",
  "state": "starting",
  "started_at": "2026-10-30T14:05:00Z",
  "stop_by": "2026-10-30T14:05:00Z",
  "attempts": 1,
  "last_error": "last-error",
  "stopped_at": "2026-10-30T14:05:00Z",
  "length_set_by_device": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's detection events

`GET /api/v1/cameras/{camera_id}/detection-events`

One feed of what was detected on the camera, oldest first: this server's detections grouped into events (one per tracked object, plus single detections; `source` `core-ai`, `alert_id` its latest alert) and the reports of the Vision Engine services attached to the camera (enrolled for it or assigned to it; `source` and `service` = the service, e.g. `hal-objects`, `hal-face`; `confidence` and `bbox` read from the report, the raw report in `attributes` when at most 2 KB). Vision Engine reports are kept 30 days (server setting `hal_events_retention_days`). Filter with `source` (repeatable or comma-separated) and `label`.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |
| `source` | query | string | No | `core-ai`, or a Vision Engine service name; repeatable or comma-separated (default all). (max 512 characters) |
| `label` | query | string | No | Exact label (`person`, `face`, `car`, …). (max 128 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/detection-events" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of events.

```json
{
  "data": [
    {
      "id": "id",
      "label": "person",
      "raw_label": "raw-label",
      "source": "source",
      "service": "service",
      "hal_token_id": 1,
      "track_id": 1,
      "start_time": "2026-10-30T14:05:00Z",
      "end_time": "2026-10-30T14:05:30Z",
      "count": 2,
      "peak_confidence": 0.5,
      "alert_id": 1,
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "attributes": {}
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's object tracks

`GET /api/v1/cameras/{camera_id}/detection-tracks`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |
| `label` | query | string | No | (max 64 characters) |
| `limit` | query | integer | No | (1–500) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/detection-tracks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The tracks.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the boxes around a camera's detected objects in a time window

`GET /api/v1/cameras/{camera_id}/detection-boxes`

API 1.110.0. What Playback draws over a recording: where detectors saw objects, as rectangles normalised to the frame (`x`, `y` = top-left corner, 0 to 1), for a window of at most 5 minutes; ask for the next window as the recording plays. Two sources: tracks of a camera with Analytics on (`source` is `track`: every observation of the object, 3 to 5 per second, kept for the Analytics raw-track retention, 7 days by default; person and vehicle classes only) and detections of the Vision Engine services and add-ons (`source` is the service: one box when the object is first seen, kept as long as the detection). A detection a track already shows is left out. `label` is as stored: a class, `face:<name>` or `plate:<text>`. `track_id` is the detector's id for the object, null when it sent none; ids of different sources are separate. The boxes are never part of a recording or an export. A box whose centre lies inside one of the camera's privacy masks is never returned (503 when the masks cannot be read).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | Yes |  |
| `to` | query | string (RFC 3339) | Yes | After `from`, at most 5 minutes later. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/detection-boxes" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The boxes, oldest first (at most 5000; `truncated` says more were cut).

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "boxes": [
    {
      "t": "2026-10-30T14:05:00Z",
      "label": "person",
      "confidence": 0.5,
      "x": 0.5,
      "y": 0.5,
      "w": 0.5,
      "h": 0.5,
      "track_id": 1,
      "source": "source"
    }
  ],
  "truncated": false
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find the recording of an alert

`GET /api/v1/alerts/{alert_id}/recording`

The recording segment containing the alert's moment and the offset into it (`GET /recordings/{recording_id}/media`), `pending` while that moment is in the segment still being recorded, and the Guardian entry whose clip shows it (`guardian_clip_start` to seek in the clip).

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts/42/recording" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Where to play it.

```json
{
  "alert_id": 1,
  "event_at": "2026-10-30T14:05:00Z",
  "recording_id": 1,
  "seek_seconds": 1,
  "segment_start": "2026-10-30T14:05:00Z",
  "segment_end": "2026-10-30T14:05:30Z",
  "in_gap": false,
  "pending": false,
  "guardian_entry_id": 1,
  "guardian_clip_start": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List people counts

`GET /api/v1/counts`

Per-minute people counts (peak and unique) of the cameras with a counter, newest first (at most 1000 rows).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |
| `hours` | query | integer | No | (1–168, default `24`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/counts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The counts.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the latest people counts

`GET /api/v1/counts/latest`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/counts/latest" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The latest counts.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List motion levels

`GET /api/v1/motion`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |
| `hours` | query | integer | No | (1–168, default `24`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/motion" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The motion samples.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the latest motion levels

`GET /api/v1/motion/latest`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/motion/latest" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The latest motion.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Unacknowledged alert counts

`GET /api/v1/alerts/summary`

Counts of the unacknowledged alerts on the cameras the caller may view, in total, by severity and by camera, with the newest one's time and id (poll this to notice new alerts cheaply). Alerts with no camera count for admins only. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts/summary" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The counts.

```json
{
  "unacknowledged": 1,
  "alerts": 1,
  "by_severity": {},
  "cameras": [
    {
      "camera_id": 3,
      "camera_name": "Front door",
      "unacknowledged": 1,
      "alerts": 1,
      "by_severity": {}
    }
  ],
  "latest_at": "2026-10-30T14:05:00Z",
  "latest_id": 1
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Analytics

People and vehicle counts, occupancy, dwell and heatmaps from the Vigiora Analytics add-on. API 1.30.0 adds queue zones and their waits (`/analytics/queues`), the busy hours of the week, crossing speeds on calibrated cameras (an estimate), paths and flows, parking bays (zones of kind `bay`, `/analytics/bays`, `bay.occupied` and `bay.freed` events), analytics alert rules with their firings, and door displays (a public page showing whether an area has room; its token is shown once). Zones gain `kind`, `queue_min_wait_sec`, `reserved_schedule` and `max_stay_min`, cameras a `calibration`, areas `open_hours`, and occupancy the source `bays`.

### List analytics areas

`GET /api/v1/analytics/areas`

Areas group counting lines and zones (possibly of several cameras) into one place, such as a shop or a car park, ordered by `sort_order` then id. An area is listed when you may view every camera of its lines and zones; areas without any line or zone are listed to admins only.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/areas" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of areas.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "site_id": 1,
      "capacity": 1,
      "reset_at": "reset-at",
      "sort_order": 1,
      "lines": [
        {
          "line_id": 1,
          "sign": 1
        }
      ],
      "zones": [
        1
      ],
      "open_hours": {
        "mon": [
          [
            "mon"
          ]
        ],
        "tue": [
          [
            "tue"
          ]
        ],
        "wed": [
          [
            "wed"
          ]
        ],
        "thu": [
          [
            "thu"
          ]
        ],
        "fri": [
          [
            "fri"
          ]
        ],
        "sat": [
          [
            "sat"
          ]
        ],
        "sun": [
          [
            "sun"
          ]
        ]
      }
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an analytics area

`POST /api/v1/analytics/areas`

`lines` are the area's entrances (`sign` 1: the line's "in" enters the area, -1: it leaves it); `zones` are counted as being inside it. Needs operator permission on every camera of the lines and zones; only admins may create an area without any.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_analytics_area`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 64 characters) |
| `capacity` | integer or null | No | (1–100000) |
| `reset_at` | string | No | (default `"04:00"`) |
| `sort_order` | integer | No | (default `0`) |
| `site_id` | integer or null | No |  |
| `lines` | array of AnalyticsAreaLine or null | No |  |
| `zones` | array of integer or null | No |  |
| `open_hours` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/areas" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `201`: The area.

```json
{
  "id": 1,
  "name": "Front door",
  "site_id": 1,
  "capacity": 1,
  "reset_at": "reset-at",
  "sort_order": 1,
  "lines": [
    {
      "line_id": 1,
      "sign": 1
    }
  ],
  "zones": [
    1
  ],
  "open_hours": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  }
}
```

Errors: `400`, `401`, `403`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update an analytics area

`PATCH /api/v1/analytics/areas/{analytics_area_id}`

Given `lines` or `zones` replace the area's lines or zones as a set.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_analytics_area`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_area_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `capacity` | integer or null | No | (1–100000) |
| `reset_at` | string | No |  |
| `sort_order` | integer | No |  |
| `site_id` | integer or null | No |  |
| `lines` | array of AnalyticsAreaLine or null | No | Replaces the area's lines (`null` = none). |
| `zones` | array of integer or null | No | Replaces the area's zones (`null` = none). |
| `open_hours` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/analytics/areas/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","capacity":1,"reset_at":"reset-at","sort_order":1,"site_id":1,"lines":[{"line_id":1,"sign":1}],"zones":[1],"open_hours":{"mon":[["mon"]],"tue":[["tue"]],"wed":[["wed"]],"thu":[["thu"]],"fri":[["fri"]],"sat":[["sat"]],"sun":[["sun"]]}}'
```

**Response** `200`: The area.

```json
{
  "id": 1,
  "name": "Front door",
  "site_id": 1,
  "capacity": 1,
  "reset_at": "reset-at",
  "sort_order": 1,
  "lines": [
    {
      "line_id": 1,
      "sign": 1
    }
  ],
  "zones": [
    1
  ],
  "open_hours": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  }
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an analytics area

`DELETE /api/v1/analytics/areas/{analytics_area_id}`

Deletes the area with its manual occupancy settings and occupancy history; its lines and zones and their counts stay.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_analytics_area`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_area_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/analytics/areas/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Correct an area's occupancy

`POST /api/v1/analytics/areas/{analytics_area_id}/actions/set-occupancy`

Sets how many are in the area now (for example 0 after closing, or a head count); counting continues from it until the next daily reset. Answers the area's occupancy after the correction.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_analytics_occupancy`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_area_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `set_to` | integer | Yes | (0–1000000) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/areas/42/actions/set-occupancy" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"set_to":1}'
```

**Response** `200`: The area's occupancy.

```json
{
  "area_id": 1,
  "name": "Front door",
  "occupancy": 1,
  "capacity": 1,
  "free": 1,
  "source": "lines",
  "since": "2026-10-30T14:05:00Z",
  "bays": {
    "free": 1,
    "total": 1
  }
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List counting lines

`GET /api/v1/analytics/lines`

The counting lines of the cameras you may view (or of `camera_id`), by id.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | Only this camera's. (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/lines" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of lines.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "a": [
        0.5
      ],
      "b": [
        0.5
      ],
      "in_label": "in-label",
      "out_label": "out-label",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "band": 0.5,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a counting line

`POST /api/v1/analytics/lines`

A line from `a` to `b` in normalised image coordinates (0..1, origin top left). Crossing it from the right of a→b to its left counts "in", the opposite "out". Needs operator permission on the camera.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_analytics_line`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes | (≥ 1) |
| `name` | string | Yes | (max 64 characters) |
| `a` | array of number | Yes | A point `[x, y]`, normalised (0..1, origin top left). (max 2 items) |
| `b` | array of number | Yes | A point `[x, y]`, normalised (0..1, origin top left). (max 2 items) |
| `in_label` | string | No | (max 32 characters, default `"In"`) |
| `out_label` | string | No | (max 32 characters, default `"Out"`) |
| `classes` | array of string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` or null | No | The classes counted; `null` = the camera's classes. |
| `anchor` | string: `foot`, `centre` | No | (default `"foot"`) |
| `band` | number | No | (0.005–0.2, default `0.02`) |
| `enabled` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/lines" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"name":"Front door","a":[0.5],"b":[0.5]}'
```

**Response** `201`: The line.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "a": [
    0.5
  ],
  "b": [
    0.5
  ],
  "in_label": "in-label",
  "out_label": "out-label",
  "classes": [
    "person"
  ],
  "anchor": "foot",
  "band": 0.5,
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a counting line

`PATCH /api/v1/analytics/lines/{analytics_line_id}`

A line cannot move to another camera.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_analytics_line`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_line_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `a` | array of number | No | A point `[x, y]`, normalised (0..1, origin top left). (max 2 items) |
| `b` | array of number | No | A point `[x, y]`, normalised (0..1, origin top left). (max 2 items) |
| `in_label` | string | No | (max 32 characters) |
| `out_label` | string | No | (max 32 characters) |
| `classes` | array of string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` or null | No | The classes counted; `null` = the camera's classes. |
| `anchor` | string: `foot`, `centre` | No |  |
| `band` | number | No | (0.005–0.2) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/analytics/lines/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","a":[0.5],"b":[0.5],"in_label":"in-label","out_label":"out-label","classes":["person"],"anchor":"foot","band":0.5,"enabled":true}'
```

**Response** `200`: The line.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "a": [
    0.5
  ],
  "b": [
    0.5
  ],
  "in_label": "in-label",
  "out_label": "out-label",
  "classes": [
    "person"
  ],
  "anchor": "foot",
  "band": 0.5,
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a counting line

`DELETE /api/v1/analytics/lines/{analytics_line_id}`

Deletes the line with its area memberships and all its counts and history (crossings and buckets). To keep the history, disable the line instead.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_analytics_line`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_line_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/analytics/lines/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List analytics zones

`GET /api/v1/analytics/zones`

The zones of the cameras you may view (or of `camera_id`), by id.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | Only this camera's. (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/zones" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of zones.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "polygon": [
        [
          0.5
        ]
      ],
      "kind": "zone",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "min_dwell_sec": 0.5,
      "capacity": 1,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "queue_min_wait_sec": 0.5,
      "reserved_schedule": {
        "mon": [
          [
            "mon"
          ]
        ],
        "tue": [
          [
            "tue"
          ]
        ],
        "wed": [
          [
            "wed"
          ]
        ],
        "thu": [
          [
            "thu"
          ]
        ],
        "fri": [
          [
            "fri"
          ]
        ],
        "sat": [
          [
            "sat"
          ]
        ],
        "sun": [
          [
            "sun"
          ]
        ]
      },
      "max_stay_min": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an analytics zone

`POST /api/v1/analytics/zones`

A polygon (3 or more points, normalised 0..1, origin top left) where visits, dwell and stopped time are measured. Needs operator permission on the camera.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_analytics_zone`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes | (≥ 1) |
| `name` | string | Yes | (max 64 characters) |
| `polygon` | array of array of number | Yes |  |
| `classes` | array of string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` or null | No | The classes counted; `null` = the camera's classes. |
| `anchor` | string: `foot`, `centre` | No | (default `"foot"`) |
| `min_dwell_sec` | number | No | Default 30 for a bay. (0–3600, default `2`) |
| `capacity` | integer or null | No | (1–100000) |
| `enabled` | boolean | No | (default `true`) |
| `kind` | string: `zone`, `queue`, `bay` | No | A bay counts vehicles only (no person or bicycle class). (default `"zone"`) |
| `queue_min_wait_sec` | number | No | (1–600, default `10`) |
| `reserved_schedule` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |
| `max_stay_min` | integer or null | No | (1–10080) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/zones" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"name":"Front door","polygon":[[0.5]]}'
```

**Response** `201`: The zone.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "polygon": [
    [
      0.5
    ]
  ],
  "kind": "zone",
  "classes": [
    "person"
  ],
  "anchor": "foot",
  "min_dwell_sec": 0.5,
  "capacity": 1,
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "queue_min_wait_sec": 0.5,
  "reserved_schedule": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  },
  "max_stay_min": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update an analytics zone

`PATCH /api/v1/analytics/zones/{analytics_zone_id}`

A zone cannot move to another camera.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_analytics_zone`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_zone_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `polygon` | array of array of number | No |  |
| `classes` | array of string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` or null | No | The classes counted; `null` = the camera's classes. |
| `anchor` | string: `foot`, `centre` | No |  |
| `min_dwell_sec` | number | No | (0–3600) |
| `capacity` | integer or null | No | (1–100000) |
| `enabled` | boolean | No |  |
| `kind` | string: `zone`, `queue`, `bay` | No |  |
| `queue_min_wait_sec` | number | No | (1–600) |
| `reserved_schedule` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |
| `max_stay_min` | integer or null | No | (1–10080) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/analytics/zones/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","polygon":[[0.5]],"classes":["person"],"anchor":"foot","min_dwell_sec":0.5,"capacity":1,"enabled":true,"kind":"zone","queue_min_wait_sec":0.5,"reserved_schedule":{"mon":[["mon"]],"tue":[["tue"]],"wed":[["wed"]],"thu":[["thu"]],"fri":[["fri"]],"sat":[["sat"]],"sun":[["sun"]]},"max_stay_min":1}'
```

**Response** `200`: The zone.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "polygon": [
    [
      0.5
    ]
  ],
  "kind": "zone",
  "classes": [
    "person"
  ],
  "anchor": "foot",
  "min_dwell_sec": 0.5,
  "capacity": 1,
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "queue_min_wait_sec": 0.5,
  "reserved_schedule": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  },
  "max_stay_min": 1
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an analytics zone

`DELETE /api/v1/analytics/zones/{analytics_zone_id}`

Deletes the zone with its area memberships and all its statistics and history (visits and buckets). To keep the history, disable the zone instead.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_analytics_zone`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_zone_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/analytics/zones/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's analytics settings

`GET /api/v1/cameras/{camera_id}/analytics`

Whether analytics runs on the camera, the classes it counts, and its lines and zones.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/analytics" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "camera_id": 3,
  "enabled": true,
  "classes": [
    "person"
  ],
  "detect_fps": 0.5,
  "source_token_id": 1,
  "stop_speed": 0.5,
  "lines": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "a": [
        0.5
      ],
      "b": [
        0.5
      ],
      "in_label": "in-label",
      "out_label": "out-label",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "band": 0.5,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "zones": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "polygon": [
        [
          0.5
        ]
      ],
      "kind": "zone",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "min_dwell_sec": 0.5,
      "capacity": 1,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "queue_min_wait_sec": 0.5,
      "reserved_schedule": {
        "mon": [
          [
            "mon"
          ]
        ],
        "tue": [
          [
            "tue"
          ]
        ],
        "wed": [
          [
            "wed"
          ]
        ],
        "thu": [
          [
            "thu"
          ]
        ],
        "fri": [
          [
            "fri"
          ]
        ],
        "sat": [
          [
            "sat"
          ]
        ],
        "sun": [
          [
            "sun"
          ]
        ]
      },
      "max_stay_min": 1
    }
  ],
  "calibration": {
    "a": [
      0.5
    ],
    "b": [
      0.5
    ],
    "metres": 0.5
  },
  "metres_per_unit": 0.5
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a camera's analytics settings

`PATCH /api/v1/cameras/{camera_id}/analytics`

Turning analytics on for more cameras than the licence of the Analytics add-on allows answers `402 limit_reached`.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_camera_analytics`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `classes` | array of string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` | No |  |
| `detect_fps` | number or null | No | (0.5–15) |
| `stop_speed` | number | No | (0.001–0.5) |
| `source_token_id` | integer or null | No | An active detector (Vision Engine token) assigned to the camera, else 400; null resets the source so the next detector to report becomes it. |
| `calibration` | AnalyticsCalibration | No | A known distance drawn on the camera's image (`a` to `b`, `metres` long) that turns image movement into speed; `null` = none (no speeds). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/cameras/3/analytics" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"classes":["person"],"detect_fps":0.5,"stop_speed":0.5,"source_token_id":1,"calibration":{"a":[0.5],"b":[0.5],"metres":0.5}}'
```

**Response** `200`: The settings.

```json
{
  "camera_id": 3,
  "enabled": true,
  "classes": [
    "person"
  ],
  "detect_fps": 0.5,
  "source_token_id": 1,
  "stop_speed": 0.5,
  "lines": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "a": [
        0.5
      ],
      "b": [
        0.5
      ],
      "in_label": "in-label",
      "out_label": "out-label",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "band": 0.5,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "zones": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "polygon": [
        [
          0.5
        ]
      ],
      "kind": "zone",
      "classes": [
        "person"
      ],
      "anchor": "foot",
      "min_dwell_sec": 0.5,
      "capacity": 1,
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "queue_min_wait_sec": 0.5,
      "reserved_schedule": {
        "mon": [
          [
            "mon"
          ]
        ],
        "tue": [
          [
            "tue"
          ]
        ],
        "wed": [
          [
            "wed"
          ]
        ],
        "thu": [
          [
            "thu"
          ]
        ],
        "fri": [
          [
            "fri"
          ]
        ],
        "sat": [
          [
            "sat"
          ]
        ],
        "sun": [
          [
            "sun"
          ]
        ]
      },
      "max_stay_min": 1
    }
  ],
  "calibration": {
    "a": [
      0.5
    ],
    "b": [
      0.5
    ],
    "metres": 0.5
  },
  "metres_per_unit": 0.5
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Count people or vehicles in and out

`GET /api/v1/analytics/counts`

How many came in and went out through an area's entrance lines (`area_id`), one line (`line_id`) or every enabled line of a camera (`camera_id`; give exactly one) over a period: `from` and `to`, or a named `period`. For example "how many customers came in between 9 and 12 today?" is `from=<today>T09:00&to=<today>T12:00` with the shop's area. Local times without an offset are in the server's time zone. When `covered_pct` is below 100 the detector was not watching the whole period: say so when you report the numbers. Counts are kept in 15-minute buckets, so `from` is rounded down to a quarter hour. `step` adds a series (`15m` for up to 7 days; `1h` and `1d` follow local hours and days). `by_class` is "in" per class whatever `class` is.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | No | An analytics area. (≥ 1) |
| `line_id` | query | integer | No | A counting line. (≥ 1) |
| `camera_id` | query | integer | No | A camera (all its enabled lines). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |
| `step` | query | string: `15m`, `1h`, `1d` | No | Adds a series with one point per step. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/counts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The counts.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "in": 1,
  "out": 1,
  "covered_pct": 0.5,
  "step": "step",
  "series": [
    {
      "t": "2026-10-30T14:05:00Z",
      "in": 1,
      "out": 1,
      "visits": 1,
      "covered_pct": 0.5
    }
  ],
  "by_class": {}
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get how many are in each area now

`GET /api/v1/analytics/occupancy`

The live occupancy of the areas you may view (or of `area_id`). Areas with entrance lines count in minus out since the daily reset or the last correction (it lags the doorway by up to about 20 seconds); areas with only zones count who is in their zones now; areas of parking bays only count the vehicles in their bays (`source: bays`, with the free and total bays in `bays`).

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | No | One analytics area. (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/occupancy" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The occupancy per area.

```json
{
  "areas": [
    {
      "area_id": 1,
      "name": "Front door",
      "occupancy": 1,
      "capacity": 1,
      "free": 1,
      "source": "lines",
      "since": "2026-10-30T14:05:00Z",
      "bays": {
        "free": 1,
        "total": 1
      }
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get how long people or vehicles stay in zones

`GET /api/v1/analytics/dwell`

Dwell statistics of the visits that started in the period, per zone: one zone (`zone_id`), an area's zones (`area_id`) or a camera's enabled zones (`camera_id`; give exactly one). Local times without an offset are in the server's time zone. Past the event retention (90 days by default) `median_ms` is null and `hist` empty.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zone_id` | query | integer | No | An analytics zone. (≥ 1) |
| `area_id` | query | integer | No | An analytics area (its zones). (≥ 1) |
| `camera_id` | query | integer | No | A camera (its enabled zones). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/dwell" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The dwell statistics.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "hist_bounds_ms": [
    1
  ],
  "zones": [
    {
      "zone_id": 1,
      "name": "Front door",
      "camera_id": 3,
      "visits": 1,
      "avg_ms": 1,
      "median_ms": 1,
      "hist": [
        1
      ],
      "stopped_pct": 0.5
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's heatmap

`GET /api/v1/analytics/heatmap`

Where people or vehicles went (`layer=pass`: track passes per cell) or stood still (`stop`: stopped tenths of a second per cell) on a camera's image, summed over the local days of the period, as a grid of `w` × `h` cells (row-major, x first, origin top left). Local times without an offset are in the server's time zone.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | Yes | The camera. (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle` | No | The class (default `person`). |
| `layer` | query | string: `pass`, `stop` | No | `pass` (default) or `stop`. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/heatmap" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The grid.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "layer": "pass",
  "w": 1,
  "h": 1,
  "cells": [
    1
  ],
  "max": 1
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get queue waits

`GET /api/v1/analytics/queues`

How long people waited in queue zones (zones of kind `queue`) for the queued visits that started in the period, all classes: one queue zone (`zone_id`), an area's enabled queue zones (`area_id`) or a camera's (`camera_id`; give exactly one), with how many are queued now. A visit counts as queued after `queue_min_wait_sec` in the zone. `service_level_pct` is the share that waited under 60 seconds. Local times without an offset are in the server's time zone. Past the event retention (90 days by default) the maximum, median and service level come from a histogram and are approximate. `step` adds a series (`15m` for up to 7 days; `1h` and `1d` follow local hours and days). API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zone_id` | query | integer | No | A queue zone. (≥ 1) |
| `area_id` | query | integer | No | An analytics area (its enabled queue zones). (≥ 1) |
| `camera_id` | query | integer | No | A camera (its enabled queue zones). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `step` | query | string: `15m`, `1h`, `1d` | No | Adds a series with one point per step (`15m` for periods up to 7 days). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/queues" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The waits per queue zone.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "step": "step",
  "zones": [
    {
      "zone_id": 1,
      "name": "Front door",
      "camera_id": 3,
      "queued_now": 1,
      "waited": 1,
      "avg_wait_ms": 1,
      "max_wait_ms": 1,
      "median_wait_ms": 1,
      "service_level_pct": 0.5,
      "series": [
        {
          "t": "2026-10-30T14:05:00Z",
          "avg_wait_ms": 1,
          "waited": 1,
          "queue_max": 1
        }
      ]
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the busiest hours of the week

`GET /api/v1/analytics/busy-hours`

The average "in" per local weekday (Monday first) and hour over the period, through an area's entrance lines (`area_id`), one line (`line_id`) or every enabled line of a camera (`camera_id`; give exactly one): the sum of each hour of the week divided by the number of those weekdays the period touches. Use a few weeks (`from` 28 days back) for a typical week. Local times without an offset are in the server's time zone. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | No | An analytics area. (≥ 1) |
| `line_id` | query | integer | No | A counting line. (≥ 1) |
| `camera_id` | query | integer | No | A camera (all its enabled lines). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/busy-hours" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The weekly matrix.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "metric": "in",
  "days": [
    [
      0.5
    ]
  ],
  "max": 0.5
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get crossing speeds

`GET /api/v1/analytics/speed`

The speeds (metres per second) of the crossings of an area's entrance lines (`area_id`), one line (`line_id`) or every enabled line of a camera (`camera_id`; give exactly one) over the period. Speed is an estimate: it is measured only on cameras with a calibration (a known distance drawn on the image) and its accuracy depends on that calibration; `calibrated` false means no camera of the scope has one and nothing is measured. Say so when you report a speed. Multiply by 3.6 for km/h. `by_class` lists every class whatever `class` is. Local times without an offset are in the server's time zone. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | No | An analytics area. (≥ 1) |
| `line_id` | query | integer | No | A counting line. (≥ 1) |
| `camera_id` | query | integer | No | A camera (all its enabled lines). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |
| `step` | query | string: `15m`, `1h`, `1d` | No | Adds a series with one point per step (`15m` for periods up to 7 days). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/speed" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The speeds.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "calibrated": false,
  "avg_mps": 0.5,
  "max_mps": 0.5,
  "count": 2,
  "by_class": {},
  "step": "step",
  "series": [
    {
      "t": "2026-10-30T14:05:00Z",
      "avg_mps": 0.5,
      "max_mps": 0.5,
      "count": 2
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the paths people or vehicles took

`GET /api/v1/analytics/paths`

A camera's stored tracks that started in the period (within the raw track retention, 7 days by default), newest first, each simplified to a few foot points (normalised, origin top left), with the top 10 flows between its lines and zones. Too large for an AI assistant: not an MCP tool; agents use `getAnalyticsFlows`. Local times without an offset are in the server's time zone. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | Yes | The camera. (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |
| `limit` | query | integer | No | The newest tracks to use (1–500, default 200). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/paths" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The paths and flows.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "paths": [
    {
      "track_id": 1,
      "class": "class",
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "points": [
        [
          0.5
        ]
      ]
    }
  ],
  "flows": [
    {
      "from": "from",
      "to": "to",
      "from_name": "from-name",
      "to_name": "to-name",
      "count": 2
    }
  ],
  "truncated": false
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get where people or vehicles went next

`GET /api/v1/analytics/flows`

The top 10 flows on a camera: how many of its tracks that started in the period went from one line or zone straight to another (`from` and `to` are `line:<id>` or `zone:<id>`, with their names), counted over the newest `limit` tracks within the raw track retention (7 days by default). `truncated` means more tracks started in the period than were counted. The paths themselves are `getAnalyticsPaths`. Local times without an offset are in the server's time zone. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | Yes | The camera. (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `class` | query | string: `person`, `car`, `truck`, `bus`, `motorbike`, `bicycle`, `all` | No | The class counted (default `person`); `all` counts every class. |
| `limit` | query | integer | No | The newest tracks to use (1–500, default 200). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/flows" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The flows.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "class": "class",
  "tracks": 1,
  "flows": [
    {
      "from": "from",
      "to": "to",
      "from_name": "from-name",
      "to_name": "to-name",
      "count": 2
    }
  ],
  "truncated": false
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get parking bays

`GET /api/v1/analytics/bays`

The enabled parking bays (zones of kind `bay`) of an area (`area_id`) or a camera (`camera_id`; give exactly one): whether each is taken now, since when and by which vehicle class, the free and total bays, and over the period (default today) the finished stays with their average and median and the share of the watched time the bay was occupied. Local times without an offset are in the server's time zone. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | No | An analytics area (its bays). (≥ 1) |
| `camera_id` | query | integer | No | A camera (its bays). (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/bays" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The bays.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "free": 1,
  "total": 1,
  "bays": [
    {
      "zone_id": 1,
      "camera_id": 3,
      "name": "Front door",
      "taken": false,
      "since": "2026-10-30T14:05:00Z",
      "stay_ms": 1,
      "class": "class",
      "stays": 1,
      "avg_stay_ms": 1,
      "median_stay_ms": 1,
      "occupied_pct": 0.5
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List analytics alert rules

`GET /api/v1/analytics/alert-rules`

The analytics alert rules whose target you may view (a zone's or line's camera, the camera, or every camera of the area), by id. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "kind": "capacity",
      "zone_id": 1,
      "line_id": 1,
      "area_id": 1,
      "camera_id": 3,
      "params": {},
      "schedule": {
        "mon": [
          [
            "mon"
          ]
        ],
        "tue": [
          [
            "tue"
          ]
        ],
        "wed": [
          [
            "wed"
          ]
        ],
        "thu": [
          [
            "thu"
          ]
        ],
        "fri": [
          [
            "fri"
          ]
        ],
        "sat": [
          [
            "sat"
          ]
        ],
        "sun": [
          [
            "sun"
          ]
        ]
      },
      "channels": {
        "push": false,
        "email": [
          "email"
        ],
        "webhook": false,
        "telegram": false,
        "line": false,
        "snapshot": false
      },
      "severity": "normal",
      "cooldown_sec": 1,
      "enabled": true,
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an analytics alert rule

`POST /api/v1/analytics/alert-rules`

A rule watches one target and raises an alert when its condition holds. Kinds, their target and `params`: `capacity` (area; `pct` 1–100, default 90: occupancy reaches that share of the capacity, again at 100 %), `queue_length` (queue zone; `max` people queued for `minutes`), `queue_wait` (queue zone; someone waited `seconds`), `loitering` (zone; someone stayed `seconds`), `wrong_direction` (line; a crossing in `direction` `in` or `out`), `tailgating` (line; two "in" crossings within `within_sec`), `speed` (line; a crossing at `limit_kmh` or more, only on calibrated cameras, and as accurate as the calibration), `no_bays_free` (area or camera; no bay free for `minutes`), `zone_empty` (zone; nobody in it for `minutes` while open), `line_below` (line; fewer than `expected` in over the last `hours`, checked every 15 minutes), `bay_reserved` (bay; taken during its `reserved_schedule`) and `bay_overstay` (bay; a stay of the zone's `max_stay_min`). A rule fires only inside its `schedule` (`null` = always) and at most once per `cooldown_sec` (default 300); conditions that stay true (`capacity`, `queue_length`, `no_bays_free`, `zone_empty`) fire again every cooldown. `zone_empty` with no `schedule` follows the opening hours (`open_hours`) of the zone's area, so with neither it never fires. `line_below` looks back over the last `hours`, so it can fire right when its schedule opens (the window then lies mostly outside the schedule). Alerts appear in `/alerts` with `source: "analytics"` and the label `analytics:<kind>` (`analytics:` labels are reserved: `POST /alerts` refuses them). Needs operator permission on every camera of the target. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_analytics_alert_rule`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 64 characters) |
| `kind` | string: `capacity`, `queue_length`, `queue_wait`, `loitering`, `wrong_direction`, `tailgating`, `speed`, `no_bays_free`, `zone_empty`, `line_below`, `bay_reserved`, `bay_overstay` | Yes |  |
| `zone_id` | integer or null | No | (≥ 1) |
| `line_id` | integer or null | No | (≥ 1) |
| `area_id` | integer or null | No | (≥ 1) |
| `camera_id` | integer or null | No | (≥ 1) |
| `params` | object | No | The kind's parameters (see the description); missing ones take their defaults. |
| `schedule` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |
| `channels` | AnalyticsAlertChannels | No | Where a firing goes besides the Alerts list. |
| `severity` | string: `low`, `normal`, `high` | No | (default `"normal"`) |
| `cooldown_sec` | integer | No | (0–86400, default `300`) |
| `enabled` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","kind":"capacity"}'
```

**Response** `201`: The rule.

```json
{
  "id": 1,
  "name": "Front door",
  "kind": "capacity",
  "zone_id": 1,
  "line_id": 1,
  "area_id": 1,
  "camera_id": 3,
  "params": {},
  "schedule": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  },
  "channels": {
    "push": false,
    "email": [
      "email"
    ],
    "webhook": false,
    "telegram": false,
    "line": false,
    "snapshot": false
  },
  "severity": "normal",
  "cooldown_sec": 1,
  "enabled": true,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update an analytics alert rule

`PATCH /api/v1/analytics/alert-rules/{analytics_alert_rule_id}`

Changes only the fields sent; a new `kind` without `params` resets the params to the kind's defaults, and `channels` replaces all channels. Needs operator permission on every camera of the old and the new target. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_analytics_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_alert_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 64 characters) |
| `kind` | string: `capacity`, `queue_length`, `queue_wait`, `loitering`, `wrong_direction`, `tailgating`, `speed`, `no_bays_free`, `zone_empty`, `line_below`, `bay_reserved`, `bay_overstay` | No |  |
| `zone_id` | integer or null | No | (≥ 1) |
| `line_id` | integer or null | No | (≥ 1) |
| `area_id` | integer or null | No | (≥ 1) |
| `camera_id` | integer or null | No | (≥ 1) |
| `params` | object | No |  |
| `schedule` | AnalyticsWeekly | No | Weekly time windows in the server's time zone, per day (`mon` … `sun`); a missing day is closed. `null` (or `{}` on input) = always. |
| `channels` | AnalyticsAlertChannels | No | Where a firing goes besides the Alerts list. |
| `severity` | string: `low`, `normal`, `high` | No |  |
| `cooldown_sec` | integer | No | (0–86400) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/analytics/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","kind":"capacity","zone_id":1,"line_id":1,"area_id":1,"camera_id":3,"params":{},"schedule":{"mon":[["mon"]],"tue":[["tue"]],"wed":[["wed"]],"thu":[["thu"]],"fri":[["fri"]],"sat":[["sat"]],"sun":[["sun"]]},"channels":{"push":false,"email":["email"],"webhook":false,"telegram":false,"line":false,"snapshot":false},"severity":"normal","cooldown_sec":1,"enabled":true}'
```

**Response** `200`: The rule.

```json
{
  "id": 1,
  "name": "Front door",
  "kind": "capacity",
  "zone_id": 1,
  "line_id": 1,
  "area_id": 1,
  "camera_id": 3,
  "params": {},
  "schedule": {
    "mon": [
      [
        "mon"
      ]
    ],
    "tue": [
      [
        "tue"
      ]
    ],
    "wed": [
      [
        "wed"
      ]
    ],
    "thu": [
      [
        "thu"
      ]
    ],
    "fri": [
      [
        "fri"
      ]
    ],
    "sat": [
      [
        "sat"
      ]
    ],
    "sun": [
      [
        "sun"
      ]
    ]
  },
  "channels": {
    "push": false,
    "email": [
      "email"
    ],
    "webhook": false,
    "telegram": false,
    "line": false,
    "snapshot": false
  },
  "severity": "normal",
  "cooldown_sec": 1,
  "enabled": true,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an analytics alert rule

`DELETE /api/v1/analytics/alert-rules/{analytics_alert_rule_id}`

Deletes the rule; its alert history stays (without the rule id). API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_analytics_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/analytics/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List analytics alert firings

`GET /api/v1/analytics/alert-events`

When analytics alert rules fired, newest first, over the period (default the last 7 days): of the rules you may view, and of deleted rules on cameras you may view. `limit` is 1–1000 (default 100). API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `rule_id` | query | integer | No | Only this rule's firings. (≥ 1) |
| `from` | query | string | No | Start: RFC 3339, or a local time without an offset (`2026-11-02T09:00`, `2026-11-02`) in the server's time zone. Required unless `period` is given. |
| `to` | query | string | No | End (exclusive), as `from`; default now. At most 400 days after `from`. |
| `period` | query | string: `today`, `yesterday`, `this_week`, `last_7_days`, `this_month` | No | A named period in the server's time zone, instead of `from` and `to`: `today` and `this_week` (from Monday) and `this_month` until now, `yesterday`, or `last_7_days`. |
| `limit` | query | integer | No | At most this many (1–1000, default 100). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/alert-events" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The firings.

```json
{
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "tz": "tz",
  "events": [
    {
      "id": 1,
      "rule_id": 1,
      "rule_name": "rule-name",
      "kind": "kind",
      "camera_id": 3,
      "fired_at": "2026-10-30T14:05:00Z",
      "value": 0.5,
      "message": "This API key lacks the cameras:write scope.",
      "detection_id": 1
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List an area's door displays

`GET /api/v1/analytics/displays`

The door displays of an area (revoked ones included), oldest first. A door display is a public full-screen page for a tablet or TV at the entrance that shows "come in" or "please wait" from the area's live occupancy against its capacity. Their tokens are never shown again. Needs operator permission on every camera of the area. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:read` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `area_id` | query | integer | Yes | The analytics area. (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/analytics/displays" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of displays.

```json
{
  "data": [
    {
      "id": 1,
      "area_id": 1,
      "name": "Front door",
      "settings": {
        "lang": "lang",
        "open_text": "open-text",
        "full_text": "full-text",
        "show_count": false,
        "open_color": "open-color",
        "full_color": "full-color",
        "logo_url": "logo-url"
      },
      "created_at": "2026-10-30T14:05:00Z",
      "last_seen_at": "2026-10-30T14:05:00Z",
      "revoked_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a door display

`POST /api/v1/analytics/displays`

Creates a door display for an area and returns its secret token, the public page URL (`<base_url>/display/<token>`) and a QR code of it. The token is shown once, here only: only its hash is kept, so give the URL to the person now; a lost token means a new display. Anyone with the URL sees the area's occupancy state and the display's texts, nothing else (no video, no names); revoke it to stop it. `base_url` defaults to the server's public address while remote access is on. Needs operator permission on every camera of the area. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_analytics_display`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `area_id` | integer | Yes | (≥ 1) |
| `name` | string | Yes | (max 64 characters) |
| `settings` | AnalyticsDisplaySettingsInput | No | The display's settings; missing or blank fields take the defaults. |
| `base_url` | string or null | No | `http(s)://host[:port]` the screen opens this server at; default the server's public address while remote access is on (else required). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/analytics/displays" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"area_id":1,"name":"Front door"}'
```

**Response** `201`: The display with its token, URL and QR code (shown once).

```json
{
  "display": {
    "id": 1,
    "area_id": 1,
    "name": "Front door",
    "settings": {
      "lang": "lang",
      "open_text": "open-text",
      "full_text": "full-text",
      "show_count": false,
      "open_color": "open-color",
      "full_color": "full-color",
      "logo_url": "logo-url"
    },
    "created_at": "2026-10-30T14:05:00Z",
    "last_seen_at": "2026-10-30T14:05:00Z",
    "revoked_at": "2026-10-30T14:05:00Z"
  },
  "token": "preset-1",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "qr_png": "qr-png"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke a door display

`DELETE /api/v1/analytics/displays/{analytics_display_id}`

Revokes the display at once: its page shows "This display is not connected". A revoked display stays listed and cannot be turned back on. API 1.30.0.

| Requirement | |
| --- | --- |
| Scope | `analytics:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `revoke_analytics_display`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `analytics_display_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/analytics/displays/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Revoked.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Floor plans

Floor plans per site with the cameras, speakers, rooms and analytics areas placed on them, their live state and plain-language descriptions of where each camera is. Anyone who can see a site sees its plans (items they cannot see left out); editing needs the admin role, or the admin or operator role with manager level on the site.

### List the sites floor plans can be added to

`GET /api/v1/floor-plan-sites`

API 1.23.0. The site nodes you can see (a site group grant on the site or on its branch with zones included, or a camera of yours on that site; admins see every site), ordered by name, with their plan count and whether you may add and edit plans there (`can_edit`: the admin role, or the admin or operator role with manager level on the site). Not paged: sites are few.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plan-sites" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The sites.

```json
{
  "data": [
    {
      "site_id": 1,
      "name": "Front door",
      "parent_id": 1,
      "can_edit": false,
      "plan_count": 2
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List floor plans

`GET /api/v1/floor-plans`

API 1.23.0. The floor plans of the sites you can see, by id (order them by `sort_order` then `floor_number` for display). `camera_count` and `unacked_alerts` count only the cameras you may view.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | query | integer | No | Only this site's plans. (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of plans.

```json
{
  "data": [
    {
      "id": 1,
      "site_id": 1,
      "site_name": "site-name",
      "name": "Front door",
      "floor_number": 1,
      "sort_order": 1,
      "image_type": "png",
      "width_px": 1,
      "height_px": 1,
      "version": 1,
      "source": "upload",
      "metres_per_unit": 0.5,
      "can_edit": false,
      "camera_count": 2,
      "unacked_alerts": 1,
      "description": "description",
      "image_url": "image-url",
      "thumb_url": "thumb-url",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Upload a floor plan

`POST /api/v1/floor-plans`

API 1.23.0. Uploads a floor plan image for a site: PNG or JPEG (recognised by content), at most 18 MB, each side at most 8192 px and at most 40 megapixels (convert PDF or SVG to PNG first). The image is re-encoded on the server (metadata such as GPS positions is dropped) and a 512 px thumbnail is made. Send `multipart/form-data` (text fields `site_id`, `name`, `floor_number`, `sort_order` and the file `image`) or JSON with the image base64-encoded in `image_base64` (a `data:image/png;base64,` prefix is accepted; MCP clients: the MCP endpoint accepts at most 1 MB per call). Needs the admin role, or the admin or operator role with manager level on the site (`403 forbidden` otherwise). `415 unsupported_media_type` for another image format, `413 payload_too_large` over the limit. Request bodies are limited to 20 MB, so the image may be 18 MB as a multipart file but only about 13.5 MB in the JSON `image_base64` form (base64 adds a third).

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_floor_plan`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `site_id` | integer | Yes | (≥ 1) |
| `name` | string | No | (max 128 characters) |
| `floor_number` | integer or null | No | (-20–200) |
| `sort_order` | integer | No | (-1000–1000) |
| `image_base64` | string | Yes | The PNG or JPEG image, base64-encoded (optionally a data: URL); about 13.5 MB of image at most (the request body is limited to 20 MB). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"site_id":1,"image_base64":"image-base64"}'
```

**Response** `201`: The plan (version 1).

```json
{
  "id": 1,
  "site_id": 1,
  "site_name": "site-name",
  "name": "Front door",
  "floor_number": 1,
  "sort_order": 1,
  "image_type": "png",
  "width_px": 1,
  "height_px": 1,
  "version": 1,
  "source": "upload",
  "metres_per_unit": 0.5,
  "can_edit": false,
  "camera_count": 2,
  "unacked_alerts": 1,
  "description": "description",
  "image_url": "image-url",
  "thumb_url": "thumb-url",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### The block library of the floor-plan editor

`GET /api/v1/floor-plans/blocks`

API 1.82.0. The standard pieces an operator drags onto a plan, each at its real size in metres: room presets, doors and windows (structure), furniture and fixtures (furniture, plan item kind `furniture`) and the grounds around the house (grounds, plan item kind `landmark`). Place a block as an item of its `kind` with its `label`; on a plan with a scale its size is `width_m` by `depth_m`. On a plan Vigiora drew (scan or description) the metre grid passes through `grid_origin_px` canvas pixels on both axes.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/blocks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The library.

```json
{
  "data": [
    {
      "id": "id",
      "category": "structure",
      "kind": "room",
      "label": "person",
      "width_m": 0.5,
      "depth_m": 0.5,
      "shape": "rect"
    }
  ],
  "grid_m": 0.5,
  "grid_origin_px": 0.5
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a floor plan with its description

`GET /api/v1/floor-plans/{floor_plan_id}`

API 1.23.0. One plan with `description`: a plain-language account of where the cameras you may view are on it (compass direction they face, the rooms and areas they cover, what is near them), written for AI assistants. Use it to answer "where is camera X", "which camera covers the back door" or, with `get_floor_plan_live`, "what is happening on floor 1". Coordinates elsewhere are fractions of the image (0..1, origin top left); rotation 0 is up on the image ("north"), clockwise.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The plan.

```json
{
  "id": 1,
  "site_id": 1,
  "site_name": "site-name",
  "name": "Front door",
  "floor_number": 1,
  "sort_order": 1,
  "image_type": "png",
  "width_px": 1,
  "height_px": 1,
  "version": 1,
  "source": "upload",
  "metres_per_unit": 0.5,
  "can_edit": false,
  "camera_count": 2,
  "unacked_alerts": 1,
  "description": "description",
  "image_url": "image-url",
  "thumb_url": "thumb-url",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a floor plan

`PATCH /api/v1/floor-plans/{floor_plan_id}`

API 1.23.0. Changes the fields sent and, with `image_base64` (JSON) or the file `image` (multipart), replaces the image (same limits as the upload: 18 MB as a multipart file, about 13.5 MB of image in the JSON `image_base64` form, since request bodies are limited to 20 MB; items keep their positions as fractions of the image). Moving the plan to another site (`site_id`) needs manager level on both. Every update increases `version`.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_floor_plan`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `site_id` | integer | No | (≥ 1) |
| `name` | string | No | (max 128 characters) |
| `floor_number` | integer or null | No | (-20–200) |
| `sort_order` | integer | No | (-1000–1000) |
| `metres_per_unit` | number | No | API 1.67.1: lock the plan scale (metres per plan unit). JSON body only; omit or null leaves it unchanged. (≥ 0) |
| `width_px` | integer | No | API 1.74.0: resize the plan canvas width in px (no image re-upload). JSON body only. Since API 1.75.1 the drawing keeps its size and scale: space is added or cut at the right, every item is moved with the drawing and metres_per_unit follows; a canvas that would cut an item is refused (422 width_px). (64–8000) |
| `height_px` | integer | No | API 1.74.0: resize the plan canvas height in px (no image re-upload). JSON body only; since API 1.75.1 space is added or cut at the bottom and the items stay on the drawing (422 height_px if one would be cut). (64–8000) |
| `image_base64` | string | No | A new PNG or JPEG image, base64-encoded (optionally a data: URL); about 13.5 MB of image at most (the request body is limited to 20 MB). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/floor-plans/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"site_id":1,"name":"Front door","floor_number":1,"sort_order":1,"metres_per_unit":0.5,"width_px":64,"height_px":64,"image_base64":"image-base64"}'
```

**Response** `200`: The plan.

```json
{
  "id": 1,
  "site_id": 1,
  "site_name": "site-name",
  "name": "Front door",
  "floor_number": 1,
  "sort_order": 1,
  "image_type": "png",
  "width_px": 1,
  "height_px": 1,
  "version": 1,
  "source": "upload",
  "metres_per_unit": 0.5,
  "can_edit": false,
  "camera_count": 2,
  "unacked_alerts": 1,
  "description": "description",
  "image_url": "image-url",
  "thumb_url": "thumb-url",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a floor plan

`DELETE /api/v1/floor-plans/{floor_plan_id}`

API 1.23.0. Deletes the plan, its image and everything placed on it (the cameras, rooms and areas themselves stay).

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_floor_plan`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/floor-plans/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Floor plan image

`GET /api/v1/floor-plans/{floor_plan_id}/image`

API 1.23.0. The plan image (PNG or JPEG as uploaded, re-encoded) or, with `size=thumb`, its JPEG thumbnail (512 px longest side). Use `image_url` / `thumb_url` of the plan: they carry the version, so the image may be cached (`Cache-Control: private, max-age=86400`). Not served through a Cloudflare Tunnel origin (media is served by the media origin). Not an MCP tool.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |
| `size` | query | string: `thumb` | No | `thumb` for the thumbnail. |
| `v` | query | integer | No | The plan version (cache key; ignored by the server). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42/image" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The image. (`image/png`)

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List what is placed on a floor plan

`GET /api/v1/floor-plans/{floor_plan_id}/items`

API 1.23.0. The cameras, speakers (pins with `x`, `y`), rooms and analytics areas (polygons) placed on the plan, with the plan `version` to send back with a replace. Items you cannot see (a camera you may not view, a speaker of such a camera, a room or area you cannot see) are left out. Coordinates are fractions of the image (0..1, origin top left); `rotation_deg` 0 is up, clockwise; `range` is a fraction of the image width.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42/items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The items.

```json
{
  "floor_plan_id": 1,
  "version": 1,
  "data": [
    {
      "id": 1,
      "kind": "camera",
      "camera_id": 3,
      "speaker_id": 1,
      "device_key": "device-key",
      "entity_id": "entity-id",
      "room_id": 1,
      "analytics_area_id": 1,
      "x": 0.5,
      "y": 0.5,
      "rotation_deg": 0.5,
      "fov_deg": 0.5,
      "range": 0.5,
      "polygon": [
        [
          0.5
        ]
      ],
      "label": "person",
      "z": 1,
      "name": "Front door"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Replace what is placed on a floor plan

`POST /api/v1/floor-plans/{floor_plan_id}/items/actions/replace`

API 1.23.0. Replaces the items you can see with `items` (at most 500; `id` and `name` are ignored); items you cannot see stay. `version` must be the plan's current version (from the items or the plan), else `409 conflict` with `details.current_version` and nothing is written: read the items again and merge. A camera appears at most once per plan; `fov_deg` defaults to 90 and `range` to 0.15. The body is at most 2 MB. Since API 1.40.0 an IoT device (`GET /iot/devices`) is pinned with kind `device` and its `device_key` (`entity_id` picks the entity whose state the pin shows); a device pinned inside a room polygon becomes a managed device of that room (its shared entities are the room's signals), like a camera; `400 validation` for a key the IoT devices page does not know.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `replace_floor_plan_items`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `version` | integer | Yes | The plan version the items were read from. |
| `items` | array of FloorPlanItemWrite | Yes | (max 500 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans/42/items/actions/replace" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"version":1,"items":[{"id":1,"kind":"camera","camera_id":3,"speaker_id":1,"device_key":"device-key","entity_id":"entity-id","room_id":1,"analytics_area_id":1,"x":0.5,"y":0.5,"rotation_deg":0.5,"fov_deg":0.5,"range":0.5,"polygon":[[0.5]],"label":"person","z":1,"name":"Front door"}]}'
```

**Response** `200`: The items after the replace, with the new version.

```json
{
  "floor_plan_id": 1,
  "version": 1,
  "data": [
    {
      "id": 1,
      "kind": "camera",
      "camera_id": 3,
      "speaker_id": 1,
      "device_key": "device-key",
      "entity_id": "entity-id",
      "room_id": 1,
      "analytics_area_id": 1,
      "x": 0.5,
      "y": 0.5,
      "rotation_deg": 0.5,
      "fov_deg": 0.5,
      "range": 0.5,
      "polygon": [
        [
          0.5
        ]
      ],
      "label": "person",
      "z": 1,
      "name": "Front door"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Live state of a floor plan

`GET /api/v1/floor-plans/{floor_plan_id}/live`

API 1.23.0. For the cameras on the plan you may view: status (`online`, `offline`, `standby`, `disabled`, `unknown`), whether it is recording, its unacknowledged alerts of the last 24 hours and the newest one. With the Analytics add-on (`analytics_entitled`), the live occupancy of the analytics areas on the plan; without it `areas` is empty. Use it with `get_floor_plan` to answer "what is happening on floor 1".

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42/live" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The live state.

```json
{
  "floor_plan_id": 1,
  "version": 1,
  "cameras": [
    {
      "camera_id": 3,
      "status": "online",
      "recording": false,
      "unacked_alerts": 1,
      "latest_alert": {
        "id": 1,
        "label": "person",
        "detected_at": "2026-10-30T14:05:00Z"
      }
    }
  ],
  "unacked_alerts": 1,
  "analytics_entitled": false,
  "areas": [
    {
      "analytics_area_id": 1,
      "name": "Front door",
      "occupancy": 1,
      "capacity": 1
    }
  ],
  "devices": [
    {
      "device_key": "device-key",
      "name": "Front door",
      "source": "home_assistant",
      "online": false,
      "battery": 1,
      "low_battery": false,
      "headline": {
        "entity_id": "entity-id",
        "name": "Front door",
        "kind": "kind",
        "value": "value",
        "unit": "unit",
        "exposed": false,
        "present": false,
        "last_changed": "2026-10-30T14:05:00Z"
      },
      "values": [
        {
          "entity_id": "entity-id",
          "name": "Front door",
          "kind": "kind",
          "value": "value",
          "unit": "unit",
          "exposed": false,
          "present": false,
          "last_changed": "2026-10-30T14:05:00Z"
        }
      ]
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rooms drawn on a floor plan

`GET /api/v1/floor-plans/{floor_plan_id}/rooms`

API 1.38.0. The rooms whose polygon is on the plan, as `GET /rooms` shows them (rooms whose every camera the caller may view; viewers do not see rooms without cameras). A room polygon saved without `room_id` is given a room by the server, so every polygon on the plan is one of these.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42/rooms" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rooms on the plan.

```json
{
  "floor_plan_id": 1,
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "site_id": 1,
      "source": "source",
      "floor_plan": {
        "id": 1,
        "name": "Front door",
        "item_id": 1
      },
      "devices": [
        "device"
      ],
      "managed_devices": [
        "managed-device"
      ],
      "mode": "mode",
      "interval_seconds": 1,
      "environment": "environment",
      "instruction": "instruction",
      "wake_word": "wake-word",
      "timezone": "timezone",
      "stt_provider": "stt-provider",
      "speech_microphone": "speech-microphone",
      "speech_microphone_choice": {
        "mode": "mode",
        "camera_id": 3,
        "camera_name": "Front door",
        "reason": "reason",
        "reason_code": "reason-code",
        "values": {},
        "since": "2026-10-30T14:05:00Z"
      },
      "speech_microphone_notice": false,
      "ai_actuation_enabled": false,
      "ai_ptz_enabled": false,
      "ai_speak_enabled": false,
      "ai_mode": "ai-mode",
      "ai_live_classic": false,
      "ai_live_coalesce_seconds": 1,
      "ai_live_keepalive_seconds": 1,
      "cameras": [
        {
          "camera_id": 3,
          "name": "Front door",
          "role": "role",
          "is_primary": false,
          "managed": false,
          "is_speech_microphone": false
        }
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Sync the rooms of a floor plan

`POST /api/v1/floor-plans/{floor_plan_id}/actions/sync-rooms`

API 1.38.0. What the server does on every write of the plan's items, on demand (idempotent; nothing a user made is removed): a room polygon without a room gets one (the site's room of that name when one is not yet on the plan, else a new room with source `plan`), a polygon's label and its room's name are made equal (the label wins), and the cameras whose pin is inside a polygon become that room's managed cameras — a camera that moved to another polygon moves with it, one outside every polygon leaves its managed room. Cameras a user put in a room by hand stay. Needs edit access to the plan.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans/42/actions/sync-rooms" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: What the sync changed and the rooms on the plan.

```json
{
  "floor_plan_id": 1,
  "rooms_created": 1,
  "rooms_renamed": 1,
  "cameras_added": 1,
  "cameras_removed": 1,
  "devices_added": 1,
  "devices_removed": 1,
  "rooms": [
    {
      "room_id": 1,
      "name": "Front door",
      "item_id": 1
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Draw a floor plan from a description

`POST /api/v1/sites/{site_id}/floor-plans/describe`

API 1.32.0. For a site without a plan image: describe the place in words ("a two-bedroom house, the kitchen left of the entrance, a pool in the garden to the east") and the AI draws a schematic plan (rooms, doors, outdoor areas, a 1 m grid, a north arrow when the description gives directions), places the site's cameras it can match (by name or the rooms they are in) and stores it as a floor plan with `source: ai`. The answer carries the plan, the `layout` it was drawn from (metres, origin at the north-west corner) and the cameras that could not be placed. One AI call (two when the first answer is unusable or has overlapping areas or a stated size not kept), charged like a Guardian chat; the whole generation is limited to 60 seconds. API 1.33.0: what is still wrong after the second answer is repaired by the server (the notes say what it changed); cameras are placed from the area they are mounted on and the areas they look at; when the site has fewer cameras than the description mentions, your other visible, enabled cameras can be matched too (by name or the words of the description; a camera without a confident match is left unplaced) and keep their site. `503 ai_unavailable` when the server has no AI (not connected to Vigiora cloud) or the AI gave no usable plan, `402 insufficient_credits` when out of credits. Editing rights as for uploading a plan.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | Yes | The place in plain language, in any language. (max 4000 characters) |
| `floor_number` | integer or null | No | The floor this plan is for. (-20–200) |
| `name` | string or null | No | (max 128 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/describe" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"description":"description"}'
```

**Response** `201`: The new plan (version 1) and its layout.

```json
{
  "floor_plan": {
    "id": 1,
    "site_id": 1,
    "site_name": "site-name",
    "name": "Front door",
    "floor_number": 1,
    "sort_order": 1,
    "image_type": "png",
    "width_px": 1,
    "height_px": 1,
    "version": 1,
    "source": "upload",
    "metres_per_unit": 0.5,
    "can_edit": false,
    "camera_count": 2,
    "unacked_alerts": 1,
    "description": "description",
    "image_url": "image-url",
    "thumb_url": "thumb-url",
    "created_at": "2026-10-30T14:05:00Z",
    "updated_at": "2026-10-30T14:05:00Z"
  },
  "layout": {
    "areas": [
      {
        "id": "id",
        "name": "Front door",
        "kind": "room",
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5,
        "floor": 1,
        "size_m": [
          0.5
        ],
        "relations": [
          {
            "to": "to",
            "kind": "behind"
          }
        ]
      }
    ],
    "openings": [
      {
        "between": [
          "between"
        ],
        "kind": "door"
      }
    ],
    "cameras": [
      {
        "monitor_id": 1,
        "name": "Front door",
        "x": 0.5,
        "y": 0.5,
        "heading_deg": 0.5,
        "fov_deg": 0.5,
        "mounted_on": "mounted-on",
        "looks_at": [
          "looks-at"
        ],
        "wall": "north",
        "facing": "north",
        "mention": 1,
        "pinned": false
      }
    ],
    "compass": false,
    "notes": "notes"
  },
  "placed_cameras": 1,
  "unplaced_cameras": [
    "unplaced-camera"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Build a floor plan by scanning the cameras

`POST /api/v1/sites/{site_id}/floor-plans/scan`

API 1.66.0. Sweeps every camera of the site (PTZ cameras turn through a panorama), reads each picture with the AI, finds where the cameras' views overlap and stores the result as the site's scanned top-down plan (`source: scan`; a re-scan makes a new version of the same plan). The answer is the plan id and how the scan went: `scale` is `locked` (a measured size was found), `estimate` or `unscaled`; `placed` cameras were put on the plan and `islands` groups (or cameras) could not be tied to the main layout. A camera that fails to scan is left out; `422 validation_error` when the site has no cameras assigned to it (`details.field: site_id` — assign cameras to the site first) or when none of its cameras could see the floor. One AI call per camera (and per overlap check), charged like a Guardian chat; the whole scan is limited to 15 minutes. Editing rights as for uploading a plan (manager level on the site). `503 service_unavailable` when the server cannot scan.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `201`: The scanned plan.

```json
{
  "plan_id": 1,
  "local_reads": 1,
  "cloud_reads": 1,
  "scale": "locked",
  "placed": 1,
  "islands": 1,
  "confidence": 0.5,
  "review": {
    "moved": 1,
    "removed": 1,
    "notes": [
      "note"
    ],
    "rounds": 1,
    "variants": 1,
    "score": 0.5,
    "winner": "winner",
    "named": 1,
    "rule_score": 0.5,
    "problems": [
      "problem"
    ],
    "repaired": 1,
    "moves": 1
  }
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start a walk-through recording session

`POST /api/v1/sites/{site_id}/floor-plans/walkthroughs/sessions`

API 1.83.0. Call when the phone starts recording a walk-through. The answer is an unguessable `token` and the `qr_prefix` of the QR codes the phone may show the cameras while walking (`<qr_prefix><seq>`, `seq` counting up once a second from 0; the sensor track records when each `seq` was shown). A camera that reads one of the codes tells Vigiora which room it is in and where: `createFloorPlanWalkthrough` with this `token` in its `session` part places those cameras in the room the walker was in, on the wall behind the phone, facing the walker. A session is valid for 24 hours and used by one upload. The token is shown only here (no Idempotency-Key). Editing rights as for uploading a plan (manager level on the site).

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs/sessions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `201`: The session.

```json
{
  "id": 1,
  "token": "preset-1",
  "qr_prefix": "qr-prefix",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the site's walk-throughs

`GET /api/v1/sites/{site_id}/floor-plans/walkthroughs`

API 1.85.0. The site's walk-throughs, newest first (at most 200), each with whether its video is kept (`video_kept`, `video_bytes`). A walk's video, sensor track and the cameras' QR sightings are kept until the walk is deleted (`DELETE /floor-plans/walkthroughs/{walkthrough_id}`), so it can be watched and run again. Managers of the site only.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The walk-throughs.

```json
{
  "data": [
    {
      "id": 1,
      "site_id": 1,
      "state": "recording",
      "phase": "recording",
      "progress": 1,
      "plan_id": 1,
      "merged": false,
      "scale": "estimate",
      "counts": {
        "frames": 1,
        "frames_read": 1,
        "local_reads": 1,
        "cloud_reads": 1,
        "places": 1,
        "rooms": 1,
        "doors": 1,
        "windows": 1,
        "furniture": 1,
        "landmarks": 1,
        "cameras": 1,
        "steps": 1,
        "distance_m": 0.5
      },
      "sensors_used": {
        "steps": false,
        "compass": false,
        "gps": false
      },
      "notes": [
        "note"
      ],
      "error": null,
      "video_kept": false,
      "video_bytes": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Build a floor plan from a walk-through video

`POST /api/v1/sites/{site_id}/floor-plans/walkthroughs`

API 1.83.0. Upload a phone video of a walk through the rooms and the grounds (MP4, MOV or WebM, up to 1 GB and 30 minutes) as `multipart/form-data`: the optional `session` (a token from `createFloorPlanWalkthroughSession`) and `sensors` (the phone's sensor track, JSON — see `FloorPlanWalkthroughSensors`) parts first, the `video` part last. The answer is `202` with the job; poll `getFloorPlanWalkthrough`. The server takes frames at about 2 per second, drops blurry and repeated ones, reads at most 48 with the vision AI (a runner's local model first, the cloud AI when there is none or it fails; only frames leave the server, never the video), splits the walk into places, and draws rooms (sized from the steps and compass when the track has them, else typical sizes), doors where the walk went from room to room, windows, the furniture seen (block library sizes) and the grounds. A site without a plan gets a new one (`source: scan`); otherwise the walk is ADDED to the site's plan (the scanned one first): rooms, doors, furniture and grounds the plan lacks — nothing on it is deleted or moved, except camera pins Vigiora placed itself, which a camera's QR sightings may move; the plan's items are kept in the job before the change. The GPS fix (or the video's own location tag) sets the site's location when it has none. Missing sensors only make a poorer plan; the job's `notes` say what was used. Cloud reads are charged like a Guardian chat; `402` when out of AI credits. `413` over 1 GB, `415` not a video. Not served through a Cloudflare Tunnel origin (media goes to the media origin). Not an MCP tool.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The job, queued; poll its URL.

```json
{
  "id": 1,
  "site_id": 1,
  "state": "recording",
  "phase": "recording",
  "progress": 1,
  "plan_id": 1,
  "merged": false,
  "scale": "estimate",
  "counts": {
    "frames": 1,
    "frames_read": 1,
    "local_reads": 1,
    "cloud_reads": 1,
    "places": 1,
    "rooms": 1,
    "doors": 1,
    "windows": 1,
    "furniture": 1,
    "landmarks": 1,
    "cameras": 1,
    "steps": 1,
    "distance_m": 0.5
  },
  "sensors_used": {
    "steps": false,
    "compass": false,
    "gps": false
  },
  "notes": [
    "note"
  ],
  "error": null,
  "video_kept": false,
  "video_bytes": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a walk-through job

`GET /api/v1/floor-plans/walkthroughs/{walkthrough_id}`

API 1.83.0. A walk-through's progress (`state` queued → running → done or failed; `phase` frames, reading, layout, saving) and, when done, the plan it made or added to (`plan_id`, `merged`), what it drew (`counts`), which phone sensors shaped it (`sensors_used`) and short `notes`. A recording session not yet uploaded is `recording`. Visible to managers of the site; `404` otherwise.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `walkthrough_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/walkthroughs/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The job.

```json
{
  "id": 1,
  "site_id": 1,
  "state": "recording",
  "phase": "recording",
  "progress": 1,
  "plan_id": 1,
  "merged": false,
  "scale": "estimate",
  "counts": {
    "frames": 1,
    "frames_read": 1,
    "local_reads": 1,
    "cloud_reads": 1,
    "places": 1,
    "rooms": 1,
    "doors": 1,
    "windows": 1,
    "furniture": 1,
    "landmarks": 1,
    "cameras": 1,
    "steps": 1,
    "distance_m": 0.5
  },
  "sensors_used": {
    "steps": false,
    "compass": false,
    "gps": false
  },
  "notes": [
    "note"
  ],
  "error": null,
  "video_kept": false,
  "video_bytes": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `404`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a walk-through

`DELETE /api/v1/floor-plans/walkthroughs/{walkthrough_id}`

API 1.85.0. Deletes the walk-through and its kept video, sensor track and QR sightings. The plan it made or added to stays. Nothing is deleted automatically: this is the only way a walk's video goes. `409` while the walk is being read.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_floor_plan_walkthrough`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `walkthrough_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/floor-plans/walkthroughs/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `409`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Walk-through video

`GET /api/v1/floor-plans/walkthroughs/{walkthrough_id}/video`

API 1.85.0. The kept video of the walk (MP4 or WebM as the phone recorded it; Range requests supported). `404` when none is kept.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `walkthrough_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/walkthroughs/42/video" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: The video. (`video/mp4`)

Errors: `401`, `404`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run a walk-through again

`POST /api/v1/floor-plans/walkthroughs/{walkthrough_id}/actions/rerun`

API 1.85.0. Reads a finished (done or failed) walk again from its kept video, sensor track and QR sightings — after a failure, or to use a better layout. The job goes back to `queued` and is followed like a new one (`GET /floor-plans/walkthroughs/{walkthrough_id}`). The plan the earlier run made stays; the new run makes a plan of its own, so the two can be compared; nothing a person placed is touched. Spends AI credits for frames read by the cloud. `409` while the walk is recorded or read, or when its video is not kept.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `walkthrough_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans/walkthroughs/42/actions/rerun" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: Queued again.

```json
{
  "id": 1,
  "site_id": 1,
  "state": "recording",
  "phase": "recording",
  "progress": 1,
  "plan_id": 1,
  "merged": false,
  "scale": "estimate",
  "counts": {
    "frames": 1,
    "frames_read": 1,
    "local_reads": 1,
    "cloud_reads": 1,
    "places": 1,
    "rooms": 1,
    "doors": 1,
    "windows": 1,
    "furniture": 1,
    "landmarks": 1,
    "cameras": 1,
    "steps": 1,
    "distance_m": 0.5
  },
  "sensors_used": {
    "steps": false,
    "compass": false,
    "gps": false
  },
  "notes": [
    "note"
  ],
  "error": null,
  "video_kept": false,
  "video_bytes": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `402`, `403`, `404`, `409`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Open a chunked walk-through upload

`POST /api/v1/sites/{site_id}/floor-plans/walkthroughs/uploads`

API 1.90.0. A walk-through video is a few hundred megabytes and the phone is often on a mobile network, where one long request dies at the first hiccup. Open an upload, send the video in chunks of `chunk_bytes` (`appendFloorPlanWalkthroughUpload`, each a small request the client simply repeats when it fails), then `finishFloorPlanWalkthroughUpload` with the sensors and the session token: the server joins the chunks and runs the same job as `createFloorPlanWalkthrough`. An upload not finished within 24 hours is dropped. Managers of the site only. Not served through a Cloudflare Tunnel origin (media goes to the media origin). Not an MCP tool.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs/uploads" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `201`: The upload, open and empty.

```json
{
  "id": "id",
  "chunk_bytes": 1,
  "received": [
    1
  ],
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send one chunk of the video

`POST /api/v1/sites/{site_id}/floor-plans/walkthroughs/uploads/{upload_id}/actions/append`

API 1.90.0. The raw bytes of chunk `index` (0-based, at most `chunk_bytes` each, `413` over that; the last chunk may be shorter). Sending an index again replaces that chunk, so a client that never saw the answer repeats the request. The answer lists the chunks received so far. `404` for an unknown, expired or another site's upload. Not an MCP tool.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |
| `upload_id` | path | string | Yes |  |
| `index` | query | integer | Yes | The chunk number, 0-based. (0–128) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs/uploads/42/actions/append" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The upload with the chunks received.

```json
{
  "id": "id",
  "chunk_bytes": 1,
  "received": [
    1
  ],
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `413`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Join the chunks and build the plan

`POST /api/v1/sites/{site_id}/floor-plans/walkthroughs/uploads/{upload_id}/actions/finish`

API 1.90.0. Says how many chunks make the video (`chunks`, and its `size` in bytes when known), with the optional `session` token and `sensors` track of `createFloorPlanWalkthrough`. `400` names a chunk that was not received (send it again and finish again). On success the answer is `202` with the job, exactly as `createFloorPlanWalkthrough`, and the upload is spent. `402`, `413`, `415` as there. Not an MCP tool.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |
| `upload_id` | path | string | Yes |  |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `chunks` | integer | Yes | How many chunks make the video (numbered 0 to chunks-1). (≥ 1) |
| `size` | integer | No | Optional: the video size in bytes; the chunks must add up to it. |
| `session` | string | No | Optional: the token of the recording session (QR codes shown to the cameras). |
| `sensors` | FloorPlanWalkthroughSensors or string | No | Optional: the phone's sensor track (FloorPlanWalkthroughSensors), as the object or as a JSON string holding it. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites/42/floor-plans/walkthroughs/uploads/42/actions/finish" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"chunks":1}'
```

**Response** `202`: The job, queued; poll its URL.

```json
{
  "id": 1,
  "site_id": 1,
  "state": "recording",
  "phase": "recording",
  "progress": 1,
  "plan_id": 1,
  "merged": false,
  "scale": "estimate",
  "counts": {
    "frames": 1,
    "frames_read": 1,
    "local_reads": 1,
    "cloud_reads": 1,
    "places": 1,
    "rooms": 1,
    "doors": 1,
    "windows": 1,
    "furniture": 1,
    "landmarks": 1,
    "cameras": 1,
    "steps": 1,
    "distance_m": 0.5
  },
  "sensors_used": {
    "steps": false,
    "compass": false,
    "gps": false
  },
  "notes": [
    "note"
  ],
  "error": null,
  "video_kept": false,
  "video_bytes": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change a described floor plan

`POST /api/v1/floor-plans/{floor_plan_id}/actions/refine`

API 1.32.0. Changes a plan drawn from a description (`source: ai`) by an instruction ("move the kitchen to the left of the entrance", "the pool is outside, to the east"): the AI gets the current layout, with the cameras where their pins are now, and returns the whole updated layout, which is drawn as a new version of the same plan (the camera pins of the layout's cameras move; other items stay). The layout before the change is kept for one undo (`undoFloorPlanLayout`). `400 validation_error` for an uploaded plan. Charged and limited like `describeFloorPlan`.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `instruction` | string | Yes | The change, e.g. "move the kitchen to the left of the entrance". (max 2000 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans/42/actions/refine" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"instruction":"instruction"}'
```

**Response** `200`: The plan's new version and its layout.

```json
{
  "floor_plan": {
    "id": 1,
    "site_id": 1,
    "site_name": "site-name",
    "name": "Front door",
    "floor_number": 1,
    "sort_order": 1,
    "image_type": "png",
    "width_px": 1,
    "height_px": 1,
    "version": 1,
    "source": "upload",
    "metres_per_unit": 0.5,
    "can_edit": false,
    "camera_count": 2,
    "unacked_alerts": 1,
    "description": "description",
    "image_url": "image-url",
    "thumb_url": "thumb-url",
    "created_at": "2026-10-30T14:05:00Z",
    "updated_at": "2026-10-30T14:05:00Z"
  },
  "layout": {
    "areas": [
      {
        "id": "id",
        "name": "Front door",
        "kind": "room",
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5,
        "floor": 1,
        "size_m": [
          0.5
        ],
        "relations": [
          {
            "to": "to",
            "kind": "behind"
          }
        ]
      }
    ],
    "openings": [
      {
        "between": [
          "between"
        ],
        "kind": "door"
      }
    ],
    "cameras": [
      {
        "monitor_id": 1,
        "name": "Front door",
        "x": 0.5,
        "y": 0.5,
        "heading_deg": 0.5,
        "fov_deg": 0.5,
        "mounted_on": "mounted-on",
        "looks_at": [
          "looks-at"
        ],
        "wall": "north",
        "facing": "north",
        "mention": 1,
        "pinned": false
      }
    ],
    "compass": false,
    "notes": "notes"
  },
  "placed_cameras": 1,
  "unplaced_cameras": [
    "unplaced-camera"
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### The layout a floor plan was drawn from

`GET /api/v1/floor-plans/{floor_plan_id}/layout`

API 1.32.0. For a plan drawn from a description: its `layout` (areas in metres with the origin at the north-west corner, x east, y south; openings; cameras where their pins are now, the ones you may view), whether one change can be undone and the description chat. An uploaded plan answers `layout: null`. With `format=svg` the layout is drawn as an SVG image with the cameras and their view (404 for an uploaded plan).

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |
| `format` | query | string: `json`, `svg` | No | `json` (default) or `svg`. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/floor-plans/42/layout" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The layout.

```json
{
  "floor_plan_id": 1,
  "version": 1,
  "source": "upload",
  "layout": {
    "areas": [
      {
        "id": "id",
        "name": "Front door",
        "kind": "room",
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5,
        "floor": 1,
        "size_m": [
          0.5
        ],
        "relations": [
          {
            "to": null,
            "kind": null
          }
        ]
      }
    ],
    "openings": [
      {
        "between": [
          "between"
        ],
        "kind": "door"
      }
    ],
    "cameras": [
      {
        "monitor_id": 1,
        "name": "Front door",
        "x": 0.5,
        "y": 0.5,
        "heading_deg": 0.5,
        "fov_deg": 0.5,
        "mounted_on": "mounted-on",
        "looks_at": [
          "looks-at"
        ],
        "wall": "north",
        "facing": "north",
        "mention": 1,
        "pinned": false
      }
    ],
    "compass": false,
    "notes": "notes"
  },
  "can_undo": false,
  "turns": [
    {
      "role": "user",
      "text": "text",
      "at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Undo the last change of a described floor plan

`POST /api/v1/floor-plans/{floor_plan_id}/layout/actions/undo`

API 1.32.0. Goes back to the layout before the last `refineFloorPlan` (one level; no AI call): the plan is drawn again from it as a new version and its cameras' pins return to where they were. `400 validation_error` when there is nothing to undo or the plan was uploaded.

| Requirement | |
| --- | --- |
| Scope | `floorplans:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `floor_plan_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/floor-plans/42/layout/actions/undo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The plan's new version and its layout.

```json
{
  "floor_plan": {
    "id": 1,
    "site_id": 1,
    "site_name": "site-name",
    "name": "Front door",
    "floor_number": 1,
    "sort_order": 1,
    "image_type": "png",
    "width_px": 1,
    "height_px": 1,
    "version": 1,
    "source": "upload",
    "metres_per_unit": 0.5,
    "can_edit": false,
    "camera_count": 2,
    "unacked_alerts": 1,
    "description": "description",
    "image_url": "image-url",
    "thumb_url": "thumb-url",
    "created_at": "2026-10-30T14:05:00Z",
    "updated_at": "2026-10-30T14:05:00Z"
  },
  "layout": {
    "areas": [
      {
        "id": "id",
        "name": "Front door",
        "kind": "room",
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5,
        "floor": 1,
        "size_m": [
          0.5
        ],
        "relations": [
          {
            "to": "to",
            "kind": "behind"
          }
        ]
      }
    ],
    "openings": [
      {
        "between": [
          "between"
        ],
        "kind": "door"
      }
    ],
    "cameras": [
      {
        "monitor_id": 1,
        "name": "Front door",
        "x": 0.5,
        "y": 0.5,
        "heading_deg": 0.5,
        "fov_deg": 0.5,
        "mounted_on": "mounted-on",
        "looks_at": [
          "looks-at"
        ],
        "wall": "north",
        "facing": "north",
        "mention": 1,
        "pinned": false
      }
    ],
    "compass": false,
    "notes": "notes"
  },
  "placed_cameras": 1,
  "unplaced_cameras": [
    "unplaced-camera"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Where a camera is on the floor plans

`GET /api/v1/cameras/{camera_id}/locations`

API 1.23.0. Every placement of the camera on the floor plans you can see: the plan, its site and floor, the position (fractions of the image), the direction it faces and a plain-language `description` ("faces north-east, covers Reception, near the main door"). Use it to answer "where is camera X". An empty list when the camera is on no plan.

| Requirement | |
| --- | --- |
| Scope | `floorplans:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/locations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The locations.

```json
{
  "camera_id": 3,
  "data": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "x": 0.5,
      "y": 0.5,
      "rotation_deg": 0.5,
      "fov_deg": 0.5,
      "range": 0.5,
      "description": "description"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Views

AI views (API 1.34.0): the user says what they want to check ("entrance and driveway live, plus today's alerts") and the AI composes a view: cards (live video, alerts, people counts, heatmaps, occupancy, queues, parking, a floor plan, transcripts, recordings, faces, plates) on the cameras it resolves from the request, in a grid. The server gives the model a catalogue of what the caller can see, matches the names it answers with, drops what a camera cannot show and caps the cards at 12. Views are per user: recent ones are kept (the 30 last opened), pinned ones for good.

### Compose an AI view

`POST /api/v1/views/actions/compose`

API 1.34.0. Says in words what to check; the AI answers with a view (title, summary, cards on cameras, grid) composed from the cameras, analytics areas and zones and floor plans the caller can see (`site_id` limits the catalogue to a site and its sub-sites). Names are matched to cameras (by name, tag, room or site); cards a camera cannot show are left out and `spec.notes` say what changed. One AI call (two when the first answer is unusable), charged like a Guardian chat; the whole composition is limited to 45 seconds. The view is stored for the caller (the 30 most recently opened unpinned views are kept). `503 ai_unavailable` when the server has no AI (not connected to Vigiora cloud) or the AI gave no usable view, `402 insufficient_credits` when out of credits.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | Yes | What to check, in any language. (max 2000 characters) |
| `site_id` | integer or null | No | Limit the catalogue to this site and its sub-sites. (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/views/actions/compose" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"prompt"}'
```

**Response** `201`: The composed view.

```json
{
  "id": 1,
  "prompt": "prompt",
  "title": "title",
  "summary": "summary",
  "spec": {
    "title": "title",
    "summary": "summary",
    "cards": [
      {
        "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
        "kind": "live",
        "title": "title",
        "monitor_ids": [
          1
        ],
        "labels": [
          "person"
        ],
        "params": {
          "period": "today",
          "hours": 1,
          "range": "day",
          "layer": "pass",
          "class": "person",
          "area_ids": [
            1
          ],
          "zone_ids": [
            1
          ],
          "floor_plan_id": 1,
          "date": "date"
        },
        "size": "s"
      }
    ],
    "layout": {
      "cols": 1
    },
    "notes": [
      "note"
    ]
  },
  "pinned": false,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_opened_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List AI views

`GET /api/v1/views`

API 1.34.0. The caller's views: pinned first, then by last opened. At most 200.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/views" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The views.

```json
{
  "data": [
    {
      "id": 1,
      "prompt": "prompt",
      "title": "title",
      "summary": "summary",
      "spec": {
        "title": "title",
        "summary": "summary",
        "cards": [
          {
            "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
            "kind": "live",
            "title": "title",
            "monitor_ids": [
              null
            ],
            "labels": [
              null
            ],
            "params": {
              "period": null,
              "hours": null,
              "range": null,
              "layer": null,
              "class": null,
              "area_ids": null,
              "zone_ids": null,
              "floor_plan_id": null,
              "date": null
            },
            "size": "s"
          }
        ],
        "layout": {
          "cols": 1
        },
        "notes": [
          "note"
        ]
      },
      "pinned": false,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "last_opened_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Example requests for an AI view

`GET /api/v1/views/suggestions`

API 1.34.0. Three example requests written from what the caller has (camera names, analytics, audio, plate or face readers, floor plans), for the empty state of the AI mode.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/views/suggestions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The examples (empty without cameras).

```json
{
  "data": [
    "data"
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an AI view

`GET /api/v1/views/{view_id}`

API 1.34.0. One of the caller's views; opening it moves it to the top of the recent views (`open=0` reads without that). Another user's view is `404`.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `view_id` | path | integer | Yes | (≥ 1) |
| `open` | query | string: `0`, `1` | No | `0` reads the view without marking it opened. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/views/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The view.

```json
{
  "id": 1,
  "prompt": "prompt",
  "title": "title",
  "summary": "summary",
  "spec": {
    "title": "title",
    "summary": "summary",
    "cards": [
      {
        "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
        "kind": "live",
        "title": "title",
        "monitor_ids": [
          1
        ],
        "labels": [
          "person"
        ],
        "params": {
          "period": "today",
          "hours": 1,
          "range": "day",
          "layer": "pass",
          "class": "person",
          "area_ids": [
            1
          ],
          "zone_ids": [
            1
          ],
          "floor_plan_id": 1,
          "date": "date"
        },
        "size": "s"
      }
    ],
    "layout": {
      "cols": 1
    },
    "notes": [
      "note"
    ]
  },
  "pinned": false,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_opened_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Pin, rename or trim an AI view

`PATCH /api/v1/views/{view_id}`

API 1.34.0. `pinned` keeps the view past the recent-views cap, `title` renames it, `card_keys` keeps only those cards (in grid order; at least one). At least one field.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `view_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `pinned` | boolean or null | No |  |
| `title` | string or null | No | (max 128 characters) |
| `card_keys` | array of string or null | No | The keys of the cards to keep (the others are removed). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/views/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"pinned":false,"title":"title","card_keys":["card-key"]}'
```

**Response** `200`: The view.

```json
{
  "id": 1,
  "prompt": "prompt",
  "title": "title",
  "summary": "summary",
  "spec": {
    "title": "title",
    "summary": "summary",
    "cards": [
      {
        "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
        "kind": "live",
        "title": "title",
        "monitor_ids": [
          1
        ],
        "labels": [
          "person"
        ],
        "params": {
          "period": "today",
          "hours": 1,
          "range": "day",
          "layer": "pass",
          "class": "person",
          "area_ids": [
            1
          ],
          "zone_ids": [
            1
          ],
          "floor_plan_id": 1,
          "date": "date"
        },
        "size": "s"
      }
    ],
    "layout": {
      "cols": 1
    },
    "notes": [
      "note"
    ]
  },
  "pinned": false,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_opened_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an AI view

`DELETE /api/v1/views/{view_id}`

API 1.34.0. The caller's own views only.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_view`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `view_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/views/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change an AI view

`POST /api/v1/views/{view_id}/actions/refine`

API 1.34.0. Changes a view by an instruction ("add the garage", "drop the heatmap", "last 7 days instead"): the AI gets the current view and answers with the whole new one; cards the instruction does not mention are carried over as they are. The instruction is appended to the view's `prompt`; a title set by hand stays. Charged and limited like `composeView`.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `view_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `instruction` | string | Yes | The change, e.g. "add the garage". (max 2000 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/views/42/actions/refine" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"instruction":"instruction"}'
```

**Response** `200`: The changed view.

```json
{
  "id": 1,
  "prompt": "prompt",
  "title": "title",
  "summary": "summary",
  "spec": {
    "title": "title",
    "summary": "summary",
    "cards": [
      {
        "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
        "kind": "live",
        "title": "title",
        "monitor_ids": [
          1
        ],
        "labels": [
          "person"
        ],
        "params": {
          "period": "today",
          "hours": 1,
          "range": "day",
          "layer": "pass",
          "class": "person",
          "area_ids": [
            1
          ],
          "zone_ids": [
            1
          ],
          "floor_plan_id": 1,
          "date": "date"
        },
        "size": "s"
      }
    ],
    "layout": {
      "cols": 1
    },
    "notes": [
      "note"
    ]
  },
  "pinned": false,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_opened_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Faces

Recognised faces (enrolled and pending) and their photos.

### List faces

`GET /api/v1/faces`

Recognised faces of cameras the caller may view (faces without a camera: admins only), newest first: enrolled faces and, as `pending`, faces seen in the last 24 hours that are not enrolled (their id is `det-<alert id>`).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `pending` | query | boolean | No | Only pending (`true`) or enrolled (`false`) faces. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/faces" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of faces.

```json
{
  "data": [
    {
      "id": "id",
      "name": "Front door",
      "camera_id": 3,
      "auto_enrolled": false,
      "pending": false,
      "confidence": 0.5,
      "has_photo": false,
      "has_crop": false,
      "created_at": "2026-10-30T14:05:00Z",
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      }
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Face photo

`GET /api/v1/faces/{face_id}/photo`

The face's JPEG (`has_photo`). Not served through a Cloudflare Tunnel origin.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `face_id` | path | string | Yes | A face id (enrolled faces), or `det-<alert id>` for a pending face. (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/faces/42/photo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Face crop

`GET /api/v1/faces/{face_id}/crop`

The face itself, as the camera's face runner cut it from the frame (`has_crop`; pending faces only, API 1.33.2). Not served through a Cloudflare Tunnel origin.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `face_id` | path | string | Yes | A face id (enrolled faces), or `det-<alert id>` for a pending face. (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/faces/42/crop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Name a face

`PATCH /api/v1/faces/{face_id}`

Names an enrolled face (biometric data: admins with the `admin` scope; audited). Its past alerts are relabelled (`face:<name>`). Pending faces (`det-…`) are enrolled by the camera's face service first (`409 conflict`).

| Requirement | |
| --- | --- |
| Scope | `admin` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `rename_face`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `face_id` | path | string | Yes | A face id (enrolled faces), or `det-<alert id>` for a pending face. (max 64 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/faces/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `200`: The face.

```json
{
  "id": "id",
  "name": "Front door",
  "camera_id": 3,
  "auto_enrolled": false,
  "pending": false,
  "confidence": 0.5,
  "has_photo": false,
  "has_crop": false,
  "created_at": "2026-10-30T14:05:00Z",
  "bbox": {
    "x": 0.5,
    "y": 0.5,
    "w": 0.5,
    "h": 0.5
  }
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a face

`DELETE /api/v1/faces/{face_id}`

Deletes an enrolled face and its photo (biometric data: admins with the `admin` scope; audited). A pending face (`det-<alert id>`, API 1.33.2) is deleted with its alert and pictures; with `not_a_face=true` ("Not a face") the camera's face runner also ignores that spot of the picture for an hour.

| Requirement | |
| --- | --- |
| Scope | `admin` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_face`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `face_id` | path | string | Yes | A face id (enrolled faces), or `det-<alert id>` for a pending face. (max 64 characters) |
| `not_a_face` | query | boolean | No | API 1.33.2. For a pending face, `true` also tells the camera's face runner to ignore that spot. |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/faces/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an alert's face crop

`GET /api/v1/alerts/{alert_id}/face-photo`

The face crop of a face alert (a pending face).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alerts/42/face-photo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The JPEG. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Recordings

Recorded segments, coverage timeline and playback.

### Recording coverage

`GET /api/v1/cameras/{camera_id}/timeline`

The stretches of `[from, to)` that have footage, merging segments less than 2 seconds apart. At most 31 days. The segment still being written counts up to its last write (API 1.98.0; before, the newest footage appeared only when its segment closed, up to 10 minutes late). The span it ends has `in_progress` set to `true` and its `end` moves forward on the next read. That segment has no recording id yet, so it is not in `GET /recordings` until it closes.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | Yes |  |
| `to` | query | string (RFC 3339) | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/timeline" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The coverage.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "spans": [
    {
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "recording_count": 2,
      "in_progress": true
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the scrubbing pictures of a camera's recordings

`GET /api/v1/cameras/{camera_id}/previews`

API 1.116.0. The preview sprite of each finished recording overlapping `[from, to)` (at most 48 hours), oldest first. A sprite is one JPEG with a small picture (160 px wide) every `interval_seconds` of the recording, `columns` per row: picture `k` shows the moment `start + k × interval_seconds` and sits at column `k mod columns`, row `k div columns`. Sprites are made when a recording closes, or on the first request of `sprite_url` for older recordings; `ready` says whether it exists now (`tile_height` is null until then). Nothing is made by this call. The segment still being written has none (it is not listed). The camera's privacy masks are painted on every picture.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | Yes |  |
| `to` | query | string (RFC 3339) | Yes | After `from`, at most 48 hours later. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/previews" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The sprites.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "interval_seconds": 1,
  "columns": 1,
  "data": [
    {
      "recording_id": 1,
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "interval_seconds": 1,
      "columns": 1,
      "count": 2,
      "ready": false,
      "tile_width": 1,
      "tile_height": 1,
      "sprite_url": "sprite-url"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find when a part of the picture changed

`POST /api/v1/cameras/{camera_id}/area-searches`

Starts a search of the camera's recordings between `from` and `to` (at most 7 days; `to` in the future is cut to now) for the moments when something inside `area` changed: an item that moved, appeared or went away, however small or slow. `area` is a rectangle in fractions (0 to 1) of the picture from its top left corner, at least 0.02 wide and high. The search reads the recordings themselves (one frame every 5 seconds, cropped to the area), so it also finds what no detector and no Guardian description noticed. Each side of a comparison is the median of 30 seconds, so someone walking through leaves no finding, and the comparison is by pattern, so a change of brightness is not a finding. A change of the whole picture at once (lights, night mode) is counted in `lighting_skipped` and not listed. A smaller area finds smaller things: an area up to 40 % of the picture's width is read at full detail, a larger one is reduced. `sensitivity` is `low`, `medium` (default) or `high`. The search runs in the background: the answer is `202` with `status: running`; read `GET /cameras/{camera_id}/area-searches/{search_id}` until `status` is `done`. A day of one camera takes seconds to a minute. Two searches run at a time on a server (`429 rate_limited` with `Retry-After` beyond that) and a result is kept for 30 minutes. The segment still being recorded is not read. Nothing is stored or changed (the scope is `recordings:write` because it starts work on the server, like a clip export). API 1.99.0. Feature `area_search`.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string (RFC 3339) | Yes |  |
| `to` | string (RFC 3339) | Yes | At most 7 days after `from`; a time in the future is cut to now. |
| `area` | AreaRect | Yes | A rectangle in fractions (0 to 1) of the picture, from its top left corner. |
| `sensitivity` | string: `low`, `medium`, `high` | No | How small a change counts. Default `medium`. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/area-searches" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"from":"2026-10-30T14:05:00Z","to":"2026-10-30T14:05:30Z","area":{"x":0.5,"y":0.5,"width":0.5,"height":0.5}}'
```

**Response** `202`: The search, started.

```json
{
  "id": "id",
  "camera_id": 3,
  "status": "running",
  "progress": 1,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "area": {
    "x": 0.5,
    "y": 0.5,
    "width": 0.5,
    "height": 0.5
  },
  "sensitivity": "low",
  "changes": [
    {
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "at": "2026-10-30T14:05:00Z",
      "kind": "changed",
      "score": 0.5,
      "box": {
        "x": 0.5,
        "y": 0.5,
        "width": 0.5,
        "height": 0.5
      },
      "before_at": "2026-10-30T14:05:00Z",
      "after_at": "2026-10-30T14:05:00Z",
      "across_gap": false
    }
  ],
  "recordings_total": 1,
  "recordings_done": 1,
  "recordings_skipped": 1,
  "seconds_searched": 0.5,
  "lighting_skipped": 1,
  "truncated": false,
  "error": null,
  "created_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read an area search

`GET /api/v1/cameras/{camera_id}/area-searches/{search_id}`

The search's progress (`status`, `progress` from 0 to 1) and what it found so far (`changes`, oldest first; they fill in while it runs). A finding of kind `changed` means the area looks different afterwards (an item moved, appeared or went away); `activity` means something stayed in the area for a while and left it as it was. `start` and `end` are when the change showed, `at` when it was strongest, `box` where in the picture, and `before_at` / `after_at` two moments to compare: `GET …/changes/{change_id}/picture` serves the area at either. `across_gap` is true for a change that happened while nothing was recorded. A search is forgotten 30 minutes after it finished (`404`). API 1.99.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `search_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/area-searches/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The search.

```json
{
  "id": "id",
  "camera_id": 3,
  "status": "running",
  "progress": 1,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "area": {
    "x": 0.5,
    "y": 0.5,
    "width": 0.5,
    "height": 0.5
  },
  "sensitivity": "low",
  "changes": [
    {
      "start": "2026-10-30T14:05:00Z",
      "end": "2026-10-30T14:05:30Z",
      "at": "2026-10-30T14:05:00Z",
      "kind": "changed",
      "score": 0.5,
      "box": {
        "x": 0.5,
        "y": 0.5,
        "width": 0.5,
        "height": 0.5
      },
      "before_at": "2026-10-30T14:05:00Z",
      "after_at": "2026-10-30T14:05:00Z",
      "across_gap": false
    }
  ],
  "recordings_total": 1,
  "recordings_done": 1,
  "recordings_skipped": 1,
  "seconds_searched": 0.5,
  "lighting_skipped": 1,
  "truncated": false,
  "error": null,
  "created_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Cancel an area search

`DELETE /api/v1/cameras/{camera_id}/area-searches/{search_id}`

Stops the search when it is still running and forgets its result. Nothing else changes. API 1.99.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `search_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/area-searches/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Canceled and forgotten.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Picture of the area before or after a finding

`GET /api/v1/cameras/{camera_id}/area-searches/{search_id}/changes/{change_id}/picture`

A JPEG of the search's area as it was at the finding's `before_at` (`side=before`) or `after_at` (`side=after`), cut from the recording and at most 480 pixels wide. `404 no_recording` when the recording that held the moment is gone. API 1.99.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `search_id` | path | string | Yes |  |
| `change_id` | path | integer | Yes | The finding's position in `changes`, from 0. (≥ 0) |
| `side` | query | string: `before`, `after` | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/area-searches/42/changes/42/picture" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The picture. (`image/jpeg`)

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's HD clips

`GET /api/v1/cameras/{camera_id}/hd-recordings`

The HD clips of a camera that overlap `from`..`to` (at most 31 days), oldest first. A camera with `record_sub_stream` and `record_hd_on_motion` records its sub stream all the time and also saves the main (HD) stream for every period with movement: one clip from about 10 seconds before the movement to 20 seconds after it, cut every 10 minutes while the movement goes on. The clips cover the same time as the continuous recording, so they are not part of `GET /api/v1/recordings` or the timeline; play one with its `media_url`. They are kept as long as the camera's recordings (`retention_days`). At most 2000 clips per answer: ask a shorter range for more. API 1.100.0. Feature `hd_on_motion`.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | Yes |  |
| `to` | query | string (RFC 3339) | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/hd-recordings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The clips.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "start_time": "2026-10-30T14:05:00Z",
      "end_time": "2026-10-30T14:05:30Z",
      "duration_seconds": 600,
      "size_bytes": 7340032,
      "media_url": "/api/v1/recordings/812/media"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Play an HD clip

`GET /api/v1/cameras/{camera_id}/hd-recordings/{hd_recording_id}/media`

The clip as MP4, H.264 (`Range` requests honoured; `download=true` adds a `Content-Disposition` attachment). This is the `media_url` of an HD clip; send the same credentials as for any call. Through the cloud gateway of a free plan, a used-up remote-video allowance answers `429 relay_limit`. API 1.100.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `hd_recording_id` | path | integer | Yes |  |
| `download` | query | boolean | No |  |
| `Range` | header | string | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/hd-recordings/42/media" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: MP4 video. (`video/mp4`)

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List recordings

`GET /api/v1/recordings`

Segments on cameras the caller may view, oldest first. With `from`/`to`, the segments that overlap `[from, to)`.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of recordings.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "start_time": "2026-10-30T14:05:00Z",
      "end_time": "2026-10-30T14:05:30Z",
      "duration_seconds": 600,
      "size_bytes": 7340032,
      "in_progress": true,
      "protected": false,
      "media_url": "/api/v1/recordings/812/media"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a recording

`GET /api/v1/recordings/{recording_id}`

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `recording_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The recording.

```json
{
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "start_time": "2026-10-30T14:05:00Z",
  "end_time": "2026-10-30T14:05:30Z",
  "duration_seconds": 600,
  "size_bytes": 7340032,
  "in_progress": true,
  "protected": false,
  "media_url": "/api/v1/recordings/812/media"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Play a recording

`GET /api/v1/recordings/{recording_id}/media`

The segment as MP4 (`Range` requests honoured; `download=true` adds a `Content-Disposition` attachment). This is the playback URL of a recording (`media_url`); send the same credentials as for any call. Not served through a Cloudflare Tunnel origin. Through the cloud gateway of a free plan, a used-up remote-video allowance answers `429 relay_limit` (`details.reason` is the gateway's code).

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `recording_id` | path | integer | Yes | (≥ 1) |
| `download` | query | boolean | No |  |
| `Range` | header | string | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings/42/media" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: MP4 video. (`video/mp4`)

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a recording's scrubbing pictures

`GET /api/v1/recordings/{recording_id}/preview`

API 1.116.0. The recording's preview sprite: one JPEG with a picture (160 px wide) every `X-Vigiora-Preview-Interval` seconds, `X-Vigiora-Preview-Columns` per row, `X-Vigiora-Preview-Count` in all, each `X-Vigiora-Preview-Tile-Width` × `X-Vigiora-Preview-Tile-Height` pixels (picture `k` is the moment `start + k × interval`, at column `k mod columns`, row `k div columns`). Made when the recording closed, or now on the first request (one pass over the file at low resolution; a busy server answers `503 preview_busy` with `Retry-After`). The camera's privacy masks are painted on every picture; when they cannot be read the sprite is withheld (`503 preview_unavailable`). `404 no_preview` for a recording without pictures (a microphone) or one still being written. Cached by the browser (`private, max-age=86400`, with an `ETag` that changes with the recording and the masks). Not served through a Cloudflare Tunnel origin.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `recording_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings/42/preview" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG sprite. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Protect a recording

`POST /api/v1/recordings/{recording_id}/actions/protect`

A protected recording is never deleted by retention (nor with an alert's clip) until unprotected. Needs operator permission on its camera. Protected recordings may use at most a share of the recordings disk (20 % by default) so they can never stop recording; past it `409 protect_limit`, and on a critically low disk `507 disk_low` (existing protections stay).

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `recording_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/recordings/42/actions/protect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The recording.

```json
{
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "start_time": "2026-10-30T14:05:00Z",
  "end_time": "2026-10-30T14:05:30Z",
  "duration_seconds": 600,
  "size_bytes": 7340032,
  "in_progress": true,
  "protected": false,
  "media_url": "/api/v1/recordings/812/media"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `507`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Unprotect a recording

`POST /api/v1/recordings/{recording_id}/actions/unprotect`

Retention applies again (a recording past its camera's retention goes at the next sweep).

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `unprotect_recording`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `recording_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/recordings/42/actions/unprotect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The recording.

```json
{
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "start_time": "2026-10-30T14:05:00Z",
  "end_time": "2026-10-30T14:05:30Z",
  "duration_seconds": 600,
  "size_bytes": 7340032,
  "in_progress": true,
  "protected": false,
  "media_url": "/api/v1/recordings/812/media"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a frame from the recordings

`GET /api/v1/cameras/{camera_id}/frame`

Extracts the picture closest to `at` from the camera's recorded footage (the finished segment covering that moment, decoded at the exact time). `at` needs an explicit offset and may not be in the future. No footage at that time is `404 no_recording` with `details.nearest_before` and `details.nearest_after` (the closest recorded moments, or `null`); the segment being written becomes available when it closes. `stream` other than the one the camera records is `404 no_recording` (`details.recorded_stream`). `X-Vigiora-Frame-Time` is the frame's time; `download=true` adds a `Content-Disposition` attachment named after the camera and time. Extraction runs ffmpeg: at most 30 a minute per credential (sharing the AI operations' concurrency cap; `429 rate_limited`). Through the cloud gateway a frame is a still image like a snapshot: it does not count against the free remote-video allowance.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `at` | query | string (RFC 3339) | Yes | The moment (RFC 3339 with an offset). |
| `format` | query | string: `jpeg`, `png` | No | (default `"jpeg"`) |
| `width` | query | integer | No | Scale down to this width (aspect kept; never up). (16–3840) |
| `quality` | query | integer | No | JPEG quality. (1–100, default `85`) |
| `stream` | query | string: `main`, `sub` | No | The recorded stream (`main` or `sub`); default the one the camera records. |
| `download` | query | string: `true`, `false`, `1`, `0` | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/frame" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The frame. (`image/jpeg`)

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the days with recordings

`GET /api/v1/cameras/{camera_id}/recording-days`

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `month` | query | string | Yes | YYYY-MM. |
| `timezone` | query | string | No | IANA zone the days are counted in (default UTC). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/recording-days" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The days.

```json
{
  "camera_id": 3,
  "month": "month",
  "days": [
    "day"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List cameras with recordings

`GET /api/v1/recordings/cameras`

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/recordings/cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cameras.

```json
{
  "camera_ids": [
    3
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Clips

Clip exports (MP4 cut from recordings) and their public share links.

### List clips

`GET /api/v1/clips`

Your clip exports on cameras you may still view (admins see every clip), newest first. `from`/`to` select clips whose requested footage overlaps `[from, to)`. Clips are kept 24 hours after they finish (longer while a share link is live).

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `status` | query | string: `running`, `ready`, `failed` | No |  |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clips" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of clips.

```json
{
  "data": [
    {
      "id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
      "kind": "single",
      "camera_id": 3,
      "camera_ids": [
        3
      ],
      "camera_name": "Front door",
      "width": 1920,
      "height": 1080,
      "timelapse_seconds": 30,
      "status": "running",
      "progress": 1,
      "requested_from": "2026-10-30T14:05:00Z",
      "requested_to": "2026-10-30T14:05:30Z",
      "from": "2026-10-30T14:05:00Z",
      "to": "2026-10-30T14:05:30Z",
      "shortened": false,
      "size_bytes": 7340032,
      "filename": "front-door-2026-10-30-1400.mp4",
      "error": null,
      "created_at": "2026-10-30T14:05:00Z",
      "finished_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Export a clip

`POST /api/v1/clips`

Starts cutting `[from, to)` (at most 30 minutes) of a camera's recordings into one MP4. Answers `202` with the job; poll `GET /api/v1/clips/{clip_id}` until `status` is `ready` or `failed`. Ready clips are kept 24 hours (longer while a share link is live). A window the camera kept in HD (`record_hd_on_motion`: the HD clips hold all of it) is cut from the HD footage; any other window from the continuous recording (API 1.100.0). Since 1.43.0 `kind: mosaic` exports one video of 2–9 cameras (`camera_ids`, tile order) as tiles synchronised on wall-clock time: 1920×1080 for up to 4 tiles, 2560×1440 for more, 15 fps, re-encoded (H.264), no audio. Tiles are arranged by `layout` cells (the saved layout's grid) when given, else in `cols` columns (0: the smallest square-ish grid). A camera without footage for part of the window shows a dark tile then; a camera without any footage is a dark tile with "No recording". `labels` (default true) draws each camera's name on its tile when the server's ffmpeg can (`mosaic_labels` of the preflight says so). A mosaic counts as one clip against the quotas; its size estimate is half the sum of its cameras' clip estimates. Every camera must be viewable by the caller (else `404`). Since 1.109.0 `kind: timelapse` samples one camera's recordings over `[from, to)` of up to 7 days into one MP4 of `length_seconds` (30, 60, 120 or 300): the recordings are joined, gaps are skipped, and one frame is taken at an even interval of the footage that exists (keyframes only when the interval is long enough, to keep the CPU low). The camera's local time is burned into the bottom-right corner (in the camera's time zone, when the server's ffmpeg can draw text). Footage shorter than `length_seconds` is `422 timelapse_too_short`; a range over 7 days is `422 timelapse_too_long`. Only one timelapse is made at a time on a server (`429 timelapse_busy`, with `Retry-After`); it also holds one of the clip slots. `DELETE /api/v1/clips/{clip_id}` cancels a running one. The output is listed with the other clips and kept as long as they are (24 hours).

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `single`, `mosaic`, `timelapse` | No | (default `"single"`) |
| `camera_id` | integer | No | The camera of a single clip. (≥ 1) |
| `camera_ids` | array of integer | No | The cameras of a mosaic, in tile order (distinct). (max 9 items) |
| `from` | string (RFC 3339) | Yes |  |
| `to` | string (RFC 3339) | Yes |  |
| `layout` | array of MosaicLayoutCell | No | Mosaic only: one grid cell per camera (a saved layout's `grid_config`); cells of other cameras are ignored. The cells' grid is scaled to the video. |
| `cols` | integer | No | Mosaic only, without `layout`: columns of the grid (0: the smallest square-ish grid). (0–9, default `0`) |
| `labels` | boolean | No | Mosaic only: draw each camera's name on its tile. (default `true`) |
| `length_seconds` | integer: `30`, `60`, `120`, `300` | No | Timelapse only (required then): the length of the video, 30 s, 1, 2 or 5 minutes. Since 1.109.0. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clips" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"from":"2026-10-30T14:00:00Z","to":"2026-10-30T14:05:00Z"}'
```

**Response** `202`: The export job.

```json
{
  "id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
  "kind": "single",
  "camera_id": 3,
  "camera_ids": [
    3
  ],
  "camera_name": "Front door",
  "width": 1920,
  "height": 1080,
  "timelapse_seconds": 30,
  "status": "running",
  "progress": 1,
  "requested_from": "2026-10-30T14:05:00Z",
  "requested_to": "2026-10-30T14:05:30Z",
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "shortened": false,
  "size_bytes": 7340032,
  "filename": "front-door-2026-10-30-1400.mp4",
  "error": null,
  "created_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`, `507`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a clip

`GET /api/v1/clips/{clip_id}`

Your own clips (admins: any) while you may still view the camera.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The clip.

```json
{
  "id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
  "kind": "single",
  "camera_id": 3,
  "camera_ids": [
    3
  ],
  "camera_name": "Front door",
  "width": 1920,
  "height": 1080,
  "timelapse_seconds": 30,
  "status": "running",
  "progress": 1,
  "requested_from": "2026-10-30T14:05:00Z",
  "requested_to": "2026-10-30T14:05:30Z",
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "shortened": false,
  "size_bytes": 7340032,
  "filename": "front-door-2026-10-30-1400.mp4",
  "error": null,
  "created_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a clip

`DELETE /api/v1/clips/{clip_id}`

Deletes the file and every share link to it.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_clip`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a download URL

`POST /api/v1/clips/{clip_id}/actions/create-download-url`

A single-use URL (a path on this server) that downloads the ready clip without credentials, valid for 60 seconds. `409 clip_not_ready` until the export is ready.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873/actions/create-download-url" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The URL.

```json
{
  "url": "/api/recordings/clip/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873/download?t=xxxxxxxxxxxx",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a clip's share links

`GET /api/v1/clips/{clip_id}/shares`

Every link of the clip (active, expired and revoked). One page; `next_cursor` is always `null`. The link URLs are not returned (only creation returns them). Needs `clips:share`, like creating and revoking.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873/shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The links.

```json
{
  "data": [
    {
      "id": 1,
      "kind": "clip",
      "clip_id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
      "entry_id": 1,
      "library_item_id": 1,
      "album_id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "status": "active",
      "views": 2,
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z",
      "revoked_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a public share link

`POST /api/v1/clips/{clip_id}/shares`

A public link (no sign-in) to the ready clip, expiring after `expires_in` (and never later than 7 days after the clip finished). The URL is returned only here. Needs the `clips:share` scope, which no other scope implies. A link created with an API key lives no longer than the key (it is revoked when the key is revoked and expires when the key expires).

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_clip_share`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expires_in` | string: `1h`, `24h`, `7d` | No | (default `"24h"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873/shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"expires_in":"24h"}'
```

**Response** `201`: The link, with its URL.

```json
{
  "id": 1,
  "kind": "clip",
  "clip_id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
  "entry_id": 1,
  "library_item_id": 1,
  "album_id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "status": "active",
  "views": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z",
  "revoked_at": "2026-10-30T14:05:00Z",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke a share link

`DELETE /api/v1/clips/{clip_id}/shares/{share_id}`

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `clip_id` | path | string | Yes |  |
| `share_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/clips/3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873/shares/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Revoked.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's live share links

`GET /api/v1/cameras/{camera_id}/live-shares`

API 1.109.0. Every live share link of the camera (active, expired and revoked), newest first, with when it was last used and how many people are watching now. One page; `next_cursor` is always `null`. The link URLs and codes are not returned (only creation returns them). Admins and operators; the caller needs the operator permission on the camera. Needs `clips:share`.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/live-shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The links.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "status": "active",
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z",
      "revoked_at": "2026-10-30T14:05:00Z",
      "last_used_at": "2026-10-30T14:05:00Z",
      "locked_until": "2026-10-30T14:05:00Z",
      "unlocks": 1,
      "viewers": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a live share link

`POST /api/v1/cameras/{camera_id}/live-shares`

API 1.109.0. Makes a public link to this ONE camera's live view for `expires_in` (`1h`, `1d` by default, or `7d`). Anyone with the URL AND the 6-digit `code` watches the live picture in a browser without an account; nothing else is reachable through it (no other camera, no recordings or playback, no PTZ, no talking, no other API). Both are returned only here: the server keeps only hashes, so a lost link is revoked and made again. The code is checked on the server: 5 wrong codes lock the link for 15 minutes (`locked_until`). At most 5 people watch one link at a time. Expiry and revoking are enforced on every request and cut people already watching. The link also stops working if its creator is disabled or loses the operator role or the operator permission on the camera. The page and stream also work through remote access (the site address, the Cloudflare Tunnel's media address for video). Admins and operators with the operator permission on the camera. Needs the `clips:share` scope, which no other scope implies. A link created with an API key lives no longer than the key. Creating one asks the person first when human in the loop is on.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_camera_live_share`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expires_in` | string: `1h`, `1d`, `7d` | No | (default `"1d"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/live-shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"expires_in":"1h"}'
```

**Response** `201`: The link, with its URL and code.

```json
{
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "status": "active",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z",
  "revoked_at": "2026-10-30T14:05:00Z",
  "last_used_at": "2026-10-30T14:05:00Z",
  "locked_until": "2026-10-30T14:05:00Z",
  "unlocks": 1,
  "viewers": 1,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "code": "code"
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke a live share link

`DELETE /api/v1/cameras/{camera_id}/live-shares/{live_share_id}`

API 1.109.0. Ends the link now and cuts everyone watching through it.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `live_share_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/cameras/3/live-shares/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Revoked.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke a share link of either kind

`DELETE /api/v1/shares/{share_id}`

Revokes a clip link or a picture link (1.27.0) by its id: one the caller created, or any for an admin (a picture link made for a chat alert has no creator, so only an admin revokes it).

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `share_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/shares/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Revoked.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List share links

`GET /api/v1/shares`

Every public link the caller created (admins: everyone's, picture links made for chat alerts included). One page.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The links.

```json
{
  "data": [
    {
      "id": 1,
      "kind": "clip",
      "clip_id": "3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873",
      "entry_id": 1,
      "library_item_id": 1,
      "album_id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "status": "active",
      "views": 2,
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z",
      "revoked_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check clips before exporting

`POST /api/v1/clips/actions/preflight`

For each camera: whether footage covers the window and the expected size, against the caller's clip limits. With `kind: mosaic` (1.43.0) the set is checked as one mosaic clip.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `single`, `mosaic` | No | `single`: one clip per camera. `mosaic` (1.43.0): one video of 2–9 cameras; the answer then counts one clip, estimates its size (`estimate`) and says whether tiles can carry camera names (`mosaic_labels`). (default `"single"`) |
| `camera_ids` | array of integer | Yes | (max 16 items) |
| `from` | string (RFC 3339) | Yes |  |
| `to` | string (RFC 3339) | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clips/actions/preflight" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_ids":[3],"from":"2026-10-30T14:05:00Z","to":"2026-10-30T14:05:30Z"}'
```

**Response** `200`: The check.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Library

The media library (API 1.52.0): pictures and clips saved on the server, in folders, and albums (ordered lists of saved items). Kept until deleted; recording retention never removes them.

### List saved pictures and clips

`GET /api/v1/library/items`

The media library's items you may see: those of the cameras you may view (admins and operators also see items without a camera). `folder` lists one folder (`""` = the top level), with `recursive=true` also the folders inside it; without `folder`, every folder. `album_id` lists an album's items, in album order unless `sort` is given. `q` searches the name, camera name, note and folder. `from` / `to` filter on `captured_at` (else the save time). API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `folder` | query | string | No | A folder path (`""` = the top level). (max 255 characters) |
| `recursive` | query | boolean | No | Also the folders inside `folder`. |
| `q` | query | string | No | Text in the name, camera name, note or folder. (max 200 characters) |
| `camera_id` | query | integer | No | (≥ 1) |
| `kind` | query | string: `image`, `clip` | No |  |
| `album_id` | query | integer | No | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |
| `sort` | query | string: `created_at`, `captured_at`, `name`, `size` | No | (default `"created_at"`) |
| `order` | query | string: `asc`, `desc` | No | (default `"desc"`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of items.

```json
{
  "data": [
    {
      "id": 1,
      "kind": "image",
      "folder": "folder",
      "name": "Front door",
      "size_bytes": 7340032,
      "mime_type": "image/jpeg",
      "width": 1920,
      "height": 1080,
      "duration_ms": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "captured_at": "2026-10-30T14:05:00Z",
      "note": "note",
      "tags": [
        "entrance"
      ],
      "album_ids": [
        1
      ],
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "media_url": "/api/v1/recordings/812/media",
      "thumbnail_url": "thumbnail-url",
      "position": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Save a clip export in the library

`POST /api/v1/library/items`

Copies a ready clip export (`POST /api/v1/clips`) into the media library on the server, so it is kept after the export expires: no upload. The clip must be yours (admins: any) and its camera viewable. `name` defaults to the clip's download name, `folder` to the top level; `album_ids` adds it to albums. `409 clip_not_ready` while the export runs; `507 disk_low` when saving would take the disk below the free-space floor clip exports keep. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `clip_id` | string | Yes | A ready clip export. |
| `name` | string | No | (max 200 characters) |
| `folder` | string | No | (max 255 characters) |
| `note` | string | No | (max 2000 characters) |
| `captured_at` | string (RFC 3339) | No | Default the clip's start. |
| `album_ids` | array of integer | No | (max 50 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"clip_id":"3f9c2a7e5b1d4c8fa0e6b2d9c4f1a873"}'
```

**Response** `201`: The saved item.

```json
{
  "id": 1,
  "kind": "image",
  "folder": "folder",
  "name": "Front door",
  "size_bytes": 7340032,
  "mime_type": "image/jpeg",
  "width": 1920,
  "height": 1080,
  "duration_ms": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "captured_at": "2026-10-30T14:05:00Z",
  "note": "note",
  "tags": [
    "entrance"
  ],
  "album_ids": [
    1
  ],
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "media_url": "/api/v1/recordings/812/media",
  "thumbnail_url": "thumbnail-url",
  "position": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`, `507`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Upload a picture or clip to the library

`POST /api/v1/library/uploads`

Saves an uploaded file as a new library item: a JPEG, PNG or WebP picture of at most 20 MB and 40 megapixels, or an MP4 or WebM clip of at most 200 MB (the type is read from the file, not trusted from the request). Send `multipart/form-data` with the fields first and the `file` part last (a field after the file is a `400`). The server makes a thumbnail. `camera_id` (optional) ties the item to a camera you may view (viewers then see it); without one only admins and operators see it. `507 disk_low` when saving would take the disk below the free-space floor. Not served through a Cloudflare Tunnel origin (media goes to the media origin). Not an MCP tool. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/uploads" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `201`: The saved item.

```json
{
  "id": 1,
  "kind": "image",
  "folder": "folder",
  "name": "Front door",
  "size_bytes": 7340032,
  "mime_type": "image/jpeg",
  "width": 1920,
  "height": 1080,
  "duration_ms": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "captured_at": "2026-10-30T14:05:00Z",
  "note": "note",
  "tags": [
    "entrance"
  ],
  "album_ids": [
    1
  ],
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "media_url": "/api/v1/recordings/812/media",
  "thumbnail_url": "thumbnail-url",
  "position": 1
}
```

Errors: `400`, `401`, `403`, `404`, `413`, `415`, `429`, `503`, `507`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a saved item

`GET /api/v1/library/items/{item_id}`

One library item. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/items/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The item.

```json
{
  "id": 1,
  "kind": "image",
  "folder": "folder",
  "name": "Front door",
  "size_bytes": 7340032,
  "mime_type": "image/jpeg",
  "width": 1920,
  "height": 1080,
  "duration_ms": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "captured_at": "2026-10-30T14:05:00Z",
  "note": "note",
  "tags": [
    "entrance"
  ],
  "album_ids": [
    1
  ],
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "media_url": "/api/v1/recordings/812/media",
  "thumbnail_url": "thumbnail-url",
  "position": 1
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename, move or annotate a saved item

`PATCH /api/v1/library/items/{item_id}`

Changes the item's `name`, `folder` (moving it; the folder need not exist yet), `note` or `tags`. Folder paths are names joined by `/`: no leading `/`, no `.` or `..` names, no `\` or control characters, at most 8 levels, 80 characters a name and 255 in all. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 200 characters) |
| `folder` | string | No | (max 255 characters) |
| `note` | string | No | (max 2000 characters) |
| `tags` | array of string | No | (max 20 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/library/items/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","folder":"folder","note":"note","tags":["entrance"]}'
```

**Response** `200`: The item.

```json
{
  "id": 1,
  "kind": "image",
  "folder": "folder",
  "name": "Front door",
  "size_bytes": 7340032,
  "mime_type": "image/jpeg",
  "width": 1920,
  "height": 1080,
  "duration_ms": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "captured_at": "2026-10-30T14:05:00Z",
  "note": "note",
  "tags": [
    "entrance"
  ],
  "album_ids": [
    1
  ],
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "media_url": "/api/v1/recordings/812/media",
  "thumbnail_url": "thumbnail-url",
  "position": 1
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a saved item

`DELETE /api/v1/library/items/{item_id}`

Deletes the item's file, its places in albums and its public links. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_library_item`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/library/items/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a saved item's file

`GET /api/v1/library/items/{item_id}/media`

The picture or clip (Range requests supported). `download=true` answers it as an attachment named after the item. Not served through a Cloudflare Tunnel origin (media is served by the media origin). Not an MCP tool. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |
| `download` | query | boolean | No | Answer as an attachment. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/items/42/media" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The file. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a saved item's thumbnail

`GET /api/v1/library/items/{item_id}/thumbnail`

A JPEG at most 320 px wide (`thumbnail_url` is `null` when the item has none, e.g. a clip saved while ffmpeg was missing). Not served through a Cloudflare Tunnel origin. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/items/42/thumbnail" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a public link to a saved item

`POST /api/v1/library/items/{item_id}/shares`

A public link anyone can open without signing in (`/s/<token>`): a picture opens as itself, a clip in a player page. It expires after `expires_in` (default 24h), can be revoked (`DELETE /shares/{share_id}`) and stops working when the item is deleted or you may no longer see it. The URL is returned only here. Needs `clips:share`. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_library_item_share`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expires_in` | string: `1h`, `24h`, `7d` | No | (default `"24h"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/items/42/shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"expires_in":"1h"}'
```

**Response** `201`: The link.

```json
{
  "id": 1,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List library folders

`GET /api/v1/library/folders`

Every folder: those created explicitly (empty ones too) and those holding items, with their parent folders. `items` and `size_bytes` count the items directly in a folder that you see. Viewers see only the folders on the way to items they see. One page; `next_cursor` is always `null`. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/folders" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The folders.

```json
{
  "data": [
    {
      "path": "path",
      "items": 1,
      "size_bytes": 7340032,
      "explicit": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a library folder

`POST /api/v1/library/folders`

Creates an empty folder (`409 conflict` when it exists). Path rules as for items. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `path` | string | Yes | (max 255 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/folders" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"path":"path"}'
```

**Response** `201`: The folder.

```json
{
  "path": "path",
  "items": 1,
  "size_bytes": 7340032,
  "explicit": false
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename or move a library folder

`POST /api/v1/library/folders/actions/move`

Renames `path` to `new_path` (which may be under another folder), with every folder and item inside it. `409 conflict` when `new_path` exists; a folder cannot move into itself. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `path` | string | Yes | (max 255 characters) |
| `new_path` | string | Yes | (max 255 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/folders/actions/move" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"path":"path","new_path":"new-path"}'
```

**Response** `200`: Moved.

```json
{
  "path": "path",
  "moved_items": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an empty library folder

`POST /api/v1/library/folders/actions/delete`

Deletes a folder that holds no item at any depth (and the empty folders inside it); `409 conflict` otherwise. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_library_folder`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `path` | string | Yes | (max 255 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/folders/actions/delete" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"path":"path"}'
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List albums

`GET /api/v1/library/albums`

Albums: ordered lists of library items (an item is stored once and can be in many albums). The counts are of the items you see; viewers see the albums holding at least one. One page; `next_cursor` is always `null`. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/albums" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The albums.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "note": "note",
      "cover_item_id": 1,
      "thumbnail_url": "thumbnail-url",
      "item_count": 2,
      "clip_count": 2,
      "image_count": 2,
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an album

`POST /api/v1/library/albums`

Creates an album, optionally with items in order. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 120 characters) |
| `note` | string | No | (max 2000 characters) |
| `item_ids` | array of integer | No | (max 500 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/albums" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `201`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an album with its items

`GET /api/v1/library/albums/{album_id}`

The album and its items you see, in album order (`position`; at most 500). API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/albums/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "items": [
    {
      "id": 1,
      "kind": "image",
      "folder": "folder",
      "name": "Front door",
      "size_bytes": 7340032,
      "mime_type": "image/jpeg",
      "width": 1920,
      "height": 1080,
      "duration_ms": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "captured_at": "2026-10-30T14:05:00Z",
      "note": "note",
      "tags": [
        "entrance"
      ],
      "album_ids": [
        1
      ],
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "media_url": "/api/v1/recordings/812/media",
      "thumbnail_url": "thumbnail-url",
      "position": 1
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename an album or change its cover

`PATCH /api/v1/library/albums/{album_id}`

Changes `name`, `note` or `cover_item_id` (an item of the album; `null` = the first item). Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 120 characters) |
| `note` | string | No | (max 2000 characters) |
| `cover_item_id` | integer or null | No | (≥ 1) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/library/albums/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","note":"note","cover_item_id":1}'
```

**Response** `200`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an album

`DELETE /api/v1/library/albums/{album_id}`

Deletes the album and its links; its items stay in the library. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_library_album`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/library/albums/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add items to an album

`POST /api/v1/library/albums/{album_id}/actions/add-items`

Appends items (that you see) at the end of the album, in order; items already in it stay where they are. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `item_ids` | array of integer | Yes | (max 500 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/albums/42/actions/add-items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"item_ids":[1]}'
```

**Response** `200`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove items from an album

`POST /api/v1/library/albums/{album_id}/actions/remove-items`

Takes items off the album; they stay in the library. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `item_ids` | array of integer | Yes | (max 500 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/albums/42/actions/remove-items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"item_ids":[1]}'
```

**Response** `200`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reorder an album

`POST /api/v1/library/albums/{album_id}/actions/reorder`

Puts the listed items (distinct items of the album) first, in that order; the others follow in their current order. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `item_ids` | array of integer | Yes | (max 500 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/albums/42/actions/reorder" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"item_ids":[1]}'
```

**Response** `200`: The album.

```json
{
  "id": 1,
  "name": "Front door",
  "note": "note",
  "cover_item_id": 1,
  "thumbnail_url": "thumbnail-url",
  "item_count": 2,
  "clip_count": 2,
  "image_count": 2,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a public link to an album

`POST /api/v1/library/albums/{album_id}/shares`

A public page (`/s/<token>`) with the album's items in order: clips as players, pictures as thumbnails that open the picture. It shows the items you (its creator) see when it is opened, expires after `expires_in` (default 24h) and can be revoked (`DELETE /shares/{share_id}`). The URL is returned only here. Needs `clips:share`. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `clips:share` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_library_album_share`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `album_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expires_in` | string: `1h`, `24h`, `7d` | No | (default `"24h"`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/library/albums/42/shares" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"expires_in":"1h"}'
```

**Response** `201`: The link.

```json
{
  "id": 1,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Library storage use

`GET /api/v1/library/stats`

How many items the whole library holds and their size, with the free space of its disk and the floor saves keep free. Admins and operators. API 1.52.0.

| Requirement | |
| --- | --- |
| Scope | `recordings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/library/stats" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The figures.

```json
{
  "items": 1,
  "images": 1,
  "clips": 1,
  "size_bytes": 7340032,
  "free_bytes": 1,
  "total_bytes": 1,
  "min_free_bytes": 1
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Guardian

The Guardian log (what the AI saw and heard), its search, on-demand analysis and chat, and the speech transcript of a camera or microphone (its segments, translated passages and summaries).

### Analyze a camera now

`POST /api/v1/cameras/{camera_id}/actions/analyze`

Runs one Guardian analysis of the camera right now (a short clip, the AI's description, the camera's alert rules, which may notify), skipping the motion gate and cooldown. The description is also added to the Guardian log (`guardian.event`). Uses AI credits. A failed analysis is an error, never an empty success: `409 ai_not_enabled` (no AI on the camera), `503 capture_failed` (no clip), `503 ai_unavailable`, `402 insufficient_credits`; `503 service_unavailable` when Guardian analysis is not enabled on this server. Limits per credential: 6 analyses a minute and 2 AI operations at once (`429 rate_limited`); non-admins also wait for the camera's 5-minute analysis cooldown (`429`, `details.reason: camera_cooldown`). With `include_objects: true` (API 1.11), object recognition first runs on three live frames of the moment (one a second, optional `prompts`), its findings are given to the AI as context and returned in `objects` (best detection per label); it then also fails with `503 no_detector`, `504 detector_timeout` or `502 detector_failed`.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `include_objects` | boolean | No | Run object recognition on frames of the moment first and give the AI its findings. (default `false`) |
| `prompts` | array of string | No | What object recognition looks for (with include_objects). (max 20 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/analyze" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"include_objects":false,"prompts":["prompt"]}'
```

**Response** `200`: The analysis.

```json
{
  "camera_id": 3,
  "description": "description",
  "analyzed_at": "2026-10-30T14:05:00Z",
  "objects": [
    {
      "label": "person",
      "confidence": 0.5,
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      }
    }
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`, `502`, `503`, `504`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Transcribe recordings in a time range

`POST /api/v1/cameras/{camera_id}/actions/transcribe-recordings`

Runs speech-to-text over the camera's stored recordings between `from` and `to`, writing the transcripts so they appear in the playback Insights pane at their real times (API 1.71). Use it to read what was said in past recordings when live audio monitoring was off, or was only just turned on. Only the audio actually in the recordings is transcribed — a camera with no microphone produces none. Idempotent in effect: a passage already transcribed is not duplicated. The call returns a job handle (`202 Accepted`) and transcription continues in the background; poll the matching `GET` for progress. `200 OK` instead of `202` means a run for this camera was already in flight (the body is that run's progress). Uses AI credits like live transcription. `400 validation_error` for a missing/!after range, a window longer than 24 h, or no recordings in it; `402 insufficient_credits`; `503 service_unavailable` when audio monitoring is disabled on this server or no speech-to-text provider is configured.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string (RFC 3339) | Yes | Start of the window to transcribe (inclusive, ISO 8601). |
| `to` | string (RFC 3339) | Yes | End of the window (exclusive, ISO 8601). Must be after `from`; at most 24 h later. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/transcribe-recordings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"from":"2026-10-30T14:05:00Z","to":"2026-10-30T14:05:30Z"}'
```

**Response** `200`: A run was already in flight; its progress.

```json
{
  "monitor_id": 1,
  "running": false,
  "segments_total": 1,
  "segments_done": 1,
  "transcripts_added": 1,
  "segments_failed": 1,
  "error": null
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Describe and find objects in an image

`POST /api/v1/images/actions/analyze`

Analyses an image you upload (JPEG, PNG or WebP, at most 10 MB and 40 megapixels): `describe` (default true) asks the AI for a short description (uses AI credits like a camera analysis; needs the `guardian:write` scope; `402 insufficient_credits`), `detect` (default true) runs object recognition on the object recognition runner, with optional `prompts` (as for detect-objects). Send it as `multipart/form-data` (field `image`, plus the options as form fields; `prompts` comma-separated) or as JSON with the image base64-encoded in `image_base64` (MCP clients: the MCP endpoint accepts at most 1 MB per call, so about 750 KB of image). The image is decoded and re-encoded on the server (metadata is dropped) and is never stored: only the annotated result, when asked for, is kept in memory for 15 minutes at `annotated_image_url`, readable by the same credential only. Limits per credential: 6 a minute with `describe` (the analyze limit), 20 a minute for detection only, 2 AI operations at once.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `image_base64` | string | Yes | The image (JPEG, PNG or WebP), base64-encoded (a `data:` URL is accepted). |
| `describe` | boolean | No | AI description (guardian:write; uses AI credits). (default `true`) |
| `detect` | boolean | No | Object recognition. (default `true`) |
| `prompts` | array of string | No | (max 20 items) |
| `min_confidence` | number | No | (0.01–0.99) |
| `annotate` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/images/actions/analyze" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"image_base64":"image-base64"}'
```

**Response** `200`: The analysis.

```json
{
  "description": "description",
  "objects": [
    {
      "label": "person",
      "confidence": 0.5,
      "bbox": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      }
    }
  ],
  "model": "model",
  "annotated_image_url": "annotated-image-url"
}
```

Errors: `400`, `401`, `402`, `403`, `413`, `415`, `429`, `502`, `503`, `504`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List Guardian entries

`GET /api/v1/guardian/entries`

The Guardian log (what the AI saw and heard) of cameras the caller may view, newest first (by `occurred_at`). `description` is plain text in the requested language (`lang`, else `Accept-Language`, else English); `descriptions` has every language.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |
| `camera_id` | query | integer | No | (≥ 1) |
| `from` | query | string (RFC 3339) | No | At or after (inclusive). |
| `to` | query | string (RFC 3339) | No | Before (exclusive). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/entries" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of entries.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "description": "description",
      "descriptions": {},
      "occurred_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "detections": [
        {
          "label": "person",
          "count": 2,
          "max_confidence": 0.5,
          "tracks": 1
        }
      ],
      "detector_checked": false,
      "person_present_seconds": 0.5,
      "frame_time": "2026-10-30T14:05:00Z",
      "frame_reason": "best_detection",
      "frame_box": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "clip_start": "2026-10-30T14:05:00Z",
      "clip_end": "2026-10-30T14:05:30Z",
      "clip_reason": "preroll_recording",
      "trigger": "motion",
      "trigger_label": "trigger-label",
      "unconfirmed_alerts": [
        {
          "alert_rule_id": 1,
          "name": "Front door"
        }
      ],
      "audio_transcript": "audio-transcript",
      "model": "model",
      "has_frame": false,
      "has_clip": false,
      "observed_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a Guardian entry

`GET /api/v1/guardian/entries/{entry_id}`

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entry_id` | path | integer | Yes | (≥ 1) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/entries/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The entry.

```json
{
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "description": "description",
  "descriptions": {},
  "occurred_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "detections": [
    {
      "label": "person",
      "count": 2,
      "max_confidence": 0.5,
      "tracks": 1
    }
  ],
  "detector_checked": false,
  "person_present_seconds": 0.5,
  "frame_time": "2026-10-30T14:05:00Z",
  "frame_reason": "best_detection",
  "frame_box": {
    "x": 0.5,
    "y": 0.5,
    "w": 0.5,
    "h": 0.5
  },
  "clip_start": "2026-10-30T14:05:00Z",
  "clip_end": "2026-10-30T14:05:30Z",
  "clip_reason": "preroll_recording",
  "trigger": "motion",
  "trigger_label": "trigger-label",
  "unconfirmed_alerts": [
    {
      "alert_rule_id": 1,
      "name": "Front door"
    }
  ],
  "audio_transcript": "audio-transcript",
  "model": "model",
  "has_frame": false,
  "has_clip": false,
  "observed_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a Guardian entry

`DELETE /api/v1/guardian/entries/{entry_id}`

Moves the entry to Recently deleted (`GET /api/v1/guardian/trash`): the entry, its clip and frame (with their cached thumbnail sizes), its search index and object-detection context, the alerts Guardian raised for it and their acknowledgements and "Reviewed" marks. It disappears from every list, feed and search at once and can be restored until it is purged (`retention_days`, default 7). The camera's continuous recordings are never deleted. An entry whose clip a protected recording covers answers `409 entry_protected`; one inside an active clip export or public share link `409 entry_shared` (`details`: `reasons`, `recording_ids`, `clip_ids`, `share_ids`). An admin can delete it anyway with `force=true`, which also revokes those share links. Audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_guardian_entry`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entry_id` | path | integer | Yes | (≥ 1) |
| `force` | query | boolean | No | Admins only. Delete even when the clip is protected or shared, revoking its share links. (default `false`) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/guardian/entries/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Moved to Recently deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete Guardian entries in bulk

`POST /api/v1/guardian/entries/actions/delete`

Deletes up to 200 entries as `DELETE /api/v1/guardian/entries/{entry_id}` does, each on its own: the ones deleted are in `succeeded`, the others in `failed` with the error code they would have answered alone (`not_found`, `forbidden`, `entry_protected`, `entry_shared`). `force` is for admins only. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_guardian_entries`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array of integer | Yes | (max 200 items) |
| `force` | boolean | No | Admins only. Delete protected or shared entries too, revoking their share links. (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/entries/actions/delete" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1]}'
```

**Response** `200`: What was done, per id.

```json
{
  "succeeded": [
    1
  ],
  "failed": [
    {
      "id": 1,
      "code": "validation_error",
      "message": "This API key lacks the cameras:write scope.",
      "details": {}
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List recently deleted Guardian entries

`GET /api/v1/guardian/trash`

Entries deleted from cameras where you have operator permission, newest deletion first, with who deleted them and when they will be purged (`purge_at`). API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/trash" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of deleted entries.

```json
{
  "data": [
    {
      "entry": {
        "id": 1,
        "camera_id": 3,
        "camera_name": "Front door",
        "description": "description",
        "descriptions": {},
        "occurred_at": "2026-10-30T14:05:00Z",
        "created_at": "2026-10-30T14:05:00Z",
        "detections": [
          {
            "label": "person",
            "count": 2,
            "max_confidence": 0.5,
            "tracks": 1
          }
        ],
        "detector_checked": false,
        "person_present_seconds": 0.5,
        "frame_time": "2026-10-30T14:05:00Z",
        "frame_reason": "best_detection",
        "frame_box": {
          "x": 0.5,
          "y": 0.5,
          "w": 0.5,
          "h": 0.5
        },
        "clip_start": "2026-10-30T14:05:00Z",
        "clip_end": "2026-10-30T14:05:30Z",
        "clip_reason": "preroll_recording",
        "trigger": "motion",
        "trigger_label": "trigger-label",
        "unconfirmed_alerts": [
          {
            "alert_rule_id": 1,
            "name": "Front door"
          }
        ],
        "audio_transcript": "audio-transcript",
        "model": "model",
        "has_frame": false,
        "has_clip": false,
        "observed_at": "2026-10-30T14:05:00Z"
      },
      "deleted_at": "2026-10-30T14:05:00Z",
      "deleted_by": {
        "id": 1,
        "username": "automation"
      },
      "purge_at": "2026-10-30T14:05:00Z",
      "alert_count": 2
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Recently deleted settings

`GET /api/v1/guardian/trash/settings`

How many days deleted Guardian entries stay restorable before they are purged. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/trash/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "retention_days": 7
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the Recently deleted settings

`PATCH /api/v1/guardian/trash/settings`

Sets `retention_days` (1–90); it applies to entries already deleted too. Audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_guardian_trash_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `retention_days` | integer | Yes | Days a deleted Guardian entry stays restorable (default 7). (1–90) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/guardian/trash/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"retention_days":7}'
```

**Response** `200`: The settings.

```json
{
  "retention_days": 7
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a deleted Guardian entry's frame

`GET /api/v1/guardian/trash/{entry_id}/frame`

The frame of a recently deleted entry, for a preview before restoring it. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entry_id` | path | integer | Yes | (≥ 1) |
| `w` | query | string: `160`, `320`, `640`, `full` | No | A smaller JPEG this many pixels wide (160, 320 or 640), or `full` (default). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/trash/42/frame" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The JPEG. (`image/jpeg`)

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restore deleted Guardian entries

`POST /api/v1/guardian/trash/actions/restore`

Puts up to 200 recently deleted entries back, with their ids, clip, frame and alerts. An entry whose camera was deleted cannot be restored (`conflict`). Audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array of integer | Yes | (max 200 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/trash/actions/restore" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1]}'
```

**Response** `200`: What was done, per id.

```json
{
  "succeeded": [
    1
  ],
  "failed": [
    {
      "id": 1,
      "code": "validation_error",
      "message": "This API key lacks the cameras:write scope.",
      "details": {}
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Permanently delete recently deleted entries

`POST /api/v1/guardian/trash/actions/purge`

Removes up to 200 entries from Recently deleted for good, with their files ("Delete permanently now"). It cannot be undone. Audited. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `purge_guardian_entries`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array of integer | Yes | (max 200 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/trash/actions/purge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1]}'
```

**Response** `200`: What was done, per id.

```json
{
  "succeeded": [
    1
  ],
  "failed": [
    {
      "id": 1,
      "code": "validation_error",
      "message": "This API key lacks the cameras:write scope.",
      "details": {}
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Search the Guardian log

`GET /api/v1/guardian/search`

Finds entries by meaning (semantic search through the Vigiora AI gateway, `match: semantic` with a `similarity`) or, when that is unavailable or finds nothing, by keyword (`match: keyword`), on cameras the caller may view. One ranked page: `next_cursor` is always `null`.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |
| `q` | query | string | Yes | What to look for (at most 500 characters). (max 500 characters) |
| `camera_id` | query | integer | No | (≥ 1) |
| `limit` | query | integer | No | Number of hits, 1–50. (default `20`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/search" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The hits, best first.

```json
{
  "data": [
    {
      "entry": {
        "id": 1,
        "camera_id": 3,
        "camera_name": "Front door",
        "description": "description",
        "descriptions": {},
        "occurred_at": "2026-10-30T14:05:00Z",
        "created_at": "2026-10-30T14:05:00Z",
        "detections": [
          {
            "label": "person",
            "count": 2,
            "max_confidence": 0.5,
            "tracks": 1
          }
        ],
        "detector_checked": false,
        "person_present_seconds": 0.5,
        "frame_time": "2026-10-30T14:05:00Z",
        "frame_reason": "best_detection",
        "frame_box": {
          "x": 0.5,
          "y": 0.5,
          "w": 0.5,
          "h": 0.5
        },
        "clip_start": "2026-10-30T14:05:00Z",
        "clip_end": "2026-10-30T14:05:30Z",
        "clip_reason": "preroll_recording",
        "trigger": "motion",
        "trigger_label": "trigger-label",
        "unconfirmed_alerts": [
          {
            "alert_rule_id": 1,
            "name": "Front door"
          }
        ],
        "audio_transcript": "audio-transcript",
        "model": "model",
        "has_frame": false,
        "has_clip": false,
        "observed_at": "2026-10-30T14:05:00Z"
      },
      "match": "semantic",
      "similarity": 0.5
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Ask Guardian

`POST /api/v1/guardian/chat`

Asks Guardian (the AI assistant of the web app) a question about what the cameras saw: it answers from the Guardian log, alerts and counts of cameras the caller may view, using the tools listed in `tool_calls`. `camera_id` focuses the question on one camera; `conversation_id` (one of your conversations in the web app) stores the exchange there. Uses AI credits (`402 insufficient_credits` when they ran out); at most 10 chats a minute and 2 AI operations at once per credential (`429 rate_limited`); no control characters or line breaks in the text; `503 service_unavailable` when AI is not available. When the server uses the owner's own AI model (`GET /system/ai-model`) and that model fails, the `503` says why in `message`, with `details.reason` one of `own_model_timeout`, `own_model_unreachable`, `own_model_error`, `own_model_capability` or `own_model_cancelled`; nothing is sent to Vigiora cloud AI then. Not idempotent: every call asks the AI again. Actions (API 1.113.0): Guardian can also act for admins and operators (sound a camera siren, set up an alert on a camera, control a Home Assistant device). While human in the loop is on (`GET /agent-policy`), and always for locks, alarm panels and sirens of Home Assistant, such an action does not run: it is returned in `pending_actions` and waits up to 5 minutes for the user, who approves or denies it in the Vigiora app (in the conversation given as `conversation_id`). Nothing you send approves it (a `confirm` argument is ignored, also when the AI passes it): approving and denying are user sessions only (`POST /guardian/pending-actions/{pending_id}/actions/approve`), so an agent can never approve its own action.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string | Yes | (max 4000 characters) |
| `camera_id` | integer or null | No | Ask about this camera. (≥ 1) |
| `conversation_id` | integer or null | No | Store the exchange in this web-app conversation of yours. (≥ 1) |
| `history` | array of GuardianChatTurn | No | Earlier turns, oldest first (the last 10 are used). Give each turn's `at` when the turns come from a stored conversation. (max 20 items) |
| `timezone` | string or null | No | IANA time zone for the times in the answer (`Europe/Rome`). Default Asia/Bangkok. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/chat" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"message":"This API key lacks the cameras:write scope."}'
```

**Response** `200`: Guardian's answer.

```json
{
  "pending_actions": [
    {
      "id": "id",
      "tool": "tool",
      "summary": "summary",
      "details": {},
      "args": {},
      "args_hash": "args-hash",
      "state": "pending",
      "conversation_id": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z"
    }
  ],
  "reply": "reply",
  "tool_calls": [
    {
      "tool": "tool",
      "args": {}
    }
  ],
  "refs": [
    {
      "token": "preset-1",
      "kind": "log",
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "at": "2026-10-30T14:05:00Z",
      "label": "person",
      "has_clip": false,
      "has_frame": false
    }
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A Guardian chat action waiting for approval

`GET /api/v1/guardian/pending-actions/{pending_id}`

One of your actions Guardian chat holds for your approval, and its state (`pending`, `approved`, `failed`, `denied`, `expired`). Your own only (another user's is `404`). User sessions only. API 1.113.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `pending_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/pending-actions/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The action.

```json
{
  "id": "id",
  "tool": "tool",
  "summary": "summary",
  "details": {},
  "args": {},
  "args_hash": "args-hash",
  "state": "pending",
  "conversation_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Approve a Guardian chat action

`POST /api/v1/guardian/pending-actions/{pending_id}/actions/approve`

Runs the action once, with its stored arguments, as you: your role and camera permissions are checked again now (a user demoted or disabled since is `403`). `409 conflict` when it expired (`reason: pending_action_expired`), was already decided (`pending_action_decided`) or `args_hash` is not the stored one (`pending_action_changed`). The outcome is added to the conversation. User sessions only: an agent can never approve its own action. API 1.113.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `pending_id` | path | string | Yes |  |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `args_hash` | string or null | No | The `args_hash` of the action the user was shown; refused (`409 conflict`) when it is not the stored one. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/pending-actions/42/actions/approve" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"args_hash":"args-hash"}'
```

**Response** `200`: The decision.

```json
{
  "id": "id",
  "tool": "tool",
  "state": "approved",
  "reply": "reply",
  "result": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Deny a Guardian chat action

`POST /api/v1/guardian/pending-actions/{pending_id}/actions/deny`

Drops the action; nothing runs. The outcome is added to the conversation. User sessions only. API 1.113.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `pending_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/pending-actions/42/actions/deny" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The decision.

```json
{
  "id": "id",
  "tool": "tool",
  "state": "approved",
  "reply": "reply",
  "result": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Compare with the reference frame

`POST /api/v1/cameras/{camera_id}/actions/compare`

Asks the AI what changed between the reference frame and the live picture (uses AI credits; the per-credential AI limits apply). The answer is also written to the Guardian log. `409 conflict` without a reference frame.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/compare" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The comparison.

```json
{
  "camera_id": 3,
  "description": "description",
  "descriptions": {},
  "changes_detected": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read licence plates

`POST /api/v1/cameras/{camera_id}/actions/read-plates`

Reads the licence plates in the live picture (needs the plate-recognition add-on; uses AI credits and the per-credential AI limits). Each plate is also recorded as an alert (`plate:<number>`).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/read-plates" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The plates.

```json
{
  "camera_id": 3,
  "plates": [
    {
      "plate": "plate",
      "confidence": 0.5,
      "country": "country"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read the weather

`POST /api/v1/cameras/{camera_id}/actions/read-weather`

Reads the current outdoor weather from the camera's live picture (sky, precipitation, fog, day/night, wet ground) — only what the camera can see, never temperature or wind. Uses AI credits and the per-credential AI limits. The reading is also recorded in the camera's weather history.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/read-weather" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The weather reading.

```json
{
  "camera_id": 3,
  "sky": "clear",
  "precip": "none",
  "fog": false,
  "is_night": false,
  "ground_wet": false,
  "confidence": 0.5
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a Guardian entry's frame

`GET /api/v1/guardian/entries/{entry_id}/frame`

The picture Guardian stored with the entry (`has_frame`): the moment of the analysed clip that shows the event best.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entry_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/entries/42/frame" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: The JPEG. (`image/jpeg`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a Guardian entry's clip

`GET /api/v1/guardian/entries/{entry_id}/clip`

The short clip Guardian analysed (`has_clip`), as MP4. Through the cloud gateway of a free plan, a used-up remote-video allowance answers `429 relay_limit`. When the camera kept the clip's whole window in HD (`record_hd_on_motion`), the same window is served from the HD footage; what Guardian analysed is the low-quality recording (API 1.100.0).

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entry_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/entries/42/clip" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: MP4 video. (`video/mp4`)

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Recompute the pictures of recent Guardian entries

`POST /api/v1/guardian/entries/actions/recompute-frames`

One-off backfill of the best-frame choice (API 1.20.0): for the entries of the last `days` days (optionally one camera's, or the listed entries) whose clip has object-detector evidence, re-chooses the picture (see `frame_reason` on a Guardian entry), cuts it from the clip (or from the recording, for a moment just outside the clip), replaces the stored picture and its cached thumbnails, and records `frame_time`, `frame_reason` and `frame_box`. Entries without evidence, or whose picture already is the choice, are left as they are, so a second run changes nothing. `dry_run: true` reports the choices without changing anything. Never runs on its own.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `recompute_guardian_frames`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `days` | integer | No | Entries observed in the last `days` days. (1–30, default `7`) |
| `camera_id` | integer or null | No | Only this camera's entries. |
| `entry_ids` | array of integer | No | Only these entries (still within `days`, and of `camera_id` when given). (max 500 items) |
| `dry_run` | boolean | No | Report what would change without changing anything. (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/entries/actions/recompute-frames" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"days":7,"camera_id":3,"entry_ids":[1],"dry_run":false}'
```

**Response** `200`: What the run examined and changed.

```json
{
  "examined": 1,
  "no_evidence": 1,
  "unchanged": 1,
  "updated": 1,
  "failed": 1,
  "dry_run": false,
  "entries": [
    {
      "id": 1,
      "camera_id": 3,
      "frame_time": "2026-10-30T14:05:00Z",
      "frame_reason": "best_detection",
      "frame_box": {
        "x": 0.5,
        "y": 0.5,
        "w": 0.5,
        "h": 0.5
      },
      "previous_frame_time": "2026-10-30T14:05:00Z",
      "updated": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Re-cut the clips of recent Guardian entries

`POST /api/v1/guardian/entries/actions/recompute-clips`

One-off backfill of the clip pre-roll (API 1.24.0): for the entries of the last `days` days (optionally one camera's, or the listed entries) whose clip was recorded live, re-cuts the clip from the camera's recording by the rule live clips follow: from the motion trigger minus the camera's pre-roll to 10 s after it, widened by up to 5 s on either side (20 s in all) to cover what the object detectors saw. It replaces the clip file in place and records `clip_start`, `clip_end` and `clip_reason` (`extended` when detections widened it, else `preroll_recording`). Entries already cut with the pre-roll, whose old clip already holds the window, whose trigger time is unknown, or without a recording of the window are left as they are, so a second run changes nothing. `dry_run: true` reports the new windows without changing anything. Never runs on its own.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `recompute_guardian_clips`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `days` | integer | No | Entries observed in the last `days` days. (1–30, default `7`) |
| `camera_id` | integer or null | No | Only this camera's entries. |
| `entry_ids` | array of integer | No | Only these entries (still within `days`). (max 100 items) |
| `dry_run` | boolean | No | Report what would change without changing anything. (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/entries/actions/recompute-clips" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"days":7,"camera_id":3,"entry_ids":[1],"dry_run":false}'
```

**Response** `200`: What the run examined and changed.

```json
{
  "examined": 1,
  "no_evidence": 1,
  "covered": 1,
  "unchanged": 1,
  "no_recording": 1,
  "updated": 1,
  "failed": 1,
  "dry_run": false,
  "entries": [
    {
      "id": 1,
      "camera_id": 3,
      "clip_start": "2026-10-30T14:05:00Z",
      "clip_end": "2026-10-30T14:05:30Z",
      "previous_clip_start": "2026-10-30T14:05:00Z",
      "previous_clip_end": "2026-10-30T14:05:30Z",
      "updated": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Guardian clip settings

`GET /api/v1/guardian/clips/settings`

How many seconds before the motion that triggered it a Guardian clip starts (the server-wide pre-roll; a camera's `guardian_clip_preroll_sec` overrides it). API 1.24.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/clips/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "preroll_seconds": 1
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the Guardian clip settings

`PATCH /api/v1/guardian/clips/settings`

Sets `preroll_seconds` (0–10) for new clips. Audited. API 1.24.0.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_guardian_clip_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `preroll_seconds` | integer | Yes | How many seconds before the motion that triggered it a Guardian clip starts (default 3). A camera's `guardian_clip_preroll_sec` overrides it. (0–10) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/guardian/clips/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"preroll_seconds":1}'
```

**Response** `200`: The settings.

```json
{
  "preroll_seconds": 1
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start AI Live in a room

`POST /api/v1/rooms/{room_id}/ai-live/actions/start`

Starts (or reuses) the room's AI Live session: the AI watches and listens to the room's cameras and answers on its cards (uses AI credits while a viewer polls the messages). Admins and operators with viewer permission on every camera of the room. A room whose `ai_mode` is `guardian` never runs AI Live: `409 conflict`. Omitted overrides use the room's settings; a value that is sent must be valid (the room validator: `mode` video, audio or both, `interval_seconds` 2–300), else `400 validation_error`, never a silent fallback.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_room_ai_live`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `instruction` | string | No | (max 4096 characters) |
| `mode` | string: `video`, `audio`, `both` | No |  |
| `interval_seconds` | integer | No | (2–300) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/ai-live/actions/start" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"instruction":"instruction","mode":"video","interval_seconds":2}'
```

**Response** `200`: The session.

```json
{
  "room_id": 1,
  "session_id": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop AI Live in a room

`POST /api/v1/rooms/{room_id}/ai-live/actions/stop`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/ai-live/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Stopped.

```json
{
  "room_id": 1,
  "stopped": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a room's AI Live cards

`GET /api/v1/rooms/{room_id}/ai-live/messages`

The cards with an id above `since_id` (the last 12 hours on the first call), and the session status. Polling keeps a running session going (the viewer heartbeat), so it needs `guardian:write`.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `since_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/ai-live/messages" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cards.

```json
{
  "status": "status",
  "messages": [
    "This API key lacks the cameras:write scope."
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark an AI Live suggestion

`POST /api/v1/rooms/{room_id}/ai-live/actions/feedback`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message_id` | integer | No |  |
| `suggestion_type` | string | No | (max 64 characters) |
| `suggestion_text` | string | Yes | (max 2048 characters) |
| `action` | string: `used`, `dismissed` | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/ai-live/actions/feedback" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"suggestion_text":"suggestion-text","action":"used"}'
```

**Response** `200`: Recorded.

```json
{
  "room_id": 1,
  "recorded": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a room's daily AI Live digest

`GET /api/v1/rooms/{room_id}/ai-live/digest`

One AI summary of what customers asked for that day (cached; the per-credential AI limits apply).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `date` | query | string | No | YYYY-MM-DD (default today). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/ai-live/digest" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The digest.

```json
{
  "room_id": 1,
  "date": "date",
  "digest": "digest"
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a room's Guardian entries

`GET /api/v1/rooms/{room_id}/guardian-entries`

The Guardian descriptions (`seen`), transcripts (`heard`) and alerts of the room's cameras, in the `GET /briefing/feed` shape: the first page is the newest items; call again with the returned `cursor` for the items after it. Viewer permission on every camera of the room. API 1.16.0.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `types` | query | string | No | Comma-separated item types: `seen`, `heard`, `alerts`, `camera` (default `seen,heard,alerts`). (max 200 characters) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/guardian-entries" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The entries.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List Guardian conversations

`GET /api/v1/guardian/conversations`

The caller's own chat conversations (newest first, at most 50): with `camera_id`, that camera's and the general ones. One page.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/conversations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The conversations.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "scope": "camera",
      "title": "title",
      "created_at": "created-at",
      "updated_at": "updated-at"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start a Guardian conversation

`POST /api/v1/guardian/conversations`

Pass its id as `conversation_id` to `POST /guardian/chat` to keep the exchange.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | No | (max 128 characters) |
| `camera_id` | integer | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/guardian/conversations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"title":"title","camera_id":3}'
```

**Response** `201`: The conversation.

```json
{
  "id": 1,
  "camera_id": 3,
  "scope": "camera",
  "title": "title",
  "created_at": "created-at",
  "updated_at": "updated-at"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename a Guardian conversation

`PATCH /api/v1/guardian/conversations/{conversation_id}`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `conversation_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/guardian/conversations/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"title":"title"}'
```

**Response** `200`: The conversation.

```json
{
  "id": 1,
  "camera_id": 3,
  "scope": "camera",
  "title": "title",
  "created_at": "created-at",
  "updated_at": "updated-at"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a Guardian conversation

`DELETE /api/v1/guardian/conversations/{conversation_id}`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_guardian_conversation`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `conversation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/guardian/conversations/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a conversation's messages

`GET /api/v1/guardian/conversations/{conversation_id}/messages`

Oldest first. One page.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `conversation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/conversations/42/messages" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The messages.

```json
{
  "data": [
    {
      "id": 1,
      "role": "role",
      "text": "text",
      "tool_calls": null,
      "created_at": "created-at"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List speech transcripts

`GET /api/v1/guardian/transcripts`

What the microphones of the cameras the caller may view heard (speech to text), newest first.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `from` | query | string (RFC 3339) | No | Started at or after. |
| `to` | query | string (RFC 3339) | No | Started before. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/guardian/transcripts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of transcripts.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "text": "text",
      "language": "language",
      "started_at": "2026-10-30T14:05:00Z",
      "ended_at": "2026-10-30T14:05:30Z",
      "duration_seconds": 600,
      "has_audio": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the current weather

`GET /api/v1/weather/current`

The server's current weather for the dashboard: the freshest recent camera-vision reading (sky, precipitation, fog, day/night, wet ground — what a camera can actually see) blended with an outdoor temperature and a place name that Vigiora resolves automatically. No AI credits (the background sampler owns the vision reads). source=none means nothing is available yet.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/weather/current" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The current weather summary.

```json
{
  "temp_c": 1,
  "condition": "clear",
  "precip": "none",
  "fog": false,
  "ground_wet": false,
  "is_night": false,
  "location": "location",
  "source": "vision",
  "camera_id": 3,
  "as_of": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Speech transcript segments

`GET /api/v1/cameras/{camera_id}/transcript`

API 1.35.0. The speech-to-text segments of the camera or microphone in `[from, to]` (default: the last 24 hours; at most 7 days), oldest first. Each segment is what the STT wrote at once (a few seconds, often cut mid-sentence); join segments closer than ~8 s into passages to read them. Within the window the newest 2000 segments are listed, paged by `limit` and `cursor`. Empty for a camera without speech-to-text.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/transcript" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The segments.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "started_at": "2026-10-30T14:05:00Z",
      "ended_at": "2026-10-30T14:05:30Z",
      "duration_seconds": 600,
      "language": "language",
      "text": "text",
      "speaker": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Transcript coverage ranges

`GET /api/v1/cameras/{camera_id}/transcript/coverage`

API 1.73.0. The stretches of `[from, to]` (default: the last 24 hours; at most 7 days) that have a transcript, as merged `{from, to, segments}` ranges, oldest first — rows closer than ~20 s are merged into one range. Computed over every row in the window (not just the newest, unlike the segment list), so it is exact across a full day: a gap between ranges is a stretch with no transcript (recorded speech not yet transcribed, or silence). Lets a client mark transcript coverage on a timeline without listing every segment. Empty for a camera without speech-to-text.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/transcript/coverage" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The coverage ranges.

```json
{
  "camera_id": 3,
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "ranges": [
    {
      "from": "2026-10-30T14:05:00Z",
      "to": "2026-10-30T14:05:30Z",
      "segments": 1
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Translate transcript passages

`POST /api/v1/cameras/{camera_id}/transcript/actions/translate`

API 1.35.0. Renders the passages you give (at most 50, 2000 characters each, 20000 in all; `id` is yours and comes back unchanged, in the same order) in the language `to` (ISO 639-1). One AI call (two when the first answer is unusable), charged like a Guardian chat under the feature key `transcript_translate`; nothing is stored. `503 ai_unavailable` when the server has no AI (not connected to Vigiora cloud) or the AI gave no usable answer, `402 insufficient_credits` when out of credits. Limits per credential: 10 a minute and 2 AI operations at once (`429 rate_limited`).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `passages` | array of TranscriptPassage | Yes | (max 50 items) |
| `to` | string | Yes | The language to translate into (ISO 639-1, e.g. `en`). (max 3 characters) |
| `from` | string | No | The language the passages are in (ISO 639-1), when known: every passage is then translated (API 1.91.0). Translations are kept on the server; a passage seen before costs nothing. (max 3 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/transcript/actions/translate" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"passages":[{"id":"id","text":"text"}],"to":"to"}'
```

**Response** `200`: The passages translated.

```json
{
  "to": "to",
  "data": [
    {
      "id": "id",
      "text": "text"
    }
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Summarize recent speech

`POST /api/v1/cameras/{camera_id}/transcript/actions/summarize`

API 1.35.0. Sums up the speech of the last `minutes` (1 to 1440; the panel offers 10 and 60) in 2–4 sentences in `language` (ISO 639-1). No speech in the window: `summary` is empty, `segments` 0 and no AI call is made. Otherwise one AI call (two when the first answer is unusable), charged like a Guardian chat under the feature key `transcript_summarize`; nothing is stored. `503 ai_unavailable` when the server has no AI or the AI gave no usable answer, `402 insufficient_credits` when out of credits. Limits per credential: 10 a minute and 2 AI operations at once (`429 rate_limited`).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `minutes` | integer | Yes | The window ending now. (1–1440) |
| `language` | string | Yes | The language of the summary (ISO 639-1). (max 3 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/transcript/actions/summarize" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"minutes":1,"language":"language"}'
```

**Response** `200`: The summary.

```json
{
  "camera_id": 3,
  "language": "language",
  "summary": "summary",
  "from": "2026-10-30T14:05:00Z",
  "to": "2026-10-30T14:05:30Z",
  "segments": 1
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `413`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Settings

Sites, rooms and layouts.

### List sites

`GET /api/v1/sites`

The site hierarchy (branches and their zones, `parent_id`), by ascending id.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/sites" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of sites.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "description": "description",
      "parent_id": 1,
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a site

`POST /api/v1/sites`

A branch (`parent_id` null) or a zone inside one (two levels). Site grants give groups every camera of a site, so site changes are audited. `settings:write` is granted only to admins' keys; operators use a user session.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_site`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `description` | string or null | No | (max 1024 characters) |
| `parent_id` | integer or null | No | The branch a zone belongs to. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/sites" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `201`: The site.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "parent_id": 1,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a site

`GET /api/v1/sites/{site_id}`

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/sites/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The site.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "parent_id": 1,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a site

`PATCH /api/v1/sites/{site_id}`

Changes only the fields sent; `parent_id: null` moves a zone to the top level (a site with zones cannot move under another).

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_site`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 128 characters) |
| `description` | string or null | No | (max 1024 characters) |
| `parent_id` | integer or null | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/sites/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","description":"description","parent_id":1}'
```

**Response** `200`: The site.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "parent_id": 1,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a site

`DELETE /api/v1/sites/{site_id}`

Its cameras and rooms are kept without a site; its zones become top-level, or are deleted too with `cascade=true`.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_site`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `site_id` | path | integer | Yes | (≥ 1) |
| `cascade` | query | boolean | No | (default `false`) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/sites/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List rooms

`GET /api/v1/rooms`

Rooms (cameras AI Live watches together) whose every camera the caller may view, by ascending id. Viewers do not see rooms without cameras.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rooms.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "site_id": 1,
      "source": "source",
      "floor_plan": {
        "id": 1,
        "name": "Front door",
        "item_id": 1
      },
      "devices": [
        "device"
      ],
      "managed_devices": [
        "managed-device"
      ],
      "mode": "mode",
      "interval_seconds": 1,
      "environment": "environment",
      "instruction": "instruction",
      "wake_word": "wake-word",
      "timezone": "timezone",
      "stt_provider": "stt-provider",
      "speech_microphone": "speech-microphone",
      "speech_microphone_choice": {
        "mode": "mode",
        "camera_id": 3,
        "camera_name": "Front door",
        "reason": "reason",
        "reason_code": "reason-code",
        "values": {},
        "since": "2026-10-30T14:05:00Z"
      },
      "speech_microphone_notice": false,
      "ai_actuation_enabled": false,
      "ai_ptz_enabled": false,
      "ai_speak_enabled": false,
      "ai_mode": "ai-mode",
      "ai_live_classic": false,
      "ai_live_coalesce_seconds": 1,
      "ai_live_keepalive_seconds": 1,
      "cameras": [
        {
          "camera_id": 3,
          "name": "Front door",
          "role": "role",
          "is_primary": false,
          "managed": false,
          "is_speech_microphone": false
        }
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a room

`POST /api/v1/rooms`

Cameras AI Live watches (and speaks, moves) together. Cameras need operator permission. Needs the admin or operator role and operator permission on every camera of the room. `source: virtual` with `cameras` and `device_entity_ids` makes a virtual room: a collection of cameras and Home Assistant devices from different rooms (API 1.38.0). Rooms with source `plan` are made by the server from room polygons on floor plans (`replaceFloorPlanItems`, `describeFloorPlan`, `syncFloorPlanRooms`).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_room`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `site_id` | integer or null | No |  |
| `instruction` | string | No | What AI Live watches for. (max 4096 characters) |
| `environment` | string: `retail`, `security`, `reception`, `home`, `custom` | No |  |
| `mode` | string: `video`, `audio`, `both` | No |  |
| `interval_seconds` | integer | No | (2–300) |
| `wake_word` | string | No | (max 64 characters) |
| `timezone` | string | No | IANA zone name. |
| `stt_provider` | string: `auto`, `whisper`, `deepgram`, `gemini` | No |  |
| `speech_microphone` | string | No | API 1.115.0. See `Room.speech_microphone`: `auto`, `all` or a camera id of the room as text. |
| `ai_actuation_enabled` | boolean | No |  |
| `ai_ptz_enabled` | boolean | No |  |
| `ai_speak_enabled` | boolean | No |  |
| `ai_rules` | string | No | (max 8192 characters) |
| `ai_mode` | string: `live`, `guardian`, `both` | No | See `Room.ai_mode` (default `live`). Switching to `guardian` stops the room's AI Live session. |
| `ai_live_classic` | boolean | No | See `Room.ai_live_classic`. |
| `ai_live_coalesce_seconds` | integer | No | (3–600) |
| `ai_live_keepalive_seconds` | integer | No | (30–3600) |
| `source` | string: `manual`, `virtual` | No | API 1.38.0. `manual` (default) or `virtual` (a collection of cameras and devices from different rooms). A `plan` room's source cannot be changed: remove its polygon from the floor plan instead. |
| `device_entity_ids` | array of string | No | API 1.38.0. Replaces the room's Home Assistant devices: device keys of entities exposed to Vigiora (`GET /integrations/home-assistant/devices`), each once. `400 validation_error` for a key that is not an exposed device, or when the server has no Home Assistant devices. (max 30 items) |
| `cameras` | array of object | No | Replaces the cameras a user put in the room; the cameras the floor plan manages (`managed`) stay. A managed camera named here takes the role sent. (max 32 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","site_id":1,"instruction":"instruction","environment":"retail","mode":"video","interval_seconds":2,"wake_word":"wake-word","timezone":"timezone","stt_provider":"auto","speech_microphone":"speech-microphone","ai_actuation_enabled":false,"ai_ptz_enabled":false,"ai_speak_enabled":false,"ai_rules":"ai-rules","ai_mode":"live","ai_live_classic":false,"ai_live_coalesce_seconds":3,"ai_live_keepalive_seconds":30,"source":"manual","device_entity_ids":["device-entity-id"],"cameras":[{"camera_id":3,"role":"video","is_primary":false}]}'
```

**Response** `201`: The room.

```json
{
  "id": 1,
  "name": "Front door",
  "site_id": 1,
  "source": "source",
  "floor_plan": {
    "id": 1,
    "name": "Front door",
    "item_id": 1
  },
  "devices": [
    "device"
  ],
  "managed_devices": [
    "managed-device"
  ],
  "mode": "mode",
  "interval_seconds": 1,
  "environment": "environment",
  "instruction": "instruction",
  "wake_word": "wake-word",
  "timezone": "timezone",
  "stt_provider": "stt-provider",
  "speech_microphone": "speech-microphone",
  "speech_microphone_choice": {
    "mode": "mode",
    "camera_id": 3,
    "camera_name": "Front door",
    "reason": "reason",
    "reason_code": "reason-code",
    "values": {},
    "since": "2026-10-30T14:05:00Z"
  },
  "speech_microphone_notice": false,
  "ai_actuation_enabled": false,
  "ai_ptz_enabled": false,
  "ai_speak_enabled": false,
  "ai_mode": "ai-mode",
  "ai_live_classic": false,
  "ai_live_coalesce_seconds": 1,
  "ai_live_keepalive_seconds": 1,
  "cameras": [
    {
      "camera_id": 3,
      "name": "Front door",
      "role": "role",
      "is_primary": false,
      "managed": false,
      "is_speech_microphone": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a room

`GET /api/v1/rooms/{room_id}`

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The room.

```json
{
  "id": 1,
  "name": "Front door",
  "site_id": 1,
  "source": "source",
  "floor_plan": {
    "id": 1,
    "name": "Front door",
    "item_id": 1
  },
  "devices": [
    "device"
  ],
  "managed_devices": [
    "managed-device"
  ],
  "mode": "mode",
  "interval_seconds": 1,
  "environment": "environment",
  "instruction": "instruction",
  "wake_word": "wake-word",
  "timezone": "timezone",
  "stt_provider": "stt-provider",
  "speech_microphone": "speech-microphone",
  "speech_microphone_choice": {
    "mode": "mode",
    "camera_id": 3,
    "camera_name": "Front door",
    "reason": "reason",
    "reason_code": "reason-code",
    "values": {},
    "since": "2026-10-30T14:05:00Z"
  },
  "speech_microphone_notice": false,
  "ai_actuation_enabled": false,
  "ai_ptz_enabled": false,
  "ai_speak_enabled": false,
  "ai_mode": "ai-mode",
  "ai_live_classic": false,
  "ai_live_coalesce_seconds": 1,
  "ai_live_keepalive_seconds": 1,
  "cameras": [
    {
      "camera_id": 3,
      "name": "Front door",
      "role": "role",
      "is_primary": false,
      "managed": false,
      "is_speech_microphone": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a room

`PATCH /api/v1/rooms/{room_id}`

Changes only the fields sent; `cameras` replaces the room's cameras (the ones the floor plan manages stay) and `device_entity_ids` its Home Assistant devices. Renaming a room drawn on a floor plan renames its polygon. `ai_actuation_enabled`, `ai_ptz_enabled` and `ai_speak_enabled` let AI Live move cameras and speak. `speech_microphone` (API 1.115.0) chooses which microphones of the room are sent to speech-to-text: `auto` (the best one, chosen by the server), `all`, or one camera id of the room. Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_room`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `site_id` | integer or null | No |  |
| `instruction` | string | No | What AI Live watches for. (max 4096 characters) |
| `environment` | string: `retail`, `security`, `reception`, `home`, `custom` | No |  |
| `mode` | string: `video`, `audio`, `both` | No |  |
| `interval_seconds` | integer | No | (2–300) |
| `wake_word` | string | No | (max 64 characters) |
| `timezone` | string | No | IANA zone name. |
| `stt_provider` | string: `auto`, `whisper`, `deepgram`, `gemini` | No |  |
| `speech_microphone` | string | No | API 1.115.0. See `Room.speech_microphone`: `auto`, `all` or a camera id of the room as text. |
| `ai_actuation_enabled` | boolean | No |  |
| `ai_ptz_enabled` | boolean | No |  |
| `ai_speak_enabled` | boolean | No |  |
| `ai_rules` | string | No | (max 8192 characters) |
| `ai_mode` | string: `live`, `guardian`, `both` | No | See `Room.ai_mode` (default `live`). Switching to `guardian` stops the room's AI Live session. |
| `ai_live_classic` | boolean | No | See `Room.ai_live_classic`. |
| `ai_live_coalesce_seconds` | integer | No | (3–600) |
| `ai_live_keepalive_seconds` | integer | No | (30–3600) |
| `source` | string: `manual`, `virtual` | No | API 1.38.0. `manual` (default) or `virtual` (a collection of cameras and devices from different rooms). A `plan` room's source cannot be changed: remove its polygon from the floor plan instead. |
| `device_entity_ids` | array of string | No | API 1.38.0. Replaces the room's Home Assistant devices: device keys of entities exposed to Vigiora (`GET /integrations/home-assistant/devices`), each once. `400 validation_error` for a key that is not an exposed device, or when the server has no Home Assistant devices. (max 30 items) |
| `cameras` | array of object | No | Replaces the cameras a user put in the room; the cameras the floor plan manages (`managed`) stay. A managed camera named here takes the role sent. (max 32 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/rooms/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","site_id":1,"instruction":"instruction","environment":"retail","mode":"video","interval_seconds":2,"wake_word":"wake-word","timezone":"timezone","stt_provider":"auto","speech_microphone":"speech-microphone","ai_actuation_enabled":false,"ai_ptz_enabled":false,"ai_speak_enabled":false,"ai_rules":"ai-rules","ai_mode":"live","ai_live_classic":false,"ai_live_coalesce_seconds":3,"ai_live_keepalive_seconds":30,"source":"manual","device_entity_ids":["device-entity-id"],"cameras":[{"camera_id":3,"role":"video","is_primary":false}]}'
```

**Response** `200`: The room.

```json
{
  "id": 1,
  "name": "Front door",
  "site_id": 1,
  "source": "source",
  "floor_plan": {
    "id": 1,
    "name": "Front door",
    "item_id": 1
  },
  "devices": [
    "device"
  ],
  "managed_devices": [
    "managed-device"
  ],
  "mode": "mode",
  "interval_seconds": 1,
  "environment": "environment",
  "instruction": "instruction",
  "wake_word": "wake-word",
  "timezone": "timezone",
  "stt_provider": "stt-provider",
  "speech_microphone": "speech-microphone",
  "speech_microphone_choice": {
    "mode": "mode",
    "camera_id": 3,
    "camera_name": "Front door",
    "reason": "reason",
    "reason_code": "reason-code",
    "values": {},
    "since": "2026-10-30T14:05:00Z"
  },
  "speech_microphone_notice": false,
  "ai_actuation_enabled": false,
  "ai_ptz_enabled": false,
  "ai_speak_enabled": false,
  "ai_mode": "ai-mode",
  "ai_live_classic": false,
  "ai_live_coalesce_seconds": 1,
  "ai_live_keepalive_seconds": 1,
  "cameras": [
    {
      "camera_id": 3,
      "name": "Front door",
      "role": "role",
      "is_primary": false,
      "managed": false,
      "is_speech_microphone": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a room

`DELETE /api/v1/rooms/{room_id}`

Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_room`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/rooms/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List layouts

`GET /api/v1/layouts`

Saved camera grids: the caller's own and the shared ones, by ascending id. Cells of cameras the caller may not view are left out.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/layouts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of layouts.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "cells": [
        {
          "camera_id": 3,
          "x": 1,
          "y": 1,
          "w": 1,
          "h": 1
        }
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a layout

`POST /api/v1/layouts`

A personal camera grid (cameras the caller may view). `settings:write` keys are admins' only; others use a session.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `cells` | array of LayoutCell | No | (max 64 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/layouts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","cells":[{"camera_id":3,"x":1,"y":1,"w":1,"h":1}]}'
```

**Response** `201`: The layout.

```json
{
  "id": 1,
  "name": "Front door",
  "cells": [
    {
      "camera_id": 3,
      "x": 1,
      "y": 1,
      "w": 1,
      "h": 1
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a layout

`GET /api/v1/layouts/{layout_id}`

Another user's personal layout is `404`.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `layout_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/layouts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The layout.

```json
{
  "id": 1,
  "name": "Front door",
  "cells": [
    {
      "camera_id": 3,
      "x": 1,
      "y": 1,
      "w": 1,
      "h": 1
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a layout

`PATCH /api/v1/layouts/{layout_id}`

The caller's own layouts only (shared layouts are `403`). `cells` replaces the grid.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `layout_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `cells` | array of LayoutCell | No | (max 64 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/layouts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","cells":[{"camera_id":3,"x":1,"y":1,"w":1,"h":1}]}'
```

**Response** `200`: The layout.

```json
{
  "id": 1,
  "name": "Front door",
  "cells": [
    {
      "camera_id": 3,
      "x": 1,
      "y": 1,
      "w": 1,
      "h": 1
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a layout

`DELETE /api/v1/layouts/{layout_id}`

The caller's own layouts only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_layout`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `layout_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/layouts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Server settings

`GET /api/v1/settings`

The recording defaults a new camera gets when its create request does not say (web app and API), camera following, the Vision Engine events retention and (API 1.42.0) the Bluetooth scan switches (`bluetooth_enabled`, `bluetooth_scan_interval_minutes`, `bluetooth_scan_seconds`).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "compress_after_days": 1,
  "compression": {
    "compressed_count": 2,
    "saved_bytes": 1,
    "pending_count": 2
  },
  "auto_update_enabled": false,
  "camera_clock_autofix_enabled": false,
  "bluetooth_enabled": false,
  "bluetooth_scan_interval_minutes": 1,
  "bluetooth_scan_seconds": 1,
  "hal_events_retention_days": 1,
  "camera_follow_enabled": false,
  "default_recording_enabled": false,
  "default_retention_days": 1,
  "retention_choices": [
    1
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change server settings

`PATCH /api/v1/settings`

Changes the defaults sent; `default_retention_days` is one of `retention_choices` (the camera form's choices). Existing cameras keep their own values. Emits `settings.changed`.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `default_recording_enabled` | boolean | No |  |
| `default_retention_days` | integer | No |  |
| `camera_follow_enabled` | boolean | No | User sessions only (`403 api_key_not_allowed`). |
| `hal_events_retention_days` | integer | No | (1–365) |
| `bluetooth_enabled` | boolean | No |  |
| `bluetooth_scan_interval_minutes` | integer | No | (5–1440) |
| `bluetooth_scan_seconds` | integer | No | (5–120) |
| `camera_clock_autofix_enabled` | boolean | No |  |
| `auto_update_enabled` | boolean | No | Install updates automatically (default false: ask first). |
| `compress_after_days` | integer | No | Compress recordings older than this many days; 0 = off (API 1.92.0). (0–89) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"default_recording_enabled":false,"default_retention_days":1,"camera_follow_enabled":false,"hal_events_retention_days":1,"bluetooth_enabled":false,"bluetooth_scan_interval_minutes":5,"bluetooth_scan_seconds":5,"camera_clock_autofix_enabled":false,"auto_update_enabled":false,"compress_after_days":1}'
```

**Response** `200`: The settings.

```json
{
  "compress_after_days": 1,
  "compression": {
    "compressed_count": 2,
    "saved_bytes": 1,
    "pending_count": 2
  },
  "auto_update_enabled": false,
  "camera_clock_autofix_enabled": false,
  "bluetooth_enabled": false,
  "bluetooth_scan_interval_minutes": 1,
  "bluetooth_scan_seconds": 1,
  "hal_events_retention_days": 1,
  "camera_follow_enabled": false,
  "default_recording_enabled": false,
  "default_retention_days": 1,
  "retention_choices": [
    1
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### AI agent settings

`GET /api/v1/settings/agents`

The server-wide human-in-the-loop setting for AI agents (see the overview).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/settings/agents" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "human_in_the_loop": false
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change AI agent settings

`PATCH /api/v1/settings/agents`

Turns human in the loop on or off for the server (API keys and connected apps that override it keep their own value). Emits `settings.changed`.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_agent_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `human_in_the_loop` | boolean | Yes |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/settings/agents" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"human_in_the_loop":false}'
```

**Response** `200`: The settings.

```json
{
  "human_in_the_loop": false
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List layout sequences

`GET /api/v1/layout-sequences`

The caller's rotations of layouts (the wall display cycles through them).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/layout-sequences" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of sequences.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "layout_ids": [
        1
      ],
      "interval_seconds": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a layout sequence

`POST /api/v1/layout-sequences`

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `layout_ids` | array of integer | Yes | (max 50 items) |
| `interval_seconds` | integer | No | (2–3600, default `10`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/layout-sequences" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","layout_ids":[1]}'
```

**Response** `201`: The sequence.

```json
{
  "id": 1,
  "name": "Front door",
  "layout_ids": [
    1
  ],
  "interval_seconds": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a layout sequence

`DELETE /api/v1/layout-sequences/{layout_sequence_id}`

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_layout_sequence`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `layout_sequence_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/layout-sequences/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List speech-to-text providers

`GET /api/v1/rooms/stt-providers`

The `stt_provider` choices for rooms and whether each runs on this server. One page.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/stt-providers" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The providers.

```json
{
  "data": [
    {
      "id": "id",
      "label": "person",
      "available": false,
      "note": "note"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a room's stock list

`GET /api/v1/rooms/{room_id}/inventory`

The products AI Live answers questions about (at most 5000).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/inventory" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The list.

```json
{
  "room_id": 1,
  "count": 2,
  "items": [
    {
      "name": "Front door",
      "price": "price",
      "location": "location",
      "notes": "notes"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Clear a room's stock list

`DELETE /api/v1/rooms/{room_id}/inventory`

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_room_inventory`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/rooms/42/inventory" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Cleared.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Replace a room's stock list

`POST /api/v1/rooms/{room_id}/inventory/actions/replace`

Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `replace_room_inventory`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of InventoryItem | Yes | (max 5000 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/inventory/actions/replace" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"name":"Front door","price":"price","location":"location","notes":"notes"}]}'
```

**Response** `200`: The list.

```json
{
  "room_id": 1,
  "count": 2,
  "items": [
    {
      "name": "Front door",
      "price": "price",
      "location": "location",
      "notes": "notes"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `413`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a room's speakers

`GET /api/v1/rooms/{room_id}/outputs`

The enabled speakers linked to the room, the default first. One page.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/outputs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The speakers.

```json
{
  "data": [
    {
      "auto": false,
      "id": 1,
      "name": "Front door",
      "kind": "kind",
      "client_id": null,
      "camera_id": 3,
      "device": "device",
      "volume": 0.5,
      "enabled": true,
      "is_default": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set a room's speakers

`PATCH /api/v1/rooms/{room_id}/outputs`

Replaces the room's speakers and its default. Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_room_outputs`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `output_ids` | array of integer | Yes | (max 32 items) |
| `default_output_id` | integer or null | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/rooms/42/outputs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"output_ids":[1]}'
```

**Response** `200`: The speakers.

```json
{
  "data": [
    {
      "auto": false,
      "id": 1,
      "name": "Front door",
      "kind": "kind",
      "client_id": null,
      "camera_id": 3,
      "device": "device",
      "volume": 0.5,
      "enabled": true,
      "is_default": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a room's actuations

`GET /api/v1/rooms/{room_id}/actuations`

The latest 50 PTZ and speak attempts in the room (AI Live and operators), newest first. One page.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/actuations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The actuations.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "kind": "kind",
      "source": "source",
      "args": {},
      "ok": false,
      "error": null,
      "created_at": "created-at"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Speak in a room

`POST /api/v1/rooms/{room_id}/actions/speak`

Says `text` aloud (text to speech) through the room's default speaker, `output_id`, or all of them. Needs the admin or operator role and operator permission on every camera of the room. A speaker that refused or did not answer is `502 ptz_failed`.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `speak_in_room`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | (max 1000 characters) |
| `output_id` | integer | No |  |
| `all` | boolean | No | (default `false`) |
| `volume` | number | No | (0–2) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/actions/speak" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"text":"text"}'
```

**Response** `200`: Spoken.

```json
{
  "ok": false,
  "details": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Play audio in a room

`POST /api/v1/rooms/{room_id}/actions/play-audio`

Plays a short clip (base64; the request is at most 64 KB) through the room's speakers. Needs the admin or operator role and operator permission on every camera of the room.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `play_audio_in_room`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `audio_base64` | string | Yes |  |
| `mime_type` | string: `audio/mpeg`, `audio/wav`, `audio/ogg`, `audio/webm`, `audio/mp4`, `audio/aac` | Yes |  |
| `output_id` | integer | No |  |
| `all` | boolean | No | (default `false`) |
| `volume` | number | No | (0–2) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/actions/play-audio" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"audio_base64":"audio-base64","mime_type":"audio/mpeg"}'
```

**Response** `200`: Played.

```json
{
  "ok": false,
  "details": {}
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `413`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List output devices (tools)

`GET /api/v1/output-devices`

API 1.54.0. Every physical device Vigiora can act with, in one list (the web app's Tools page): speakers (camera speakers, including the ones Vigiora added by itself, USB and Google Cast speakers; client speakers for admins), the cameras' own sirens, and the Home Assistant / Zigbee devices shared with Vigiora for control (lights, switches, locks, covers, …) with their live state. Cameras the caller cannot view are left out. Change speakers with the outputs operations, devices with setIoTDeviceEntity.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/output-devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The devices.

```json
{
  "data": [
    {
      "id": "id",
      "type": "type",
      "source": "source",
      "name": "Front door",
      "camera_id": 3,
      "camera_name": "Front door",
      "client_id": null,
      "room_ids": [
        1
      ],
      "room_names": [
        "room-name"
      ],
      "capabilities": [
        "capabilitie"
      ],
      "state": {
        "online": false,
        "summary": "summary"
      },
      "enabled": true,
      "auto": false,
      "note": "note",
      "output_id": 1,
      "device_key": "device-key",
      "entity_id": "entity-id"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List speakers

`GET /api/v1/outputs`

Audio outputs: camera speakers (cameras the caller may view) and vigiora-client USB and Cast speakers.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/outputs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of speakers.

```json
{
  "data": [
    {
      "auto": false,
      "id": 1,
      "name": "Front door",
      "kind": "kind",
      "client_id": null,
      "camera_id": 3,
      "device": "device",
      "volume": 0.5,
      "enabled": true,
      "is_default": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a speaker

`POST /api/v1/outputs`

`camera_backchannel` (a camera's own speaker, `camera_id`: operator permission), `usb` (`client_id` and `device`) or `cast` (`client_id`, `device` = host:port). Client speakers are admins' (`GET /clients/{client_id}/audio-outputs` lists a client's devices). A camera speaker's `client_id` is optional (API 1.12): when the camera has no vigiora-client, this server plays the audio through its own go2rtc (the camera's ONVIF two-way audio), whatever `client_id` says.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_output`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `kind` | string: `camera_backchannel`, `usb`, `cast` | Yes |  |
| `client_id` | string or null | No | Required for `usb` and `cast`. Optional for `camera_backchannel`: `null`, `""` or absent means this server delivers through its own go2rtc (a camera with no vigiora-client). |
| `camera_id` | integer | No |  |
| `device` | string | No | (max 256 characters) |
| `volume` | number | No | (0–2, default `1`) |
| `enabled` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/outputs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","kind":"camera_backchannel"}'
```

**Response** `201`: The speaker.

```json
{
  "auto": false,
  "id": 1,
  "name": "Front door",
  "kind": "kind",
  "client_id": null,
  "camera_id": 3,
  "device": "device",
  "volume": 0.5,
  "enabled": true,
  "is_default": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a speaker

`PATCH /api/v1/outputs/{output_id}`

`kind` and `camera_id` never change. A camera speaker's `client_id` can (API 1.12): a vigiora-client, or `null` for this server; a USB or Cast speaker's cannot (400).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_output`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `output_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 128 characters) |
| `client_id` | string or null | No | Camera speakers only (API 1.12): the vigiora-client that plays it, or `null` (or `""`) for this server. |
| `device` | string | No | (max 256 characters) |
| `volume` | number | No | (0–2) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/outputs/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","client_id":null,"device":"device","volume":0.5,"enabled":true}'
```

**Response** `200`: The speaker.

```json
{
  "auto": false,
  "id": 1,
  "name": "Front door",
  "kind": "kind",
  "client_id": null,
  "camera_id": 3,
  "device": "device",
  "volume": 0.5,
  "enabled": true,
  "is_default": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a speaker

`DELETE /api/v1/outputs/{output_id}`

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_output`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `output_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/outputs/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test a speaker

`POST /api/v1/outputs/{output_id}/actions/test`

Says a short test message aloud through the speaker.

| Requirement | |
| --- | --- |
| Scope | `cameras:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `test_output`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `output_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | No | (max 500 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/outputs/42/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"text":"text"}'
```

**Response** `200`: Played.

```json
{
  "output_id": 1,
  "played": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a client's audio devices

`GET /api/v1/clients/{client_id}/audio-outputs`

The USB speakers and Cast devices a vigiora-client offers (asked live; `502` when it does not answer).

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clients/42/audio-outputs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The devices.

```json
{
  "client_id": null,
  "audio_outputs": [
    "audio-output"
  ],
  "cast_devices": [
    {}
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the server's custom branding

`GET /api/v1/branding`

API 1.120.0. The name, logo and accent colour this server shows instead of Vigiora, and what is applied now (`effective`). The name is free on every server; the logo, the accent colour and hiding the small "Powered by Vigiora" line need a plan with custom branding (`entitled`). Without it those values are kept but not applied. `logo_url` is the public picture at `/api/branding/logo` (a PNG this server made; the `v` query is the version, so it may be cached). The sign-in page reads only `effective` from the public `/api/branding/public`.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/branding" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The branding.

```json
{
  "name": "Front door",
  "logo_url": "logo-url",
  "accent_color": "accent-color",
  "hide_powered_by": false,
  "entitled": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "limits": {
    "name_max": 1,
    "logo_max_bytes": 1,
    "logo_max_side": 1,
    "logo_types": [
      "logo-type"
    ]
  },
  "effective": {
    "name": "Front door",
    "logo_url": "logo-url",
    "accent_color": "accent-color",
    "powered_by": false
  }
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the server's name, accent colour or Powered by line

`PATCH /api/v1/branding`

API 1.120.0. `name`: plain text shown instead of Vigiora, trimmed, at most 40 characters, no control characters; an empty string goes back to Vigiora (free). `accent_color`: `#rrggbb`, or an empty string for Vigiora's own colour. `hide_powered_by`: hide the "Powered by Vigiora" line on the sign-in page and in About. Setting a colour or hiding the line needs a plan with custom branding: without it `402 limit_reached` with `details.limit` `feature:branding` (clearing them is always allowed). At least one field. Audited. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_branding`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 40 characters) |
| `accent_color` | string | No | #rrggbb, or empty for the Vigiora colour. |
| `hide_powered_by` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/branding" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","accent_color":"accent-color","hide_powered_by":false}'
```

**Response** `200`: The branding.

```json
{
  "name": "Front door",
  "logo_url": "logo-url",
  "accent_color": "accent-color",
  "hide_powered_by": false,
  "entitled": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "limits": {
    "name_max": 1,
    "logo_max_bytes": 1,
    "logo_max_side": 1,
    "logo_types": [
      "logo-type"
    ]
  },
  "effective": {
    "name": "Front door",
    "logo_url": "logo-url",
    "accent_color": "accent-color",
    "powered_by": false
  }
}
```

Errors: `400`, `401`, `402`, `403`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove the server's logo

`DELETE /api/v1/branding/logo`

API 1.120.0. Goes back to the Vigiora logo. Always allowed, with or without the plan. Audited. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_branding_logo`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/branding/logo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The branding without a logo.

```json
{
  "name": "Front door",
  "logo_url": "logo-url",
  "accent_color": "accent-color",
  "hide_powered_by": false,
  "entitled": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "limits": {
    "name_max": 1,
    "logo_max_bytes": 1,
    "logo_max_side": 1,
    "logo_types": [
      "logo-type"
    ]
  },
  "effective": {
    "name": "Front door",
    "logo_url": "logo-url",
    "accent_color": "accent-color",
    "powered_by": false
  }
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Upload the server's logo

`PUT /api/v1/branding/logo`

API 1.120.0. Replaces the logo. Send the picture as the raw body (`Content-Type` `image/png`, `image/jpeg` or `image/webp`), or as JSON with it base64-encoded in `image_base64` (MCP clients). At most 512 KB. No SVG. The server decodes the picture and stores a new PNG of at most 512 pixels on the long side, so the uploaded bytes are never served. Needs a plan with custom branding (`402 limit_reached`, `details.limit` `feature:branding`). `413` too big, `415` another type, `400` not a readable picture. Audited. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `upload_branding_logo`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `image_base64` | string | Yes | The logo (PNG, JPEG or WebP, at most 512 KB), base64-encoded (a `data:` URL is accepted). |

**Example request**

```bash
curl -s -X PUT "https://yourname.vigiora.com/api/v1/branding/logo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"image_base64":"image-base64"}'
```

**Response** `200`: The branding with the new logo.

```json
{
  "name": "Front door",
  "logo_url": "logo-url",
  "accent_color": "accent-color",
  "hide_powered_by": false,
  "entitled": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "limits": {
    "name_max": 1,
    "logo_max_bytes": 1,
    "logo_max_side": 1,
    "logo_types": [
      "logo-type"
    ]
  },
  "effective": {
    "name": "Front door",
    "logo_url": "logo-url",
    "accent_color": "accent-color",
    "powered_by": false
  }
}
```

Errors: `400`, `401`, `402`, `403`, `413`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## System

Server status and health.

### Server status

`GET /api/v1/system/status`

Version, load, disks and totals of the whole server (every camera, not only the caller's).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/status" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "version": "version",
  "cpu_count": 2,
  "load_average": [
    0.5
  ],
  "disks": [
    {
      "label": "person",
      "path": "path",
      "total_bytes": 1,
      "used_bytes": 1,
      "free_bytes": 1,
      "used_percent": 1
    }
  ],
  "cameras_enabled": 1,
  "recordings": {
    "segment_count": 2,
    "size_bytes": 7340032,
    "cache_bytes": 1,
    "active_recorders": 1
  },
  "unacknowledged_alerts": 1,
  "api_version": "api-version",
  "memory": {
    "total_bytes": 1,
    "available_bytes": 1,
    "used_bytes": 1,
    "used_percent": 1,
    "swap_total_bytes": 1,
    "swap_used_bytes": 1
  }
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Server health

`GET /api/v1/system/health`

The self-heal watchdog's latest check of the server's components (`monitoring: false` when the watchdog is off). Since API 1.126.0 also the automatic memory profile (`memory_profile`, read-only).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The health snapshot.

```json
{
  "monitoring": false,
  "overall": "overall",
  "incidents_open": 1,
  "checked_at": "2026-10-30T14:05:00Z",
  "components": [
    {
      "name": "Front door",
      "kind": "kind",
      "status": "status",
      "detail": "detail",
      "restartable": false,
      "last_checked": "2026-10-30T14:05:00Z"
    }
  ],
  "memory_profile": {
    "tier": "normal",
    "low_memory": false,
    "total_bytes": 1,
    "summary": "summary",
    "under_pressure": false
  }
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the dashboard summary

`GET /api/v1/system/dashboard`

The web app dashboard's aggregated view of the caller's cameras.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/dashboard" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The dashboard.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get current object counts

`GET /api/v1/system/objects`

People, vehicles and other objects the detectors see now, over the caller's cameras.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/objects" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The counts.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get object count history

`GET /api/v1/system/object-history`

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |
| `hours` | query | integer | No | (1–720, default `24`) |
| `bucket_minutes` | query | integer | No | (1–1440) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/object-history" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The history.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the AI status

`GET /api/v1/system/ai-status`

Whether the AI gateway is reachable and which AI features are paused or limited. `ai` is the AI availability (as in `getServer`, see `AIAvailability`): `ai.reason` `allowance_used` with `ai.resumes_at` when this month's Vigiora AI allowance is used up; `descriptions_paused` is true while only the automatic descriptions stop (`auto_reserved`, 70% of the allowance used).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/ai-status" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Retry the paused AI now

`POST /api/v1/system/ai-status/actions/retry`

"Retry now" on the AI-paused banner. While the AI provider is paused (for example out of credit, `ai.reason` `provider_402`), Vigiora asks it again only every few minutes; this asks at once with one minimal call, so AI resumes right after a credit top-up without a restart. When AI is not paused, or is paused because the monthly AI allowance is used up (`allowance_used`: the server checks it every 15 minutes by itself), nothing is called. Answers the same body as `GET /system/ai-status`, read after the attempt (`ai.status` `ok` when the provider accepted). Changes no setting. API 1.86.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/ai-status/actions/retry" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The AI status after the attempt.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get this server's entitlements

`GET /api/v1/system/plan`

The licence's limits (cameras, AI cameras, add-ons) and their use.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/plan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The plan.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the Vigiora cloud plan

`GET /api/v1/system/cloud-plan`

This server's Vigiora cloud plan. Since 1.87.0 also `catalog` (the cloud's priced lines, null until one is stored), `cameras` (each enabled camera's Core AI / add-on state and whether it holds a free Core AI slot) and `monthly_cents` (the plan's current monthly total; 0 without a catalog).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/cloud-plan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The plan.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the open plan cart

`GET /api/v1/system/plan/cart`

The open upgrade cart: the services and cameras the user wants to add to the plan. Nothing is charged here; payment happens on vigiora.com through the checkout link. API 1.88.0. Admins and operators. `cart` is null when none is open.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/plan/cart" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The open cart, or null.

```json
{
  "cart": {
    "id": "id",
    "status": "status",
    "items": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "created_by": 1,
    "created_at": "2026-10-30T14:05:00Z",
    "checked_out_at": "2026-10-30T14:05:00Z",
    "paid_at": "2026-10-30T14:05:00Z",
    "applied_at": "2026-10-30T14:05:00Z",
    "applied": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "skipped": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "error": null
  }
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add cameras to the plan cart

`POST /api/v1/system/plan/cart/actions/add-items`

Adds the cameras to a service in the open cart (creating the cart if none is open). Cameras that do not exist, are disabled or already have the service are not added (never an error): `skipped` lists them with the reason, and the checkout link never charges for them. Unknown or coming-soon services and an empty camera list answer 400; a camera the caller may not operate answers 403 naming it. Once the cart's checkout link was issued, an add starts a new open cart (the checked-out one stays for the return trip). Nothing is charged. API 1.88.0; `skipped` and the per-camera check since 1.89.1.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `service` | string | Yes |  |
| `camera_ids` | array of integer | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/plan/cart/actions/add-items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"service":"service","camera_ids":[3]}'
```

**Response** `200`: The cart after the change, and the cameras that were not added.

```json
{
  "cart": {
    "id": "id",
    "status": "status",
    "items": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "created_by": 1,
    "created_at": "2026-10-30T14:05:00Z",
    "checked_out_at": "2026-10-30T14:05:00Z",
    "paid_at": "2026-10-30T14:05:00Z",
    "applied_at": "2026-10-30T14:05:00Z",
    "applied": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "skipped": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "error": null
  },
  "skipped": [
    {
      "camera_id": 3,
      "name": "Front door",
      "service": "service",
      "reason": "not_found"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove cameras from the plan cart

`POST /api/v1/system/plan/cart/actions/remove-items`

Takes the cameras off a service in the open cart; the cart is closed when it empties (`cart` null). A camera the caller may not operate answers 403. Once the cart's checkout link was issued, a removal starts a new open cart (the checked-out one stays for the return trip). Nothing is charged. API 1.88.0.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `service` | string | Yes |  |
| `camera_ids` | array of integer | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/plan/cart/actions/remove-items" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"service":"service","camera_ids":[3]}'
```

**Response** `200`: The cart after the change, or null when it emptied.

```json
{
  "cart": {
    "id": "id",
    "status": "status",
    "items": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "created_by": 1,
    "created_at": "2026-10-30T14:05:00Z",
    "checked_out_at": "2026-10-30T14:05:00Z",
    "paid_at": "2026-10-30T14:05:00Z",
    "applied_at": "2026-10-30T14:05:00Z",
    "applied": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "skipped": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "error": null
  }
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the cart checkout link

`POST /api/v1/system/plan/cart/actions/checkout-url`

Returns the vigiora.com link, prefilled with the cart and what the site has today, where the user pays; only cameras that would gain a service are counted. The cart is stamped `checked_out_at`. Nothing is charged here. Answers 409 `no_cart` when no cart is open. API 1.88.0.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/plan/cart/actions/checkout-url" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The checkout link.

```json
{
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a plan cart by id

`GET /api/v1/system/plan/cart/{cart_id}`

Returns the cart in any status (open, checkout, paid, applied, partial, timeout). `applied` lists what is switched on, `items` what is still waiting for the licence, `skipped` what was not switched on and why (`reason`, `error`). A paid or partial cart still waiting 10 minutes after payment is timed out when read. Answers 404 for an unknown id. API 1.89.0.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cart_id` | path | string | Yes |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/plan/cart/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cart.

```json
{
  "cart": {
    "id": "id",
    "status": "status",
    "items": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "created_by": 1,
    "created_at": "2026-10-30T14:05:00Z",
    "checked_out_at": "2026-10-30T14:05:00Z",
    "paid_at": "2026-10-30T14:05:00Z",
    "applied_at": "2026-10-30T14:05:00Z",
    "applied": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "skipped": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "error": null
  }
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark a plan cart paid

`POST /api/v1/system/plan/cart/{cart_id}/actions/paid`

Records that the user came back from vigiora.com having paid: an open (or checked-out) cart becomes paid, the licence is pulled at once and whatever the licence already covers is switched on. Calling it again returns the cart unchanged. Answers 404 for an unknown id. Not an MCP tool: only the return-trip page calls it (every licence pull also applies paid carts and carts the licence covers in full). API 1.89.0.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cart_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/plan/cart/42/actions/paid" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cart.

```json
{
  "cart": {
    "id": "id",
    "status": "status",
    "items": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "created_by": 1,
    "created_at": "2026-10-30T14:05:00Z",
    "checked_out_at": "2026-10-30T14:05:00Z",
    "paid_at": "2026-10-30T14:05:00Z",
    "applied_at": "2026-10-30T14:05:00Z",
    "applied": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "skipped": [
      {
        "service": "service",
        "camera_ids": [
          3
        ],
        "reason": "not_found",
        "error": null
      }
    ],
    "error": null
  }
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the mesh status

`GET /api/v1/system/mesh`

The Vigiora mesh (how vigiora-clients and remote access reach this server).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/mesh" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the update status

`GET /api/v1/system/update`

The self-update status. `auto_install` reflects the "Install updates automatically" setting (`auto_update_enabled` of `GET /settings`): when it is false (the default) a newer signed release is downloaded and staged (state `ready`, with the version in `available`) and waits for `POST /system/update/actions/install`; when true the server restarts into it automatically.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/update" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check for an update

`POST /api/v1/system/update/actions/check`

Checks for a newer signed release now; the self-updater downloads and applies it as configured. Audited.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `check_system_update`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/update/actions/check" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Install the staged update

`POST /api/v1/system/update/actions/install`

Installs the already-downloaded, staged update now: the server restarts into it. Used when "Install updates automatically" is off (`auto_update_enabled` false) and `GET /system/update` reports `ready` with a version in `available`. Idempotent and safe when nothing is staged — it then returns the current status rather than an error. Audited.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `install_system_update`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/update/actions/install" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the edge status

`GET /api/v1/system/edge`

The local HTTPS edge (certificates, listeners).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/edge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get remote access

`GET /api/v1/system/remote-access`

Whether the server is reachable from the internet through Vigiora cloud (`https://<site>.vigiora.com`).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/remote-access" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Remote access.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Switch remote access

`PATCH /api/v1/system/remote-access`

Turns internet access through Vigiora cloud on or off: it changes the site's exposure. Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | Yes |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/system/remote-access" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true}'
```

**Response** `200`: Remote access.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the server's hardware inventory

`GET /api/v1/system/health/inventory`

What the server knows of its own hardware and software, collected at startup and with every health check: CPU, memory and swap, GPUs with their driver (and, for NVIDIA on Linux, the running kernel module, so a driver/module mismatch shows), disks with model, size, file system, mount and role (`os`, `recordings`, `db`, `data`), network interfaces with link speed, USB devices of interest (Zigbee coordinators, Bluetooth, audio, cameras), the OS, kernel and uptime, the Vigiora and PostgreSQL versions and the enrolled AI (Vision Engine) runners. `notes` says which probes could not run on this platform. Collected now when none is stored yet. API 1.55.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/inventory" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The inventory.

```json
{
  "collected_at": "2026-10-30T14:05:00Z",
  "platform": "platform",
  "os_family": "os-family",
  "os": "os",
  "kernel": "kernel",
  "hostname": "hostname",
  "uptime_seconds": 1,
  "in_container": false,
  "cpu": {
    "model": "model",
    "cores": 1,
    "threads": 1
  },
  "form_factor": "form-factor",
  "machine": "machine",
  "memory": {
    "type": "type",
    "form": "form",
    "speed_mts": 1,
    "slots_total": 1,
    "slots_used": 1,
    "module_bytes": [
      1
    ]
  },
  "ram_bytes": 1,
  "swap_bytes": 1,
  "gpus": [
    {
      "vendor": "nvidia",
      "name": "Front door",
      "driver": "driver",
      "kernel_module": "kernel-module",
      "memory_bytes": 1,
      "memory_used_bytes": 1,
      "temp_c": 1,
      "error": null
    }
  ],
  "disks": [
    {
      "device": "device",
      "model": "model",
      "size_bytes": 7340032,
      "rotational": false,
      "fs": "fs",
      "mount": "mount",
      "roles": [
        "role"
      ],
      "total_bytes": 1,
      "free_bytes": 1,
      "used_pct": 0.5,
      "read_only": false,
      "health": "health"
    }
  ],
  "network": [
    {
      "name": "Front door",
      "kind": "ethernet",
      "up": false,
      "speed_mbps": 1,
      "addrs": [
        "addr"
      ]
    }
  ],
  "usb": [
    {
      "kind": "kind",
      "vendor_id": "vendor-id",
      "product_id": "product-id",
      "name": "Front door"
    }
  ],
  "version": "version",
  "postgres": "postgres",
  "db_mode": "db-mode",
  "hal_runners": [
    {
      "service": "service",
      "hostname": "hostname",
      "last_seen": "2026-10-30T14:05:00Z"
    }
  ],
  "memory_profile": {
    "tier": "normal",
    "low_memory": false,
    "total_bytes": 1,
    "summary": "summary",
    "under_pressure": false
  },
  "notes": [
    "note"
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the hardware upgrade suggestions

`GET /api/v1/system/health/upgrades`

The hardware upgrade suggestions of the latest health report and the hardware they are fitted to. When the hardware holds the server back (memory nearly full or swapping, too little memory for the cameras, the CPU busy or slowing down for heat, no hardware video decoding, a disk filling up, failing or too slow), the daily check adds an `upgrade.<kind>` item; each suggestion has 2–3 options from the most convenient (cheapest, easiest) to the most "pro", each with a short why, an approximate price in US dollars and an Amazon search link built from the exact spec (no affiliate tag). Suggestions only: check compatibility before buying. Empty `upgrades` when nothing needs upgrading or before the first report. API 1.125.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/upgrades" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The suggestions.

```json
{
  "report_id": 1,
  "checked_at": "2026-10-30T14:05:00Z",
  "hardware": {
    "form_factor": "form-factor",
    "machine": "machine",
    "cpu_model": "cpu-model",
    "ram_bytes": 1,
    "memory": {
      "type": "type",
      "form": "form",
      "speed_mts": 1,
      "slots_total": 1,
      "slots_used": 1,
      "module_bytes": [
        1
      ]
    }
  },
  "upgrades": [
    {
      "kind": "kind",
      "reason": "reason",
      "options": [
        {
          "level": "convenient",
          "title": "title",
          "why": "why",
          "price_min_usd": 1,
          "price_max_usd": 1,
          "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
        }
      ]
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the disks' speed and space left

`GET /api/v1/system/health/disks`

Every disk that holds the recordings, the database or the system: free space now, the last speed test (sequential write and read in MB/s, the latency of a small saved write), how busy the disk is right now (sampled for about a second: Linux /proc/diskstats, Windows performance counters, macOS iostat), what the cameras write (recordings disk), a speed verdict (`ok`, `warn` when too slow for the cameras or saturated, `unknown` before the first test) and the space forecast: the growth per day (measured on the disk, else what the cameras record), the date it is full, or — when retention deletes old footage first — the level it settles at. The speed test runs with the daily health check (at most once a day, never while the server is busy) and on demand. API 1.125.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/disks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The disks.

```json
{
  "checked_at": "2026-10-30T14:05:00Z",
  "disks": [
    {
      "device": "device",
      "model": "model",
      "mount": "mount",
      "roles": [
        "role"
      ],
      "rotational": false,
      "total_bytes": 1,
      "free_bytes": 1,
      "used_pct": 0.5,
      "bench": {
        "measured_at": "2026-10-30T14:05:00Z",
        "write_mbps": 0.5,
        "read_mbps": 0.5,
        "latency_ms": 0.5,
        "error": null
      },
      "io": {
        "util_pct": 0.5,
        "read_mbps": 0.5,
        "write_mbps": 0.5,
        "total_mbps": 0.5,
        "await_ms": 0.5
      },
      "need_write_mbps": 0.5,
      "cameras": 1,
      "speed_status": "ok",
      "speed_note": "speed-note",
      "forecast": {
        "growth_bytes_per_day": 0.5,
        "growth_source": "growth-source",
        "days_left": 0.5,
        "full_at": "2026-10-30T14:05:00Z",
        "stable": false,
        "stable_used_bytes": 0.5,
        "retention_days": 7,
        "text": "text"
      }
    }
  ],
  "bench_skipped": "bench-skipped"
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test the disks' speed now

`POST /api/v1/system/health/disks/actions/benchmark`

Runs the disk speed test now and answers with the disks (as `GET /system/health/disks`). Per recordings or data disk it writes a 32 MiB file in synced 1 MiB chunks, makes 20 small synced writes, reads the file back past the cache where the OS allows, and deletes it; at low I/O priority, a few seconds. When the server is busy (CPU load or a disk over half busy) the test does not run and `bench_skipped` says why; the last result stays. Changes nothing else. API 1.125.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/health/disks/actions/benchmark" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The disks with the new test.

```json
{
  "checked_at": "2026-10-30T14:05:00Z",
  "disks": [
    {
      "device": "device",
      "model": "model",
      "mount": "mount",
      "roles": [
        "role"
      ],
      "rotational": false,
      "total_bytes": 1,
      "free_bytes": 1,
      "used_pct": 0.5,
      "bench": {
        "measured_at": "2026-10-30T14:05:00Z",
        "write_mbps": 0.5,
        "read_mbps": 0.5,
        "latency_ms": 0.5,
        "error": null
      },
      "io": {
        "util_pct": 0.5,
        "read_mbps": 0.5,
        "write_mbps": 0.5,
        "total_mbps": 0.5,
        "await_ms": 0.5
      },
      "need_write_mbps": 0.5,
      "cameras": 1,
      "speed_status": "ok",
      "speed_note": "speed-note",
      "forecast": {
        "growth_bytes_per_day": 0.5,
        "growth_source": "growth-source",
        "days_left": 0.5,
        "full_at": "2026-10-30T14:05:00Z",
        "stable": false,
        "stable_used_bytes": 0.5,
        "retention_days": 7,
        "text": "text"
      }
    }
  ],
  "bench_skipped": "bench-skipped"
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List health reports

`GET /api/v1/system/health/reports`

The daily health checks (and the ones run on demand or at startup), newest first, kept 90 days. Each report has every check's status (`ok`, `warn`, `fail`, `skip`), a plain sentence and a fix hint, the one-line summary and the changes since the report before it. `since` keeps reports checked at or after it. API 1.55.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `since` | query | string (RFC 3339) | No | Only reports checked at or after this time (RFC 3339). |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/reports" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of reports.

```json
{
  "data": [
    {
      "id": 1,
      "checked_at": "2026-10-30T14:05:00Z",
      "trigger": "scheduled",
      "status": "ok",
      "summary": "summary",
      "counts": {
        "ok": 1,
        "warn": 1,
        "fail": 1,
        "skip": 1
      },
      "items": [
        {
          "id": "id",
          "category": "disk",
          "title": "title",
          "status": "ok",
          "detail": "detail",
          "hint": "hint",
          "short": "short",
          "value": 0.5,
          "unit": "unit",
          "upgrade": {
            "kind": "kind",
            "reason": "reason",
            "options": [
              null
            ]
          }
        }
      ],
      "changes": [
        {
          "id": "id",
          "title": "title",
          "kind": "new_problem",
          "from": "ok",
          "to": "ok",
          "detail": "detail"
        }
      ],
      "duration_ms": 1,
      "previous_id": 1,
      "inventory_id": 1,
      "cloud_sent_at": "2026-10-30T14:05:00Z",
      "cloud_error": "cloud-error",
      "notified_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the latest health report

`GET /api/v1/system/health/reports/latest`

The newest report (`null` before the first), whether a check is running now (after `POST /system/health/actions/run`: poll until `running` is false) and when the next scheduled check runs (`null` when the daily check is turned off). API 1.55.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/reports/latest" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The latest report and the schedule.

```json
{
  "report": {
    "id": 1,
    "checked_at": "2026-10-30T14:05:00Z",
    "trigger": "scheduled",
    "status": "ok",
    "summary": "summary",
    "counts": {
      "ok": 1,
      "warn": 1,
      "fail": 1,
      "skip": 1
    },
    "items": [
      {
        "id": "id",
        "category": "disk",
        "title": "title",
        "status": "ok",
        "detail": "detail",
        "hint": "hint",
        "short": "short",
        "value": 0.5,
        "unit": "unit",
        "upgrade": {
          "kind": "kind",
          "reason": "reason",
          "options": [
            null
          ]
        }
      }
    ],
    "changes": [
      {
        "id": "id",
        "title": "title",
        "kind": "new_problem",
        "from": "ok",
        "to": "ok",
        "detail": "detail"
      }
    ],
    "duration_ms": 1,
    "previous_id": 1,
    "inventory_id": 1,
    "cloud_sent_at": "2026-10-30T14:05:00Z",
    "cloud_error": "cloud-error",
    "notified_at": "2026-10-30T14:05:00Z"
  },
  "running": false,
  "started_at": "2026-10-30T14:05:00Z",
  "next_run_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a health report

`GET /api/v1/system/health/reports/{health_report_id}`

One report. API 1.55.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `health_report_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/reports/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The report.

```json
{
  "id": 1,
  "checked_at": "2026-10-30T14:05:00Z",
  "trigger": "scheduled",
  "status": "ok",
  "summary": "summary",
  "counts": {
    "ok": 1,
    "warn": 1,
    "fail": 1,
    "skip": 1
  },
  "items": [
    {
      "id": "id",
      "category": "disk",
      "title": "title",
      "status": "ok",
      "detail": "detail",
      "hint": "hint",
      "short": "short",
      "value": 0.5,
      "unit": "unit",
      "upgrade": {
        "kind": "kind",
        "reason": "reason",
        "options": [
          {
            "level": "convenient",
            "title": "title",
            "why": "why",
            "price_min_usd": 1,
            "price_max_usd": 1,
            "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
          }
        ]
      }
    }
  ],
  "changes": [
    {
      "id": "id",
      "title": "title",
      "kind": "new_problem",
      "from": "ok",
      "to": "ok",
      "detail": "detail"
    }
  ],
  "duration_ms": 1,
  "previous_id": 1,
  "inventory_id": 1,
  "cloud_sent_at": "2026-10-30T14:05:00Z",
  "cloud_error": "cloud-error",
  "notified_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run the health check now

`POST /api/v1/system/health/actions/run`

Starts a health check now ("Run now") and answers at once (`202`); it takes up to a minute (the disks' SMART reading waits for the root helper on Linux). Poll `GET /system/health/reports/latest` until `running` is false. The report is stored, notified and sent to Vigiora cloud like the daily one. One check runs at a time (`409 conflict`). Reads only: it changes nothing on the server. API 1.55.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/health/actions/run" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The check started.

```json
{
  "running": false,
  "started_at": "2026-10-30T14:05:00Z",
  "next_run_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### How many more cameras the server can take

`GET /api/v1/system/capacity`

The last capacity check (`report`) and its answer (`verdict`); both are null before the first check. The server checks by itself about 10 minutes after it starts when the last check is older than a week, and `POST /system/capacity/actions/check` checks now. The check writes 256 MiB to the recordings disk (synced, then deleted) for its write speed and reads the free space, the CPU load per core, the memory, the network link speed and what the enabled cameras send (measured from their recordings, else estimated from their stream size). `verdict.more_cameras` is the smallest of the limits it could work out: disk write (half the measured speed), disk space (the free space less what the cameras will still add until their retention is full, over the cameras' retention), CPU (up to 70 % load per core) and network (half the link). A field the server could not measure is null and its limit is left out. With no cameras the figures are for a typical 1080p 15 fps camera. API 1.95.0. Feature `system_capacity`. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/capacity" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The last check, or nulls before the first.

```json
{
  "report": {
    "measured_at": "2026-10-30T14:05:00Z",
    "disk": {
      "write_bytes_per_sec": 0.5,
      "free_bytes": 0.5,
      "total_bytes": 0.5
    },
    "cpu": {
      "cores": 1,
      "load_1m": 0.5
    },
    "memory": {
      "total_bytes": 0.5,
      "free_bytes": 0.5
    },
    "network": {
      "interface": "interface",
      "link_mbps": 1
    },
    "cameras": {
      "count": 2,
      "measured": 1,
      "bytes_per_day": 0.5,
      "ingest_bytes_per_sec": 0.5,
      "retention_days": 7,
      "pending_bytes": 0.5
    }
  },
  "verdict": {
    "more_cameras": 1,
    "limited_by": "disk_write",
    "limits": {
      "disk_write": 1,
      "disk_space": 1,
      "cpu": 1,
      "network": 1
    },
    "camera_bytes_per_day": 0.5,
    "typical_camera": false
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check the server's capacity now

`POST /api/v1/system/capacity/actions/check`

Runs the capacity check now and answers its result (synchronous, up to a minute; usually a few seconds). The result is stored and `GET /system/capacity` returns it from then on. One check runs at a time (`409 conflict`). It writes and deletes one temporary file and changes nothing else. API 1.95.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/capacity/actions/check" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The new check.

```json
{
  "report": {
    "measured_at": "2026-10-30T14:05:00Z",
    "disk": {
      "write_bytes_per_sec": 0.5,
      "free_bytes": 0.5,
      "total_bytes": 0.5
    },
    "cpu": {
      "cores": 1,
      "load_1m": 0.5
    },
    "memory": {
      "total_bytes": 0.5,
      "free_bytes": 0.5
    },
    "network": {
      "interface": "interface",
      "link_mbps": 1
    },
    "cameras": {
      "count": 2,
      "measured": 1,
      "bytes_per_day": 0.5,
      "ingest_bytes_per_sec": 0.5,
      "retention_days": 7,
      "pending_bytes": 0.5
    }
  },
  "verdict": {
    "more_cameras": 1,
    "limited_by": "disk_write",
    "limits": {
      "disk_write": 1,
      "disk_space": 1,
      "cpu": 1,
      "network": 1
    },
    "camera_bytes_per_day": 0.5,
    "typical_camera": false
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the health check settings

`GET /api/v1/system/health/settings`

When the daily check runs (`time`, HH:MM in the server's time zone `time_zone`; default 07:00), whether it runs (`enabled`), when to notify through push and email (`notify`: `always`, `problems` — default, only when something is warn or fail — or `never`) and whether the summary goes to Vigiora cloud (`cloud`, default true). API 1.55.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/health/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The settings.

```json
{
  "enabled": true,
  "time": "time",
  "notify": "always",
  "cloud": false,
  "time_zone": "time-zone",
  "next_run_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the health check settings

`PATCH /api/v1/system/health/settings`

Changes any of `enabled`, `time` (HH:MM, 24-hour clock, the server's time zone), `notify` (`always`, `problems`, `never`) and `cloud` (send the summary to Vigiora cloud). The schedule follows at once. API 1.55.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_health_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `time` | string | No |  |
| `notify` | string: `always`, `problems`, `never` | No |  |
| `cloud` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/system/health/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"time":"time","notify":"always","cloud":false}'
```

**Response** `200`: The settings now.

```json
{
  "enabled": true,
  "time": "time",
  "notify": "always",
  "cloud": false,
  "time_zone": "time-zone",
  "next_run_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `415`, `422`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List client error reports

`GET /api/v1/system/client-errors`

The web app's uncaught errors (the "Something went wrong" page, window errors, unhandled promise rejections), as the browser reported them to `POST /api/client-errors`, grouped by fingerprint (message without numbers + top stack frames) and newest-seen first. Each report carries its count, when it was first and last seen, the page (`url`, path only), the web build and server version it happened on and the reporting user's id and role when signed in. `unresolved` (default true) hides reports marked resolved; `since` keeps reports last seen at or after it; `q` matches the message or url. API 1.41.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `unresolved` | query | boolean | No | Only reports not marked resolved (default true). (default `true`) |
| `since` | query | string (RFC 3339) | No | Only reports last seen at or after this time (RFC 3339). |
| `q` | query | string | No | A substring of the message or the page path (case-insensitive). (max 200 characters) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/client-errors" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of reports.

```json
{
  "data": [
    {
      "id": 1,
      "fingerprint": "fingerprint",
      "message": "This API key lacks the cameras:write scope.",
      "stack": "stack",
      "component_stack": "component-stack",
      "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
      "web_build": "web-build",
      "server_version": "server-version",
      "user_agent": "user-agent",
      "user_id": 1,
      "role": "role",
      "first_seen_at": "2026-10-30T14:05:00Z",
      "last_seen_at": "2026-10-30T14:05:00Z",
      "count": 2,
      "resolved_at": "2026-10-30T14:05:00Z",
      "resolved_note": "resolved-note"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Resolve every client error report

`POST /api/v1/system/client-errors/actions/resolve-all`

Marks every unresolved report resolved, with an optional `note`. Reversible per report with unresolve. API 1.41.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `note` | string | No | What was fixed (optional). (max 2000 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/client-errors/actions/resolve-all" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"note":"note"}'
```

**Response** `200`: How many reports were resolved.

```json
{
  "resolved": 1
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a client error report

`GET /api/v1/system/client-errors/{client_error_id}`

One report with its full stack and component stack. API 1.41.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_error_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/client-errors/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The report.

```json
{
  "id": 1,
  "fingerprint": "fingerprint",
  "message": "This API key lacks the cameras:write scope.",
  "stack": "stack",
  "component_stack": "component-stack",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "web_build": "web-build",
  "server_version": "server-version",
  "user_agent": "user-agent",
  "user_id": 1,
  "role": "role",
  "first_seen_at": "2026-10-30T14:05:00Z",
  "last_seen_at": "2026-10-30T14:05:00Z",
  "count": 2,
  "resolved_at": "2026-10-30T14:05:00Z",
  "resolved_note": "resolved-note"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Resolve a client error report

`POST /api/v1/system/client-errors/{client_error_id}/actions/resolve`

Marks the report resolved now, with an optional `note` (what was fixed, in which version). A report that fires again after that comes back unresolved with its count going on. Audited. API 1.41.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_error_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `note` | string | No | What was fixed (optional). (max 2000 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/client-errors/42/actions/resolve" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"note":"note"}'
```

**Response** `200`: The report, resolved.

```json
{
  "id": 1,
  "fingerprint": "fingerprint",
  "message": "This API key lacks the cameras:write scope.",
  "stack": "stack",
  "component_stack": "component-stack",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "web_build": "web-build",
  "server_version": "server-version",
  "user_agent": "user-agent",
  "user_id": 1,
  "role": "role",
  "first_seen_at": "2026-10-30T14:05:00Z",
  "last_seen_at": "2026-10-30T14:05:00Z",
  "count": 2,
  "resolved_at": "2026-10-30T14:05:00Z",
  "resolved_note": "resolved-note"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Unresolve a client error report

`POST /api/v1/system/client-errors/{client_error_id}/actions/unresolve`

Puts the report back on the unresolved list (the fix did not hold). API 1.41.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_error_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/client-errors/42/actions/unresolve" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The report, unresolved.

```json
{
  "id": 1,
  "fingerprint": "fingerprint",
  "message": "This API key lacks the cameras:write scope.",
  "stack": "stack",
  "component_stack": "component-stack",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "web_build": "web-build",
  "server_version": "server-version",
  "user_agent": "user-agent",
  "user_id": 1,
  "role": "role",
  "first_seen_at": "2026-10-30T14:05:00Z",
  "last_seen_at": "2026-10-30T14:05:00Z",
  "count": 2,
  "resolved_at": "2026-10-30T14:05:00Z",
  "resolved_note": "resolved-note"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List error reports for Vigiora

`GET /api/v1/system/error-reports`

Reports of this server's own failures, kept to be sent to Vigiora so the problem can be fixed: `panic` (an internal error the server recovered from), `crash` (the server process stopped unexpectedly and was restarted) and `client_error` (a new error of the web app). One report per fingerprint, counted on repeats, pending first. Every text is redacted before it is stored: addresses, URLs, e-mails, tokens, file paths and camera, room, site and user names are removed, and no picture, video or request body is ever included. `wire` is exactly what is (or would be) sent. Nothing is sent unless an administrator agrees: `mode` `ask` (default: an admin sends each time), `always` or `never`. `can_send` is false on a server that is not connected to Vigiora cloud: its reports stay here. API 1.118.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/error-reports" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The consent setting and the reports.

```json
{
  "mode": "ask",
  "can_send": false,
  "pending": 1,
  "system": {
    "os": "os",
    "arch": "arch",
    "install": "native"
  },
  "reports": [
    {
      "id": 1,
      "kind": "panic",
      "fingerprint": "fingerprint",
      "message": "This API key lacks the cameras:write scope.",
      "stack": "stack",
      "count": 2,
      "first_seen_at": "2026-10-30T14:05:00Z",
      "last_seen_at": "2026-10-30T14:05:00Z",
      "server_version": "server-version",
      "web_build": "web-build",
      "exit_code": 1,
      "status": "pending",
      "sent_at": "2026-10-30T14:05:00Z",
      "reject_reason": "reject-reason",
      "wire": {
        "kind": "panic",
        "fingerprint": "fingerprint",
        "message": "This API key lacks the cameras:write scope.",
        "stack": "stack",
        "count": 2,
        "first_seen": "2026-10-30T14:05:00Z",
        "last_seen": "2026-10-30T14:05:00Z",
        "server_version": "server-version",
        "web_build": "web-build",
        "os": "os",
        "arch": "arch",
        "install": "native",
        "exit_code": 1
      }
    }
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change whether error reports are sent

`PATCH /api/v1/system/error-reports/settings`

`mode`: `ask` (default: reports wait until an admin sends them), `always` (sent by themselves, without asking) or `never` (every pending report is dismissed, and new ones are kept on this server only, as dismissed). Audited. API 1.118.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_error_report_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `ask`, `always`, `never` | Yes | `ask` (default: an admin sends each report), `always` (sent without asking) or `never` (kept on this server only). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/system/error-reports/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"ask"}'
```

**Response** `200`: The setting.

```json
{
  "mode": "ask",
  "can_send": false
}
```

Errors: `400`, `401`, `403`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send error reports to Vigiora

`POST /api/v1/system/error-reports/actions/send`

Sends these pending `reports` to Vigiora cloud now: each with the `last_seen_at` it was shown with, so the text sent is the `wire` the admin read. 409 (`details.changed_ids`) when any of them changed since (fired again, or was sent or dismissed): nothing is sent; reload and ask again. Without `reports` every pending report is sent, which needs `mode` `always` (409 otherwise). Sent reports are marked `sent`; one that fires again later is pending again, its count still adding up. A report the cloud refuses is marked `rejected` (with `reject_reason`) and the others still go. 409 when this server is not connected to Vigiora cloud; 503 when the cloud could not be reached or did not accept them (they stay pending; `details.sent` counts those that went before). Audited. API 1.118.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `send_error_reports`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reports` | array of object | No | (max 200 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/error-reports/actions/send" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"reports":[{"id":1,"last_seen_at":"2026-10-30T14:05:00Z"}]}'
```

**Response** `200`: How many reports were sent.

```json
{
  "sent": 1,
  "rejected": 1
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Dismiss error reports

`POST /api/v1/system/error-reports/actions/dismiss`

Marks the pending reports with these `ids` (all pending reports when `ids` is omitted) `dismissed`: they are never sent, and stay on this server in the list. A dismissed problem that fires again stays dismissed. API 1.118.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array of integer | No | (max 200 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/error-reports/actions/dismiss" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1]}'
```

**Response** `200`: How many reports were dismissed.

```json
{
  "dismissed": 1
}
```

Errors: `400`, `401`, `403`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the Vigiora Feedback Program status

`GET /api/v1/system/program`

Whether this server is in the Vigiora Feedback Program and the settings the program uses: `update_channel` (`early` gets the program's early builds, which install by themselves only at night, 02:00-05:00 server time, and at most twice a week; `stable` is everyone's), automatic updates, the error reports consent and whether the daily health summary goes to the owner's Vigiora account. Read-only: the program is joined and left on vigiora.com (`leave_url`), and Vigiora cloud applies it to this server. A Docker install (`docker_install`) always stays on `stable`, since it has no automatic rollback. Every update, early or not, is rolled back by itself when the new version does not start, or when a camera that recorded before the update does not record again within 5 minutes. `feedback_ready` is false when this server is not connected to a Vigiora account (feedback cannot be sent). API 1.128.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/program" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The program status.

```json
{
  "program": "program",
  "member": false,
  "update_channel": "stable",
  "docker_install": false,
  "auto_update": false,
  "error_reports": "ask",
  "health_summary": false,
  "feedback_ready": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "leave_url": "leave-url"
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List sent feedback

`GET /api/v1/feedback`

The feedback sent to Vigiora from this server, newest first (at most 100): every user's for an admin, the caller's own otherwise. `feedback_ready` is false when this server is not connected to a Vigiora account; `member` is true in the Vigiora Feedback Program. API 1.128.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/feedback" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The sent feedback.

```json
{
  "feedback_ready": false,
  "member": false,
  "feedback": [
    {
      "id": 1,
      "kind": "idea",
      "username": "automation",
      "text": "text",
      "page": "page",
      "server_version": "server-version",
      "web_build": "web-build",
      "member": false,
      "created_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send feedback to Vigiora

`POST /api/v1/feedback`

Sends `text` (what the person wants to tell Vigiora, up to 4000 characters) with the web app `page` they are on (a path; any query string is dropped), this server's version and the web app build to Vigiora cloud, and keeps it in the list. No screenshot or other data is attached. Open to everyone; for members of the Vigiora Feedback Program it goes to the program's queue. 409 (`details.reason` `not_paired`) when this server is not connected to a Vigiora account; 429 after 20 in a day; 503 when Vigiora could not be reached (nothing is kept; try again). A person sends it from the web app: signed-in sessions only (no API keys, OAuth clients or agents). Audited. API 1.128.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `idea`, `problem`, `praise`, `question`, `other` | No | (default `"other"`) |
| `text` | string | Yes | (max 4000 characters) |
| `page` | string | No | The web app path the person is on. (max 200 characters) |
| `web_build` | string | No | The web app build. (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/feedback" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"text":"text"}'
```

**Response** `201`: The feedback was sent.

```json
{
  "id": 1,
  "kind": "idea",
  "username": "automation",
  "text": "text",
  "page": "page",
  "server_version": "server-version",
  "web_build": "web-build",
  "member": false,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the AI model setting

`GET /api/v1/system/ai-model`

Which AI model answers the assistant (Guardian chat) and makes the picture descriptions: `vigiora` (Vigiora cloud AI, the default), `ollama` (a local Ollama server at `base_url`) or `own_key` (an OpenAI-compatible provider with the owner's own API key: `preset` `openai`, `gemini`, `anthropic` or `custom`). The API key is never returned: only `api_key_set` and its last 4 characters. `capabilities` is what the last test found (`null` = not tested). `uses_vigiora_credits` is false with an own model. `privacy` says where questions and pictures go. Every other AI feature keeps using Vigiora cloud AI. API 1.112.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/system/ai-model" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The setting.

```json
{
  "mode": "vigiora",
  "preset": "openai",
  "base_url": "base-url",
  "model": "model",
  "api_key_set": false,
  "api_key_last4": "api-key-last4",
  "fallback_to_vigiora": false,
  "capabilities": {
    "text": false,
    "pictures": false,
    "tools": false,
    "tested_at": "2026-10-30T14:05:00Z"
  },
  "uses_vigiora_credits": false,
  "routed_features": [
    "routed-feature"
  ],
  "privacy": "privacy",
  "presets": [
    {
      "id": "id",
      "name": "Front door",
      "base_url": "base-url",
      "note": "note"
    }
  ],
  "default_ollama_url": "default-ollama-url",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Choose the AI model

`PATCH /api/v1/system/ai-model`

Changes the AI model of the assistant and the picture descriptions. Only the fields sent change. `mode` `ollama` needs `model` (from `actions/list-models`); `base_url` defaults to `http://127.0.0.1:11434`. `mode` `own_key` needs `model` and `api_key` (optional for `preset` `custom`); a preset fixes `base_url`. `api_key` is stored sealed with the server's secret key and never returned; an empty string clears it; changing the address needs the key again (a stored key is never sent to a new address). `base_url` must be http or https; loopback and private network addresses are allowed, link-local (169.254.0.0/16, fe80::/10) and cloud metadata addresses are refused; a key travels only over https or to this computer / a private network. `fallback_to_vigiora` (default false): when the chosen model cannot read pictures or use tools, those requests go to Vigiora cloud AI instead of being refused. Changing the model forgets the last test. `Idempotency-Key` refused (the body may hold a key). `409 conflict` (`no_secret_key`). It changes where camera pictures are sent, so an AI agent needs the user's approval while human in the loop is on (`x-vigiora-confirm`). API 1.112.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_ai_model`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `vigiora`, `ollama`, `own_key` | No |  |
| `preset` | string: `openai`, `gemini`, `anthropic`, `custom` | No |  |
| `base_url` | string | No | (max 512 characters) |
| `model` | string | No | (max 200 characters) |
| `api_key` | string | No | Write-only (never returned); empty clears it. (max 512 characters) |
| `fallback_to_vigiora` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/system/ai-model" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"vigiora","preset":"openai","base_url":"base-url","model":"model","api_key":"api-key","fallback_to_vigiora":false}'
```

**Response** `200`: The setting.

```json
{
  "mode": "vigiora",
  "preset": "openai",
  "base_url": "base-url",
  "model": "model",
  "api_key_set": false,
  "api_key_last4": "api-key-last4",
  "fallback_to_vigiora": false,
  "capabilities": {
    "text": false,
    "pictures": false,
    "tools": false,
    "tested_at": "2026-10-30T14:05:00Z"
  },
  "uses_vigiora_credits": false,
  "routed_features": [
    "routed-feature"
  ],
  "privacy": "privacy",
  "presets": [
    {
      "id": "id",
      "name": "Front door",
      "base_url": "base-url",
      "note": "note"
    }
  ],
  "default_ollama_url": "default-ollama-url",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test the AI model

`POST /api/v1/system/ai-model/actions/test`

Runs three small checks on the chosen own model and says plainly what works: `text` (a one-word reply), `pictures` (a built-in red test picture) and `tools` (one tool call and its result), sent the way the real calls go (for Ollama: its own `/api/chat` with a context size chosen from the request). `supported: false` means the model cannot do it at all. The optional body is applied for the test only (not saved), so a model can be tried before it is chosen. Testing the saved model remembers the result, which decides what the assistant asks of it. Nothing about the server is sent: only the fixed test prompt and picture. `409 conflict` (`vigiora_chosen`). The server connects to the model's address, so an AI agent needs the user's approval while human in the loop is on (`x-vigiora-confirm`); an admin in the web app is not asked. API 1.112.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `test_ai_model`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `vigiora`, `ollama`, `own_key` | No |  |
| `preset` | string: `openai`, `gemini`, `anthropic`, `custom` | No |  |
| `base_url` | string | No | (max 512 characters) |
| `model` | string | No | (max 200 characters) |
| `api_key` | string | No | Write-only (never returned); empty clears it. (max 512 characters) |
| `fallback_to_vigiora` | boolean | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/ai-model/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"vigiora","preset":"openai","base_url":"base-url","model":"model","api_key":"api-key","fallback_to_vigiora":false}'
```

**Response** `200`: The checks.

```json
{
  "mode": "ollama",
  "model": "model",
  "text": {
    "ok": false,
    "supported": false,
    "detail": "detail"
  },
  "pictures": {
    "ok": false,
    "supported": false,
    "detail": "detail"
  },
  "tools": {
    "ok": false,
    "supported": false,
    "detail": "detail"
  },
  "latency_ms": 1
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the models of a model server

`POST /api/v1/system/ai-model/actions/list-models`

The models an Ollama server has pulled (its `/api/tags`), or the models an OpenAI-compatible provider lists (`/models`). The optional body is applied for the listing only (not saved; `model` is not needed). `502 device_failed` when the server cannot be reached or refuses (the reason, without the key). The server connects to the address in the body, so an AI agent needs the user's approval while human in the loop is on (`x-vigiora-confirm`); an admin in the web app is not asked. API 1.112.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `list_ai_models`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `vigiora`, `ollama`, `own_key` | No |  |
| `preset` | string: `openai`, `gemini`, `anthropic`, `custom` | No |  |
| `base_url` | string | No | (max 512 characters) |
| `model` | string | No | (max 200 characters) |
| `api_key` | string | No | Write-only (never returned); empty clears it. (max 512 characters) |
| `fallback_to_vigiora` | boolean | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/system/ai-model/actions/list-models" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"vigiora","preset":"openai","base_url":"base-url","model":"model","api_key":"api-key","fallback_to_vigiora":false}'
```

**Response** `200`: The model names, sorted.

```json
{
  "models": [
    "model"
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Users

Users and permission groups. Admins only.

### List users

`GET /api/v1/users`

Every user, by ascending id. Admins only.

| Requirement | |
| --- | --- |
| Scope | `users:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/users" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of users.

```json
{
  "data": [
    {
      "id": 1,
      "username": "automation",
      "email": "email",
      "role": "admin",
      "enabled": true,
      "groups": [
        {
          "id": 1,
          "name": "Front door"
        }
      ],
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a user

`POST /api/v1/users`

Creates a user (password 8-72 bytes, stored as a bcrypt hash and never returned). Role `viewer` by default. Admins only. Audit-logged; emits `user.created`.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_user`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `username` | string | Yes | (max 64 characters) |
| `password` | string | Yes | 8-72 bytes. (max 72 characters) |
| `email` | string or null | No | (max 255 characters) |
| `role` | string: `admin`, `operator`, `viewer` | No |  |
| `enabled` | boolean | No |  |
| `group_ids` | array of integer | No | (max 100 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/users" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"username":"automation","password":"password"}'
```

**Response** `201`: The user.

```json
{
  "id": 1,
  "username": "automation",
  "email": "email",
  "role": "admin",
  "enabled": true,
  "groups": [
    {
      "id": 1,
      "name": "Front door"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a user

`GET /api/v1/users/{user_id}`

| Requirement | |
| --- | --- |
| Scope | `users:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `user_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/users/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The user.

```json
{
  "id": 1,
  "username": "automation",
  "email": "email",
  "role": "admin",
  "enabled": true,
  "groups": [
    {
      "id": 1,
      "name": "Front door"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change a user

`PATCH /api/v1/users/{user_id}`

Changes the fields sent (`group_ids` replaces the membership). A new password ends every session of the user. Demoting or disabling the last enabled admin is `409 conflict`. Audit-logged with the changed field names (never values); emits `user.updated`.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_user`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `user_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `username` | string | No | (max 64 characters) |
| `password` | string | No | (max 72 characters) |
| `email` | string or null | No | (max 255 characters) |
| `role` | string: `admin`, `operator`, `viewer` | No |  |
| `enabled` | boolean | No |  |
| `group_ids` | array of integer | No | (max 100 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/users/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"username":"automation","password":"password","email":"email","role":"admin","enabled":true,"group_ids":[1]}'
```

**Response** `200`: The user.

```json
{
  "id": 1,
  "username": "automation",
  "email": "email",
  "role": "admin",
  "enabled": true,
  "groups": [
    {
      "id": 1,
      "name": "Front door"
    }
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a user

`DELETE /api/v1/users/{user_id}`

Deletes the user with their API keys and webhooks. The last enabled admin cannot be deleted (`409 conflict`). Audit-logged; emits `user.deleted`.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_user`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `user_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/users/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Turn a user's two-factor sign-in off

`POST /api/v1/users/{user_id}/actions/reset-two-factor`

For a user who lost their phone and their recovery codes: turns their two-factor sign-in off so the password alone signs in again (they can turn it on again from their account page). Written to the audit log (`user.two_factor.reset`). Answers the user's status after the change (already off: nothing changes). Admins' user sessions only, never an API key. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `user_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/users/42/actions/reset-two-factor" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The user's two-factor status after the change.

```json
{
  "enabled": true,
  "pending": false,
  "enabled_at": "2026-10-30T14:05:00Z",
  "recovery_codes_left": 1,
  "available": false
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List groups

`GET /api/v1/groups`

Permission groups with their members and camera and site grants, by ascending id. Admins only.

| Requirement | |
| --- | --- |
| Scope | `users:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/groups" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of groups.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "description": "description",
      "user_ids": [
        1
      ],
      "camera_grants": [
        {
          "camera_id": 3,
          "camera_name": "Front door",
          "permission": "viewer"
        }
      ],
      "site_grants": [
        {
          "site_id": 1,
          "site_name": "site-name",
          "permission": "viewer",
          "include_zones": false
        }
      ],
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a group

`POST /api/v1/groups`

Members (`user_ids`) get the group's camera and site permissions. Audited.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_group`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `description` | string or null | No | (max 1024 characters) |
| `user_ids` | array of integer | No | (max 1000 items) |
| `camera_grants` | array of object | No | (max 1000 items) |
| `site_grants` | array of object | No | (max 1000 items) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/groups" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","description":"description","user_ids":[1],"camera_grants":[{"camera_id":3,"permission":"viewer"}],"site_grants":[{"site_id":1,"permission":"viewer","include_zones":true}]}'
```

**Response** `201`: The group.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "user_ids": [
    1
  ],
  "camera_grants": [
    {
      "camera_id": 3,
      "camera_name": "Front door",
      "permission": "viewer"
    }
  ],
  "site_grants": [
    {
      "site_id": 1,
      "site_name": "site-name",
      "permission": "viewer",
      "include_zones": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a group

`GET /api/v1/groups/{group_id}`

| Requirement | |
| --- | --- |
| Scope | `users:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `group_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/groups/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The group.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "user_ids": [
    1
  ],
  "camera_grants": [
    {
      "camera_id": 3,
      "camera_name": "Front door",
      "permission": "viewer"
    }
  ],
  "site_grants": [
    {
      "site_id": 1,
      "site_name": "site-name",
      "permission": "viewer",
      "include_zones": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a group

`PATCH /api/v1/groups/{group_id}`

Changes only the fields sent; `user_ids`, `camera_grants` and `site_grants` replace the current lists. Audited.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_group`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `group_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Required on create. (max 128 characters) |
| `description` | string or null | No | (max 1024 characters) |
| `user_ids` | array of integer | No | (max 1000 items) |
| `camera_grants` | array of object | No | (max 1000 items) |
| `site_grants` | array of object | No | (max 1000 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/groups/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","description":"description","user_ids":[1],"camera_grants":[{"camera_id":3,"permission":"viewer"}],"site_grants":[{"site_id":1,"permission":"viewer","include_zones":true}]}'
```

**Response** `200`: The group.

```json
{
  "id": 1,
  "name": "Front door",
  "description": "description",
  "user_ids": [
    1
  ],
  "camera_grants": [
    {
      "camera_id": 3,
      "camera_name": "Front door",
      "permission": "viewer"
    }
  ],
  "site_grants": [
    {
      "site_id": 1,
      "site_name": "site-name",
      "permission": "viewer",
      "include_zones": false
    }
  ],
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a group

`DELETE /api/v1/groups/{group_id}`

Its members lose the permissions it granted. Audited.

| Requirement | |
| --- | --- |
| Scope | `users:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_group`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `group_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/groups/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Config

Configuration export and import (backup and restore). Admins only.

### Export the configuration

`GET /api/v1/config/export`

The server's configuration as one versioned JSON document (format `vigiora.config` version 2): settings, sites, cameras, alert rules, rooms, layouts, outputs and floor plans with their items (not users, recordings or alerts). The floor plan images are not in the JSON (each plan names its file); `format=bundle` (1.27.0) answers a zip instead, `vigiora-config.json` plus the images at the names the plans give (`floorplans/<id>/plan-<version>.png|jpg`), which `POST /config/import` restores. Every credential (stream URL userinfo and credential parameters, ONVIF URL credentials, SRT passphrases) is `REDACTED`. With `include_secrets=true` they are encrypted instead, each as `{"$enc": "v1:<base64url>"}` (AES-256-GCM, key = Argon2id of the `X-Export-Passphrase` header over a random salt, t=3, m=64 MiB, p=1, recorded in `kdf`); that needs a credential with the `admin` scope (an admin session or an `admin`-scoped key) and a passphrase of at least 12 characters. The passphrase is never stored or logged. Every export is written to the audit log and emits `config.exported` (admins only).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `include_secrets` | query | boolean | No |  |
| `format` | query | string: `json`, `bundle` | No | `json` (default) or `bundle`: a zip with the document and the floor plan images. |
| `X-Export-Passphrase` | header | string | No | With `include_secrets=true`; at least 12 characters. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/config/export" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The configuration document, or the bundle.

```json
{
  "format": "vigiora.config",
  "version": 1,
  "exported_at": "2026-10-30T14:05:00Z",
  "server_version": "server-version",
  "includes_secrets": false,
  "kdf": {
    "name": "Front door",
    "salt": "salt",
    "time": 1,
    "memory_kib": 1,
    "parallelism": 1,
    "key_length": 1,
    "cipher": "aes-256-gcm"
  },
  "settings": {
    "default_recording_enabled": false,
    "default_retention_days": 1
  },
  "sites": [
    {
      "id": 1,
      "name": "Front door",
      "description": "description",
      "parent_id": 1
    }
  ],
  "cameras": [
    {
      "id": 1,
      "name": "Front door",
      "enabled": true,
      "recording_enabled": true,
      "retention_days": 7,
      "width": 1920,
      "height": 1080,
      "fps": 15,
      "source_type": "rtsp",
      "connection_type": "local",
      "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
      "source_url": "source-url",
      "ptz_onvif_url": "ptz-onvif-url",
      "srt_passphrase": "srt-passphrase",
      "site_id": 1,
      "tags": [
        "entrance"
      ],
      "ai_guardian": false,
      "has_ptz": false
    }
  ],
  "alert_rules": [
    {
      "camera_id": 3,
      "label": "person",
      "severity": "normal",
      "enabled": true
    }
  ],
  "rooms": [
    {
      "id": 1,
      "name": "Front door",
      "site_id": 1,
      "mode": "mode",
      "interval_seconds": 1,
      "environment": "environment",
      "instruction": "instruction",
      "wake_word": "wake-word",
      "timezone": "timezone",
      "stt_provider": "stt-provider",
      "ai_actuation_enabled": false,
      "ai_ptz_enabled": false,
      "ai_speak_enabled": false,
      "source": "source",
      "speech_microphone": "speech-microphone",
      "cameras": [
        {
          "camera_id": 3,
          "role": "role",
          "is_primary": false,
          "managed": false
        }
      ]
    }
  ],
  "layouts": [
    {
      "id": 1,
      "name": "Front door",
      "owner_username": "owner-username",
      "cells": [
        {
          "camera_id": 3,
          "x": 1,
          "y": 1,
          "w": 1,
          "h": 1
        }
      ]
    }
  ],
  "outputs": [
    {
      "id": 1,
      "name": "Front door",
      "kind": "kind",
      "client_id": null,
      "camera_id": 3,
      "device": "device",
      "volume": 0.5,
      "enabled": true
    }
  ],
  "floor_plans": [
    {
      "id": 1,
      "site_id": 1,
      "name": "Front door",
      "floor_number": 1,
      "sort_order": 1,
      "image": "image",
      "image_type": "png",
      "width_px": 1,
      "height_px": 1,
      "version": 1,
      "items": [
        {
          "kind": "camera",
          "camera_id": 3,
          "speaker_id": 1,
          "device_key": "device-key",
          "entity_id": "entity-id",
          "room_id": 1,
          "analytics_area_id": 1,
          "x": 0.5,
          "y": 0.5,
          "rotation_deg": 0.5,
          "fov_deg": 0.5,
          "range": 0.5,
          "polygon": [
            [
              null
            ]
          ],
          "label": "person",
          "z": 1
        }
      ]
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Import a configuration

`POST /api/v1/config/import`

Applies a document from `GET /config/export` in one transaction. Objects are matched by id (alert rules by camera and label). A field absent from an object keeps the stored value, so a partial object never clears anything; a new object needs its required fields (`id` and `name`; cameras also `stream_url`, outputs `kind`) and gets the create defaults for the rest. Objects missing from the document are left alone: an import never deletes, and importing the same document again changes nothing. Every object is validated with the rules of its create or update (camera source URLs, ONVIF URL, names and lengths, references); any invalid object refuses the whole document (`400 validation_error`, every problem listed in `details.errors` as `{type, id, field, message}`), as does a wrong passphrase or a plan limit: nothing is ever partly applied. A camera's `retention_days` is one of 1, 3, 7, 14, 30, 90 (or its stored value); a reduction deletes recordings and needs `allow_retention_reduction=true` (it is listed in the change's `warnings` and counted in `summary.retention_reductions`). `REDACTED` credentials keep the stored value of the same camera; encrypted ones need the export's `X-Export-Passphrase` (decrypted before the transaction starts). A layout whose owner is not a user here is skipped. `dry_run=true` answers the same report without changing anything. Imported cameras are picked up by the stream reconciler within a minute (recording changes at the recorder's next reconcile or restart). Written to the audit log. At most 8 MiB as JSON. Floor plans (version 2 documents) are matched by id too; their items are replaced when `items` is sent and their references (cameras, rooms, speakers, analytics areas) must exist on the server or in the document. A plan's image comes from a bundle (`Content-Type: application/zip`, the export with `format=bundle`, at most 256 MiB): a new plan needs its image file in the bundle; an existing plan keeps its stored image when the file is not there (noted in `warnings`). Version 1 documents still import.

| Requirement | |
| --- | --- |
| Scope | `admin` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `import_config`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dry_run` | query | boolean | No |  |
| `allow_retention_reduction` | query | boolean | No | Allow lowering a camera's `retention_days` (recordings older than the new period are deleted at the next retention sweep). Without it a reduction refuses the document. |
| `X-Export-Passphrase` | header | string | No | For a document with encrypted values. |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | string: `vigiora.config` | Yes |  |
| `version` | integer | Yes | 1 or 2. A server refuses versions it does not know. |
| `exported_at` | string (RFC 3339) | No |  |
| `server_version` | string | No |  |
| `includes_secrets` | boolean | No |  |
| `kdf` | ConfigKDF or any or null | No |  |
| `settings` | ConfigImportSettings | No |  |
| `sites` | array of ConfigImportSite | No |  |
| `cameras` | array of ConfigImportCamera | No |  |
| `alert_rules` | array of ConfigImportAlertRule | No |  |
| `rooms` | array of ConfigImportRoom | No |  |
| `layouts` | array of ConfigImportLayout | No |  |
| `outputs` | array of ConfigImportOutput | No |  |
| `floor_plans` | array of ConfigImportFloorPlan | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/config/import" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"format":"vigiora.config","version":1}'
```

**Response** `200`: What was (or would be) changed.

```json
{
  "dry_run": false,
  "applied": false,
  "summary": {
    "create": 1,
    "update": 1,
    "unchanged": 1,
    "skipped": 1,
    "retention_reductions": 1
  },
  "changes": [
    {
      "type": "type",
      "id": "id",
      "action": "create",
      "fields": [
        "field"
      ],
      "warnings": [
        "warning"
      ],
      "reason": "reason"
    }
  ]
}
```

Errors: `400`, `401`, `402`, `403`, `413`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## API keys

Personal API keys with scopes. User sessions only.

### List API keys

`GET /api/v1/api-keys`

Your keys, newest first. Admins may pass `user_id` (one user) or `all_users=true`. Legacy keys (`scoped: false`) show their implicit scopes.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `user_id` | query | integer | No | (≥ 1) |
| `all_users` | query | boolean | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/api-keys" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: A page of keys.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "prefix": "vgk_xxxxxxxx",
      "user_id": 1,
      "username": "automation",
      "scoped": true,
      "scopes": [
        "cameras:read"
      ],
      "status": "active",
      "created_at": "2026-10-30T14:05:00Z",
      "last_used_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z",
      "revoked_at": "2026-10-30T14:05:00Z",
      "human_in_the_loop": "inherit"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an API key

`POST /api/v1/api-keys`

Creates a scoped key for yourself. The full key is in the response only once. `admin`, `users:read`, `users:write` and `settings:write` need the admin role. At most 20 active keys per user (`409 conflict`).

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 100 characters) |
| `scopes` | array of string: `cameras:read`, `cameras:write`, `cameras:control`, `alerts:read`, `alerts:write`, `analytics:read`, `analytics:write`, `floorplans:read`, `floorplans:write`, `recordings:read`, `recordings:write`, `clips:share`, `guardian:read`, `guardian:write`, `memory:read`, `memory:write`, `account:read`, `account:write`, `settings:read`, `settings:write`, `users:read`, `users:write`, `events:read`, `webhooks:read`, `webhooks:write`, `network:read`, `devices:read`, `devices:write`, `devices:control`, `admin` | Yes |  |
| `expires_at` | string (RFC 3339) | No | At most 10 years ahead. Use this or `expires_in_days`; neither = no expiry. |
| `expires_in_days` | integer | No | (1–3650) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/api-keys" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"name":"Alarm panel","scopes":["alerts:write","cameras:read"],"expires_in_days":365}'
```

**Response** `201`: The key, with its secret.

```json
{
  "id": 1,
  "name": "Front door",
  "prefix": "vgk_xxxxxxxx",
  "user_id": 1,
  "username": "automation",
  "scoped": true,
  "scopes": [
    "cameras:read"
  ],
  "status": "active",
  "created_at": "2026-10-30T14:05:00Z",
  "last_used_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z",
  "revoked_at": "2026-10-30T14:05:00Z",
  "human_in_the_loop": "inherit",
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an API key

`GET /api/v1/api-keys/{key_id}`

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/api-keys/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The key.

```json
{
  "id": 1,
  "name": "Front door",
  "prefix": "vgk_xxxxxxxx",
  "user_id": 1,
  "username": "automation",
  "scoped": true,
  "scopes": [
    "cameras:read"
  ],
  "status": "active",
  "created_at": "2026-10-30T14:05:00Z",
  "last_used_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z",
  "revoked_at": "2026-10-30T14:05:00Z",
  "human_in_the_loop": "inherit"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change an API key

`PATCH /api/v1/api-keys/{key_id}`

Sets the key's human-in-the-loop override for AI agents (`inherit`, `on`, `off`). Your own keys, or any key for an admin; `off` needs an admin while the server setting is on (`403 forbidden`).

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `human_in_the_loop` | string: `inherit`, `on`, `off` | Yes | `inherit` follows the server setting; `on` and `off` override it for this key or app. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/api-keys/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"human_in_the_loop":"inherit"}'
```

**Response** `200`: The key.

```json
{
  "id": 1,
  "name": "Front door",
  "prefix": "vgk_xxxxxxxx",
  "user_id": 1,
  "username": "automation",
  "scoped": true,
  "scopes": [
    "cameras:read"
  ],
  "status": "active",
  "created_at": "2026-10-30T14:05:00Z",
  "last_used_at": "2026-10-30T14:05:00Z",
  "expires_at": "2026-10-30T14:05:30Z",
  "revoked_at": "2026-10-30T14:05:00Z",
  "human_in_the_loop": "inherit"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke an API key

`DELETE /api/v1/api-keys/{key_id}`

Revokes at once (keys are never hard-deleted). Requests in flight with the key end within 30 seconds. Revoking a revoked key is a no-op.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/api-keys/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `204`: Revoked.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Events

The event log and live event stream.

### List events

`GET /api/v1/events`

The event log (7 days), oldest first; page forward with the cursor. Visibility as for the stream. `from` is inclusive, `to` exclusive.

| Requirement | |
| --- | --- |
| Scope | `events:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `types` | query | string | No | Comma-separated event types. |
| `camera_ids` | query | string | No | Comma-separated camera ids (at most 100). |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/events" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of events.

```json
{
  "data": [
    {
      "id": "id",
      "type": "type",
      "time": "2026-10-30T14:05:00Z",
      "camera_id": 3,
      "data": {}
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stream events (SSE)

`GET /api/v1/events/stream`

Server-Sent Events: see Events in the description. Filters as for the list.

| Requirement | |
| --- | --- |
| Scope | `events:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `types` | query | string | No | Comma-separated event types. |
| `camera_ids` | query | string | No | Comma-separated camera ids (at most 100). |
| `last_event_id` | query | string | No | Resume after this event (or send the Last-Event-ID header). (max 26 characters) |
| `Last-Event-ID` | header | string | No |  |
| `format` | query | string: `v1`, `things` | No | `v1` (default): the event envelope. `things` (API 1.18.0): the Things envelope (CloudEvents attributes; `event:` is the things type, e.g. `vigiora.motion.started`); `types` still filters by the v1 types. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/events/stream" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: The event stream. (`text/event-stream`)

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Webhooks

Signed event delivery to your URLs. Admins only.

### List webhooks

`GET /api/v1/webhooks`

Every webhook of the server, newest first, each with its newest delivery (`last_delivery_*`). Admins, and operators' sessions (read only; the `webhooks:*` scopes stay admin-only for keys).

| Requirement | |
| --- | --- |
| Scope | `webhooks:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/webhooks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of webhooks.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
      "event_types": [
        "event-type"
      ],
      "camera_ids": [
        3
      ],
      "enabled": true,
      "allow_insecure": false,
      "consecutive_failures": 1,
      "disabled_reason": "disabled-reason",
      "disabled_at": "2026-10-30T14:05:00Z",
      "last_delivery_at": "2026-10-30T14:05:00Z",
      "last_delivery_status": "pending",
      "last_delivery_code": 1,
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a webhook

`POST /api/v1/webhooks`

The signing `secret` is returned only here (and by rotate-secret). At most 50 webhooks per server.

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_webhook`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 100 characters) |
| `url` | string | Yes | (max 2048 characters) |
| `event_types` | array of string: `alert.created`, `alert.acknowledged`, `alert.unacknowledged`, `guardian.event`, `camera.online`, `camera.offline`, `camera.moved`, `motion.started`, `motion.ended`, `presence.changed`, `recording.started`, `recording.stopped`, `clip.ready`, `clip.failed`, `ptz.moved`, `settings.changed`, `webhook.disabled`, `config.exported`, `user.created`, `user.updated`, `user.deleted`, `network.camera_found`, `alert_rule.created`, `alert_rule.updated`, `alert_rule.deleted`, `device.state_changed`, `bay.occupied`, `bay.freed`, `bluetooth.device_found`, `plan.applied`, `robot.wifi_motion`, `robot.nav.started`, `robot.nav.arrived`, `robot.nav.ended`, `robot.place.learned` | No | (max 50 items) |
| `camera_ids` | array of integer | No | (max 100 items) |
| `enabled` | boolean | No | (default `true`) |
| `allow_insecure` | boolean | No | Allows private (LAN) targets and plain http to them. Needs an admin session or an admin-scoped key. (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/webhooks" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"}'
```

**Response** `201`: The webhook, with its secret.

```json
{
  "id": 1,
  "name": "Front door",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "event_types": [
    "event-type"
  ],
  "camera_ids": [
    3
  ],
  "enabled": true,
  "allow_insecure": false,
  "consecutive_failures": 1,
  "disabled_reason": "disabled-reason",
  "disabled_at": "2026-10-30T14:05:00Z",
  "last_delivery_at": "2026-10-30T14:05:00Z",
  "last_delivery_status": "pending",
  "last_delivery_code": 1,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "secret": "secret"
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a webhook

`GET /api/v1/webhooks/{webhook_id}`

Never shows the secret.

| Requirement | |
| --- | --- |
| Scope | `webhooks:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/webhooks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The webhook.

```json
{
  "id": 1,
  "name": "Front door",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "event_types": [
    "event-type"
  ],
  "camera_ids": [
    3
  ],
  "enabled": true,
  "allow_insecure": false,
  "consecutive_failures": 1,
  "disabled_reason": "disabled-reason",
  "disabled_at": "2026-10-30T14:05:00Z",
  "last_delivery_at": "2026-10-30T14:05:00Z",
  "last_delivery_status": "pending",
  "last_delivery_code": 1,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a webhook

`PATCH /api/v1/webhooks/{webhook_id}`

Changes only the fields sent. `enabled: true` re-enables a disabled webhook and resets its failure count.

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_webhook`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 100 characters) |
| `url` | string | No | (max 2048 characters) |
| `event_types` | array of string: `alert.created`, `alert.acknowledged`, `alert.unacknowledged`, `guardian.event`, `camera.online`, `camera.offline`, `camera.moved`, `motion.started`, `motion.ended`, `presence.changed`, `recording.started`, `recording.stopped`, `clip.ready`, `clip.failed`, `ptz.moved`, `settings.changed`, `webhook.disabled`, `config.exported`, `user.created`, `user.updated`, `user.deleted`, `network.camera_found`, `alert_rule.created`, `alert_rule.updated`, `alert_rule.deleted`, `device.state_changed`, `bay.occupied`, `bay.freed`, `bluetooth.device_found`, `plan.applied`, `robot.wifi_motion`, `robot.nav.started`, `robot.nav.arrived`, `robot.nav.ended`, `robot.place.learned` | No | (max 50 items) |
| `camera_ids` | array of integer | No | (max 100 items) |
| `enabled` | boolean | No |  |
| `allow_insecure` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/webhooks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","url":"https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx","event_types":["alert.created"],"camera_ids":[3],"enabled":true,"allow_insecure":false}'
```

**Response** `200`: The webhook.

```json
{
  "id": 1,
  "name": "Front door",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "event_types": [
    "event-type"
  ],
  "camera_ids": [
    3
  ],
  "enabled": true,
  "allow_insecure": false,
  "consecutive_failures": 1,
  "disabled_reason": "disabled-reason",
  "disabled_at": "2026-10-30T14:05:00Z",
  "last_delivery_at": "2026-10-30T14:05:00Z",
  "last_delivery_status": "pending",
  "last_delivery_code": 1,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a webhook

`DELETE /api/v1/webhooks/{webhook_id}`

Deletes it and its delivery log.

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_webhook`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/webhooks/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rotate the signing secret

`POST /api/v1/webhooks/{webhook_id}/actions/rotate-secret`

A new secret takes effect at once and is returned only here.

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `rotate_webhook_secret`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/webhooks/42/actions/rotate-secret" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The webhook, with its new secret.

```json
{
  "id": 1,
  "name": "Front door",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "event_types": [
    "event-type"
  ],
  "camera_ids": [
    3
  ],
  "enabled": true,
  "allow_insecure": false,
  "consecutive_failures": 1,
  "disabled_reason": "disabled-reason",
  "disabled_at": "2026-10-30T14:05:00Z",
  "last_delivery_at": "2026-10-30T14:05:00Z",
  "last_delivery_status": "pending",
  "last_delivery_code": 1,
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "secret": "secret"
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send a test event

`POST /api/v1/webhooks/{webhook_id}/actions/test`

Sends a `webhook.test` event now (one attempt, no retries) and returns the delivery. A disabled webhook answers `409 conflict`.

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/webhooks/42/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The delivery.

```json
{
  "id": 1,
  "webhook_id": 1,
  "event_id": "event-id",
  "event_type": "event-type",
  "status": "pending",
  "attempts": 1,
  "next_attempt_at": "2026-10-30T14:05:00Z",
  "last_attempt_at": "2026-10-30T14:05:00Z",
  "last_status_code": 1,
  "last_error": "last-error",
  "duration_ms": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "delivered_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delivery log

`GET /api/v1/webhooks/{webhook_id}/deliveries`

The webhooks deliveries (14 days), newest first.

| Requirement | |
| --- | --- |
| Scope | `webhooks:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `status` | query | string: `pending`, `delivering`, `succeeded`, `failed`, `held` | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/webhooks/42/deliveries" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of deliveries.

```json
{
  "data": [
    {
      "id": 1,
      "webhook_id": 1,
      "event_id": "event-id",
      "event_type": "event-type",
      "status": "pending",
      "attempts": 1,
      "next_attempt_at": "2026-10-30T14:05:00Z",
      "last_attempt_at": "2026-10-30T14:05:00Z",
      "last_status_code": 1,
      "last_error": "last-error",
      "duration_ms": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "delivered_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Redeliver

`POST /api/v1/webhooks/{webhook_id}/deliveries/{delivery_id}/actions/redeliver`

Queues the same payload again as a new delivery, due at once (with its own retries).

| Requirement | |
| --- | --- |
| Scope | `webhooks:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webhook_id` | path | integer | Yes | (≥ 1) |
| `delivery_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/webhooks/42/deliveries/42/actions/redeliver" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The new delivery.

```json
{
  "id": 1,
  "webhook_id": 1,
  "event_id": "event-id",
  "event_type": "event-type",
  "status": "pending",
  "attempts": 1,
  "next_attempt_at": "2026-10-30T14:05:00Z",
  "last_attempt_at": "2026-10-30T14:05:00Z",
  "last_status_code": 1,
  "last_error": "last-error",
  "duration_ms": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "delivered_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Automations

Rules drawn on a canvas: a trigger (a detection, a device changing, a camera going offline, a time of day, a web address, or by hand), conditions and actions (a notification, a device command, a light effect, a sound or siren, a PTZ preset, the AI guardian, an outgoing webhook, a wait). Admins and operators.

### List automations

`GET /api/v1/automations`

The automations drawn on the Automations page, newest first: each one's name, on/off switch, graph (triggers, conditions and actions joined by wires), whether it has sensitive actions and whether an admin confirmed them, and its last run. The webhook secret is never shown. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of automations.

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "enabled": true,
      "graph": {
        "nodes": [
          {
            "id": "id",
            "kind": "trigger",
            "type": "type",
            "params": {},
            "x": 0.5,
            "y": 0.5
          }
        ],
        "edges": [
          {
            "from": "from",
            "to": "to"
          }
        ]
      },
      "sensitive": false,
      "sensitive_reasons": [
        "lock"
      ],
      "confirmed": false,
      "confirmed_at": "2026-10-30T14:05:00Z",
      "has_webhook": false,
      "blueprint_id": "blueprint-id",
      "created_by": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "last_run_at": "2026-10-30T14:05:00Z",
      "last_result": "ok"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an automation

`POST /api/v1/automations`

Stores an automation. The graph is checked first (`400 validation_error`, `details.problems` lists each problem in plain words with its `node_id` and `field`): at least one trigger, at most 40 steps, no loop, every step reachable from a trigger, every step type known (`GET /automations/node-types`) and every setting valid; cameras must exist and devices must be shared with Vigiora. `enabled` defaults to true. An automation with sensitive actions (unlock a door, open a garage door, arm or disarm the alarm, a siren) cannot be turned on until an admin confirms it (`409 conflict`, `details.reason` `sensitive_confirmation_required`): an admin signed in may pass `confirm_sensitive: true` (`403 forbidden` for anyone else). A graph with a webhook trigger gets a secret web address, returned once in `webhook_path` (POST to it on the LAN to run the automation). At most 200 automations (`409 conflict`). It makes the server act by itself, so it needs confirmation from an AI agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_automation`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 80 characters) |
| `enabled` | boolean | No |  |
| `graph` | AutomationGraph | No |  |
| `confirm_sensitive` | boolean | No | An admin, signed in, confirms the sensitive actions (refused for anyone else). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","enabled":true,"graph":{"nodes":[{"id":"id","kind":"trigger","type":"type","params":{},"x":0.5,"y":0.5}],"edges":[{"from":"from","to":"to"}]},"confirm_sensitive":false}'
```

**Response** `201`: The automation (with its webhook path, shown this once).

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  },
  "sensitive": false,
  "sensitive_reasons": [
    "lock"
  ],
  "confirmed": false,
  "confirmed_at": "2026-10-30T14:05:00Z",
  "has_webhook": false,
  "blueprint_id": "blueprint-id",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_run_at": "2026-10-30T14:05:00Z",
  "last_result": "ok",
  "webhook_path": "webhook-path"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the steps an automation can use

`GET /api/v1/automations/node-types`

The palette of the automation editor: every trigger, condition and action type with its settings (name, type, whether it is required, bounds, choices, default). `wired: false` marks a type the server shows but cannot run yet. `sensitive_reasons` words each reason an automation needs an admin's confirmation. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations/node-types" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The node types.

```json
{
  "node_types": [
    {
      "kind": "trigger",
      "type": "type",
      "fields": [
        {
          "name": "Front door",
          "type": "string",
          "required": false,
          "min": 0.5,
          "max": 0.5,
          "max_len": 1,
          "enum": [
            "enum"
          ],
          "default": null,
          "domains": [
            "domain"
          ]
        }
      ],
      "wired": false
    }
  ],
  "sensitive_reasons": {},
  "cameras": [
    {
      "camera_id": 3,
      "device": "device",
      "label": "person"
    }
  ],
  "devices": [
    {
      "device": "device",
      "label": "person",
      "domain": "domain",
      "control": false
    }
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check an automation's graph

`POST /api/v1/automations/actions/validate`

Checks a graph without storing it, as create and update would, and answers the problems in plain words (an empty list when it is valid) and the reasons it would need an admin's confirmation. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `graph` | AutomationGraph | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/actions/validate" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"graph":{"nodes":[{"id":"id","kind":"trigger","type":"type","params":{},"x":0.5,"y":0.5}],"edges":[{"from":"from","to":"to"}]}}'
```

**Response** `200`: The result.

```json
{
  "valid": false,
  "problems": [
    {
      "node_id": "node-id",
      "field": "field",
      "message": "This API key lacks the cameras:write scope."
    }
  ],
  "sensitive_reasons": [
    "lock"
  ]
}
```

Errors: `400`, `401`, `403`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create an automation from a blueprint

`POST /api/v1/automations/actions/import`

Answers a blueprint's questions and stores the automation. Send `blueprint_id` (a built-in blueprint, GET /automations/blueprints) or `blueprint` (a blueprint file, at most 256 KB, checked as untrusted input) with `answers` (input key to a camera id, a device key, a text or true/false). Wrong or missing answers and an invalid graph give `400 validation_error` with `details.problems`. An automation with sensitive actions is saved switched off unless an admin signed in passes `confirm_sensitive: true`. It makes the server act by itself, so it needs confirmation from an AI agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `import_automation`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `blueprint_id` | string | No | A built-in blueprint. |
| `blueprint` | object | No | A blueprint file's content. |
| `answers` | object | No | Input key to its answer. |
| `name` | string | No | (max 80 characters) |
| `enabled` | boolean | No |  |
| `confirm_sensitive` | boolean | No | An admin signed in confirms the sensitive actions. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/actions/import" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"blueprint_id":"blueprint-id","blueprint":{},"answers":{},"name":"Front door","enabled":true,"confirm_sensitive":false}'
```

**Response** `201`: The automation (with its webhook path, shown this once).

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  },
  "sensitive": false,
  "sensitive_reasons": [
    "lock"
  ],
  "confirmed": false,
  "confirmed_at": "2026-10-30T14:05:00Z",
  "has_webhook": false,
  "blueprint_id": "blueprint-id",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_run_at": "2026-10-30T14:05:00Z",
  "last_result": "ok",
  "webhook_path": "webhook-path"
}
```

Errors: `400`, `401`, `403`, `409`, `413`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Built-in automation blueprints

`GET /api/v1/automations/blueprints`

The blueprints shipped with the server (welcome home, doorbell, camera offline, …), each with its questions and, for camera and device questions, the cameras and devices of this server that fit (`candidates`; a device commanded by the automation must be shared for control). `sensitive` is true when the blueprint can unlock, open a garage door, arm or disarm or sound a siren with every optional step on. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations/blueprints" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The blueprints.

```json
{
  "items": [
    {
      "id": "id",
      "name": "Front door",
      "description": "description",
      "builtin": false,
      "sensitive": false,
      "inputs": [
        {
          "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
          "type": "camera",
          "label": "person",
          "domains": [
            "domain"
          ],
          "control": false,
          "optional": false,
          "default": null,
          "candidates": [
            {
              "camera_id": null,
              "device": null,
              "label": null
            }
          ]
        }
      ],
      "blueprint": {
        "format": "vigiora.automation-blueprint",
        "version": 1,
        "id": "id",
        "name": "Front door",
        "description": "description",
        "inputs": [
          {
            "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
            "type": "camera",
            "label": "person",
            "domains": [
              null
            ],
            "control": false,
            "optional": false,
            "default": null
          }
        ],
        "graph": {
          "nodes": [
            {
              "id": null,
              "kind": null,
              "type": null,
              "params": null,
              "x": null,
              "y": null,
              "include_if": null
            }
          ],
          "edges": [
            {
              "from": null,
              "to": null
            }
          ]
        }
      }
    }
  ]
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Check a blueprint file

`POST /api/v1/automations/blueprints/actions/check`

Reads a blueprint file (at most 256 KB; unknown fields, unknown step types and invalid settings are refused with `400 validation_error`) and answers it with its questions and the matching cameras and devices, as GET /automations/blueprints does for the built-in ones. Stores nothing. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `blueprint` | object | Yes | The blueprint file's content. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/blueprints/actions/check" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"blueprint":{}}'
```

**Response** `200`: The blueprint with its questions.

```json
{
  "id": "id",
  "name": "Front door",
  "description": "description",
  "builtin": false,
  "sensitive": false,
  "inputs": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "type": "camera",
      "label": "person",
      "domains": [
        "domain"
      ],
      "control": false,
      "optional": false,
      "default": null,
      "candidates": [
        {
          "camera_id": 3,
          "device": "device",
          "label": "person"
        }
      ]
    }
  ],
  "blueprint": {
    "format": "vigiora.automation-blueprint",
    "version": 1,
    "id": "id",
    "name": "Front door",
    "description": "description",
    "inputs": [
      {
        "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
        "type": "camera",
        "label": "person",
        "domains": [
          "domain"
        ],
        "control": false,
        "optional": false,
        "default": null
      }
    ],
    "graph": {
      "nodes": [
        {
          "id": "id",
          "kind": "trigger",
          "type": "type",
          "params": {},
          "x": 0.5,
          "y": 0.5,
          "include_if": "include-if"
        }
      ],
      "edges": [
        {
          "from": "from",
          "to": "to"
        }
      ]
    }
  }
}
```

Errors: `400`, `401`, `403`, `413`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read one automation

`GET /api/v1/automations/{automation_id}`

One automation with its graph. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The automation.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  },
  "sensitive": false,
  "sensitive_reasons": [
    "lock"
  ],
  "confirmed": false,
  "confirmed_at": "2026-10-30T14:05:00Z",
  "has_webhook": false,
  "blueprint_id": "blueprint-id",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_run_at": "2026-10-30T14:05:00Z",
  "last_result": "ok"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change an automation

`PATCH /api/v1/automations/{automation_id}`

Changes the name, the on/off switch or the whole graph (fields left out keep their value), with the checks of create. Moving steps or renaming keeps an admin's confirmation; changing a sensitive action (another lock, another command) needs a new one before the automation can stay on (`409 conflict`). Adding a webhook trigger makes a web address, returned once in `webhook_path`; removing it deletes the address. It needs confirmation from an AI agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_automation`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 80 characters) |
| `enabled` | boolean | No |  |
| `graph` | AutomationGraph | No |  |
| `confirm_sensitive` | boolean | No | An admin, signed in, confirms the sensitive actions (refused for anyone else). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/automations/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","enabled":true,"graph":{"nodes":[{"id":"id","kind":"trigger","type":"type","params":{},"x":0.5,"y":0.5}],"edges":[{"from":"from","to":"to"}]},"confirm_sensitive":false}'
```

**Response** `200`: The automation after the change.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  },
  "sensitive": false,
  "sensitive_reasons": [
    "lock"
  ],
  "confirmed": false,
  "confirmed_at": "2026-10-30T14:05:00Z",
  "has_webhook": false,
  "blueprint_id": "blueprint-id",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_run_at": "2026-10-30T14:05:00Z",
  "last_result": "ok",
  "webhook_path": "webhook-path"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an automation

`DELETE /api/v1/automations/{automation_id}`

Deletes an automation, its web address and its run log. It needs confirmation from an AI agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_automation`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/automations/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run or test an automation now

`POST /api/v1/automations/{automation_id}/actions/run`

Runs an automation by hand, on or off, from its manual trigger (else its first trigger) with a sample of what that trigger would hand over; its conditions still apply. `dry_run: true` acts on nothing: every condition is checked and every action is described (`would_run`), and the run is answered (`200`) and logged as a test. A real run happens in the background (`202`; waits can take minutes) and lands in the run log; `409 conflict` while it is already running. An automation with sensitive actions runs only once an admin confirmed it, and an API key or agent must pass `acknowledge_sensitive: true` after the user approved it (`409 conflict`, `details.reason` `sensitive_confirmation_required`); through MCP that always asks the person. `503 service_unavailable` when the engine is not running. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `run_automation`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dry_run` | boolean | No | Act on nothing; answer what would happen. |
| `acknowledge_sensitive` | boolean | No | API keys and agents: the user approved running sensitive actions. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/42/actions/run" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"dry_run":false,"acknowledge_sensitive":false}'
```

**Response** `200`: The dry run.

```json
{
  "id": 1,
  "automation_id": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "duration_ms": 1,
  "trigger_node": "trigger-node",
  "trigger_type": "trigger-type",
  "trigger_summary": {},
  "result": "ok",
  "dry_run": false,
  "steps": [
    {
      "node_id": "node-id",
      "type": "type",
      "status": "fired",
      "message": "This API key lacks the cameras:write scope.",
      "ms": 1
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Confirm an automation's sensitive actions

`POST /api/v1/automations/{automation_id}/actions/confirm`

An admin, signed in, confirms the automation's sensitive actions as they are now ("This automation can unlock a door"), so it can be turned on and they run. A later change to a sensitive action needs a new confirmation. Never through an API key or an agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/42/actions/confirm" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The confirmed automation.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  },
  "sensitive": false,
  "sensitive_reasons": [
    "lock"
  ],
  "confirmed": false,
  "confirmed_at": "2026-10-30T14:05:00Z",
  "has_webhook": false,
  "blueprint_id": "blueprint-id",
  "created_by": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "last_run_at": "2026-10-30T14:05:00Z",
  "last_result": "ok"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Replace an automation's web address

`POST /api/v1/automations/{automation_id}/actions/rotate-webhook`

Makes a new secret web address for the automation's webhook trigger, returned once; the old one stops working. `409 conflict` when the automation has no webhook trigger. The address answers on the server's local network only. It needs confirmation from an AI agent. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `rotate_automation_webhook`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/automations/42/actions/rotate-webhook" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The new address.

```json
{
  "webhook_path": "webhook-path"
}
```

Errors: `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Export an automation as a blueprint

`GET /api/v1/automations/{automation_id}/blueprint`

The automation as a blueprint file to share: every camera, device, known face, number plate, preset and web address becomes a question for whoever imports it, so nothing of this home is in the file; web addresses are always removed and the webhook token is never included. API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations/42/blueprint" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The blueprint file.

```json
{
  "format": "vigiora.automation-blueprint",
  "version": 1,
  "id": "id",
  "name": "Front door",
  "description": "description",
  "inputs": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "type": "camera",
      "label": "person",
      "domains": [
        "domain"
      ],
      "control": false,
      "optional": false,
      "default": null
    }
  ],
  "graph": {
    "nodes": [
      {
        "id": "id",
        "kind": "trigger",
        "type": "type",
        "params": {},
        "x": 0.5,
        "y": 0.5,
        "include_if": "include-if"
      }
    ],
    "edges": [
      {
        "from": "from",
        "to": "to"
      }
    ]
  }
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### An automation's run log

`GET /api/v1/automations/{automation_id}/runs`

The automation's runs, newest first (the last 200 are kept): when, which trigger and what it handed over (short), each step's result (`fired`, `pass`, `fail`, `ok`, `error`, `blocked`, `would_run`) with a plain message and its duration, and the overall result (`ok`, `partial`, `failed`, `not_met`, `no_steps`, `dry_run`). API 1.111.0.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `automation_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/automations/42/runs" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of runs.

```json
{
  "data": [
    {
      "id": 1,
      "automation_id": 1,
      "started_at": "2026-10-30T14:05:00Z",
      "duration_ms": 1,
      "trigger_node": "trigger-node",
      "trigger_type": "trigger-type",
      "trigger_summary": {},
      "result": "ok",
      "dry_run": false,
      "steps": [
        {
          "node_id": "node-id",
          "type": "type",
          "status": "fired",
          "message": "This API key lacks the cameras:write scope.",
          "ms": 1
        }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Network

Discovery on the server's own LAN (self-hosted servers only): scan the directly connected private subnets for devices, open camera ports and ONVIF cameras, and resolve a MAC address to its current IP (DHCP addresses change; MACs do not). Only RFC 1918 subnets connected to a physical interface are ever probed (never CGNAT, public or link-local ranges), at most a /22 (1022 hosts) per scan, with TCP connects to an allowlist of ports (80, 443, 554, 8000, 8080, 8899, 9000, 34567, 37777) and one WS-Discovery multicast probe. Automatic camera following has priority on the LAN: while it sweeps, scans and lookup sweeps answer `503 network_busy` with `Retry-After` at once (and a running scan it interrupts ends `failed` with `error: busy…`); lookup sweeps also share a server-wide budget of 4 per 10 minutes (`503 network_busy`, `details.reason: lookup_budget`). When discovery cannot work here (hosted server, a container without host networking, no neighbour table on this OS, no private subnet) every operation answers `409 network_unavailable` with `details.reason` (`hosted`, `container_network` — a Docker/Podman bridge, Kubernetes pod, containerd or LXC container without host networking, or Docker Desktop —, `not_supported`, `no_lan`, `disabled`), never an empty result (except `GET /network/auto-scan`, which answers `available: false` with the reason). Automatic scanning (`/network/auto-scan`) runs these scans on a schedule and keeps the new camera candidates (`/network/candidates`). Admins and operators with `network:read`.

### Scan the local network

`POST /api/v1/network/actions/scan`

Starts a scan of the server's directly connected private subnets (each narrowed to the /22 around the server's own address; at most 1022 hosts in all) and answers `202` with the scan to poll (`GET /network/scans/{scan_id}`). The scan sweeps every host with one TCP connect (any answer makes the OS learn its MAC), reads the neighbour (ARP) table, checks the requested allowlisted ports on live hosts, sends one ONVIF WS-Discovery probe (multicast, plus unicast to hosts with a scanned port open; an answer counts only with a device URL on the answering address; a camera with ONVIF disabled answers nothing) and, with `resolve_names: true`, looks up reverse DNS names (off by default: it sends the LAN's addresses to the server's resolver). It ends within about 60 seconds (`failed` with `error: timed out` otherwise, keeping what it found). When the 1022-host cap leaves connected subnets out, `truncated` is true and `skipped_subnets` lists them; scan one with `subnet`. While camera following sweeps: `503 network_busy`. One scan runs at a time per server: another request meanwhile is `409 scan_in_progress` with `details.scan_id`. At most 2 scans a minute per credential (`429 rate_limited`). `subnet` must lie inside a connected private subnet and be /22 to /30; `ports` must be from the allowlist (`details.allowed_ports` on refusal).

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_network_scan`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `subnet` | string | No | One subnet to scan (CIDR, /22 to /30) inside a connected private subnet. Default every connected subnet. |
| `ports` | array of integer: `80`, `443`, `554`, `8000`, `8080`, `8899`, `9000`, `34567`, `37777` | No | Ports to check on live hosts (default all of them; `[]` none). (max 8 items) |
| `onvif` | boolean | No | Send an ONVIF WS-Discovery probe (default true). |
| `resolve_names` | boolean | No | Look up reverse DNS names of the devices found (default false). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/network/actions/scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"subnet":"192.168.1.0/24","ports":[80],"onvif":false,"resolve_names":false}'
```

**Response** `202`: The scan started.

```json
{
  "id": "id",
  "status": "running",
  "phase": "sweep",
  "progress": 1,
  "subnets": [
    "subnet"
  ],
  "ports": [
    1
  ],
  "onvif": false,
  "resolve_names": false,
  "hosts_total": 1,
  "truncated": false,
  "skipped_subnets": [
    "skipped-subnet"
  ],
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "error": null,
  "device_count": 2,
  "devices": [
    {
      "ip": "ip",
      "mac": "mac",
      "vendor": "vendor",
      "vendor_class": "camera",
      "known_camera_name": "known-camera-name",
      "model": "model",
      "firmware": "firmware",
      "serial": "serial",
      "name": "Front door",
      "discovery": [
        "sadp"
      ],
      "dhcp": false,
      "activated": false,
      "ip_conflict": false,
      "conflict_mac": "conflict-mac",
      "catalog": {
        "brand_id": "brand-id",
        "brand": "brand",
        "model": "model",
        "name": "Front door",
        "matched_by": "model",
        "rtsp": "yes",
        "verified": false,
        "source": "source",
        "notes": "notes",
        "credential_hint": "credential-hint",
        "default_username": "default-username",
        "type": "type",
        "ptz": false,
        "likely_brands": [
          "likely-brand"
        ],
        "templates": [
          {
            "id": null,
            "label": null,
            "url": null,
            "main": null,
            "kind": null,
            "protocol": null,
            "verified": null,
            "notes": null
          }
        ]
      },
      "hostname": "hostname",
      "open_ports": [
        1
      ],
      "onvif": false,
      "onvif_url": "onvif-url",
      "last_seen": "2026-10-30T14:05:00Z",
      "known_camera_id": 3,
      "is_known_camera": false,
      "is_self": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a network scan

`GET /api/v1/network/scans/{scan_id}`

The scan's status (`running`, `done`, `failed`), phase, progress (0–100) and the devices found so far (all of them once finished; at most 1022). The last 10 scans are kept in memory, not across restarts.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `scan_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/scans/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The scan.

```json
{
  "id": "id",
  "status": "running",
  "phase": "sweep",
  "progress": 1,
  "subnets": [
    "subnet"
  ],
  "ports": [
    1
  ],
  "onvif": false,
  "resolve_names": false,
  "hosts_total": 1,
  "truncated": false,
  "skipped_subnets": [
    "skipped-subnet"
  ],
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "error": null,
  "device_count": 2,
  "devices": [
    {
      "ip": "ip",
      "mac": "mac",
      "vendor": "vendor",
      "vendor_class": "camera",
      "known_camera_name": "known-camera-name",
      "model": "model",
      "firmware": "firmware",
      "serial": "serial",
      "name": "Front door",
      "discovery": [
        "sadp"
      ],
      "dhcp": false,
      "activated": false,
      "ip_conflict": false,
      "conflict_mac": "conflict-mac",
      "catalog": {
        "brand_id": "brand-id",
        "brand": "brand",
        "model": "model",
        "name": "Front door",
        "matched_by": "model",
        "rtsp": "yes",
        "verified": false,
        "source": "source",
        "notes": "notes",
        "credential_hint": "credential-hint",
        "default_username": "default-username",
        "type": "type",
        "ptz": false,
        "likely_brands": [
          "likely-brand"
        ],
        "templates": [
          {
            "id": null,
            "label": null,
            "url": null,
            "main": null,
            "kind": null,
            "protocol": null,
            "verified": null,
            "notes": null
          }
        ]
      },
      "hostname": "hostname",
      "open_ports": [
        1
      ],
      "onvif": false,
      "onvif_url": "onvif-url",
      "last_seen": "2026-10-30T14:05:00Z",
      "known_camera_id": 3,
      "is_known_camera": false,
      "is_self": false
    }
  ]
}
```

Errors: `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List devices on the local network

`GET /api/v1/network/devices`

The latest known devices: those of the most recent scan, updated with the current neighbour table of the connected subnets (no new traffic is sent). Ordered by IP. `known_camera_id` is the Vigiora camera with this MAC or address when you may view it; `is_known_camera` is true for any camera. Ports, ONVIF and hostnames come from the last scan only.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `vendor` | query | string | No | Vendor (the short maker name from the IEEE registry) contains this text, case-insensitive. (max 64 characters) |
| `has_port` | query | integer: `80`, `443`, `554`, `8000`, `8080`, `8899`, `9000`, `34567`, `37777` | No | Only devices with this (allowlisted) port open in the last scan. |
| `unassigned` | query | boolean | No | `true`: only devices no Vigiora camera uses; `false`: only those one does. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of devices.

```json
{
  "data": [
    {
      "ip": "ip",
      "mac": "mac",
      "vendor": "vendor",
      "vendor_class": "camera",
      "known_camera_name": "known-camera-name",
      "model": "model",
      "firmware": "firmware",
      "serial": "serial",
      "name": "Front door",
      "discovery": [
        "sadp"
      ],
      "dhcp": false,
      "activated": false,
      "ip_conflict": false,
      "conflict_mac": "conflict-mac",
      "catalog": {
        "brand_id": "brand-id",
        "brand": "brand",
        "model": "model",
        "name": "Front door",
        "matched_by": "model",
        "rtsp": "yes",
        "verified": false,
        "source": "source",
        "notes": "notes",
        "credential_hint": "credential-hint",
        "default_username": "default-username",
        "type": "type",
        "ptz": false,
        "likely_brands": [
          "likely-brand"
        ],
        "templates": [
          {
            "id": null,
            "label": null,
            "url": null,
            "main": null,
            "kind": null,
            "protocol": null,
            "verified": null,
            "notes": null
          }
        ]
      },
      "hostname": "hostname",
      "open_ports": [
        1
      ],
      "onvif": false,
      "onvif_url": "onvif-url",
      "last_seen": "2026-10-30T14:05:00Z",
      "known_camera_id": 3,
      "is_known_camera": false,
      "is_self": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find the current IP of a MAC (or the MAC of an IP)

`GET /api/v1/network/lookup`

`?mac=` resolves the address a MAC has now: the neighbour table when that entry still answers (`source: neighbor`), else a sweep of the connected subnets in small chunks that stops as soon as the MAC answers (`source: sweep`; up to about 20 seconds). MACs may be written `aa:bb:cc:dd:ee:ff`, `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff` or `aabbccddeeff`; the answer is lower-case with colons. `?ip=` (a private address in a connected subnet) gives that host's MAC. Give exactly one. Not on the network: `404 not_found`. At most 30 lookups a minute per credential; a sweep yields to camera following and lookup sweeps share a budget of 4 per 10 minutes per server (`503 network_busy` with `Retry-After`). Not read-only for MCP clients: a lookup may probe the LAN.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `lookup_network_address`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mac` | query | string | No | (max 32 characters) |
| `ip` | query | string | No | (max 15 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/lookup" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "mac": "mac",
  "ip": "ip",
  "found": false,
  "source": "neighbor",
  "checked_at": "2026-10-30T14:05:00Z",
  "other_ips": [
    "other-ip"
  ],
  "known_camera_id": 3,
  "is_known_camera": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the automatic network scan settings

`GET /api/v1/network/auto-scan`

Automatic scanning for new cameras: whether it is on (`enabled`; on by default on a self-hosted server), how often it runs (`interval_minutes`, one of `interval_choices`), the last run and its summary (devices found, how many are cameras already, new cameras ready for the setup wizard, possible cameras), the next planned run and, while a scan of it runs, `running`, `scan_id` and `progress`. Each run is an ordinary network scan (same rules and limits as `POST /network/actions/scan`) started about 2 minutes after the server starts and then every interval plus a small random delay. A run is skipped quietly while another scan runs, camera following needs the LAN (retried after 5 minutes) or discovery cannot work here (`last_skipped`). On a hosted server, or when discovery cannot work here, this still answers `200` with `available: false` and `unavailable_reason` (as `details.reason` of `network_unavailable`); a hosted server is always `enabled: false`.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/auto-scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The automatic scan settings and state.

```json
{
  "enabled": true,
  "interval_minutes": 15,
  "interval_choices": [
    1
  ],
  "available": false,
  "unavailable_reason": "unavailable-reason",
  "unavailable_message": "unavailable-message",
  "running": false,
  "scan_id": "scan-id",
  "progress": 1,
  "last_run": {
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z",
    "status": "ok",
    "error": null,
    "trigger": "schedule",
    "scan_id": "scan-id"
  },
  "last_summary": {
    "devices": 1,
    "cameras": 1,
    "new_cameras": 1,
    "possible_cameras": 1
  },
  "last_skipped": {
    "at": "2026-10-30T14:05:00Z",
    "reason": "network_unavailable"
  },
  "next_run": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Turn automatic network scanning on or off

`PATCH /api/v1/network/auto-scan`

Sets `enabled` and/or `interval_minutes` (15, 30, 60, 180 or 720) and answers the new state. Turning it on (or changing the interval) plans the next run one interval after the last one, at least a minute from now. Emits `settings.changed` (`data.resource: network.auto_scan`). A hosted server refuses with `409 network_unavailable` (`details.reason: hosted`). Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_auto_scan`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `interval_minutes` | integer: `15`, `30`, `60`, `180`, `720` | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/network/auto-scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"interval_minutes":15}'
```

**Response** `200`: The automatic scan settings and state.

```json
{
  "enabled": true,
  "interval_minutes": 15,
  "interval_choices": [
    1
  ],
  "available": false,
  "unavailable_reason": "unavailable-reason",
  "unavailable_message": "unavailable-message",
  "running": false,
  "scan_id": "scan-id",
  "progress": 1,
  "last_run": {
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z",
    "status": "ok",
    "error": null,
    "trigger": "schedule",
    "scan_id": "scan-id"
  },
  "last_summary": {
    "devices": 1,
    "cameras": 1,
    "new_cameras": 1,
    "possible_cameras": 1
  },
  "last_skipped": {
    "at": "2026-10-30T14:05:00Z",
    "reason": "network_unavailable"
  },
  "next_run": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Scan the network for new cameras now

`POST /api/v1/network/auto-scan/actions/run`

Runs the automatic scan now, whether the schedule is on or off ("Scan now"), and answers `202` with the scan's id. Follow it with `GET /network/scans/{scan_id}` (progress) or `GET /network/auto-scan` (`running`, then `last_run` and `last_summary` once its devices are processed); then `GET /network/candidates`. New cameras are announced like scheduled ones (`network.camera_found`). Same limits as `POST /network/actions/scan`: one scan at a time (`409 scan_in_progress` with `details.scan_id`), camera following first (`503 network_busy`), 2 scans a minute per credential, `409 network_unavailable` when discovery cannot work here.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `run_auto_scan`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/network/auto-scan/actions/run" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The scan started.

```json
{
  "scan_id": "scan-id",
  "status": "running",
  "started_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List new cameras found on the network

`GET /api/v1/network/candidates`

Devices the scans found (by MAC) that look like a camera and are not one yet (no Vigiora camera has their MAC or address) and were not dismissed. `confidence`: `high` (answers ONVIF or has RTSP port 554 open), `medium` (a camera maker's MAC with a port open, or ONVIF port 8899 open) — both `wizard_ready`: offer the setup wizard's Connect step for them —, or `low` ("possible camera": Reolink's port 9000 open without RTSP, unless the MAC's maker is a computer, phone, router or NAS maker such as Apple — the Reolink desktop app opens 9000 too —, or a camera maker's or a Wi-Fi camera chip maker's MAC, such as iComm Semiconductor, with no camera port open; `hint` and `hint_code` say what to turn on, then scan again). `reasons` lists the signals (`onvif`, `rtsp_open`, `onvif_port_open`, `reolink_port_open`, `camera_vendor`, `camera_chip`). Ordered by confidence, then IP. Only devices still on the network are listed: one that the latest scans did not see (more than one scan interval plus 10 minutes before the newest sighting) is left out until a scan sees it again. Devices not seen for 7 days are forgotten (at most 5000 are kept). Random (locally administered) MACs count only with a camera port open or an ONVIF answer.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `wizard_ready` | query | boolean | No | `true`: only `high` and `medium` candidates; `false`: only `low` ones. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/candidates" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of candidates.

```json
{
  "data": [
    {
      "id": "id",
      "model": "model",
      "mac": "mac",
      "ip": "ip",
      "vendor": "vendor",
      "confidence": "high",
      "wizard_ready": false,
      "reasons": [
        "discovered"
      ],
      "open_ports": [
        1
      ],
      "onvif": false,
      "rtsp_open": false,
      "hint": "hint",
      "hint_code": "enable_rtsp_onvif",
      "first_seen": "2026-10-30T14:05:00Z",
      "last_seen": "2026-10-30T14:05:00Z",
      "announced_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Ignore a device found on the network

`POST /api/v1/network/candidates/{candidate_id}/actions/dismiss`

Hides the device from the candidates and from new-camera announcements ("Ignore this device"). It is announced again only if it disappears from the network for 7 days (and is forgotten) and then comes back. Unknown MAC: `404 not_found`.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `candidate_id` | path | string | Yes | The candidate's `id`, its MAC (`aa:bb:cc:dd:ee:ff`; other common spellings accepted). (max 32 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/network/candidates/42/actions/dismiss" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Dismissed.

```json
{
  "id": "id",
  "mac": "mac",
  "dismissed": false,
  "dismissed_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Move a camera from a conflicting static address to DHCP

`POST /api/v1/network/devices/actions/move-to-dhcp`

For a new camera found with `ip_conflict` (on its factory static address while another device holds that address). Answers `202` with a job to poll (`GET /network/dhcp-moves/{job_id}`). The job pins a neighbour entry for the camera's MAC at that address (so the server's packets reach the camera, not the other device), reads who answers (`device_info`: it must be the camera's MAC), switches it to DHCP (Hikvision and EZVIZ over ISAPI, Dahua and Amcrest over their CGI), reboots it, waits up to 2 minutes for its next discovery reply and reports `new_ip`; then detect it there (`POST /cameras/actions/detect`). The credentials are the camera's own and are never stored or returned. Admins only; one move per camera at a time (`409 conflict`). A server without CAP_NET_ADMIN cannot pin the entry: the job ends `failed` with `needs_privilege` and the one command to run on the server (`sudo ip neigh replace …`), after which the same request succeeds. API 1.28.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `move_device_to_dhcp`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | string | Yes | The camera's current (conflicting) IPv4 address, on a subnet this server is connected to. |
| `mac` | string | Yes | The camera's MAC, from its discovery reply (`NetworkDevice.mac`). (max 32 characters) |
| `vendor` | string | Yes | `hikvision`, `ezviz` (ISAPI), `dahua` or `amcrest` (CGI); other makers are refused (`400`). (max 64 characters) |
| `username` | string | Yes | (max 128 characters) |
| `password` | string | Yes | (max 256 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/network/devices/actions/move-to-dhcp" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"ip":"ip","mac":"mac","vendor":"vendor","username":"automation","password":"password"}'
```

**Response** `202`: The move started.

```json
{
  "id": "id",
  "status": "running",
  "step": "route",
  "mac": "mac",
  "vendor": "vendor",
  "old_ip": "old-ip",
  "new_ip": "new-ip",
  "model": "model",
  "serial": "serial",
  "firmware": "firmware",
  "steps": [
    {
      "name": "Front door",
      "status": "running",
      "message": "This API key lacks the cameras:write scope."
    }
  ],
  "error": null,
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Poll a move to DHCP

`GET /api/v1/network/dhcp-moves/{job_id}`

The job of `POST /network/devices/actions/move-to-dhcp`; kept for an hour after it ends. API 1.28.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `job_id` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/network/dhcp-moves/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The job.

```json
{
  "id": "id",
  "status": "running",
  "step": "route",
  "mac": "mac",
  "vendor": "vendor",
  "old_ip": "old-ip",
  "new_ip": "new-ip",
  "model": "model",
  "serial": "serial",
  "firmware": "firmware",
  "steps": [
    {
      "name": "Front door",
      "status": "running",
      "message": "This API key lacks the cameras:write scope."
    }
  ],
  "error": null,
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Setup

The first-install setup wizard and the dashboard's Setup checklist: health checks with fixes, the checklist and the AI camera suggestion. Camera detection (connect with a login, streams found automatically) is under Cameras. The web app's wizard calls these with the admin's session once its account step signed the admin in.

### Run the health checks

`GET /api/v1/setup/diagnostics`

Runs every health check of the setup wizard and answers the report: recording disk (free space: `warn` under 15 %, `fail` under 5 %; write access), clock (SNTP offset: `warn` over 5 s, `fail` over 5 min), network ports (the web port, go2rtc's internal port 1984, 554 is not needed), Vigiora cloud link (enrolment, last heartbeat, remote access relay), go2rtc, ffmpeg, graphics acceleration (information only), LAN camera search, DNS (vigiora.com), updates and (API 1.45.0) camera clocks (from the stored camera clock checks: cameras whose clock is off, in another zone or not synced; no camera is contacted). Each check is `ok`, `warn`, `fail` or `skip` (not applicable, or could not decide) with a plain explanation and, for `warn`/`fail`, a `fix`: `auto` (run it with `POST /setup/diagnostics/actions/fix` and its `action_id`; admins only) or `manual` with steps for this server's `platform` (`linux`, `docker`, `macos`, `windows`). Checks run concurrently, each within 6 seconds. `cached=true` answers the last report when there is one (no new checks). This sends a little traffic (an NTP query, a DNS lookup, local port checks).

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cached` | query | boolean | No | `true`: the last report instead of a new run (a new run when there is none). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/setup/diagnostics" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The report.

```json
{
  "status": "ok",
  "platform": "linux",
  "checked_at": "2026-10-30T14:05:00Z",
  "checks": [
    {
      "id": "id",
      "title": "title",
      "status": "ok",
      "detail": "detail",
      "fix": {
        "kind": "auto",
        "action_id": "restart_go2rtc",
        "steps": [
          "step"
        ]
      },
      "duration_ms": 1
    }
  ],
  "actions": [
    {
      "id": "id",
      "title": "title",
      "available": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run an automatic fix

`POST /api/v1/setup/diagnostics/actions/fix`

Runs one whitelisted fix and then its check again: `restart_go2rtc` (restarts the video streaming service on native installs: live view and recording of every camera stop for a few seconds), `check_updates` (checks for an update now), `resync_cloud` (contacts Vigiora cloud now) or `sync_clock` (API 1.43.1, native Linux installs with the installer's time-sync helper: turns on internet time sync with `timedatectl set-ntp true` and restarts the time daemon so the clock is corrected now). Nothing else can run; an unknown id is `400 validation_error` with `details.allowed_actions`, one not available on this install `409 conflict` (`details.reason: action_unavailable`), a fix that failed `409 conflict` (`action_failed`). One fix at most every 20 seconds per action (`429 rate_limited`). Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `run_diagnostic_fix`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action_id` | string | Yes | `restart_go2rtc`, `check_updates`, `resync_cloud` or `sync_clock`. (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/setup/diagnostics/actions/fix" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"action_id":"action-id"}'
```

**Response** `200`: The fix ran; the check's new result.

```json
{
  "action_id": "action-id",
  "check": {
    "id": "id",
    "title": "title",
    "status": "ok",
    "detail": "detail",
    "fix": {
      "kind": "auto",
      "action_id": "restart_go2rtc",
      "steps": [
        "step"
      ]
    },
    "duration_ms": 1
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the setup checklist

`GET /api/v1/setup/checklist`

The first-install checklist the dashboard shows until it is complete: `health`, `cameras`, `recording`, `ai_cameras`, `notifications`, `phone_app` and `claude_connector` (optional), each `done`, `skipped` or `pending`. `source` says why: `auto` (the data shows it: the last health run had no failure, a camera exists / records / has AI, a device gets push notifications or a webhook exists, an app is connected over OAuth) or `user` (marked with `PATCH`). `complete` is true when every non-optional item is done or skipped.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/setup/checklist" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The checklist.

```json
{
  "complete": false,
  "done": 1,
  "total": 1,
  "items": [
    {
      "id": "health",
      "title": "title",
      "status": "done",
      "source": "auto",
      "optional": false,
      "detail": "detail",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark setup checklist items

`PATCH /api/v1/setup/checklist`

Marks items `done` or `skipped`, or back to `pending` (clears the mark), in one step: `{"items": {"phone_app": "skipped"}}`. Every wizard step is skippable. An item the data shows as done stays done. Answers the whole checklist. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | object | Yes | Item id (at least one) → `done`, `skipped` or `pending`. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/setup/checklist" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"items":{}}'
```

**Response** `200`: The checklist.

```json
{
  "complete": false,
  "done": 1,
  "total": 1,
  "items": [
    {
      "id": "health",
      "title": "title",
      "status": "done",
      "source": "auto",
      "optional": false,
      "detail": "detail",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Suggest the cameras for AI

`GET /api/v1/setup/ai-camera-suggestions`

Ranks the enabled cameras you can view for the plan's AI camera slots (`slots`; the free plan has 2; `used` by cameras that already have AI, `free` left). `basis` says how: `activity` (people, detections and motion of the last `window_days` days), `stream` (no activity yet: cameras whose stream is live now come first) or `order` (neither known: the first cameras added). `suggested` marks the cameras to give the free slots; turn AI on with `POST /cameras/{camera_id}/actions/enable-ai`.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/setup/ai-camera-suggestions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The ranking.

```json
{
  "slots": 1,
  "used": 1,
  "free": 1,
  "basis": "activity",
  "window_days": 1,
  "cameras": [
    {
      "camera_id": 3,
      "name": "Front door",
      "has_ai": false,
      "suggested": false,
      "score": 0.5,
      "people": 1,
      "motion_events": 1,
      "detections": 1,
      "stream_live": false,
      "reason": "reason"
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Alert rules

What raises alerts: Guardian alert rules (natural-language rules the AI checks each analysed clip and transcript against), label alert rules (which detector labels are alerts) and smart-motion rules (lines and zones). Rules only fire on cameras with AI (`ai_enabled`).

### List Guardian alert rules

`GET /api/v1/alert-rules`

Guardian alert rules of the cameras the caller may view, by ascending id. `email_recipients` is `null` unless the caller is an admin or operator with a user session.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `camera_id` | query | integer | No | (≥ 1) |
| `type` | query | string: `video`, `audio`, `video_and_audio`, `none` | No | What the rule is checked against: `video` (only `video_rule`), `audio` (only `audio_rule`), `video_and_audio` (both) or `none` (neither: it never fires). |
| `enabled` | query | boolean | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "speaker": {
        "mode": "default",
        "cameras": "alert_camera",
        "camera_ids": [
          3
        ],
        "volume": 0.5,
        "message": "This API key lacks the cameras:write scope."
      },
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "name": "Front door",
      "description": "description",
      "type": "video",
      "severity": "normal",
      "enabled": true,
      "cooldown_seconds": 1,
      "video_rule": "video-rule",
      "audio_rule": "audio-rule",
      "email_enabled": false,
      "email_recipients": "email-recipients",
      "telegram_enabled": false,
      "line_enabled": false,
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "warnings": [
        "warning"
      ],
      "require_detector_confirmation": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's Guardian alert rules

`GET /api/v1/cameras/{camera_id}/alert-rules`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `type` | query | string: `video`, `audio`, `video_and_audio`, `none` | No | What the rule is checked against: `video` (only `video_rule`), `audio` (only `audio_rule`), `video_and_audio` (both) or `none` (neither: it never fires). |
| `enabled` | query | boolean | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "speaker": {
        "mode": "default",
        "cameras": "alert_camera",
        "camera_ids": [
          3
        ],
        "volume": 0.5,
        "message": "This API key lacks the cameras:write scope."
      },
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "name": "Front door",
      "description": "description",
      "type": "video",
      "severity": "normal",
      "enabled": true,
      "cooldown_seconds": 1,
      "video_rule": "video-rule",
      "audio_rule": "audio-rule",
      "email_enabled": false,
      "email_recipients": "email-recipients",
      "telegram_enabled": false,
      "line_enabled": false,
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "warnings": [
        "warning"
      ],
      "require_detector_confirmation": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a Guardian alert rule

`POST /api/v1/cameras/{camera_id}/alert-rules`

A natural-language rule the Guardian AI checks the camera's analysed clips (`video_rule`) and transcripts (`audio_rule`) against; give one or both (both: the video must match and the audio must have matched within 5 minutes). The texts go into the AI's prompt: control characters and invisible formatting characters are refused (line breaks and tabs are allowed in `description` and the rules). Rules only fire on cameras with AI: when the camera's AI is off the rule is still created and `warnings` lists `ai_not_enabled`. E-mail settings (`email_enabled`, `email_recipients`) are never set with an API key or an OAuth token (`403 api_key_not_allowed`): use the web app; recipients only by admins and operators.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_alert_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | No control characters. (max 128 characters) |
| `description` | string | Yes | (max 4096 characters) |
| `severity` | string: `low`, `normal`, `high` | No | (default `"normal"`) |
| `enabled` | boolean | No | (default `true`) |
| `cooldown_seconds` | integer or null | No | `0`, or 60 to 86400; `null` (default) = the severity's default. (0–86400) |
| `video_rule` | string or null | No | (max 4096 characters) |
| `audio_rule` | string or null | No | (max 4096 characters) |
| `email_enabled` | boolean | No | User sessions only. (default `false`) |
| `email_recipients` | string or null | No | Comma-separated e-mail addresses (at most 10). Admin and operator sessions only. (max 1024 characters) |
| `telegram_enabled` | boolean | No | Send to the Telegram channel set up in System → Integrations. API 1.26.0. (default `false`) |
| `line_enabled` | boolean | No | Send to the LINE channel set up in System → Integrations. API 1.26.0. (default `false`) |
| `require_detector_confirmation` | boolean | No | See `AlertRule.require_detector_confirmation`. (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","description":"description"}'
```

**Response** `201`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a Guardian alert rule

`GET /api/v1/alert-rules/{alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a Guardian alert rule

`PATCH /api/v1/alert-rules/{alert_rule_id}`

Changes only the fields sent. Same checks as on create; `null` clears `cooldown_seconds` (the severity's default), `video_rule` or `audio_rule` (one must remain). A `null` `email_recipients` from a caller who cannot see them is ignored.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `speaker` | RuleSpeakerUpdate | No | API 1.54.0. Only the fields sent change (see RuleSpeaker). `chosen` needs `camera_ids` (operator permission on each). |
| `name` | string | No | (max 128 characters) |
| `description` | string | No | (max 4096 characters) |
| `severity` | string: `low`, `normal`, `high` | No |  |
| `enabled` | boolean | No |  |
| `cooldown_seconds` | integer or null | No | (0–86400) |
| `video_rule` | string or null | No | (max 4096 characters) |
| `audio_rule` | string or null | No | (max 4096 characters) |
| `email_enabled` | boolean | No |  |
| `email_recipients` | string or null | No | (max 1024 characters) |
| `telegram_enabled` | boolean | No |  |
| `line_enabled` | boolean | No |  |
| `require_detector_confirmation` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"speaker":{"mode":"default","cameras":"alert_camera","camera_ids":[3],"volume":0.5,"message":"This API key lacks the cameras:write scope."},"name":"Front door","description":"description","severity":"normal","enabled":true,"cooldown_seconds":1,"video_rule":"video-rule","audio_rule":"audio-rule","email_enabled":false,"email_recipients":"email-recipients","telegram_enabled":false,"line_enabled":false,"require_detector_confirmation":false}'
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a Guardian alert rule

`DELETE /api/v1/alert-rules/{alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Enable a Guardian alert rule

`POST /api/v1/alert-rules/{alert_rule_id}/actions/enable`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `enable_alert_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alert-rules/42/actions/enable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disable a Guardian alert rule

`POST /api/v1/alert-rules/{alert_rule_id}/actions/disable`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disable_alert_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/alert-rules/42/actions/disable" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example"
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "camera_name": "Front door",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's label alert rules

`GET /api/v1/cameras/{camera_id}/label-alert-rules`

Which detector labels on the camera are alerts (`is_alert` on its alerts), by ascending id.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/label-alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "speaker": {
        "mode": "default",
        "cameras": "alert_camera",
        "camera_ids": [
          3
        ],
        "volume": 0.5,
        "message": "This API key lacks the cameras:write scope."
      },
      "id": 1,
      "camera_id": 3,
      "label": "person",
      "severity": "normal",
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a label alert rule

`POST /api/v1/cameras/{camera_id}/label-alert-rules`

Makes detections of `label` on the camera alerts (when `enabled`) with `severity`. One rule per label and camera: a second is `409 conflict`.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_label_alert_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `label` | string | Yes | A detector label (`person`, `car`, …). (max 128 characters) |
| `severity` | string: `low`, `normal`, `high` | No | (default `"normal"`) |
| `enabled` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/label-alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"label":"person"}'
```

**Response** `201`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "label": "person",
  "severity": "normal",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a label alert rule

`GET /api/v1/label-alert-rules/{label_alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `label_alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/label-alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "label": "person",
  "severity": "normal",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a label alert rule

`PATCH /api/v1/label-alert-rules/{label_alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_label_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `label_alert_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `speaker` | RuleSpeakerUpdate | No | API 1.54.0. Only the fields sent change (see RuleSpeaker). `chosen` needs `camera_ids` (operator permission on each). |
| `severity` | string: `low`, `normal`, `high` | No |  |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/label-alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"speaker":{"mode":"default","cameras":"alert_camera","camera_ids":[3],"volume":0.5,"message":"This API key lacks the cameras:write scope."},"severity":"normal","enabled":true}'
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "camera_id": 3,
  "label": "person",
  "severity": "normal",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a label alert rule

`DELETE /api/v1/label-alert-rules/{label_alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_label_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `label_alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/label-alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's detector labels

`GET /api/v1/cameras/{camera_id}/labels`

The labels the camera's detectors have produced (AI service events and detections, at most 500 of each) and the label alert rules set on them, in one page (`next_cursor` is always `null`).

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/labels" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The labels.

```json
{
  "data": [
    {
      "label": "person",
      "service_name": "service-name",
      "source": "hal_events",
      "promoted": false,
      "severity": "normal",
      "label_alert_rule_id": 1,
      "results_only": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a camera's smart-motion rules

`GET /api/v1/cameras/{camera_id}/motion-rules`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/cameras/3/motion-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "name": "Front door",
      "rule_type": "line",
      "geometry": [
        [
          0.5
        ]
      ],
      "label_filter": "label-filter",
      "enabled": true,
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a smart-motion rule

`POST /api/v1/cameras/{camera_id}/motion-rules`

A line to cross (2 points) or a zone to enter (3 to 32 points), in normalised image coordinates (0..1, origin top left), for `person`, `vehicle` or `any` object. Evaluated by the camera's smart-motion service.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_motion_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `rule_type` | string: `line`, `zone` | Yes |  |
| `geometry` | array of array of number | Yes | (max 32 items) |
| `label_filter` | string: `any`, `person`, `vehicle` | No | (default `"any"`) |
| `enabled` | boolean | No | (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/motion-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","rule_type":"line","geometry":[[0.5]]}'
```

**Response** `201`: The rule.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "rule_type": "line",
  "geometry": [
    [
      0.5
    ]
  ],
  "label_filter": "label-filter",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a smart-motion rule

`GET /api/v1/motion-rules/{motion_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `motion_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/motion-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rule.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "rule_type": "line",
  "geometry": [
    [
      0.5
    ]
  ],
  "label_filter": "label-filter",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a smart-motion rule

`PATCH /api/v1/motion-rules/{motion_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_motion_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `motion_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 128 characters) |
| `rule_type` | string: `line`, `zone` | No |  |
| `geometry` | array of array of number | No | (max 32 items) |
| `label_filter` | string: `any`, `person`, `vehicle` | No |  |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/motion-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","rule_type":"line","geometry":[[0.5]],"label_filter":"any","enabled":true}'
```

**Response** `200`: The rule.

```json
{
  "id": 1,
  "camera_id": 3,
  "name": "Front door",
  "rule_type": "line",
  "geometry": [
    [
      0.5
    ]
  ],
  "label_filter": "label-filter",
  "enabled": true,
  "created_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a smart-motion rule

`DELETE /api/v1/motion-rules/{motion_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_motion_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `motion_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/motion-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List a room's Guardian alert rules

`GET /api/v1/rooms/{room_id}/alert-rules`

Rules of the room, by ascending id. While the room's `ai_mode` is `guardian` or `both` they are checked, with each camera's own rules, on every camera of the room (detector confirmation, cooldowns and severity as for camera rules; a room rule's cooldown is the rule's own, across the room's cameras). Viewer permission on every camera of the room. API 1.16.0.

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of rules.

```json
{
  "data": [
    {
      "speaker": {
        "mode": "default",
        "cameras": "alert_camera",
        "camera_ids": [
          3
        ],
        "volume": 0.5,
        "message": "This API key lacks the cameras:write scope."
      },
      "id": 1,
      "room_id": 1,
      "room_name": "room-name",
      "name": "Front door",
      "description": "description",
      "type": "video",
      "severity": "normal",
      "enabled": true,
      "cooldown_seconds": 1,
      "video_rule": "video-rule",
      "audio_rule": "audio-rule",
      "email_enabled": false,
      "email_recipients": "email-recipients",
      "telegram_enabled": false,
      "line_enabled": false,
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "warnings": [
        "warning"
      ],
      "require_detector_confirmation": false
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a room Guardian alert rule

`POST /api/v1/rooms/{room_id}/alert-rules`

Same body and checks as `POST /cameras/{camera_id}/alert-rules`. The rule is checked on the room's cameras that have AI and a motion trigger while the room's `ai_mode` is `guardian` or `both`; otherwise `warnings` lists `room_not_guardian`. Admins and operators with operator permission on every camera of the room. API 1.16.0.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_room_alert_rule`) |
| Idempotency-Key | Honoured |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | No control characters. (max 128 characters) |
| `description` | string | Yes | (max 4096 characters) |
| `severity` | string: `low`, `normal`, `high` | No | (default `"normal"`) |
| `enabled` | boolean | No | (default `true`) |
| `cooldown_seconds` | integer or null | No | `0`, or 60 to 86400; `null` (default) = the severity's default. (0–86400) |
| `video_rule` | string or null | No | (max 4096 characters) |
| `audio_rule` | string or null | No | (max 4096 characters) |
| `email_enabled` | boolean | No | User sessions only. (default `false`) |
| `email_recipients` | string or null | No | Comma-separated e-mail addresses (at most 10). Admin and operator sessions only. (max 1024 characters) |
| `telegram_enabled` | boolean | No | Send to the Telegram channel set up in System → Integrations. API 1.26.0. (default `false`) |
| `line_enabled` | boolean | No | Send to the LINE channel set up in System → Integrations. API 1.26.0. (default `false`) |
| `require_detector_confirmation` | boolean | No | See `AlertRule.require_detector_confirmation`. (default `true`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/alert-rules" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","description":"description"}'
```

**Response** `201`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "room_id": 1,
  "room_name": "room-name",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `422`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a room Guardian alert rule

`GET /api/v1/rooms/{room_id}/alert-rules/{alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/rooms/42/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "room_id": 1,
  "room_name": "room-name",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a room Guardian alert rule

`PATCH /api/v1/rooms/{room_id}/alert-rules/{alert_rule_id}`

Changes only the fields sent; same checks as `PATCH /alert-rules/{alert_rule_id}`.

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_room_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `speaker` | RuleSpeakerUpdate | No | API 1.54.0. Only the fields sent change (see RuleSpeaker). `chosen` needs `camera_ids` (operator permission on each). |
| `name` | string | No | (max 128 characters) |
| `description` | string | No | (max 4096 characters) |
| `severity` | string: `low`, `normal`, `high` | No |  |
| `enabled` | boolean | No |  |
| `cooldown_seconds` | integer or null | No | (0–86400) |
| `video_rule` | string or null | No | (max 4096 characters) |
| `audio_rule` | string or null | No | (max 4096 characters) |
| `email_enabled` | boolean | No |  |
| `email_recipients` | string or null | No | (max 1024 characters) |
| `telegram_enabled` | boolean | No |  |
| `line_enabled` | boolean | No |  |
| `require_detector_confirmation` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/rooms/42/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"speaker":{"mode":"default","cameras":"alert_camera","camera_ids":[3],"volume":0.5,"message":"This API key lacks the cameras:write scope."},"name":"Front door","description":"description","severity":"normal","enabled":true,"cooldown_seconds":1,"video_rule":"video-rule","audio_rule":"audio-rule","email_enabled":false,"email_recipients":"email-recipients","telegram_enabled":false,"line_enabled":false,"require_detector_confirmation":false}'
```

**Response** `200`: The rule.

```json
{
  "speaker": {
    "mode": "default",
    "cameras": "alert_camera",
    "camera_ids": [
      3
    ],
    "volume": 0.5,
    "message": "This API key lacks the cameras:write scope."
  },
  "id": 1,
  "room_id": 1,
  "room_name": "room-name",
  "name": "Front door",
  "description": "description",
  "type": "video",
  "severity": "normal",
  "enabled": true,
  "cooldown_seconds": 1,
  "video_rule": "video-rule",
  "audio_rule": "audio-rule",
  "email_enabled": false,
  "email_recipients": "email-recipients",
  "telegram_enabled": false,
  "line_enabled": false,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "warnings": [
    "warning"
  ],
  "require_detector_confirmation": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a room Guardian alert rule

`DELETE /api/v1/rooms/{room_id}/alert-rules/{alert_rule_id}`

| Requirement | |
| --- | --- |
| Scope | `alerts:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_room_alert_rule`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/rooms/42/alert-rules/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Briefing

The dashboard Briefing: what needs attention, the AI recap and the activity feed of the caller's cameras.

### Get the Briefing

`GET /api/v1/briefing`

What needs attention on the caller's cameras (alerts, Guardian events, health, setup), as the dashboard shows it. For admins and operators, `health` (API 1.55.0) is the latest daily health check as one line (`report_id`, `status`, `summary`, `checked_at`, `warn`, `fail`); see `GET /system/health/reports/latest`.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `period` | query | string | No | `today`, `24h`, `7d`, … (default `today`). (max 16 characters) |
| `camera_ids` | query | string | No | Comma-separated camera ids (default every camera the caller may view). (max 1000 characters) |
| `types` | query | string | No | Comma-separated item types. (max 200 characters) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/briefing" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Briefing.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the Briefing recap

`GET /api/v1/briefing/recap`

The AI-written summary of the period (cached; an API key never triggers a new one).

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `period` | query | string | No | `today`, `24h`, `7d`, … (default `today`). (max 16 characters) |
| `camera_ids` | query | string | No | Comma-separated camera ids (default every camera the caller may view). (max 1000 characters) |
| `types` | query | string | No | Comma-separated item types. (max 200 characters) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/briefing/recap" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The recap.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Refresh the Briefing recap

`POST /api/v1/briefing/recap/actions/refresh`

Writes a new AI recap now (uses AI credits; the per-credential AI limits apply).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `period` | query | string | No | `today`, `24h`, `7d`, … (default `today`). (max 16 characters) |
| `camera_ids` | query | string | No | Comma-separated camera ids (default every camera the caller may view). (max 1000 characters) |
| `types` | query | string | No | Comma-separated item types. (max 200 characters) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/briefing/recap/actions/refresh" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The recap.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the Briefing activity feed

`GET /api/v1/briefing/feed`

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_ids` | query | string | No | Comma-separated camera ids (default every camera the caller may view). (max 1000 characters) |
| `types` | query | string | No | Comma-separated item types. (max 200 characters) |
| `lang` | query | string | No | Language of AI-written texts (ISO-639-1, e.g. `th`); default the `Accept-Language` header's first tag, else English (texts without that language fall back to English). |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/briefing/feed" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The feed.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark a Briefing item reviewed

`POST /api/v1/briefing/items/{briefing_item_token}/actions/mark-reviewed`

For the caller; an alert item is also acknowledged when the caller is an admin or operator with operator permission.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `briefing_item_token` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/briefing/items/42/actions/mark-reviewed" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Marked.

```json
{
  "item_id": "item-id",
  "reviewed": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mark a Briefing item unreviewed

`POST /api/v1/briefing/items/{briefing_item_token}/actions/unmark-reviewed`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `briefing_item_token` | path | string | Yes | (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/briefing/items/42/actions/unmark-reviewed" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Unmarked.

```json
{
  "item_id": "item-id",
  "reviewed": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## AI Live

AI Live sessions on single cameras (rooms have their own under `/rooms/{room_id}/ai-live`).

### List AI Live sessions

`GET /api/v1/ai-live/sessions`

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |
| `active` | query | boolean | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ai-live/sessions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The sessions.

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "user_id": 1,
      "instruction": "instruction",
      "mode": "mode",
      "active": false,
      "interval_seconds": 1,
      "created_at": "created-at",
      "ended_at": "ended-at"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start AI Live on a camera

`POST /api/v1/ai-live/sessions`

The AI watches (and listens to) the camera and answers `instruction` on its cards while someone polls the messages (uses AI credits). Needs the `hal-live` service on the camera; an identical running session is reused. At most 3 active sessions per user (`429`).

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_camera_ai_live_session`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_id` | integer | Yes |  |
| `instruction` | string | No | (max 4096 characters) |
| `mode` | string: `video`, `audio`, `both` | No |  |
| `interval_seconds` | integer | No | (3–300) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-live/sessions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3}'
```

**Response** `201`: The session.

```json
{
  "id": 1,
  "camera_id": 3,
  "user_id": 1,
  "instruction": "instruction",
  "mode": "mode",
  "active": false,
  "interval_seconds": 1,
  "created_at": "created-at",
  "ended_at": "ended-at"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an AI Live session

`DELETE /api/v1/ai-live/sessions/{ai_live_session_id}`

Deletes the session and its cards: operator permission unless the caller started it.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_camera_ai_live_session`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_live_session_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/ai-live/sessions/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop an AI Live session

`POST /api/v1/ai-live/sessions/{ai_live_session_id}/actions/stop`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_live_session_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-live/sessions/42/actions/stop" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Stopped.

```json
{
  "ai_live_session_id": 1,
  "stopped": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change what AI Live watches

`POST /api/v1/ai-live/sessions/{ai_live_session_id}/actions/set-mode`

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_live_session_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | string: `video`, `audio`, `both` | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-live/sessions/42/actions/set-mode" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"video"}'
```

**Response** `200`: Changed.

```json
{
  "ai_live_session_id": 1,
  "mode": "mode",
  "applied_live": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an AI Live session's cards

`GET /api/v1/ai-live/sessions/{ai_live_session_id}/messages`

Cards with an id above `since_id`. Polling keeps the session running (the viewer heartbeat), so it needs `guardian:write`.

| Requirement | |
| --- | --- |
| Scope | `guardian:write` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_live_session_id` | path | integer | Yes | (≥ 1) |
| `since_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ai-live/sessions/42/messages" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cards.

```json
{
  "status": "status",
  "messages": [
    "This API key lacks the cameras:write scope."
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a camera's AI Live history

`GET /api/v1/ai-live/history`

The AI Live cards of a camera in a time window (both `from` and `to`; default the last 24 hours), newest first, at most 500.

| Requirement | |
| --- | --- |
| Scope | `guardian:read` |
| Roles | admin, operator, viewer |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | Yes | (≥ 1) |
| `from` | query | string (RFC 3339) | No |  |
| `to` | query | string (RFC 3339) | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ai-live/history" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The cards.

```json
{
  "data": [
    {
      "id": 1,
      "text": "text",
      "audio_excerpt": "audio-excerpt",
      "suggestions": null,
      "tool_context": null,
      "created_at": "created-at"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Clients

vigiora-clients: the boxes on remote sites that relay their cameras to this server.

### List vigiora-clients

`GET /api/v1/clients`

`camera_ids` lists the client's cameras the caller may view; `camera_count` all of them. One page.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clients" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The clients.

```json
{
  "data": [
    {
      "id": "id",
      "name": "Front door",
      "hostname": "hostname",
      "status": "status",
      "version": "version",
      "last_seen_at": "last-seen-at",
      "created_at": "created-at",
      "camera_ids": [
        3
      ],
      "camera_count": 2,
      "timezone": "timezone",
      "timezone_utc_offset_seconds": 1,
      "timezone_override": "timezone-override",
      "effective_timezone": "effective-timezone",
      "clock_relay": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a vigiora-client

`GET /api/v1/clients/{client_id}`

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clients/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The client.

```json
{
  "id": "id",
  "name": "Front door",
  "hostname": "hostname",
  "status": "status",
  "version": "version",
  "last_seen_at": "last-seen-at",
  "created_at": "created-at",
  "camera_ids": [
    3
  ],
  "camera_count": 2,
  "timezone": "timezone",
  "timezone_utc_offset_seconds": 1,
  "timezone_override": "timezone-override",
  "effective_timezone": "effective-timezone",
  "clock_relay": false
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a vigiora-client

`PATCH /api/v1/clients/{client_id}`

API 1.50.0. Sets the time zone this client's cameras' clocks are set to (`timezone_override`; `null` = the zone the client reports, client 1.16.0+). Its cameras are checked again in the background. Audited (`client.timezone`).

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_client`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timezone_override` | string or null | No | An IANA zone (`Europe/Rome`) for this client's cameras' clocks; `null` or `""` = the zone the client reports. |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/clients/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"timezone_override":"timezone-override"}'
```

**Response** `200`: The client.

```json
{
  "id": "id",
  "name": "Front door",
  "hostname": "hostname",
  "status": "status",
  "version": "version",
  "last_seen_at": "last-seen-at",
  "created_at": "created-at",
  "camera_ids": [
    3
  ],
  "camera_count": 2,
  "timezone": "timezone",
  "timezone_utc_offset_seconds": 1,
  "timezone_override": "timezone-override",
  "effective_timezone": "effective-timezone",
  "clock_relay": false
}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a vigiora-client

`DELETE /api/v1/clients/{client_id}`

Forgets the client (its cameras stop streaming until it enrols again). Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_client`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/clients/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Removed.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restart a vigiora-client

`POST /api/v1/clients/{client_id}/actions/restart`

Queued for the client's next heartbeat (about a minute). Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `client_action_restart`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clients/42/actions/restart" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Queued.

```json
{
  "client_id": null,
  "action": "action",
  "queued": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a vigiora-client

`POST /api/v1/clients/{client_id}/actions/update`

Queued for the client's next heartbeat (about a minute). Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `client_action_update`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clients/42/actions/update" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Queued.

```json
{
  "client_id": null,
  "action": "action",
  "queued": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Resync a client's cameras

`POST /api/v1/clients/{client_id}/actions/resync-cameras`

Queued for the client's next heartbeat (about a minute). Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `client_action_resync_cameras`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clients/42/actions/resync-cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Queued.

```json
{
  "client_id": null,
  "action": "action",
  "queued": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Install ffmpeg on a client

`POST /api/v1/clients/{client_id}/actions/install-ffmpeg`

Queued for the client's next heartbeat (about a minute). Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `client_action_install_ffmpeg`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clients/42/actions/install-ffmpeg" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Queued.

```json
{
  "client_id": null,
  "action": "action",
  "queued": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a client's status history

`GET /api/v1/clients/{client_id}/status-history`

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |
| `days` | query | integer | No | (1–90, default `7`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/clients/42/status-history" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The history.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a camera on a client's network

`POST /api/v1/clients/{client_id}/cameras`

The client connects to the camera (`stream_url`, and optionally `sub_stream_url`, on its own network; credentials allowed) and relays it; or a USB microphone (`source_type: usb_audio`, `audio_device`). The client receives the credentials, so admins only. Audited.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_client_camera`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | Yes | (max 128 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 128 characters) |
| `stream_url` | string | No |  |
| `sub_stream_url` | string | No |  |
| `source_type` | string: `rtsp`, `usb_audio` | No | (default `"rtsp"`) |
| `audio_device` | string | No | (max 256 characters) |
| `wake_word_enabled` | boolean | No | (default `false`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/clients/42/cameras" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `201`: The camera.

```json
{
  "speaker": {
    "kind": "voice",
    "siren": false,
    "checked_at": "2026-10-30T14:05:00Z"
  },
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "status": "online",
  "source_type": "rtsp",
  "connection_type": "local",
  "stream_url": "rtsp://REDACTED@192.0.2.20:554/stream1",
  "width": 1920,
  "height": 1080,
  "fps": 15,
  "recording_enabled": true,
  "retention_days": 7,
  "ai_enabled": true,
  "ai_guardian_enabled": false,
  "ai_live_enabled": false,
  "has_ptz": false,
  "has_speaker": false,
  "talk": {
    "available": false,
    "reason": "no_speaker"
  },
  "has_audio": false,
  "site_id": 1,
  "client_id": null,
  "client_name": null,
  "client_status": null,
  "tags": [
    "entrance"
  ],
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "sub_stream_name": "sub-stream-name",
  "record_sub_stream": false,
  "record_hd_on_motion": false,
  "onvif_url": "onvif-url",
  "hardware_id": "hardware-id",
  "audio_monitoring_enabled": false,
  "wake_word_enabled": false,
  "ptz_manual": false,
  "onvif_enabled": false,
  "sort_order": 1,
  "brand": "brand",
  "model": "model",
  "brand_source": "camera",
  "body_type": "bullet",
  "ptz_zoom": "ptz-zoom",
  "ptz_settle_seconds": 0.5,
  "ai_guardian_prompt": "ai-guardian-prompt",
  "ai_live_env": "ai-live-env",
  "stt_languages": [
    "stt-language"
  ],
  "stt_prompt": "stt-prompt",
  "lat": 0.5,
  "lon": 0.5,
  "source_error": "source-error",
  "guardian_use_detections": false,
  "guardian_use_detections_set": false,
  "guardian_clip_preroll_sec": 1,
  "ai_services": [
    "ai-service"
  ],
  "warnings": [
    "warning"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Admin

Billing, costs, connected apps, enrolled AI service instances and external tools. User sessions only (never an API key), as in the web app.

### Get costs

`GET /api/v1/costs`

This month's usage and bill estimate (Vigiora cloud, storage, relay). User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/costs" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The costs.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the billing account

`GET /api/v1/billing/account`

Admins. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/billing/account" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The data.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List billing plans

`GET /api/v1/billing/plans`

Admins. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/billing/plans" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The data.

```json
{}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List billing transactions

`GET /api/v1/billing/transactions`

Admins. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | (1–200) |
| `offset` | query | integer | No | (≥ 0) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/billing/transactions" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The data.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get billing usage

`GET /api/v1/billing/usage`

Admins. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `days` | query | integer | No | (1–366) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/billing/usage" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The data.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List connected apps

`GET /api/v1/connected-apps`

The AI apps the caller connected with OAuth (admins: `all=true` for every user's). User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `all` | query | boolean | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/connected-apps" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The apps.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change a connected app's human in the loop

`PATCH /api/v1/connected-apps/{connected_app_id}`

`human_in_the_loop`: `inherit`, `on` or `off` (see AI agents). User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connected_app_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `human_in_the_loop` | string: `inherit`, `on`, `off` | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/connected-apps/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"human_in_the_loop":"inherit"}'
```

**Response** `200`: The app.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disconnect an app

`DELETE /api/v1/connected-apps/{connected_app_id}`

User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connected_app_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/connected-apps/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `204`: Revoked.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List AI service instances

`GET /api/v1/ai-service-instances`

The enrolled AI services (Vision Engine) and their cameras. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ai-service-instances" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The instances.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get an AI service instance

`GET /api/v1/ai-service-instances/{ai_service_instance_id}`

User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_service_instance_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/ai-service-instances/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The instance.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Revoke an AI service instance

`DELETE /api/v1/ai-service-instances/{ai_service_instance_id}`

Its enrolment token stops working. Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_service_instance_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/ai-service-instances/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `204`: Revoked.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start an AI service instance

`POST /api/v1/ai-service-instances/{ai_service_instance_id}/actions/start`

Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_service_instance_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-service-instances/42/actions/start" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: Done.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop an AI service instance

`POST /api/v1/ai-service-instances/{ai_service_instance_id}/actions/stop`

Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_service_instance_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-service-instances/42/actions/stop" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: Done.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restart an AI service instance

`POST /api/v1/ai-service-instances/{ai_service_instance_id}/actions/restart`

Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ai_service_instance_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/ai-service-instances/42/actions/restart" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: Done.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List external tools

`GET /api/v1/tools`

HTTP tools Guardian chat may call (Home Assistant, …); stored credentials are never returned. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/tools" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The tools.

```json
{}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add an external tool

`POST /api/v1/tools`

Same body and URL checks as the web app. Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/tools" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `201`: The tool.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test an external tool

`POST /api/v1/tools/actions/test`

Calls the tool once. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/tools/actions/test" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The answer.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get the tool log

`GET /api/v1/tools/log`

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | (1–500) |
| `severity` | query | string: `info`, `warning`, `error` | No |  |
| `tool` | query | string | No | (max 128 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/tools/log" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The log.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Search external tools

`GET /api/v1/tools/search`

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | No | (max 500 characters) |
| `limit` | query | integer | No | (1–50) |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/tools/search" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The matches.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update an external tool

`PATCH /api/v1/tools/{tool_id}`

Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tool_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/tools/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The tool.

```json
{}
```

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete an external tool

`DELETE /api/v1/tools/{tool_id}`

Audited. User sessions only (never an API key or an AI agent), as in the web app.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tool_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/tools/42" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `204`: Deleted.

Errors: `400`, `401`, `403`, `404`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Things

A platform-neutral view for IoT platforms (Home Assistant, MQTT, Matter, Google Home, Alexa, SmartThings, HomeKit): devices with capabilities from a closed, versioned catalogue, commands that run the existing operations, and events in one CloudEvents-style envelope. See Things in the description.

### Things capability catalogue

`GET /api/v1/thing-capabilities`

The closed, versioned vocabulary of the Things model (see Things): device kinds, and for each capability its state schema, its commands (the operation each runs, the scope and roles it needs, its human-in-the-loop class) and its events (types in the `vigiora.<capability>.<event>` envelope). API 1.18.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/thing-capabilities" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The catalogue.

```json
{
  "version": "version",
  "kinds": [
    "kind"
  ],
  "capabilities": [
    {
      "name": "Front door",
      "version": "version",
      "description": "description",
      "kinds": [
        "kind"
      ],
      "state_schema": {},
      "commands": [
        {
          "name": "Front door",
          "description": "description",
          "operations": {},
          "scope": "scope",
          "roles": [
            "role"
          ],
          "hitl": "none",
          "params_schema": {}
        }
      ],
      "events": [
        {
          "type": "type",
          "description": "description",
          "data_schema": {}
        }
      ]
    }
  ],
  "envelope": {}
}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List things

`GET /api/v1/things`

The server, cameras, microphones, speakers, rooms and Analytics areas the caller may see, each with its capabilities and their current state. Built from the other operations as the caller: what the key's scopes and the user's role and camera permissions allow (speakers need the admin or operator role, areas `analytics:read`, alert counts `alerts:read`). Not paged: every thing is on the one page (`next_cursor` is always null). `?kind=` filters by kind. API 1.18.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | query | string: `server`, `camera`, `microphone`, `speaker`, `room`, `area` | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/things" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The things.

```json
{
  "data": [
    {
      "id": "id",
      "kind": "server",
      "source": "vigiora",
      "name": "Front door",
      "parent_id": "parent-id",
      "site_id": 1,
      "room_ids": [
        "room-id"
      ],
      "online": false,
      "manufacturer": "manufacturer",
      "model": "model",
      "capabilities": [
        {
          "name": "Front door",
          "version": "version",
          "state": {},
          "commands": [
            "command"
          ],
          "events": [
            "event"
          ]
        }
      ]
    }
  ],
  "next_cursor": null,
  "catalog_version": "catalog-version"
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get a thing

`GET /api/v1/things/{thing_id}`

One thing with its capabilities and current state. API 1.18.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `thing_id` | path | string | Yes | A thing id: `server`, `camera:12`, `microphone:4`, `speaker:3`, `room:2`, `area:1`. (max 64 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/things/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The thing.

```json
{
  "id": "id",
  "kind": "server",
  "source": "vigiora",
  "name": "Front door",
  "parent_id": "parent-id",
  "site_id": 1,
  "room_ids": [
    "room-id"
  ],
  "online": false,
  "manufacturer": "manufacturer",
  "model": "model",
  "capabilities": [
    {
      "name": "Front door",
      "version": "version",
      "state": {},
      "commands": [
        "command"
      ],
      "events": [
        "event"
      ]
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run a command on a thing

`POST /api/v1/things/{thing_id}/commands/{command_id}`

Runs the one existing operation behind the command (`GET /thing-capabilities` names it) with the command's params as its body, as the caller: that operation's validation, scope, role, camera permission, rate limits and audit apply, and its errors are answered unchanged. The body is the command's params (an object; empty for none). Not an MCP tool: AI agents use the operations themselves, where human in the loop applies (a command's `hitl` class says which need the user's approval). API 1.18.0.

| Requirement | |
| --- | --- |
| Scope | `cameras:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `thing_id` | path | string | Yes | A thing id: `server`, `camera:12`, `microphone:4`, `speaker:3`, `room:2`, `area:1`. (max 64 characters) |
| `command_id` | path | string | Yes | `<capability>.<command>`, one of the thing's `capabilities[].commands` (e.g. `speak.say`). (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/things/42/commands/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The operation's result.

```json
{
  "thing_id": "thing-id",
  "command": "command",
  "operation_id": "operation-id",
  "result": null
}
```

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `422`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Media

Signed, short-lived media links (live video, images) for clients that cannot send an API key.

### Signed live video (HLS)

`GET /api/v1/media/{media_token}/stream.m3u8`

The HLS master playlist of a live video link (`createCameraStreamUrl`). No credential: the link authorizes it, and is checked again on every request (expiry, its key, the camera permission). Its playlist and segments follow below `hls/`. An invalid, expired or revoked link is `404`. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `media_token` | path | string | Yes | The signed link token (opaque; from a stream-url or snapshot-url answer, or an event). (max 1024 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/media/42/stream.m3u8" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: HLS playlist. (`application/vnd.apple.mpegurl`)

Errors: `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Signed live video (HLS files)

`GET /api/v1/media/{media_token}/hls/{hls_file}`

A media playlist, init segment or segment of a live video link. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `media_token` | path | string | Yes | The signed link token (opaque; from a stream-url or snapshot-url answer, or an event). (max 1024 characters) |
| `hls_file` | path | string: `playlist.m3u8`, `segment.ts`, `init.mp4`, `segment.m4s` | Yes | `playlist.m3u8`, `segment.ts`, `init.mp4` or `segment.m4s`, as the playlists name them. |
| `id` | query | string | No | The HLS session id (from the playlist). |
| `n` | query | string | No | The segment number (from the playlist). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/media/42/hls/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o recording.mp4
```

**Response** `200`: Playlist or media segment. (`application/vnd.apple.mpegurl`)

Errors: `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Signed image

`GET /api/v1/media/{media_token}/image`

The image of a snapshot link: a camera's live snapshot (`createCameraSnapshotUrl`, `snapshot_url` of `motion.started`, `presence.changed` and `camera.online`), an alert's snapshot (`alert.created`) or a Guardian entry's frame (`guardian.event`). No credential: the link authorizes it and is checked again on every request. An invalid, expired or revoked link is `404`. API 1.19.0.

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `media_token` | path | string | Yes | The signed link token (opaque; from a stream-url or snapshot-url answer, or an event). (max 1024 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/media/42/image" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -o snapshot.jpg
```

**Response** `200`: JPEG image. (`image/jpeg`)

Errors: `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Integrations

Home Assistant: install it next to this server ("Install Home Assistant for me"; Linux servers for now), with the Vigiora integration set up, or connect an existing one. Vigiora runs the pinned ghcr.io/home-assistant/home-assistant image (version and digest recorded by Vigiora) as the Docker container vigiora-homeassistant through a root helper that a person installs once with a command on the server; the web app never asks for the administrator password. Home Assistant is reachable on the LAN only. Install, update and uninstall need the user's approval for AI agents while human in the loop is on.
MQTT (API 1.26.0): Vigiora publishes its Things to an MQTT broker (retained state per thing, every event in the Things envelope, Home Assistant MQTT discovery) and, when an admin allows control, runs Things commands sent to the command topic. Chat notifications (API 1.26.0): alert rules can send Telegram and LINE messages (`telegram_enabled`, `line_enabled`), with the entry's picture on Telegram; at most 20 messages a minute per service, the rest of a burst summarised. The broker password and the bot tokens are never returned.
Add camera flow (API 1.28.0): network scans also send the camera makers' discovery probes (Hikvision SADP, Dahua, SSDP, mDNS) and report each device's model, firmware and serial, whether it is on DHCP and, for a Hikvision, activated; a device answering from an address another device holds is marked `ip_conflict` and can be moved to DHCP from here (`POST /network/devices/actions/move-to-dhcp`, admins). Camera detection reports the device's facts (model, PTZ, microphone, speaker, audio track), the maker's login advice and a suggested name; `add-detected` can turn on object recognition and Core AI as it creates the camera.

### Home Assistant status

`GET /api/v1/integrations/home-assistant`

What Vigiora knows of Home Assistant on this server: `mode` (`none`, `managed` — the container Vigiora installed —, `external` — an existing Home Assistant connected with an API key), `state`, the installed and latest pinned versions, whether the container runs, the pre-checks of an install (OS, memory, disk, port 8123, Docker, the root helper) with the command a person runs once when one needs it, and the running or last job (`job`: install, update, restart or uninstall, with its steps and log). `access` is `lan_only`: Home Assistant is not exposed through the site address. API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Find Home Assistant on the LAN

`GET /api/v1/integrations/home-assistant/discovered`

Looks for Home Assistant: one zeroconf (mDNS) query for `_home-assistant._tcp`, then port 8123 on this server and on the hosts the last LAN scan saw, each confirmed by Home Assistant's `/manifest.json`. Takes up to about 6 seconds. `managed` marks the instance Vigiora installed. Use an instance found here with `POST /integrations/home-assistant/actions/connect-existing` instead of installing a second one. API 1.21.0. Admins with `network:read`.

| Requirement | |
| --- | --- |
| Scope | `network:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/discovered" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The instances found (may be empty).

```json
{
  "instances": [
    {
      "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
      "host": "host",
      "port": 1,
      "name": "Front door",
      "version": "version",
      "sources": [
        "mdns"
      ],
      "managed": false
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Install Home Assistant

`POST /api/v1/integrations/home-assistant/actions/install`

Starts installing Home Assistant (Linux servers only for now) and answers `202` with the status, whose `job` to poll shows each step: pre-checks, the Vigiora integration files, downloading and starting the pinned `ghcr.io/home-assistant/home-assistant` image (several minutes), onboarding (an owner user with a generated password — shown once in the web app, never through an API key —, language, time zone, location and unit system), a restart, a scoped Vigiora API key "Home Assistant (local)" and the Vigiora config entry. `latitude`/`longitude` default to the cameras' map position; without either, `400 validation_error` (`details.reason: location_required`). A pre-check that stops the install is `409 conflict` with `details.reason: precheck_failed` and `details.check` (with the command to run, when a person must run one on the server); also `409` with `reason` `busy`, `already_installed`, `external_connected` or `unsupported_os`. Retrying after a failure continues where it can. API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `install_home_assistant`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `version` | string | No | One of `available_versions` (default: `latest_version`). |
| `language` | string | No | Home Assistant's language, e.g. `en`, `th`, `pt-BR` (default `en`). (max 10 characters) |
| `latitude` | number | No | (-90–90) |
| `longitude` | number | No | (-180–180) |
| `unit_system` | string: `metric`, `us_customary` | No | Default: `us_customary` for US, LR and MM, else `metric`. |
| `country` | string | No | ISO 3166-1 alpha-2. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/install" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"version":"version","language":"language","latitude":0.5,"longitude":0.5,"unit_system":"metric","country":"country"}'
```

**Response** `202`: The install started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Connect an existing Home Assistant

`POST /api/v1/integrations/home-assistant/actions/connect-existing`

For a Home Assistant that already runs (found with `GET /integrations/home-assistant/discovered`, or elsewhere): creates the scoped Vigiora API key "Home Assistant (local)" (revoking the previous one) and answers it once with the Vigiora address and the steps to install the integration through HACS and add it. `url` (optional) records where that Home Assistant runs. `409 conflict` (`already_installed`) while Vigiora manages its own Home Assistant. The response holds a secret, so `Idempotency-Key` is refused. API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `connect_existing_home_assistant`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | No | The existing Home Assistant's address, e.g. `http://192.0.2.20:8123`. (max 300 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/connect-existing" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"}'
```

**Response** `200`: The key (shown once) and the steps.

```json
{
  "api_key": "api-key",
  "api_key_id": 1,
  "scopes": [
    "cameras:read"
  ],
  "vigiora_url": "vigiora-url",
  "hacs_repository": "hacs-repository",
  "steps": [
    "step"
  ],
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update Home Assistant

`POST /api/v1/integrations/home-assistant/actions/update`

Moves the Home Assistant Vigiora installed to `version` (default: the latest pinned one, `latest_version`; any of `available_versions`) and refreshes the Vigiora integration files when this server carries newer ones. The new image is downloaded before the container is replaced; the configuration stays. Answers `202` with the status and its job. `409 conflict` with `reason` `not_installed`, `not_newer` or `busy`. API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `version` | string | No | One of `available_versions` (default: `latest_version`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/update" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"version":"version"}'
```

**Response** `202`: The update started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update the Vigiora integration in Home Assistant

`POST /api/v1/integrations/home-assistant/actions/update-integration`

Writes this server's Vigiora integration (`integration.version`, pinned by commit and tree hash) into the Home Assistant Vigiora installed (`custom_components/vigiora`; the previous files move to a backup folder), checks the files on disk against the pin, restarts Home Assistant and waits until the Vigiora entry is loaded with the new version. The Home Assistant version does not change. Answers `202` with the status and its job (`action` `update_integration`). `409 conflict` with `reason` `not_installed`, `integration_current` (already this version) or `busy`; `503` with `reason` `no_integration` when this build carries no integration. API 1.22.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_integration`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/update-integration" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The update started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restart Home Assistant

`POST /api/v1/integrations/home-assistant/actions/restart`

Restarts the Home Assistant container Vigiora installed (about a minute without Home Assistant). Answers `202` with the status and its job. `409 conflict` (`not_installed`, `busy`). API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `restart_home_assistant`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/restart" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The restart started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Uninstall Home Assistant

`POST /api/v1/integrations/home-assistant/actions/uninstall`

Revokes the "Home Assistant (local)" API key and, for the Home Assistant Vigiora installed, removes its container and image and moves its configuration folder into a backup folder on the server (never deleted; `last_backup` names it). For a connected existing Home Assistant it only revokes the key and forgets it. Answers `202` with the status and its job. `409 conflict` (`not_installed`, `busy`). API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `uninstall_home_assistant`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/uninstall" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The uninstall started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set up Zigbee in Home Assistant

`POST /api/v1/integrations/home-assistant/actions/setup-zigbee`

Sets up Home Assistant's Zigbee integration (ZHA) for the USB Zigbee coordinator passed into the Home Assistant Vigiora installed, through Home Assistant's own config-flow API: the serial port is chosen (`/dev/serial/by-id/…`), the radio type detected or taken from the stick's name (EZSP for SONOFF Dongle Plus V2 / Dongle-E and SkyConnect, ZNP for Dongle-P and CC2652 sticks, deCONZ for ConBee), a network already on the stick is kept, else a new Zigbee network is formed. Vigiora runs this itself after an install, update or restart and when a known Zigbee stick is plugged in (one attempt per stick set; the outcome is `zigbee` in the status). This operation runs it on request, for instance after a failed attempt. Answers `202` with the status and its job (`setup_zigbee`: `checks`, `configure`, `verify`); "configured" at once when ZHA is already set up. `409 conflict` (`not_installed`, `no_zigbee_dongle`, `busy`). Pairing a device: `…/actions/zigbee-permit-join`. API 1.37.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `setup_home_assistant_zigbee`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/setup-zigbee" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: The Zigbee setup started; poll the status.

```json
{
  "mode": "none",
  "state": "not_installed",
  "version": "version",
  "latest_version": "latest-version",
  "available_versions": [
    "available-version"
  ],
  "update_available": false,
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "access": "lan_only",
  "running": false,
  "container_state": "container-state",
  "devices": [
    "device"
  ],
  "devices_pending": [
    "devices-pending"
  ],
  "helper": {
    "installed": false,
    "version": "version",
    "protocol": 1,
    "remove_command": "remove-command"
  },
  "prechecks": [
    {
      "id": "id",
      "status": "ok",
      "detail": "detail",
      "command": "command"
    }
  ],
  "setup_command": "setup-command",
  "owner_username": "owner-username",
  "owner_password_available": false,
  "api_key_id": 1,
  "config_entry_id": "config-entry-id",
  "integration": {
    "embedded": false,
    "version": "version",
    "commit": "commit",
    "installed_commit": "installed-commit",
    "update_available": false
  },
  "last_error": "last-error",
  "last_backup": "last-backup",
  "zigbee": {
    "available": false,
    "configured": false,
    "port": "port",
    "radio_type": "radio-type",
    "last_error": "last-error"
  },
  "job": {
    "id": "id",
    "action": "install",
    "state": "running",
    "steps": [
      {
        "id": "id",
        "status": "pending"
      }
    ],
    "log": [
      "log"
    ],
    "error": null,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Let a new Zigbee device join

`POST /api/v1/integrations/home-assistant/actions/zigbee-permit-join`

Opens the Zigbee network of the Home Assistant Vigiora installed for new devices for `duration_seconds` (Home Assistant's `zha.permit`): put the device in pairing mode within that time; it then appears in Home Assistant (Settings → Devices & services → Zigbee Home Automation). `409 conflict` (`not_installed`, `zigbee_not_configured`). API 1.37.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `permit_home_assistant_zigbee_join`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/zigbee-permit-join" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Pairing is open.

```json
{
  "duration_seconds": 1,
  "open": false,
  "until": "2026-10-30T14:05:00Z",
  "seconds_left": 1,
  "ieee": "ieee"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the Zigbee devices

`GET /api/v1/integrations/home-assistant/zigbee/devices`

The devices on the Zigbee network of the Home Assistant Vigiora installed (ZHA), fresh from Home Assistant: name, manufacturer, model, address (`ieee`), power source, signal (`lqi`, `rssi`), `last_seen`, `available`, the coordinator flag and each device's entities with the access Vigiora has to them. A device listed for the first time has its useful entities (door, motion, occupancy and vibration sensors, temperature, humidity, illuminance and battery readings, switches, lights, buttons) shared with Vigiora through the Home Assistant bridge, once (`auto_exposed`); a device an admin hid stays hidden (`hidden`). `permit` is the pairing window with its countdown. `409 conflict` (`not_installed`, `zigbee_not_configured`). API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The devices and the pairing window.

```json
{
  "devices": [
    {
      "ieee": "ieee",
      "nwk": 1,
      "name": "Front door",
      "user_name": "user-name",
      "manufacturer": "manufacturer",
      "model": "model",
      "device_reg_id": "device-reg-id",
      "power_source": "power-source",
      "lqi": 1,
      "rssi": 1,
      "last_seen": "last-seen",
      "available": false,
      "coordinator": false,
      "device_type": "device-type",
      "area_id": "area-id",
      "entities": [
        {
          "entity_id": "entity-id",
          "name": "Front door",
          "domain": "domain",
          "kind": "kind",
          "state": "state",
          "access": "none",
          "useful": false,
          "present": false
        }
      ],
      "exposed": false,
      "auto_exposed": false,
      "hidden": false,
      "first_seen_at": "2026-10-30T14:05:00Z",
      "can_identify": false
    }
  ],
  "permit": {
    "duration_seconds": 1,
    "open": false,
    "until": "2026-10-30T14:05:00Z",
    "seconds_left": 1,
    "ieee": "ieee"
  },
  "refreshed_at": "2026-10-30T14:05:00Z",
  "bridge_connected": false
}
```

Errors: `401`, `403`, `409`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename a Zigbee device

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/rename`

Names the device in Home Assistant's device registry (its entities' names follow) and in Vigiora's bridge names ("\<name\> – \<kind\>"). API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | (max 60 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/rename" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door"}'
```

**Response** `200`: The device.

```json
{
  "ieee": "ieee",
  "nwk": 1,
  "name": "Front door",
  "user_name": "user-name",
  "manufacturer": "manufacturer",
  "model": "model",
  "device_reg_id": "device-reg-id",
  "power_source": "power-source",
  "lqi": 1,
  "rssi": 1,
  "last_seen": "last-seen",
  "available": false,
  "coordinator": false,
  "device_type": "device-type",
  "area_id": "area-id",
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "kind": "kind",
      "state": "state",
      "access": "none",
      "useful": false,
      "present": false
    }
  ],
  "exposed": false,
  "auto_exposed": false,
  "hidden": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "can_identify": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a Zigbee device

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/remove`

Removes the device from the Zigbee network (Home Assistant tells it to leave), hides its entities from Vigiora and forgets it: pairing it again starts over. The coordinator cannot be removed (`409 coordinator`). API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `remove_home_assistant_zigbee_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/remove" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Done.

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reconfigure a Zigbee device

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/reconfigure`

Re-interviews and re-binds the device (ZHA's reconfigure); a battery device must be awake (press its button). Answers the device at once; the work runs in Home Assistant. API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/reconfigure" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "ieee": "ieee",
  "nwk": 1,
  "name": "Front door",
  "user_name": "user-name",
  "manufacturer": "manufacturer",
  "model": "model",
  "device_reg_id": "device-reg-id",
  "power_source": "power-source",
  "lqi": 1,
  "rssi": 1,
  "last_seen": "last-seen",
  "available": false,
  "coordinator": false,
  "device_type": "device-type",
  "area_id": "area-id",
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "kind": "kind",
      "state": "state",
      "access": "none",
      "useful": false,
      "present": false
    }
  ],
  "exposed": false,
  "auto_exposed": false,
  "hidden": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "can_identify": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Make a Zigbee device blink

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/identify`

Presses the device's identify button so it blinks (find it in the house). `409 no_identify` when the device has none (`can_identify`). API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/identify" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "ieee": "ieee",
  "nwk": 1,
  "name": "Front door",
  "user_name": "user-name",
  "manufacturer": "manufacturer",
  "model": "model",
  "device_reg_id": "device-reg-id",
  "power_source": "power-source",
  "lqi": 1,
  "rssi": 1,
  "last_seen": "last-seen",
  "available": false,
  "coordinator": false,
  "device_type": "device-type",
  "area_id": "area-id",
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "kind": "kind",
      "state": "state",
      "access": "none",
      "useful": false,
      "present": false
    }
  ],
  "exposed": false,
  "auto_exposed": false,
  "hidden": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "can_identify": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Share a Zigbee device with Vigiora

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/expose`

Exposes the device's useful entities through the Home Assistant bridge (control where possible, read-only for a lock or an alarm panel) and lifts a `hidden` mark. `409 bridge_not_connected` while the bridge does not report the device's entities. API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `expose_home_assistant_zigbee_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/expose" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "ieee": "ieee",
  "nwk": 1,
  "name": "Front door",
  "user_name": "user-name",
  "manufacturer": "manufacturer",
  "model": "model",
  "device_reg_id": "device-reg-id",
  "power_source": "power-source",
  "lqi": 1,
  "rssi": 1,
  "last_seen": "last-seen",
  "available": false,
  "coordinator": false,
  "device_type": "device-type",
  "area_id": "area-id",
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "kind": "kind",
      "state": "state",
      "access": "none",
      "useful": false,
      "present": false
    }
  ],
  "exposed": false,
  "auto_exposed": false,
  "hidden": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "can_identify": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Hide a Zigbee device from Vigiora

`POST /api/v1/integrations/home-assistant/zigbee/devices/{zigbee_device_id}/actions/unexpose`

Hides every entity of the device from Vigiora (its links, triggers and rule actions go with them) and marks it `hidden`: the automatic sharing never touches it again. API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `unexpose_home_assistant_zigbee_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `zigbee_device_id` | path | string | Yes | A Zigbee device address (eight hex pairs, `00:12:4b:00:1c:a1:b2:c3`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/zigbee/devices/42/actions/unexpose" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "ieee": "ieee",
  "nwk": 1,
  "name": "Front door",
  "user_name": "user-name",
  "manufacturer": "manufacturer",
  "model": "model",
  "device_reg_id": "device-reg-id",
  "power_source": "power-source",
  "lqi": 1,
  "rssi": 1,
  "last_seen": "last-seen",
  "available": false,
  "coordinator": false,
  "device_type": "device-type",
  "area_id": "area-id",
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "kind": "kind",
      "state": "state",
      "access": "none",
      "useful": false,
      "present": false
    }
  ],
  "exposed": false,
  "auto_exposed": false,
  "hidden": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "can_identify": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Show the Home Assistant owner password once

`POST /api/v1/integrations/home-assistant/actions/reveal-owner-password`

Answers the generated Home Assistant owner sign-in once and forgets the password (`404 not_found` afterwards; change it in Home Assistant if it is lost). User sessions only (never an API key or an AI agent), as in the web app. API 1.21.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/actions/reveal-owner-password" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The sign-in.

```json
{
  "username": "automation",
  "password": "password"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Home Assistant device connection status

`GET /api/v1/integrations/home-assistant/bridge`

Of instance 1 (several instances: `GET …/instances`, API 1.29.0; `instance_count` says how many exist): whether Vigiora is connected to Home Assistant to use its devices (`state`: `not_configured`, `connecting`, `connected`, `auth_failed`, `error`, `no_secret_key`), with the connection's `source` (`managed`: the token of the Home Assistant Vigiora installed; `manual`: a URL and long-lived token an admin pasted; `none`), Home Assistant's version, the last error and the next retry, how many entities Home Assistant reports and how many are exposed to Vigiora. The token is never returned. `managed_available`: a Home Assistant installed by Vigiora can be used; `human_in_the_loop`: the server's setting that makes agents' device actions wait for approval. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/bridge" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1,
  "managed_available": false,
  "human_in_the_loop": false,
  "instance_id": 1,
  "instance_count": 2
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Connect Home Assistant's devices

`POST /api/v1/integrations/home-assistant/bridge/actions/connect`

Connects Vigiora to Home Assistant's WebSocket API to use its devices: `source: managed` uses the token of the Home Assistant Vigiora installed; `source: manual` takes the Home Assistant `url` (http or https) and a long-lived access `token` (Home Assistant: your profile → Security → Long-lived access tokens). The token is checked by connecting first (`400 validation_error` on `token` when Home Assistant refuses it; `502 device_failed` when it cannot be reached), then stored sealed with the server's secret key; it is never logged or returned, and the request is not idempotent-replayable (`Idempotency-Key` refused). Nothing is exposed until an admin selects devices. Acts on instance 1 and creates it ("Home Assistant") if needed (API 1.29.0). `409 conflict` (`no_managed`, `no_secret_key`, `managed_in_use`: another instance uses the Home Assistant Vigiora installed). API 1.25.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `connect_home_assistant_bridge`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `source` | string: `managed`, `manual` | Yes |  |
| `url` | string | No | manual: http(s)://host:8123 |
| `token` | string | No | manual: a long-lived access token (never returned). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/bridge/actions/connect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"source":"managed"}'
```

**Response** `200`: The status.

```json
{
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1,
  "managed_available": false,
  "human_in_the_loop": false,
  "instance_id": 1,
  "instance_count": 2
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disconnect Home Assistant's devices

`POST /api/v1/integrations/home-assistant/bridge/actions/disconnect`

Forgets the connection (and a pasted token). The selection, links, triggers and rule actions stay for a later connection; devices stop updating and cannot be controlled meanwhile. API 1.25.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disconnect_home_assistant_bridge`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/bridge/actions/disconnect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The status.

```json
{
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1,
  "managed_available": false,
  "human_in_the_loop": false,
  "instance_id": 1,
  "instance_count": 2
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the Home Assistant instances

`GET /api/v1/integrations/home-assistant/instances`

Every Home Assistant this server uses (one per site, e.g. home and shop), by id, with its name, whether it is enabled and its connection status (as `GET …/bridge`). Tokens are never returned. API 1.29.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Every instance (one page).

```json
{
  "data": [
    {
      "id": 1,
      "name": "Front door",
      "enabled": true,
      "state": "not_configured",
      "source": "none",
      "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
      "ha_version": "ha-version",
      "connected_since": "2026-10-30T14:05:00Z",
      "last_event_at": "2026-10-30T14:05:00Z",
      "last_error": "last-error",
      "retry_at": "2026-10-30T14:05:00Z",
      "entities": 1,
      "exposed": 1
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add a Home Assistant instance

`POST /api/v1/integrations/home-assistant/instances`

Adds a Home Assistant with a unique `name` and its connection (`source` and, for `manual`, `url` and a long-lived `token`, checked by connecting first, then stored sealed; never logged or returned; `Idempotency-Key` refused). At most one instance uses `source: managed` (`409 conflict`, `reason: managed_in_use`). Its selection starts empty. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_home_assistant_instance`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | Unique (case-insensitive), e.g. "Home" or "Shop". (max 60 characters) |
| `source` | string: `managed`, `manual` | Yes |  |
| `url` | string | No | manual: http(s)://host:8123 |
| `token` | string | No | manual: a long-lived access token (never returned). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","source":"managed"}'
```

**Response** `201`: The instance.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A Home Assistant instance

`GET /api/v1/integrations/home-assistant/instances/{instance_id}`

API 1.29.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The instance.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Rename, enable or disable a Home Assistant instance

`PATCH /api/v1/integrations/home-assistant/instances/{instance_id}`

`name` (unique) and `enabled` (a disabled instance does not connect; its devices stay selected but are offline). API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_instance`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 60 characters) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","enabled":true}'
```

**Response** `200`: The instance.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a Home Assistant instance

`DELETE /api/v1/integrations/home-assistant/instances/{instance_id}`

Removes the instance with its token, selection, links, triggers and rule actions. The action log keeps its entries. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_home_assistant_instance`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Removed.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Connect a Home Assistant instance

`POST /api/v1/integrations/home-assistant/instances/{instance_id}/actions/connect`

Sets the instance's connection, as `…/bridge/actions/connect` does for instance 1 (the token is checked first, stored sealed and never returned; `Idempotency-Key` refused). API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `connect_home_assistant_instance`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `source` | string: `managed`, `manual` | Yes |  |
| `url` | string | No | manual: http(s)://host:8123 |
| `token` | string | No | manual: a long-lived access token (never returned). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42/actions/connect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"source":"managed"}'
```

**Response** `200`: The instance.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disconnect a Home Assistant instance

`POST /api/v1/integrations/home-assistant/instances/{instance_id}/actions/disconnect`

Forgets the instance's connection (and a pasted token); the instance, its selection, links, triggers and rule actions stay. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disconnect_home_assistant_instance`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42/actions/disconnect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The instance.

```json
{
  "id": 1,
  "name": "Front door",
  "enabled": true,
  "state": "not_configured",
  "source": "none",
  "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx",
  "ha_version": "ha-version",
  "connected_since": "2026-10-30T14:05:00Z",
  "last_event_at": "2026-10-30T14:05:00Z",
  "last_error": "last-error",
  "retry_at": "2026-10-30T14:05:00Z",
  "entities": 1,
  "exposed": 1
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Test a Home Assistant connection

`POST /api/v1/integrations/home-assistant/instances/{instance_id}/actions/test`

Connects to the instance's Home Assistant now, with the stored connection or with the given `url` and `token`, and changes nothing: `ok` with Home Assistant's version, or the `error` (never containing the token). `Idempotency-Key` refused. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | No | With token: test these instead of the stored connection. |
| `token` | string | No | With url (never stored nor returned). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx","token":"preset-1"}'
```

**Response** `200`: The result.

```json
{
  "ok": false,
  "ha_version": "ha-version",
  "error": null
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List an instance's entities to expose

`GET /api/v1/integrations/home-assistant/instances/{instance_id}/entities`

As `GET …/entities`, for this instance. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42/entities" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Every entity (one page).

```json
{
  "data": [
    {
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "name": "Front door",
      "area": "area",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "summary": "summary",
      "capability": "capability",
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "sensitive_ack": false,
      "present": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Expose an instance's entity

`POST /api/v1/integrations/home-assistant/instances/{instance_id}/entities/{entity_id}/actions/set-access`

As `POST …/entities/{entity_id}/actions/set-access`, for this instance's entity. API 1.29.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_home_assistant_instance_entity_access`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | path | integer | Yes | A Home Assistant instance id. (≥ 1) |
| `entity_id` | path | string | Yes | A Home Assistant entity id of the instance (`light.porch`). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `access` | string: `none`, `read`, `control` | Yes |  |
| `confirm_sensitive` | boolean | No | Required to enable control of a lock, alarm panel or siren. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/instances/42/entities/42/actions/set-access" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"access":"none"}'
```

**Response** `200`: The entity.

```json
{
  "instance_id": 1,
  "instance_name": "instance-name",
  "entity_id": "entity-id",
  "name": "Front door",
  "area": "area",
  "domain": "domain",
  "device_class": "device-class",
  "state": "state",
  "summary": "summary",
  "capability": "capability",
  "controllable": false,
  "sensitive": false,
  "access": "none",
  "sensitive_ack": false,
  "present": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List Home Assistant entities to expose

`GET /api/v1/integrations/home-assistant/entities`

Of instance 1, or of `instance_id` (API 1.29.0; also `GET …/instances/{instance_id}/entities`): every entity Home Assistant reports that Vigiora supports (binary sensors, lights, switches, input booleans, locks, alarm panels, sirens, sensors) and its notify services (`notify.<service>`), by area and domain, with the current state, the mapped capability, whether it can be controlled, whether it is sensitive (locks, alarm panels, sirens) and its `access` (`none`, `read`, `control`). Exposed entities Home Assistant no longer reports have `present: false`. Nothing is exposed by default. API 1.25.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | query | integer | No | The Home Assistant instance (default 1). API 1.29.0. (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/entities" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Every entity (one page).

```json
{
  "data": [
    {
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "name": "Front door",
      "area": "area",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "summary": "summary",
      "capability": "capability",
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "sensitive_ack": false,
      "present": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Expose a Home Assistant entity

`POST /api/v1/integrations/home-assistant/entities/{entity_id}/actions/set-access`

Sets what Vigiora may do with an entity: `none` (hidden: its links, triggers and rule actions are removed), `read` or `control` (read and run the commands of its capabilities). Control of a sensitive entity (lock, alarm panel, siren) needs `confirm_sensitive: true` (else `409 conflict`, `reason: sensitive_confirmation_required`); every action on it must then be confirmed again. `400` for an entity Vigiora does not support or with nothing to control; `503` while Home Assistant does not report it. API 1.25.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_home_assistant_entity_access`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entity_id` | path | string | Yes | A Home Assistant device key: the entity id for instance 1 (`light.porch`, `notify.mobile_app_pixel`), `<instance_id>:<entity_id>` for another instance (`2:light.porch`, API 1.29.0). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `access` | string: `none`, `read`, `control` | Yes |  |
| `confirm_sensitive` | boolean | No | Required to enable control of a lock, alarm panel or siren. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/entities/42/actions/set-access" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"access":"none"}'
```

**Response** `200`: The entity.

```json
{
  "instance_id": 1,
  "instance_name": "instance-name",
  "entity_id": "entity-id",
  "name": "Front door",
  "area": "area",
  "domain": "domain",
  "device_class": "device-class",
  "state": "state",
  "summary": "summary",
  "capability": "capability",
  "controllable": false,
  "sensitive": false,
  "access": "none",
  "sensitive_ack": false,
  "present": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List the exposed Home Assistant devices

`GET /api/v1/integrations/home-assistant/devices`

The exposed entities with their live state per capability, the commands allowed (none for read-only devices, and none for a sensitive one before its control is confirmed), the cameras and rooms they are linked to and their recent changes. The same devices are things (`GET /things?kind=external`, `source: home-assistant`). Every instance's devices, or those of `instance_id` (API 1.29.0). API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `instance_id` | query | integer | No | Only this Home Assistant instance (API 1.29.0). (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Every exposed device (one page).

```json
{
  "data": [
    {
      "thing_id": "thing-id",
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "name": "Front door",
      "area": "area",
      "domain": "domain",
      "device_class": "device-class",
      "online": false,
      "access": "read",
      "sensitive": false,
      "sensitive_ack": false,
      "summary": "summary",
      "ha_state": "ha-state",
      "last_changed": "2026-10-30T14:05:00Z",
      "capabilities": [
        {
          "name": "Front door",
          "state": {},
          "commands": [
            "command"
          ]
        }
      ],
      "camera_ids": [
        3
      ],
      "room_ids": [
        1
      ],
      "recent": [
        {
          "at": "2026-10-30T14:05:00Z",
          "from": "from",
          "to": "to",
          "summary": "summary"
        }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Link a device to cameras and rooms

`PATCH /api/v1/integrations/home-assistant/devices/{entity_id}`

Replaces the cameras (`camera_ids`, operator permission on each) and rooms (`room_ids`) a device is linked to. A camera's Guardian descriptions and alert rules get its linked devices (and those of its rooms) as quoted sensor data; a room's AI Live and Guardian get its devices as signals. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entity_id` | path | string | Yes | A Home Assistant device key: the entity id for instance 1 (`light.porch`, `notify.mobile_app_pixel`), `<instance_id>:<entity_id>` for another instance (`2:light.porch`, API 1.29.0). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `camera_ids` | array of integer | No | (max 50 items) |
| `room_ids` | array of integer | No | (max 50 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/home-assistant/devices/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"camera_ids":[3],"room_ids":[1]}'
```

**Response** `200`: The device.

```json
{
  "thing_id": "thing-id",
  "instance_id": 1,
  "instance_name": "instance-name",
  "entity_id": "entity-id",
  "name": "Front door",
  "area": "area",
  "domain": "domain",
  "device_class": "device-class",
  "online": false,
  "access": "read",
  "sensitive": false,
  "sensitive_ack": false,
  "summary": "summary",
  "ha_state": "ha-state",
  "last_changed": "2026-10-30T14:05:00Z",
  "capabilities": [
    {
      "name": "Front door",
      "state": {},
      "commands": [
        "command"
      ]
    }
  ],
  "camera_ids": [
    3
  ],
  "room_ids": [
    1
  ],
  "recent": [
    {
      "at": "2026-10-30T14:05:00Z",
      "from": "from",
      "to": "to",
      "summary": "summary"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run a command on a device

`POST /api/v1/integrations/home-assistant/devices/{entity_id}/actions/command`

Runs one command of the device's capabilities (`<capability>.<command>`: `onoff.turn_on`, `onoff.turn_off`, `brightness.set {level}`, (API 1.47.0) `light.set {on, brightness_pct, rgb, hs, color_name, color_temp_kelvin}`, `light.set_color {rgb|hs|color_name}`, `light.set_temperature {kelvin}`, `cover.open`, `cover.close`, `cover.stop`, `cover.set_position {position}`, `number.set {value}`, `select.select {option}`, `button.press`, `lock.lock`, `lock.unlock`, `alarm_mode.set {mode}`, `siren.turn_on {duration}`, `siren.turn_off`, `notify.send {message, title}`), which calls exactly one Home Assistant service; nothing else can be called. The device must be exposed for control (`403 forbidden`, `reason: read_only`). A sensitive device (lock, alarm panel, siren) needs its control confirmed by an admin (`403`, `reason: sensitive_not_enabled`) and `acknowledge_sensitive: true` (`409 conflict`, `reason: sensitive_confirmation_required`); through MCP it always asks the person, human in the loop on or off. Rate limited (10 a minute per device, 30 per credential, 60 in all: `429`); every action, refused or not, is in the action log. `502 device_failed` when Home Assistant refuses or fails; `503` when it is not connected. API 1.25.0. Admins and operators. Sirens (API 1.105.0): `siren.turn_on` makes a loud noise in a real building; Vigiora sends at most 15 s as its `duration` (also when none or more is asked), stores the run before it sounds and sends `siren.turn_off` at the end itself, and allows at most 60 s per siren in 10 minutes (`429 rate_limited`, `reason: siren_limit`). Alert rules cannot sound one for 10 minutes after Stop all sounds (`409 conflict`, `reason: sounds_paused`); a person or an agent still can. While the siren's last run was not confirmed off, a new `siren.turn_on` is `409 conflict` (`reason: siren_not_off`). `siren.turn_off` here, POST /sounds/actions/stop-all and GET /sounds/active cover these sirens too; stopping is always safe.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `command_home_assistant_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `entity_id` | path | string | Yes | A Home Assistant device key: the entity id for instance 1 (`light.porch`, `notify.mobile_app_pixel`), `<instance_id>:<entity_id>` for another instance (`2:light.porch`, API 1.29.0). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `command` | string | Yes | \<capability\>.\<command\>, e.g. onoff.turn_on. |
| `params` | object | No | The command's params (GET /thing-capabilities documents them). |
| `acknowledge_sensitive` | boolean | No | Confirms an action on a lock, alarm panel or siren. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/devices/42/actions/command" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"command":"command"}'
```

**Response** `200`: Done.

```json
{
  "thing_id": "thing-id",
  "instance_id": 1,
  "entity_id": "entity-id",
  "command": "command",
  "service": "service",
  "log_id": 1
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A room's devices

`GET /api/v1/integrations/home-assistant/room-signals/{room_id}`

The exposed devices a room includes as signals (e.g. the pool gate contact): their state and recent changes go to the room's AI Live and Guardian as quoted sensor data, and a change wakes the room's event-driven AI Live. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/room-signals/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The room's devices.

```json
{
  "room_id": 1,
  "entity_ids": [
    "entity-id"
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set a room's devices

`PATCH /api/v1/integrations/home-assistant/room-signals/{room_id}`

Replaces the room's devices (`entity_ids`, at most 30, exposed devices; notify services are not signals). The devices the floor plan put in the room (an IoT device pinned inside its outline, `managed_devices` of the room) stay whether listed or not (API 1.40.0). API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_room_signals`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `entity_ids` | array of string | Yes | Device keys (`light.porch`, `2:light.porch`). (max 30 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/home-assistant/room-signals/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"entity_ids":["entity-id"]}'
```

**Response** `200`: The room's devices.

```json
{
  "room_id": 1,
  "entity_ids": [
    "entity-id"
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List device triggers

`GET /api/v1/integrations/home-assistant/triggers`

Guardian triggers "device changed → analyse a camera now" of the cameras you may view (or of `camera_id`). API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/triggers" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Every trigger (one page).

```json
{
  "data": [
    {
      "id": 1,
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "camera_id": 3,
      "to_state": "to-state",
      "cooldown_seconds": 1,
      "enabled": true,
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Create a device trigger

`POST /api/v1/integrations/home-assistant/triggers`

When the device changes (to `to_state`, a Home Assistant state such as `on`, `open`, `unlocked`; null = any change), Guardian analyses `camera_id` now, at most once per `cooldown_seconds` (10–86400, default 120), past the motion debounce. The analysis gets the change as quoted sensor data. Needs operator permission on the camera. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_home_assistant_trigger`) |
| Idempotency-Key | Honoured |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `instance_id` | integer | No | The entity's instance (default 1, or the prefix of a device key in entity_id). API 1.29.0. (≥ 1) |
| `entity_id` | string | Yes | An entity id or a device key. |
| `camera_id` | integer | Yes | (≥ 1) |
| `to_state` | string or null | No | (max 64 characters) |
| `cooldown_seconds` | integer | No | (10–86400) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/triggers" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 6f1d2c9a-example" \
  -H "Content-Type: application/json" \
  -d '{"entity_id":"entity-id","camera_id":3}'
```

**Response** `201`: The trigger.

```json
{
  "id": 1,
  "instance_id": 1,
  "instance_name": "instance-name",
  "entity_id": "entity-id",
  "camera_id": 3,
  "to_state": "to-state",
  "cooldown_seconds": 1,
  "enabled": true,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update a device trigger

`PATCH /api/v1/integrations/home-assistant/triggers/{trigger_id}`

A trigger cannot move to another camera. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_trigger`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `trigger_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `instance_id` | integer | No | The entity's instance (default 1, or the prefix of a device key in entity_id). API 1.29.0. (≥ 1) |
| `entity_id` | string | No | An entity id or a device key. |
| `camera_id` | integer | No | Must be the trigger's camera. (≥ 1) |
| `to_state` | string or null | No | (max 64 characters) |
| `cooldown_seconds` | integer | No | (10–86400) |
| `enabled` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/home-assistant/triggers/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"instance_id":1,"entity_id":"entity-id","camera_id":3,"to_state":"to-state","cooldown_seconds":10,"enabled":true}'
```

**Response** `200`: The trigger.

```json
{
  "id": 1,
  "instance_id": 1,
  "instance_name": "instance-name",
  "entity_id": "entity-id",
  "camera_id": 3,
  "to_state": "to-state",
  "cooldown_seconds": 1,
  "enabled": true,
  "last_fired_at": "2026-10-30T14:05:00Z",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Delete a device trigger

`DELETE /api/v1/integrations/home-assistant/triggers/{trigger_id}`

API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_home_assistant_trigger`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `trigger_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/integrations/home-assistant/triggers/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### An alert rule's device actions

`GET /api/v1/integrations/home-assistant/rule-actions/{alert_rule_id}`

What a Guardian alert rule (camera or room rule) does in Home Assistant when it fires. Codes in params are never returned. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Camera permission | at least viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/rule-actions/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The actions.

```json
{
  "alert_rule_id": 1,
  "actions": [
    {
      "id": 1,
      "position": 1,
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "command": "command",
      "params": {},
      "duration_seconds": 1,
      "sensitive_confirmed": false
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set an alert rule's device actions

`PATCH /api/v1/integrations/home-assistant/rule-actions/{alert_rule_id}`

Replaces the rule's actions (at most 10), run in order each time it fires, e.g. `onoff.turn_on` on `light.porch` with `duration_seconds: 300` (turned off again after 5 minutes), `siren.turn_on {duration: 30}`, `notify.send` on `notify.mobile_app_<phone>` (`message` and `title` may use `{rule}`, `{reason}`, `{camera}`, `{room}`, `{severity}`; default `{rule}: {reason}`). Each action is validated against the exposed devices (`400`, with the action's index); a sensitive device needs `sensitive_confirmed: true` (`409 conflict`, `reason: sensitive_confirmation_required`). Actions are logged on the alert (`GET …/action-log?alert_id=`). Needs operator permission on the rule's camera. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_home_assistant_rule_actions`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_rule_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `actions` | array of HomeAssistantRuleActionInput | Yes | (max 10 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/home-assistant/rule-actions/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"actions":[{"instance_id":1,"entity_id":"entity-id","command":"command","params":{},"duration_seconds":1,"sensitive_confirmed":false}]}'
```

**Response** `200`: The actions.

```json
{
  "alert_rule_id": 1,
  "actions": [
    {
      "id": 1,
      "position": 1,
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "command": "command",
      "params": {},
      "duration_seconds": 1,
      "sensitive_confirmed": false
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Device action log

`GET /api/v1/integrations/home-assistant/action-log`

Every control action, newest first: its source (`api`, `mcp`, `chat`, `ai_live`, `rule`, `revert`), who (user, API key or OAuth grant), the alert and rule it ran for, the service called, the outcome (`ok`, `failed`, `refused`, `rate_limited`, `pending`, `denied`) and the error. Codes are never stored. Filters: `alert_id`, `alert_rule_id`, `instance_id`, `entity_id`; `limit` 1–500 (default 100). API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alert_id` | query | integer | No | (≥ 1) |
| `alert_rule_id` | query | integer | No | (≥ 1) |
| `instance_id` | query | integer | No | Only this Home Assistant instance (API 1.29.0). (≥ 1) |
| `entity_id` | query | string | No |  |
| `limit` | query | integer | No | (1–500) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/action-log" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Entries (one page).

```json
{
  "data": [
    {
      "id": 1,
      "at": "2026-10-30T14:05:00Z",
      "source": "source",
      "user_id": 1,
      "api_key_id": 1,
      "oauth_grant_id": 1,
      "alert_rule_id": 1,
      "alert_id": 1,
      "camera_id": 3,
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "command": "command",
      "service": "service",
      "params": {},
      "outcome": "ok",
      "error": null
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Device actions waiting for approval

`GET /api/v1/integrations/home-assistant/pending-actions`

Actions Guardian chat or AI Live asked for that wait for a person (human in the loop is on, or the device is sensitive): your own, and AI Live's for admins and operators (admins see all). They expire after 10 minutes. User sessions only. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/home-assistant/pending-actions" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: Pending actions (one page).

```json
{
  "data": [
    {
      "id": "id",
      "source": "source",
      "requested_by": 1,
      "thing_id": "thing-id",
      "instance_id": 1,
      "instance_name": "instance-name",
      "entity_id": "entity-id",
      "name": "Front door",
      "command": "command",
      "params": {},
      "summary": "summary",
      "sensitive": false,
      "created_at": "2026-10-30T14:05:00Z",
      "expires_at": "2026-10-30T14:05:30Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Approve a pending device action

`POST /api/v1/integrations/home-assistant/pending-actions/{pending_id}/actions/approve`

Runs the action as asked (a sensitive one counts as confirmed by you) and answers its result. User sessions only: an agent can never approve its own action. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `pending_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/pending-actions/42/actions/approve" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The decision.

```json
{
  "id": "id",
  "decision": "approved",
  "result": {
    "thing_id": "thing-id",
    "instance_id": 1,
    "entity_id": "entity-id",
    "command": "command",
    "service": "service",
    "log_id": 1
  }
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Deny a pending device action

`POST /api/v1/integrations/home-assistant/pending-actions/{pending_id}/actions/deny`

Drops the action; nothing runs. User sessions only. API 1.25.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `pending_id` | path | string | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/home-assistant/pending-actions/42/actions/deny" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: The decision.

```json
{
  "id": "id",
  "decision": "approved",
  "result": {
    "thing_id": "thing-id",
    "instance_id": 1,
    "entity_id": "entity-id",
    "command": "command",
    "service": "service",
    "log_id": 1
  }
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### MQTT integration

`GET /api/v1/integrations/mqtt`

The MQTT broker Vigiora publishes its Things to (`broker_url`, `username`, whether a password is stored — `password_set`; the password is never returned —, `client_id`, `topic_prefix`, `node_id`, `tls_verify`, Home Assistant discovery and its prefix, `allow_control`, `qos`) and the connection's `status` (`state`: `disabled`, `connecting`, `connected`, `error`, `no_secret_key`; the topic root `<topic_prefix>/<node_id>`, messages published, things published and discovery entities, the last error and the next retry). Topics: `<root>/status` (online/offline), `<root>/things/<thing_id>/state` (retained JSON), `<root>/events` (the Things envelope, as `GET /events/stream?format=things`), `<root>/things/<thing_id>/cmd` (commands, JSON `{"command": "<capability>.<command>", "params": {}}`, with `allow_control`) and `<discovery_prefix>/<component>/vigiora_<node_id>/<thing>_<key>/config`. API 1.26.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/mqtt" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The integration.

```json
{
  "enabled": true,
  "broker_url": "broker-url",
  "username": "automation",
  "password_set": false,
  "client_id": null,
  "topic_prefix": "topic-prefix",
  "node_id": "node-id",
  "tls_verify": false,
  "discovery": false,
  "discovery_prefix": "discovery-prefix",
  "allow_control": false,
  "qos": 1,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "disabled",
    "broker": "broker",
    "last_error": "last-error",
    "connected_since": "2026-10-30T14:05:00Z",
    "retry_at": "2026-10-30T14:05:00Z",
    "published": 1,
    "last_publish_at": "2026-10-30T14:05:00Z",
    "topic_root": "topic-root",
    "node_id": "node-id",
    "things": 1,
    "discovered": 1
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set up the MQTT integration

`PATCH /api/v1/integrations/mqtt`

Changes the MQTT settings (only the fields sent): `broker_url` (`mqtt://host[:1883]`, `mqtts://`, `ws://`, `wss://`), `username` and `password` (stored sealed with the server's secret key, never returned; an empty string clears it), `client_id`, `topic_prefix` (default `vigiora`), `node_id` (default: this server's slug), `tls_verify`, `discovery` and `discovery_prefix` (default `homeassistant`), `allow_control` (lets anyone who can publish to the command topic run Things commands as the admin who saved these settings: switch recording and AI, set a room's AI mode) and `qos`. `enabled` needs a broker address. The bridge reconnects at once. The request is not idempotent-replayable (`Idempotency-Key` refused). `409 conflict` (`no_secret_key`). API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_mqtt_integration`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `broker_url` | string | No | mqtt://, mqtts://, ws:// or wss://; no credentials in it. (max 512 characters) |
| `username` | string | No | (max 256 characters) |
| `password` | string | No | Never returned; empty clears it. (max 1024 characters) |
| `client_id` | string | No | Letters, digits, _ and -. (max 64 characters) |
| `topic_prefix` | string | No | Up to 4 segments of letters, digits, _ and -; no wildcards. (max 259 characters) |
| `node_id` | string | No | Lowercase letters, digits, _ and -. (max 64 characters) |
| `tls_verify` | boolean | No |  |
| `discovery` | boolean | No |  |
| `discovery_prefix` | string | No | (max 259 characters) |
| `allow_control` | boolean | No |  |
| `qos` | integer | No | (0–2) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/mqtt" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"broker_url":"broker-url","username":"automation","password":"password","client_id":null,"topic_prefix":"topic-prefix","node_id":"node-id","tls_verify":false,"discovery":false,"discovery_prefix":"discovery-prefix","allow_control":false,"qos":1}'
```

**Response** `200`: The integration.

```json
{
  "enabled": true,
  "broker_url": "broker-url",
  "username": "automation",
  "password_set": false,
  "client_id": null,
  "topic_prefix": "topic-prefix",
  "node_id": "node-id",
  "tls_verify": false,
  "discovery": false,
  "discovery_prefix": "discovery-prefix",
  "allow_control": false,
  "qos": 1,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "disabled",
    "broker": "broker",
    "last_error": "last-error",
    "connected_since": "2026-10-30T14:05:00Z",
    "retry_at": "2026-10-30T14:05:00Z",
    "published": 1,
    "last_publish_at": "2026-10-30T14:05:00Z",
    "topic_root": "topic-root",
    "node_id": "node-id",
    "things": 1,
    "discovered": 1
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Publish an MQTT test message

`POST /api/v1/integrations/mqtt/actions/test`

Publishes a test message on `<root>/test` over the current connection. `409 conflict` (`disabled`, `not_connected`); `502 device_failed` when the broker refuses it. API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/mqtt/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Published.

```json
{
  "topic": "topic"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Telegram notifications

`GET /api/v1/integrations/telegram`

The Telegram channel alerts can go to: whether it is on, whether a bot token is stored (`token_set`; the token itself is never returned), the recipients, and its delivery status (`state`: `not_set_up`, `disabled`, `ready`, `error`; `sent`, `suppressed` by the 20-a-minute limit, the last error). API 1.26.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/telegram" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The channel.

```json
{
  "service": "telegram",
  "enabled": true,
  "token_set": false,
  "recipients": [
    "recipient"
  ],
  "pictures": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "not_set_up",
    "last_error": "last-error",
    "last_sent_at": "2026-10-30T14:05:00Z",
    "sent": 1,
    "suppressed": 1
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set up Telegram notifications

`PATCH /api/v1/integrations/telegram`

Changes the Telegram channel: `token` (the bot token from @BotFather, `123456789:AA…`; stored sealed with the server's secret key and never returned; an empty string clears it), `recipients` (Telegram chat ids: a number, negative for groups, or `@channel`; at most 10) and `enabled` (needs a token and a recipient). Only the fields sent change. Then an alert rule's `telegram_enabled` / `line_enabled` chooses it. The request is not idempotent-replayable (`Idempotency-Key` refused). `409 conflict` (`no_secret_key`). API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_telegram_integration`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `token` | string | No | The bot token (never returned); empty clears it. (max 1024 characters) |
| `recipients` | array of string | No | (max 10 items) |
| `pictures` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/telegram" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"token":"preset-1","recipients":["recipient"],"pictures":false}'
```

**Response** `200`: The channel.

```json
{
  "service": "telegram",
  "enabled": true,
  "token_set": false,
  "recipients": [
    "recipient"
  ],
  "pictures": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "not_set_up",
    "last_error": "last-error",
    "last_sent_at": "2026-10-30T14:05:00Z",
    "sent": 1,
    "suppressed": 1
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send a Telegram test message

`POST /api/v1/integrations/telegram/actions/test`

Sends a test message to every recipient of the Telegram channel (the token and recipients must be set; the channel need not be on). `409 conflict` (`not_configured`); `502 device_failed` when Telegram refuses it (the reason, without the token). API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/telegram/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Sent.

```json
{
  "sent_to": [
    "sent-to"
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### LINE notifications

`GET /api/v1/integrations/line`

The LINE channel alerts can go to: whether it is on, whether a bot token is stored (`token_set`; the token itself is never returned), the recipients, and its delivery status (`state`: `not_set_up`, `disabled`, `ready`, `error`; `sent`, `suppressed` by the 20-a-minute limit, the last error). API 1.26.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/integrations/line" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The channel.

```json
{
  "service": "telegram",
  "enabled": true,
  "token_set": false,
  "recipients": [
    "recipient"
  ],
  "pictures": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "not_set_up",
    "last_error": "last-error",
    "last_sent_at": "2026-10-30T14:05:00Z",
    "sent": 1,
    "suppressed": 1
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Set up LINE notifications

`PATCH /api/v1/integrations/line`

Changes the LINE channel: `token` (the Messaging API channel access token; stored sealed with the server's secret key and never returned; an empty string clears it), `recipients` (LINE user, group or room ids: `U…`, `C…` or `R…`, 33 characters; at most 10) and `enabled` (needs a token and a recipient). Only the fields sent change. Then an alert rule's `telegram_enabled` / `line_enabled` chooses it. The request is not idempotent-replayable (`Idempotency-Key` refused). `409 conflict` (`no_secret_key`). API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_line_integration`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `token` | string | No | The bot token (never returned); empty clears it. (max 1024 characters) |
| `recipients` | array of string | No | (max 10 items) |
| `pictures` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/integrations/line" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"token":"preset-1","recipients":["recipient"],"pictures":false}'
```

**Response** `200`: The channel.

```json
{
  "service": "telegram",
  "enabled": true,
  "token_set": false,
  "recipients": [
    "recipient"
  ],
  "pictures": false,
  "updated_at": "2026-10-30T14:05:00Z",
  "status": {
    "state": "not_set_up",
    "last_error": "last-error",
    "last_sent_at": "2026-10-30T14:05:00Z",
    "sent": 1,
    "suppressed": 1
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Send a LINE test message

`POST /api/v1/integrations/line/actions/test`

Sends a test message to every recipient of the LINE channel (the token and recipients must be set; the channel need not be on). `409 conflict` (`not_configured`); `502 device_failed` when LINE refuses it (the reason, without the token). API 1.26.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/integrations/line/actions/test" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: Sent.

```json
{
  "sent_to": [
    "sent-to"
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## IoT devices

The IoT devices page (API 1.39.0): one list of every device Vigiora knows through Home Assistant — the bridge's devices and the Zigbee devices of the Home Assistant Vigiora installed, merged by Home Assistant device id — with search, filters, a detail with the data mapping (what Vigiora makes of each entity) and the settings (rename, rooms, cameras, exposure, Zigbee actions).

### List the IoT devices

`GET /api/v1/iot/devices`

One list of every device Vigiora knows through Home Assistant — the devices of every bridge instance and the Zigbee devices of the Home Assistant Vigiora installed, merged by Home Assistant device id (a Zigbee device carries its `zigbee` facts) — for the IoT devices page: name, manufacturer, model, source, online, battery, signal, whether shared with Vigiora, the device types, up to three headline readings, rooms and cameras. Filters: `q` (name, model, entity id, address), `type`, `source` (`zigbee`, `loona` or an instance id), `state` (`online`, `offline`, `low_battery`), `room_id`, `shared`. `refresh=true` reads the Zigbee network again instead of the recent copy. Sorted by name; paged. The Zigbee pairing window: `GET /iot/zigbee`. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | No | Search words (name, manufacturer, model, area, entity id, Zigbee address). (max 200 characters) |
| `type` | query | string: `sensor`, `binary_sensor`, `switch_light`, `lock_cover`, `climate`, `button`, `camera_linked`, `coordinator` | No |  |
| `source` | query | string | No | `zigbee`, `home_assistant` (any instance), or a Home Assistant instance id. (max 20 characters) |
| `state` | query | string: `online`, `offline`, `low_battery` | No |  |
| `room_id` | query | integer | No | (≥ 1) |
| `shared` | query | boolean | No | Only devices shared with Vigiora (true) or not (false). |
| `refresh` | query | boolean | No | Read the Zigbee network again. |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/iot/devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of devices.

```json
{
  "data": [
    {
      "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
      "instance_id": 1,
      "instance_name": "instance-name",
      "device_id": "device-id",
      "name": "Front door",
      "manufacturer": "manufacturer",
      "model": "model",
      "area": "area",
      "source": "home_assistant",
      "zigbee": {
        "ieee": "ieee",
        "lqi": 1,
        "rssi": 1,
        "last_seen": "last-seen",
        "power_source": "power-source",
        "available": false,
        "coordinator": false,
        "can_identify": false,
        "hidden": false,
        "auto_exposed": false,
        "first_seen_at": "2026-10-30T14:05:00Z"
      },
      "online": false,
      "battery": 1,
      "low_battery": false,
      "signal": 1,
      "shared": false,
      "shared_entities": 1,
      "entity_count": 2,
      "types": [
        "sensor"
      ],
      "headline": [
        {
          "kind": "kind",
          "entity_id": "entity-id",
          "value": "value",
          "unit": "unit"
        }
      ],
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "primary": {
        "entity_id": "entity-id",
        "name": "Front door",
        "access": "none",
        "control": {
          "kind": "light",
          "role": "control",
          "primary": false,
          "device_class": "device-class",
          "fields": [
            null
          ],
          "commands": [
            null
          ]
        }
      },
      "entities": [
        {
          "entity_id": "entity-id",
          "name": "Front door",
          "domain": "domain",
          "device_class": "device-class",
          "state": "state",
          "unit": "unit",
          "summary": "summary",
          "last_changed": "2026-10-30T14:05:00Z",
          "present": false,
          "supported": false,
          "controllable": false,
          "sensitive": false,
          "access": "none",
          "signal": "signal",
          "signal_auto": "signal-auto",
          "signal_override": "signal-override",
          "room_ids": [
            1
          ],
          "managed_room_ids": [
            1
          ],
          "camera_ids": [
            3
          ],
          "trigger_ids": [
            1
          ],
          "rule_ids": [
            1
          ],
          "control": {
            "kind": null,
            "role": null,
            "primary": null,
            "device_class": null,
            "fields": null,
            "commands": null
          },
          "light": {
            "on": null,
            "brightness_pct": null,
            "color_modes": null,
            "color_mode": null,
            "supports_brightness": null,
            "supports_color": null,
            "supports_color_temp": null,
            "rgb": null,
            "hs": null,
            "color_temp_kelvin": null,
            "min_kelvin": null,
            "max_kelvin": null,
            "effect": null,
            "effects": null
          },
          "entity_category": "entity-category"
        }
      ],
      "floor_plans": [
        {
          "floor_plan_id": 1,
          "floor_plan_name": "floor-plan-name",
          "floor_number": 1,
          "site_id": 1,
          "site_name": "site-name",
          "item_id": 1,
          "x": 0.5,
          "y": 0.5,
          "entity_id": "entity-id",
          "room_id": 1,
          "room_name": "room-name"
        }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### An IoT device with its data mapping

`GET /api/v1/iot/devices/{iot_device_id}`

The device with its entities: live value and unit, and what Vigiora makes of each — the access level (`none`, `read`, `control`), the rooms it feeds and the cameras it is linked to, the camera triggers (`trigger_ids`) and alert rules (`rule_ids`) that use it, and the signal kind (`signal`: door, motion, occupancy, vibration, smoke, moisture, temperature, humidity, illuminance, battery, power, switch, light, button, lock, cover, climate, unknown) with the automatic kind and the admin's override, and (API 1.40.0) `floor_plans`: where the device is pinned on floor plans and in which room, with `managed_room_ids` the rooms those pins put it in. `refresh=true` reads the Zigbee network again. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/iot/devices/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device with its entities.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `401`, `403`, `404`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change an IoT devices settings

`PATCH /api/v1/iot/devices/{iot_device_id}`

Renames the device (`name`: Home Assistant's device registry for a Home Assistant or Zigbee device, Vigiora's bridge names follow; an entity without a device is renamed in Vigiora only, once shared), replaces the rooms (`room_ids`) and cameras (`camera_ids`, operator permission on each) every shared entity of the device is linked to (`409 not_shared` before anything is shared; the rooms the floor plan manages stay, API 1.40.0), and sets signal kind overrides (`mappings`: `signal` null = back to the automatic kind). API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_io_t_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No | (max 60 characters) |
| `room_ids` | array of integer | No | The rooms the floor plan manages (`managed_room_ids`) stay whether listed or not (API 1.40.0). (max 50 items) |
| `camera_ids` | array of integer | No | (max 50 items) |
| `mappings` | array of IoTMappingUpdate | No | (max 100 items) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/iot/devices/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Front door","room_ids":[1],"camera_ids":[3],"mappings":[{"entity_id":"entity-id","signal":"door"}]}'
```

**Response** `200`: The device.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### An IoT devices entities

`GET /api/v1/iot/devices/{iot_device_id}/entities`

The device's entities with their live values and data mapping (the same as the device's `entities`; one page). API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/iot/devices/42/entities" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The entities (one page).

```json
{
  "data": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `404`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Forget an IoT device

`POST /api/v1/iot/devices/{iot_device_id}/actions/forget`

Removes what Vigiora keeps about a stale device: its entities are hidden (their links, triggers and rule actions go with them) and its signal kind overrides dropped. Home Assistant is not touched; the device lists again while Home Assistant reports it. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `forget_io_t_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/forget" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Done.

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Share an IoT device with Vigiora

`POST /api/v1/iot/devices/{iot_device_id}/actions/expose`

Exposes the device's useful entities through the Home Assistant bridge (control where possible, read-only for a lock or an alarm panel), named "\<device\> – \<kind\>"; a Zigbee device also loses its `hidden` mark. `409 nothing_to_expose` when no entity is of use. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `expose_io_t_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/expose" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Hide an IoT device from Vigiora

`POST /api/v1/iot/devices/{iot_device_id}/actions/unexpose`

Hides every entity of the device from Vigiora (links, triggers and rule actions go with them); a Zigbee device is marked `hidden` so the automatic sharing never touches it again. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `unexpose_io_t_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/unexpose" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reconfigure a Zigbee device

`POST /api/v1/iot/devices/{iot_device_id}/actions/reconfigure`

ZHA's reconfigure (re-interview and re-bind; a battery device must be awake). `409 not_zigbee` for a device that is not one. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/reconfigure" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Make a Zigbee device blink

`POST /api/v1/iot/devices/{iot_device_id}/actions/identify`

Presses the device's identify button. `409 not_zigbee` for a device that is not one, `409 no_identify` when it has none. API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/identify" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device.

```json
{
  "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
  "instance_id": 1,
  "instance_name": "instance-name",
  "device_id": "device-id",
  "name": "Front door",
  "manufacturer": "manufacturer",
  "model": "model",
  "area": "area",
  "source": "home_assistant",
  "zigbee": {
    "ieee": "ieee",
    "lqi": 1,
    "rssi": 1,
    "last_seen": "last-seen",
    "power_source": "power-source",
    "available": false,
    "coordinator": false,
    "can_identify": false,
    "hidden": false,
    "auto_exposed": false,
    "first_seen_at": "2026-10-30T14:05:00Z"
  },
  "online": false,
  "battery": 1,
  "low_battery": false,
  "signal": 1,
  "shared": false,
  "shared_entities": 1,
  "entity_count": 2,
  "types": [
    "sensor"
  ],
  "headline": [
    {
      "kind": "kind",
      "entity_id": "entity-id",
      "value": "value",
      "unit": "unit"
    }
  ],
  "room_ids": [
    1
  ],
  "managed_room_ids": [
    1
  ],
  "camera_ids": [
    3
  ],
  "primary": {
    "entity_id": "entity-id",
    "name": "Front door",
    "access": "none",
    "control": {
      "kind": "light",
      "role": "control",
      "primary": false,
      "device_class": "device-class",
      "fields": [
        {
          "name": "Front door",
          "type": "boolean",
          "writable": false,
          "value": null,
          "min": 0.5,
          "max": 0.5,
          "step": 0.5,
          "unit": "unit",
          "options": [
            null
          ],
          "max_length": 1
        }
      ],
      "commands": [
        "command"
      ]
    }
  },
  "entities": [
    {
      "entity_id": "entity-id",
      "name": "Front door",
      "domain": "domain",
      "device_class": "device-class",
      "state": "state",
      "unit": "unit",
      "summary": "summary",
      "last_changed": "2026-10-30T14:05:00Z",
      "present": false,
      "supported": false,
      "controllable": false,
      "sensitive": false,
      "access": "none",
      "signal": "signal",
      "signal_auto": "signal-auto",
      "signal_override": "signal-override",
      "room_ids": [
        1
      ],
      "managed_room_ids": [
        1
      ],
      "camera_ids": [
        3
      ],
      "trigger_ids": [
        1
      ],
      "rule_ids": [
        1
      ],
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      },
      "light": {
        "on": false,
        "brightness_pct": 1,
        "color_modes": [
          "color-mode"
        ],
        "color_mode": "color-mode",
        "supports_brightness": false,
        "supports_color": false,
        "supports_color_temp": false,
        "rgb": [
          1
        ],
        "hs": [
          0.5
        ],
        "color_temp_kelvin": 1,
        "min_kelvin": 1,
        "max_kelvin": 1,
        "effect": "effect",
        "effects": [
          "effect"
        ]
      },
      "entity_category": "entity-category"
    }
  ],
  "floor_plans": [
    {
      "floor_plan_id": 1,
      "floor_plan_name": "floor-plan-name",
      "floor_number": 1,
      "site_id": 1,
      "site_name": "site-name",
      "item_id": 1,
      "x": 0.5,
      "y": 0.5,
      "entity_id": "entity-id",
      "room_id": 1,
      "room_name": "room-name"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove a Zigbee device from the network

`POST /api/v1/iot/devices/{iot_device_id}/actions/remove`

Home Assistant tells the device to leave the Zigbee network; its entities are hidden from Vigiora and its overrides dropped. `409 not_zigbee` for a device that is not one, `409 coordinator` for the coordinator. API 1.39.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `remove_io_t_device`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/actions/remove" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Done.

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change a device's control or setting

`POST /api/v1/iot/devices/{iot_device_id}/entities/{entity_id}/actions/set`

Changes one entity of the device as its `control` description allows: `values` sets writable fields (a light's `on`, `brightness_pct` (0 turns it off), one colour `rgb` [r, g, b], `hs` [hue, saturation] or `color_name` (a colour word like "red", "purple", "warm white", translated to rgb), or `color_temp_kelvin` clamped to the light's range, in one call; a switch's or siren's `on`; a cover's `position`; a lock's `locked` (+ `code`); an alarm's `mode` (+ `code`); a number's `value` within its min, max and step; a select's `option`; a notify service's `message` and `title`), `command` runs one of its `commands` (`open`, `close`, `stop`, `press`, `lock`, `unlock`). Values are checked against the description (`400` with the field) and mapped to exactly one Home Assistant service through the bridge: the same rate limits, action log and sensitive-device rules as `commandHomeAssistantDevice` (a lock, alarm panel or siren needs its control confirmed by an admin and `acknowledge_sensitive: true`). The entity must be shared with Vigiora for control (`409 not_controllable`; `409 no_control` when it has nothing to change). Answers what ran and the device afterwards (Home Assistant's new state when it reports it within about 1.5 s). API 1.47.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `set_io_t_device_entity`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |
| `entity_id` | path | string | Yes | A Home Assistant entity id of the instance (`light.porch`). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `command` | string | No | (max 32 characters) |
| `values` | object | No | Field name → new value (only writable fields of the entity's `control`). |
| `acknowledge_sensitive` | boolean | No | A person confirmed this action on a lock, alarm panel or siren. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/entities/42/actions/set" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"command":"command","values":{},"acknowledge_sensitive":false}'
```

**Response** `200`: Done.

```json
{
  "entity_id": "entity-id",
  "command": "command",
  "service": "service",
  "log_id": 1,
  "device": {
    "key": "vgk_xxxxxxxx_xxxxxxxxxxxxxxxx",
    "instance_id": 1,
    "instance_name": "instance-name",
    "device_id": "device-id",
    "name": "Front door",
    "manufacturer": "manufacturer",
    "model": "model",
    "area": "area",
    "source": "home_assistant",
    "zigbee": {
      "ieee": "ieee",
      "lqi": 1,
      "rssi": 1,
      "last_seen": "last-seen",
      "power_source": "power-source",
      "available": false,
      "coordinator": false,
      "can_identify": false,
      "hidden": false,
      "auto_exposed": false,
      "first_seen_at": "2026-10-30T14:05:00Z"
    },
    "online": false,
    "battery": 1,
    "low_battery": false,
    "signal": 1,
    "shared": false,
    "shared_entities": 1,
    "entity_count": 2,
    "types": [
      "sensor"
    ],
    "headline": [
      {
        "kind": "kind",
        "entity_id": "entity-id",
        "value": "value",
        "unit": "unit"
      }
    ],
    "room_ids": [
      1
    ],
    "managed_room_ids": [
      1
    ],
    "camera_ids": [
      3
    ],
    "primary": {
      "entity_id": "entity-id",
      "name": "Front door",
      "access": "none",
      "control": {
        "kind": "light",
        "role": "control",
        "primary": false,
        "device_class": "device-class",
        "fields": [
          {
            "name": null,
            "type": null,
            "writable": null,
            "value": null,
            "min": null,
            "max": null,
            "step": null,
            "unit": null,
            "options": null,
            "max_length": null
          }
        ],
        "commands": [
          "command"
        ]
      }
    },
    "entities": [
      {
        "entity_id": "entity-id",
        "name": "Front door",
        "domain": "domain",
        "device_class": "device-class",
        "state": "state",
        "unit": "unit",
        "summary": "summary",
        "last_changed": "2026-10-30T14:05:00Z",
        "present": false,
        "supported": false,
        "controllable": false,
        "sensitive": false,
        "access": "none",
        "signal": "signal",
        "signal_auto": "signal-auto",
        "signal_override": "signal-override",
        "room_ids": [
          1
        ],
        "managed_room_ids": [
          1
        ],
        "camera_ids": [
          3
        ],
        "trigger_ids": [
          1
        ],
        "rule_ids": [
          1
        ],
        "control": {
          "kind": "light",
          "role": "control",
          "primary": false,
          "device_class": "device-class",
          "fields": [
            null
          ],
          "commands": [
            null
          ]
        },
        "light": {
          "on": false,
          "brightness_pct": 1,
          "color_modes": [
            null
          ],
          "color_mode": "color-mode",
          "supports_brightness": false,
          "supports_color": false,
          "supports_color_temp": false,
          "rgb": [
            null
          ],
          "hs": [
            null
          ],
          "color_temp_kelvin": 1,
          "min_kelvin": 1,
          "max_kelvin": 1,
          "effect": "effect",
          "effects": [
            null
          ]
        },
        "entity_category": "entity-category"
      }
    ],
    "floor_plans": [
      {
        "floor_plan_id": 1,
        "floor_plan_name": "floor-plan-name",
        "floor_number": 1,
        "site_id": 1,
        "site_name": "site-name",
        "item_id": 1,
        "x": 0.5,
        "y": 0.5,
        "entity_id": "entity-id",
        "room_id": 1,
        "room_name": "room-name"
      }
    ]
  }
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Run a light effect (blink, pulse, strobe)

`POST /api/v1/iot/devices/{iot_device_id}/entities/{entity_id}/actions/start-effect`

Runs a server-generated effect on one light entity: Vigiora Server drives the on/off/colour sequence itself (it does not rely on the light's own firmware), so any light that can turn on and off can blink, and any colour light can pulse. `kind` is `blink` (on/off), `pulse` (fades between `rgb` and off, or between `rgb` and `rgb2`), `strobe` (fast on/off) or `sos` (· · · — — — · · ·). `duration_s` caps the whole run (default 10, max 300); `period_ms` is one on/off cycle (clamped 120–10000); `rgb`/`rgb2` are `[r, g, b]` 0–255; `brightness_pct` is 0–100 (0 keeps the light's own). The light's state (on/off, brightness, colour) is captured before the effect and restored exactly when it ends — on its own, when stopped, when a newer effect starts on the same light, or when the server stops. Starting an effect on a light that already has one replaces it. Checked against the entity's control the same way as `setIoTDeviceEntity` (a sensitive light needs the control confirmed by an admin). API 1.59.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `start_io_t_light_effect`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |
| `entity_id` | path | string | Yes | A Home Assistant entity id of the instance (`light.porch`). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `blink`, `pulse`, `strobe`, `sos` | Yes | The effect to run. |
| `duration_s` | integer | No | Whole run in seconds (0 → 10, max 300). (0–300) |
| `period_ms` | integer | No | One on/off cycle in milliseconds (0 → per-kind default; clamped 120–10000). |
| `rgb` | array of integer | No | Colour for blink/pulse as [r, g, b]; omit to keep the light's own colour. (max 3 items) |
| `rgb2` | array of integer | No | Pulse's second colour as [r, g, b]; omit to pulse the colour against off. (max 3 items) |
| `brightness_pct` | integer | No | 0 keeps the light's own brightness. (0–100) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/entities/42/actions/start-effect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"kind":"blink"}'
```

**Response** `200`: The effect is running.

```json
{
  "id": "id",
  "entity_id": "entity-id",
  "kind": "kind",
  "started": "2026-10-30T14:05:00Z",
  "ends": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Stop a light effect

`POST /api/v1/iot/devices/{iot_device_id}/entities/{entity_id}/actions/stop-effect`

Cancels the effect running on a light entity and restores the light to the state it had before the effect started. `404` if no effect is running there. API 1.59.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `iot_device_id` | path | string | Yes | An IoT device key: `<instance id>:`, or `<instance id>:<entity id>` for an entity without a device. (max 200 characters) |
| `entity_id` | path | string | Yes | A Home Assistant entity id of the instance (`light.porch`). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/iot/devices/42/entities/42/actions/stop-effect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Stopped and restored.

Errors: `401`, `403`, `404`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Automatic camera-alert light actions

`GET /api/v1/iot/auto-actions`

The actions Vigiora created by itself: when an alert rule fires on a camera, the light Vigiora may control in the camera's room turns on (high severity: an SOS flash first) and goes back after `cooldown_seconds`. One per (camera, light) pair that share a room; `after_dark` is on by default (sunset to sunrise at the server's location). `announced_at` is when Vigiora told the staff it linked the light; it first acts a few minutes after that. `camera_id` narrows the list. API 1.62.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/iot/auto-actions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The automatic actions (one page; there is no next cursor).

```json
{
  "data": [
    {
      "id": 1,
      "camera_id": 3,
      "camera_name": "Front door",
      "room_id": 1,
      "room_name": "room-name",
      "device": "device",
      "entity_id": "entity-id",
      "device_name": "device-name",
      "enabled": true,
      "after_dark": false,
      "cooldown_seconds": 1,
      "announced_at": "2026-10-30T14:05:00Z",
      "last_fired_at": "2026-10-30T14:05:00Z",
      "created_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Dismiss an automatic light action

`DELETE /api/v1/iot/auto-actions/{auto_action_id}`

The undo: removes the action and remembers it, so Vigiora never links that camera and light again. The light stays under your control (a light Vigiora turned on for it is put back). API 1.62.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `dismiss_auto_light_action`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `auto_action_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/iot/auto-actions/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Dismissed.

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Zigbee for the IoT devices page

`GET /api/v1/iot/zigbee`

Whether the Home Assistant Vigiora installed has Zigbee set up and the pairing window with its countdown (`permit`, null when Zigbee is not available), for the IoT devices page's "Pair a new device" state. Pairing itself: `POST /integrations/home-assistant/actions/zigbee-permit-join` (admins). API 1.39.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/iot/zigbee" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Zigbee state.

```json
{
  "available": false,
  "configured": false,
  "permit": {
    "duration_seconds": 1,
    "open": false,
    "until": "2026-10-30T14:05:00Z",
    "seconds_left": 1,
    "ieee": "ieee"
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Bluetooth

Bluetooth nearby (API 1.42.0): the devices in range of the server's Bluetooth adapter (BLE and classic, through BlueZ), scanned once an hour and on demand, each with what it advertises, a classification and a report of the data it could provide and how Vigiora could use it. Advertisements only: nothing is ever paired or connected to.

### Bluetooth nearby status

`GET /api/v1/bluetooth`

Whether the server can scan the Bluetooth devices around it (`available`; `reason` `not_supported` (not Linux), `no_dbus`, `no_bluez`, `no_adapter`, `adapter_off`, `denied` (the D-Bus policy refuses the service account) or `disabled`), the adapter, the scan settings (`enabled`, `scan_interval_minutes`, `scan_seconds`: also on `GET /settings` as `bluetooth_enabled`, `bluetooth_scan_interval_minutes`, `bluetooth_scan_seconds`), whether a scan runs now, the last scan, when the next scheduled one is due (`next_scan_at`, null while disabled or unavailable), the number of devices known (ignored ones excluded) and those first seen in the last 24 hours. The server scans once an hour (and two minutes after it starts): BLE and classic devices in range of the host adapter, through BlueZ, reading advertisements only — nothing is ever paired or connected to. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/bluetooth" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Bluetooth state.

```json
{
  "available": false,
  "reason": "not_supported",
  "message": "This API key lacks the cameras:write scope.",
  "adapter": {
    "address": "address",
    "name": "Front door",
    "powered": false,
    "discovering": false
  },
  "enabled": true,
  "scan_interval_minutes": 1,
  "scan_seconds": 1,
  "scanning": false,
  "last_scan": {
    "id": 1,
    "started_at": "2026-10-30T14:05:00Z",
    "finished_at": "2026-10-30T14:05:00Z",
    "duration_seconds": 1,
    "devices_found": 1,
    "new_devices": 1,
    "adapter": "adapter",
    "trigger": "schedule",
    "error": null
  },
  "next_scan_at": "2026-10-30T14:05:00Z",
  "devices": 1,
  "new_today": 1
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Bluetooth devices seen near the server

`GET /api/v1/bluetooth/devices`

Every device a scan has seen, most recently seen first, with what it advertised (name, maker from the Bluetooth SIG company identifier, services by name, manufacturer and service data as hex, appearance, class of device, signal), the classification (`kind`: phone, watch, earbuds, speaker_tv, tracker, sensor, smart_home, computer, car, beacon, unknown; `label`, `confidence`) and the history (first and last seen, `seen_count`, `new_today`). A device is keyed by its address; phones, watches and earbuds rotate a random address (`random_address`) every few minutes, and a device that came back under a new address with the same name and payload keeps its entry (`address_changes`). Ignored devices are left out unless `include_ignored=true`. The full report (what it is, the data it could provide, how Vigiora could use it) is on the detail. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | query | string: `phone`, `watch`, `earbuds`, `speaker_tv`, `tracker`, `sensor`, `smart_home`, `computer`, `car`, `beacon`, `unknown` | No |  |
| `q` | query | string | No | Search words (name, address, maker, label, note). (max 200 characters) |
| `seen_since` | query | string (RFC 3339) | No | Only devices seen at or after this time. |
| `include_ignored` | query | boolean | No |  |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/bluetooth/devices" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: One page of devices.

```json
{
  "data": [
    {
      "address": "address",
      "address_type": "public",
      "random_address": false,
      "address_changes": 1,
      "name": "Front door",
      "kind": "phone",
      "label": "person",
      "confidence": "high",
      "rssi": 1,
      "rssi_best": 1,
      "tx_power": 1,
      "manufacturer_id": 1,
      "manufacturer": "manufacturer",
      "manufacturer_data": "manufacturer-data",
      "services": [
        {
          "uuid": "uuid",
          "name": "Front door"
        }
      ],
      "service_data": {},
      "appearance": 1,
      "class_of_device": 1,
      "paired": false,
      "connected": false,
      "trusted": false,
      "first_seen_at": "2026-10-30T14:05:00Z",
      "last_seen_at": "2026-10-30T14:05:00Z",
      "seen_count": 2,
      "new_today": false,
      "ignored": false,
      "note": "note",
      "report": {
        "kind": "phone",
        "label": "person",
        "confidence": "high",
        "data_available": [
          {
            "code": "code",
            "text": "text"
          }
        ],
        "uses_for_vigiora": [
          {
            "code": "code",
            "text": "text"
          }
        ],
        "notes": [
          {
            "code": "code",
            "text": "text"
          }
        ],
        "reasons": [
          "reason"
        ]
      }
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### A Bluetooth device with its report

`GET /api/v1/bluetooth/devices/{bluetooth_device_id}`

The device with its `report`: what it is (`kind`, `label`, `confidence`, the `reasons` that decided it), the data it could provide (`data_available`: presence per scan, signal, a stable or rotating identity, battery or readings over GATT (a documented future step: nothing is connected to yet), beacon ids, tracker status…) and how Vigiora could use it (`uses_for_vigiora`: occupancy of a known phone or watch, a 'someone is home' signal from a TV or speaker, an unknown device at night as a security signal, a tracker staying near the house, environmental readings on the floor plan…), with `notes` (rotating addresses, nothing paired). Each line has a stable `code` and an English `text`. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bluetooth_device_id` | path | string | Yes | A Bluetooth device address (`AA:BB:CC:DD:EE:FF`, any case). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/bluetooth/devices/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The device and its report.

```json
{
  "address": "address",
  "address_type": "public",
  "random_address": false,
  "address_changes": 1,
  "name": "Front door",
  "kind": "phone",
  "label": "person",
  "confidence": "high",
  "rssi": 1,
  "rssi_best": 1,
  "tx_power": 1,
  "manufacturer_id": 1,
  "manufacturer": "manufacturer",
  "manufacturer_data": "manufacturer-data",
  "services": [
    {
      "uuid": "uuid",
      "name": "Front door"
    }
  ],
  "service_data": {},
  "appearance": 1,
  "class_of_device": 1,
  "paired": false,
  "connected": false,
  "trusted": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "last_seen_at": "2026-10-30T14:05:00Z",
  "seen_count": 2,
  "new_today": false,
  "ignored": false,
  "note": "note",
  "report": {
    "kind": "phone",
    "label": "person",
    "confidence": "high",
    "data_available": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "uses_for_vigiora": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "notes": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "reasons": [
      "reason"
    ]
  }
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Note or ignore a Bluetooth device

`PATCH /api/v1/bluetooth/devices/{bluetooth_device_id}`

Sets the admin's `note` (at most 500 characters) and the `ignored` flag (an ignored device is left out of the list and the counts, and is still updated by scans). Give at least one. Nothing is paired, connected or removed. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bluetooth_device_id` | path | string | Yes | A Bluetooth device address (`AA:BB:CC:DD:EE:FF`, any case). |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `note` | string | No | (max 500 characters) |
| `ignored` | boolean | No |  |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/bluetooth/devices/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"note":"note","ignored":false}'
```

**Response** `200`: The device and its report.

```json
{
  "address": "address",
  "address_type": "public",
  "random_address": false,
  "address_changes": 1,
  "name": "Front door",
  "kind": "phone",
  "label": "person",
  "confidence": "high",
  "rssi": 1,
  "rssi_best": 1,
  "tx_power": 1,
  "manufacturer_id": 1,
  "manufacturer": "manufacturer",
  "manufacturer_data": "manufacturer-data",
  "services": [
    {
      "uuid": "uuid",
      "name": "Front door"
    }
  ],
  "service_data": {},
  "appearance": 1,
  "class_of_device": 1,
  "paired": false,
  "connected": false,
  "trusted": false,
  "first_seen_at": "2026-10-30T14:05:00Z",
  "last_seen_at": "2026-10-30T14:05:00Z",
  "seen_count": 2,
  "new_today": false,
  "ignored": false,
  "note": "note",
  "report": {
    "kind": "phone",
    "label": "person",
    "confidence": "high",
    "data_available": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "uses_for_vigiora": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "notes": [
      {
        "code": "code",
        "text": "text"
      }
    ],
    "reasons": [
      "reason"
    ]
  }
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Scan for Bluetooth devices now

`POST /api/v1/bluetooth/actions/scan`

Runs a scan now and answers when it is done (about `seconds`, 5–60, default the `bluetooth_scan_seconds` setting) with the scan: how many devices were seen and how many were new. New devices are announced as `bluetooth.device_found` events. One scan runs at a time (`409 scan_in_progress`); without a usable adapter `409 bluetooth_unavailable` with `details.reason`. Advertisements only: nothing is paired or connected to. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `scan_bluetooth`) |
| Idempotency-Key | Ignored |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seconds` | integer | No | How long to listen (default the `bluetooth_scan_seconds` setting). (5–60) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/bluetooth/actions/scan" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"seconds":5}'
```

**Response** `200`: The finished scan.

```json
{
  "id": 1,
  "started_at": "2026-10-30T14:05:00Z",
  "finished_at": "2026-10-30T14:05:00Z",
  "duration_seconds": 1,
  "devices_found": 1,
  "new_devices": 1,
  "adapter": "adapter",
  "trigger": "schedule",
  "error": null
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Bluetooth scan history

`GET /api/v1/bluetooth/scans`

The scans run (scheduled, at startup or on demand), newest first, with their outcome. API 1.42.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/bluetooth/scans" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: One page of scans.

```json
{
  "data": [
    {
      "id": 1,
      "started_at": "2026-10-30T14:05:00Z",
      "finished_at": "2026-10-30T14:05:00Z",
      "duration_seconds": 1,
      "devices_found": 1,
      "new_devices": 1,
      "adapter": "adapter",
      "trigger": "schedule",
      "error": null
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Loona

Loona pet robot (API 1.64.0, experimental, read-only): the server finds a Loona robot on the home network, keeps a session to it and reads its battery and version; it also appears on the IoT devices page (source `loona`). Off by default and dormant until an admin enables it and enters the KEYi account user id. Unofficial integration: it uses the vendor app's local protocol and may not be covered by the vendor's terms of service.

### Loona robot status

`GET /api/v1/loona`

The Loona pet robot integration (experimental): whether it is `configured` (enabled and the KEYi account id stored; otherwise nothing runs and nothing is tried), `online` (a session to the robot is open now; a sleeping or off-network robot is normal), `rejected` (the robot refused the account id), the last error, and the robot (`device`: serial, model, IP, firmware version, battery percent, last seen). The robot is found on the local network automatically. The account id is never returned (`keyi_user_id_set`). API 1.64.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/loona" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the Loona settings

`PATCH /api/v1/loona/settings`

Turns the integration on or off and sets the KEYi account user id (`keyi_user_id`, the one value the server cannot find out; required to enable), the KEYi region host (`host`, default `jploona.keyirobot.cn`) and optionally the robot's serial (helps discovery) or IP (skips discovery). Fields left out keep their value. The server then connects by itself. Enabling connects a device on the local network to a third-party robot with the owner's account id, so it needs confirmation from an AI agent. `400 validation_failed` for a bad value. API 1.64.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_loona_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No | Needs `keyi_user_id`. |
| `keyi_user_id` | string | No | The KEYi ("Hello Loona" app) account user id. (max 128 characters) |
| `host` | string | No | The KEYi region host (default `jploona.keyirobot.cn`). (max 253 characters) |
| `robot_serial` | string | No | Optional: the robot serial, so discovery can find it. (max 128 characters) |
| `robot_ip` | string | No | Optional: the robot IP (skips discovery); empty clears it. (max 45 characters) |
| `auto_turn` | boolean | No | Turn the robot toward a room where a high-severity alert fires (off by default). |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/loona/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"keyi_user_id":"keyi-user-id","host":"host","robot_serial":"robot-serial","robot_ip":"robot-ip","auto_turn":false}'
```

**Response** `200`: The Loona state with the new settings.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Ask the Loona robot for its state now

`POST /api/v1/loona/actions/refresh`

Re-queries the battery, firmware version, system and mode over the open session (read-only: nothing moves) and answers with the state as it is now; the new readings arrive within a second or two (call `GET /loona`). `409 conflict` with `details.reason` `not_connected` when the robot is asleep, off the network or the integration is off. `502 device_failed` when the robot did not accept the query. API 1.64.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `refresh_loona`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/refresh" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Drive the Loona robot

`POST /api/v1/loona/actions/drive`

EXPERIMENTAL. Nudges the robot in a direction (`direction`: `forward`, `backward`, `left` or `right`) for `duration_ms` milliseconds (default ~400, clamped to a safe range). The robot physically moves, so it needs confirmation from an AI agent. The command enters remote control, sends the nudge and leaves. The wire payload is best-effort (the integration is reverse-engineered). `409 conflict` with `details.reason` `not_connected` when the robot is asleep, off the network or the integration is off. `502 device_failed` when the robot did not accept the command. API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `drive_loona`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `direction` | string: `forward`, `backward`, `left`, `right` | Yes | Which way to nudge the robot. |
| `duration_ms` | integer or null | No | How long to drive in milliseconds (clamped 100-3000; default ~400). (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/drive" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"direction":"forward"}'
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Make the Loona robot speak

`POST /api/v1/loona/actions/speak`

EXPERIMENTAL. Makes the robot say `text` (at most 500 characters) out loud through its GPT-chat command. The robot speaks, so it needs confirmation from an AI agent. The wire payload is best-effort. `409 conflict` (`details.reason` `not_connected`) when the robot is not connected. `502 device_failed` when the robot did not accept the command. API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `speak_loona`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | What the robot should say out loud. (max 500 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/speak" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"text":"text"}'
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Make the Loona robot take a photo

`POST /api/v1/loona/actions/photo`

EXPERIMENTAL. Asks the robot to take a still with its camera (saved to the KEYi cloud; nothing is returned on the socket). Needs confirmation from an AI agent. The wire payload is best-effort. `409 conflict` (`details.reason` `not_connected`) when the robot is not connected. `502 device_failed` when the robot did not accept the command. API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `photo_loona`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/photo" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Make the Loona robot play an expression

`POST /api/v1/loona/actions/emote`

EXPERIMENTAL. Makes the robot play a canned expression / behaviour (`kind`: `face`, `find_people`, `fondle`, `listen_name` or `mechanical`). The robot moves and emotes, so it needs confirmation from an AI agent. The wire payload is best-effort. `409 conflict` (`details.reason` `not_connected`) when the robot is not connected. `502 device_failed` when the robot did not accept the command. API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:control` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `emote_loona`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `face`, `find_people`, `fondle`, `listen_name`, `mechanical` | Yes | The canned expression / behaviour to play. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/emote" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"kind":"face"}'
```

**Response** `200`: The Loona state.

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Disconnect from the Loona robot

`POST /api/v1/loona/actions/disconnect`

Drops the live link to the robot and stops the server redialling, WITHOUT forgetting it: the KEYi account id, host, serial and IP stay configured, so a later reconnect brings it back. The robot then shows as disconnected by you (`paused`) rather than merely asleep. Reversible with `POST /loona/actions/reconnect`. API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `disconnect_loona`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/disconnect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Loona state (now paused).

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Reconnect to the Loona robot

`POST /api/v1/loona/actions/reconnect`

Clears the paused state set by `POST /loona/actions/disconnect` and redials the robot now (it connects when the robot is awake and reachable). API 1.67.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `devices:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `reconnect_loona`) |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/loona/actions/reconnect" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The Loona state (redialling).

```json
{
  "configured": false,
  "enabled": true,
  "keyi_user_id_set": false,
  "host": "host",
  "robot_serial": "robot-serial",
  "robot_ip": "robot-ip",
  "online": false,
  "auto_turn": false,
  "paused": false,
  "rejected": false,
  "last_error": "last-error",
  "device": {
    "sn": "sn",
    "model": "model",
    "ip": "ip",
    "fw_version": "fw-version",
    "battery_pct": 1,
    "online": false,
    "last_seen_at": "2026-10-30T14:05:00Z",
    "os": "os",
    "mode": "mode",
    "iot_device_key": "iot-device-key"
  }
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## PerceptionCoach

Perception Coach (API 1.68.0): a background service that audits each AI-guardian camera's prompt against the live frames and either rewrites it (blank prompt, or a camera that opted in) or records a suggestion an operator can apply. Off by default; uses AI credits within a daily cap. Every prompt change is kept in the camera's prompt history so the human prompt can be restored. Since 1.69.0 it also tunes each room's AI rules (`rooms.ai_rules`) the same way.

### Perception Coach status

`GET /api/v1/agents/perception-coach`

The coach configuration (`enabled`, `interval_seconds`, `bar`, `daily_cap`), the model calls made today (`calls_today`, UTC day) and the newest prompt history entries (`recent`, at most 10, of cameras the caller may view). API 1.68.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/agents/perception-coach" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The coach state.

```json
{
  "enabled": true,
  "interval_seconds": 1,
  "bar": 0.5,
  "daily_cap": 1,
  "calls_today": 1,
  "recent": [
    {
      "id": 1,
      "kind": "camera",
      "monitor_id": 1,
      "room_id": 1,
      "prompt": "prompt",
      "source": "human",
      "score": {},
      "rationale": "rationale",
      "created_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Change the Perception Coach settings

`PATCH /api/v1/agents/perception-coach/settings`

Turns the coach on or off and sets how often a camera is audited (`interval_seconds`), the score below which a prompt is rewritten or a rewrite suggested (`bar`, above 0 up to 1) and the model calls allowed per day (`daily_cap`, 0 pauses it). Fields left out keep their value. Enabling lets AI rewrite camera prompts and spend AI credits, so it needs confirmation from an AI agent. `400 validation_failed` for a bad value. API 1.68.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `patch_perception_coach_settings`) |
| Idempotency-Key | Ignored |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No |  |
| `interval_seconds` | integer | No | (≥ 1) |
| `bar` | number | No | Above 0. (0–1) |
| `daily_cap` | integer | No | (≥ 0) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/agents/perception-coach/settings" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"interval_seconds":1,"bar":0.5,"daily_cap":1}'
```

**Response** `200`: The new settings.

```json
{
  "enabled": true,
  "interval_seconds": 1,
  "bar": 0.5,
  "daily_cap": 1
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Perception Coach prompt history

`GET /api/v1/agents/perception-coach/history`

The newest prompt history entries, newest first: every prompt a person wrote (`human`, recorded when the coach first replaces it) and every prompt the coach applied or suggested (`coach`; `score` and `rationale` say why). With `camera_id` only that camera (needs permission to view it); otherwise all cameras the caller may view. API 1.68.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin, operator |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | query | integer | No | Only this camera. (≥ 1) |
| `room_id` | query | integer | No | Only this room (API 1.69.0); not together with `camera_id`. (≥ 1) |
| `limit` | query | integer | No | At most this many (1–200, default 50). (default `50`) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/agents/perception-coach/history" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The entries.

```json
{
  "entries": [
    {
      "id": 1,
      "kind": "camera",
      "monitor_id": 1,
      "room_id": 1,
      "prompt": "prompt",
      "source": "human",
      "score": {},
      "rationale": "rationale",
      "created_at": "2026-10-30T14:05:00Z"
    }
  ]
}
```

Errors: `400`, `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Apply the Perception Coach suggestion

`POST /api/v1/cameras/{camera_id}/actions/apply-perception-coach`

Replaces the camera's AI guardian prompt with the coach's newest suggestion (the human opting in). The prompt in force is kept in the history first, so `POST /cameras/{camera_id}/actions/revert-perception-coach` can restore it. `404 not_found` when the coach has no suggestion that differs from the prompt in force; `409 conflict` when the prompt changed while this ran. API 1.68.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `apply_perception_coach`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/apply-perception-coach" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The prompt now in force.

```json
{
  "prompt": "prompt"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restore the human prompt

`POST /api/v1/cameras/{camera_id}/actions/revert-perception-coach`

Puts back the camera's newest human-written AI guardian prompt (the one the coach replaced) and records the revert in the history. `404 not_found` when no human prompt was ever recorded for the camera; `409 conflict` when the prompt changed while this ran. API 1.68.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `cameras:write` |
| Roles | admin, operator |
| Camera permission | at least operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `revert_perception_coach`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `camera_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/cameras/3/actions/revert-perception-coach" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The prompt now in force.

```json
{
  "prompt": "prompt"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Apply the Perception Coach suggestion to a room

`POST /api/v1/rooms/{room_id}/actions/apply-perception-coach`

Replaces the room's AI rules (`ai_rules`) with the coach's newest suggestion (the human opting in). The rules in force are kept in the history first, so `POST /rooms/{room_id}/actions/revert-perception-coach` can restore them. `404 not_found` when there is no such room or the coach has no suggestion that differs from the rules in force; `409 conflict` when the rules changed while this ran. Needs operator permission on every camera of the room (an empty room is reachable by admins and operators); `403 forbidden` otherwise. API 1.69.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `apply_room_perception_coach`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/actions/apply-perception-coach" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rules now in force (in `prompt`).

```json
{
  "prompt": "prompt"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Restore the human room rules

`POST /api/v1/rooms/{room_id}/actions/revert-perception-coach`

Puts back the room's newest human-written AI rules (the ones the coach replaced) and records the revert in the history. `404 not_found` when there is no such room or no human rules were ever recorded; `409 conflict` when the rules changed while this ran. Needs operator permission on every camera of the room (an empty room is reachable by admins and operators); `403 forbidden` otherwise. API 1.69.0. Admins and operators.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin, operator |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `revert_room_perception_coach`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `room_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/rooms/42/actions/revert-perception-coach" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The rules now in force (in `prompt`).

```json
{
  "prompt": "prompt"
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Memory

What Vigiora remembers about the calling user (API 1.65.0): durable facts learned from their Guardian chats, which they can list, correct and delete. Every call is limited to the caller's own facts.

### List what Vigiora remembers about you

`GET /api/v1/memory/facts`

The durable facts Vigiora learned about the calling user from their Guardian chats (a person, a habit, an experience, a preference), newest change first. Only the caller's own facts are ever returned, whatever the role. Filters: `kind` and `subject` (exact, case-insensitive). API 1.65.0.

| Requirement | |
| --- | --- |
| Scope | `memory:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | No | Page size, 1–200. (default `50`) |
| `cursor` | query | string | No | `next_cursor` of the previous page. |
| `kind` | query | string: `person`, `habit`, `experience`, `preference`, `other` | No |  |
| `subject` | query | string | No |  |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/memory/facts" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: A page of facts.

```json
{
  "data": [
    {
      "id": 1,
      "kind": "person",
      "subject": "subject",
      "fact": "fact",
      "confidence": 0.5,
      "source_conversation_id": 1,
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z"
    }
  ],
  "next_cursor": null
}
```

Errors: `400`, `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Read one remembered fact

`GET /api/v1/memory/facts/{fact_id}`

One of the caller's own facts. `404 not_found` for a fact that does not exist or belongs to another user. API 1.65.0.

| Requirement | |
| --- | --- |
| Scope | `memory:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fact_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/memory/facts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The fact.

```json
{
  "id": 1,
  "kind": "person",
  "subject": "subject",
  "fact": "fact",
  "confidence": 0.5,
  "source_conversation_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Correct a remembered fact

`PATCH /api/v1/memory/facts/{fact_id}`

Changes the text (`fact`), `kind` or `subject` of one of the caller's own facts; fields left out keep their value. The fact is embedded again so recall finds it by its new meaning (`503 service_unavailable` when the embedding service is not available, `502 device_failed` when it fails). It rewrites what Vigiora believes about a person, so it needs confirmation from an AI agent. `404 not_found` for a fact that belongs to another user. API 1.65.0.

| Requirement | |
| --- | --- |
| Scope | `memory:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_memory_fact`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fact_id` | path | integer | Yes | (≥ 1) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string: `person`, `habit`, `experience`, `preference`, `other` | No |  |
| `subject` | string | No | (max 200 characters) |
| `fact` | string | No | (max 1000 characters) |

**Example request**

```bash
curl -s -X PATCH "https://yourname.vigiora.com/api/v1/memory/facts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"kind":"person","subject":"subject","fact":"fact"}'
```

**Response** `200`: The fact after the change.

```json
{
  "id": 1,
  "kind": "person",
  "subject": "subject",
  "fact": "fact",
  "confidence": 0.5,
  "source_conversation_id": 1,
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z"
}
```

Errors: `400`, `401`, `403`, `404`, `415`, `429`, `502`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Forget a remembered fact

`DELETE /api/v1/memory/facts/{fact_id}`

Permanently deletes one of the caller's own facts; Vigiora stops using it in answers. It cannot be undone, so it needs confirmation from an AI agent. `404 not_found` for a fact that belongs to another user. API 1.65.0.

| Requirement | |
| --- | --- |
| Scope | `memory:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `delete_memory_fact`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fact_id` | path | integer | Yes | (≥ 1) |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/memory/facts/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Deleted.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Account

The caller's own sign-in security (API 1.107.0): two-factor sign-in with an authenticator app (status with `account:read`; turning it on or off and new recovery codes need a user session, never an API key) and the signed-in devices list (`account:read`, signing one out `account:write`). Every call is limited to the caller's own account. OAuth clients (MCP connections) are never granted the `account:*` scopes.

### Two-factor sign-in status

`GET /api/v1/account/two-factor`

Whether the caller signs in with a code from an authenticator app as well as the password (`enabled`), has started turning it on without confirming a first code (`pending`), since when, and how many unused recovery codes are left. `available: false` when the server cannot store two-factor secrets (its secret key is missing). Turning it on or off needs a user session (the actions below), never an API key. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | `account:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/account/two-factor" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The caller's two-factor status.

```json
{
  "enabled": true,
  "pending": false,
  "enabled_at": "2026-10-30T14:05:00Z",
  "recovery_codes_left": 1,
  "available": false
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Start turning two-factor sign-in on

`POST /api/v1/account/two-factor/actions/enrol`

Checks the caller's password and creates a new secret (replacing one not yet confirmed). Show `otpauth_uri` as a QR code (or `secret` for typing in) to the user's authenticator app, then confirm with a first code. The secret is never shown again. Wrong passwords count in the same per-user limit as codes (5 per address in 10 minutes, 20 per hour: `429 rate_limited`). `403 forbidden` for a wrong password, `409 conflict` when it is already on, `503 service_unavailable` when the server cannot store secrets. User sessions only. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `password` | string | Yes | The caller's current password. (max 1024 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/account/two-factor/actions/enrol" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"password":"password"}'
```

**Response** `200`: The new secret.

```json
{
  "secret": "secret",
  "otpauth_uri": "otpauth-uri"
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Confirm two-factor sign-in with a first code

`POST /api/v1/account/two-factor/actions/confirm`

Turns two-factor sign-in on when `code` (6 digits, one 30-second step of clock drift either way) matches the secret from the enrol action, and returns 10 one-time recovery codes. They are shown only here; keep them somewhere safe. From now on a sign-in needs the password and a code. `400 validation_error` (field `code`) for a wrong code, `409 conflict` when nothing is being turned on. User sessions only. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | The 6-digit code from the authenticator app. (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/account/two-factor/actions/confirm" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"code":"code"}'
```

**Response** `200`: On, with the recovery codes.

```json
{
  "enabled": true,
  "recovery_codes": [
    "recovery-code"
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Get new recovery codes

`POST /api/v1/account/two-factor/actions/regenerate-recovery-codes`

Replaces the caller's recovery codes with 10 new ones (the old ones stop working). Needs the password and a code (from the app, or a recovery code). `403 forbidden` for a wrong password, `400 validation_error` for a wrong code, `409 conflict` when two-factor sign-in is off. User sessions only. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `password` | string | Yes | The caller's current password. (max 1024 characters) |
| `code` | string | Yes | A 6-digit code from the app, or an unused recovery code (XXXX-XXXX-XXXX-XXXX; case, spaces and dashes do not matter). (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/account/two-factor/actions/regenerate-recovery-codes" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"password":"password","code":"code"}'
```

**Response** `200`: The new recovery codes.

```json
{
  "recovery_codes": [
    "recovery-code"
  ]
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Turn two-factor sign-in off

`POST /api/v1/account/two-factor/actions/disable`

Turns two-factor sign-in off for the caller: the secret and the recovery codes are deleted and the password alone signs in again. Needs the password and a code (from the app, or a recovery code). `403 forbidden` for a wrong password, `400 validation_error` for a wrong code, `409 conflict` when it is already off. User sessions only. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `password` | string | Yes | The caller's current password. (max 1024 characters) |
| `code` | string | Yes | A 6-digit code from the app, or an unused recovery code (XXXX-XXXX-XXXX-XXXX; case, spaces and dashes do not matter). (max 64 characters) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/account/two-factor/actions/disable" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>" \
  -H "Content-Type: application/json" \
  -d '{"password":"password","code":"code"}'
```

**Response** `200`: The status after the change.

```json
{
  "enabled": true,
  "pending": false,
  "enabled_at": "2026-10-30T14:05:00Z",
  "recovery_codes_left": 1,
  "available": false
}
```

Errors: `400`, `401`, `403`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### List your signed-in devices

`GET /api/v1/account/sessions`

The caller's signed-in devices (web app and app sign-ins that have not expired or been signed out), the current one first, then the most recently used. `browser` and `os` are read from the device's User-Agent (empty when not recognised); `ip` and `last_used_at` are those of its last sign-in or token refresh. `current` is true for the session making the call (never for an API key). API keys and MCP connections are not listed here (see `/api-keys`). Not paginated (`next_cursor` is always null). API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | `account:read` |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/account/sessions" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The signed-in devices.

```json
{
  "data": [
    {
      "id": "id",
      "created_at": "2026-10-30T14:05:00Z",
      "last_used_at": "2026-10-30T14:05:00Z",
      "ip": "ip",
      "browser": "browser",
      "os": "os",
      "current": false
    }
  ],
  "next_cursor": null
}
```

Errors: `401`, `403`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Sign a device out

`DELETE /api/v1/account/sessions/{session_id}`

Signs one of the caller's devices out: its refresh token stops working at once, so it is asked to sign in again within the access token's lifetime (15 minutes at most). `404 not_found` for a session that does not exist or belongs to another user. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | `account:write` |
| Roles | admin, operator, viewer |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `revoke_account_session`) |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `session_id` | path | string | Yes | A signed-in device's id (GET /account/sessions). |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/account/sessions/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Signed out.

Errors: `401`, `403`, `404`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Sign out everywhere else

`POST /api/v1/account/sessions/actions/revoke-others`

Signs out every signed-in device of the caller except the one making the call, and returns how many were signed out. `409 conflict` for a session from before 1.107.0 that does not know its own id (sign out and in again). User sessions only. API 1.107.0.

| Requirement | |
| --- | --- |
| Scope | User session only (API keys are refused) |
| Roles | admin, operator, viewer |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/account/sessions/actions/revoke-others" \
  -H "Authorization: Bearer <access token from POST /api/auth/login>"
```

**Response** `200`: How many devices were signed out.

```json
{
  "revoked": 1
}
```

Errors: `401`, `403`, `409`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Add-ons

Add-ons (API 1.104.0): the catalogue (Vigiora's own add-ons first, then the community's) with a hardware check against this server, the installed community add-ons with their progress, and install, update and remove. A community add-on runs in Docker on this server or on a remembered SSH machine, from the commit Vigiora reviewed, with an override the server writes (the author's compose file is never edited), and enrols with a token limited to its permissions. Paid community add-ons are listed but cannot be installed yet. Installing from a git address with no review (developer mode) is done from the web app only, as are add-ons asking for elevated access (both ask for the admin's password). Vigiora's built-in runners keep `/runners`. Alerts from add-ons (API 1.106.0): an add-on granted the `alerts:write` scope may report a detection through the HAL API (`POST /api/hal/events` with a `detection` object, not part of `/api/v1`), only on cameras it is assigned to, only on the label namespaces it declares in its manifest `labels` (`tamper:lens covered`), never a plain label or a namespace Vigiora owns (`face:`, `plate:`, `qr:`, `guardian:`, `analytics:` and others), without a picture, at most 30 a minute and 300 an hour. It is then an alert like any other: `GET /alerts`, `alert.created`, the camera's label alert rules and speakers. The alert's `addon` names the add-on; a camera label an add-on can only report as a result has `results_only: true`. Pictures (API 1.106.0): an add-on with `streams:read` gets one current frame of a camera it is assigned to from `GET /api/hal/frame` (HAL API, not part of `/api/v1`); go2rtc's RTSP restream is reachable only with host networking.

### Installed community add-ons

`GET /api/v1/addons`

The community add-ons installed on this server (from the catalogue, or from a git address in developer mode), each with its `version`, `commit`, `source` (`community`, `vigiora` or `developer`), the `machine` it runs on (`local` or `host:<id>`, a remembered SSH machine), its install `state` (queued, fetching, building, pulling, starting, running, failed, removing, or suspended: Vigiora suspended it, so it is stopped and its token revoked) with the `step` it is on and the `error` when it failed, the `scopes` it was given, whether it `enrolled`, `suspended_reason` when Vigiora suspended it, and `update_version` when a newer approved version is listed (updates are never automatic). `developer_mode` says whether developer mode is on. Vigiora's four built-in runners are listed by `GET /runners`. API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/addons" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The installed add-ons.

```json
{
  "addons": [
    {
      "id": "id",
      "name": "Front door",
      "version": "version",
      "commit": "commit",
      "repository": "repository",
      "source": "community",
      "machine": "machine",
      "host_id": 1,
      "state": "queued",
      "step": "step",
      "error": null,
      "service_name": "service-name",
      "created_at": "2026-10-30T14:05:00Z",
      "updated_at": "2026-10-30T14:05:00Z",
      "scopes": [
        "scope"
      ],
      "enrolled": false,
      "token_id": 1,
      "network": "none",
      "privileged": false,
      "suspended_reason": "suspended-reason",
      "update_version": "update-version",
      "reviewed": false
    }
  ],
  "developer_mode": false
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Add-on catalogue

`GET /api/v1/addons/catalog`

The add-ons that can be installed: Vigiora's own first (the four built-in runners, `builtin: true`, installed with `POST /runners/install-token` or the web app; they appear even when the Vigiora cloud does not list them), then the community's. Each carries its price (`free`; paid community add-ons are listed but cannot be installed yet), its hardware block and `hardware_check` against this server (exact sentences such as "needs a GPU with 6 GB; this server has none"), and `installed_state`. The list comes from the server's cache and never waits long on the cloud: when the cloud cannot be reached the last list answers with `stale: true` and `updated_at`, the time it was fetched. `suspended` lists add-ons Vigiora suspended, with the reason when the cloud gives one. Icons are served by the web app's session routes. API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/addons/catalog" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The catalogue.

```json
{
  "addons": [
    {
      "id": "id",
      "name": "Front door",
      "summary": "summary",
      "version": "version",
      "author": {
        "name": "Front door",
        "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
      },
      "categories": [
        "categorie"
      ],
      "hardware": {
        "arch": [
          "amd64"
        ],
        "os": [
          "linux"
        ],
        "cpu_min_cores": 0.5,
        "ram_min_gb": 0.5,
        "disk_min_gb": 0.5,
        "gpu": {
          "required": false,
          "vendor": [
            "nvidia"
          ],
          "min_vram_gb": 0.5
        },
        "devices": [
          "usb"
        ],
        "notes": "notes"
      },
      "price": {
        "model": "free",
        "amount_usd": 0.5
      },
      "by_vigiora": false,
      "icon": "icon",
      "builtin": false,
      "install_service": "install-service",
      "free": false,
      "hardware_check": {
        "fits": false,
        "missing": [
          {
            "code": "arch",
            "need": "need",
            "have": "have",
            "sentence": "sentence"
          }
        ],
        "unknown": [
          "unknown"
        ],
        "needs_gpu": false,
        "warnings": [
          "warning"
        ]
      },
      "installed_state": "installed-state"
    }
  ],
  "suspended": [
    {
      "id": "id",
      "reason": "reason"
    }
  ],
  "updated_at": "2026-10-30T14:05:00Z",
  "stale": false,
  "error": null
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### One add-on of the catalogue

`GET /api/v1/addons/catalog/{addon_id}`

One add-on with its manifest as the server's validator read it (`manifest` null and `problems` when the server refuses it: such an add-on is shown but cannot be installed), README and how-to (Markdown, to be shown without HTML), screenshots, repository and the reviewed commit, author, licence, permissions, `scopes_enforced` (which of the manifest's scopes this server enforces today), `warnings` (how it will run: privileged, host network, no network), `hardware_check` against this server, `installed` and `suspended_reason`. `reviewed` is true for every catalogue add-on (reviewed by Vigiora); an add-on installed in developer mode is not. `404 not_found` when the cloud does not list it (not approved, or suspended). API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `addon_id` | path | string | Yes | The add-on's id (its manifest id). |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/addons/catalog/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The add-on.

```json
{
  "id": "id",
  "name": "Front door",
  "summary": "summary",
  "version": "version",
  "author": {
    "name": "Front door",
    "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
  },
  "categories": [
    "categorie"
  ],
  "hardware": {
    "arch": [
      "amd64"
    ],
    "os": [
      "linux"
    ],
    "cpu_min_cores": 0.5,
    "ram_min_gb": 0.5,
    "disk_min_gb": 0.5,
    "gpu": {
      "required": false,
      "vendor": [
        "nvidia"
      ],
      "min_vram_gb": 0.5
    },
    "devices": [
      "usb"
    ],
    "notes": "notes"
  },
  "price": {
    "model": "free",
    "amount_usd": 0.5
  },
  "by_vigiora": false,
  "icon": "icon",
  "manifest": {
    "manifest": 1,
    "id": "id",
    "name": "Front door",
    "summary": "summary",
    "version": "version",
    "author": {
      "name": "Front door",
      "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx"
    },
    "licence": "licence",
    "homepage": "homepage",
    "categories": [
      "categorie"
    ],
    "languages": [
      "language"
    ],
    "vigiora": {
      "min_version": "min-version",
      "addon_api": 1
    },
    "hardware": {
      "arch": [
        "amd64"
      ],
      "os": [
        "linux"
      ],
      "cpu_min_cores": 0.5,
      "ram_min_gb": 0.5,
      "disk_min_gb": 0.5,
      "gpu": {
        "required": false,
        "vendor": [
          "nvidia"
        ],
        "min_vram_gb": 0.5
      },
      "devices": [
        "usb"
      ],
      "notes": "notes"
    },
    "run": {
      "kind": "compose",
      "compose": "compose",
      "source": "image",
      "images": [
        "image"
      ],
      "privileged": false,
      "network": "none",
      "ports": [
        1
      ]
    },
    "permissions": {
      "scopes": [
        "cameras:read"
      ]
    },
    "price": {
      "model": "free",
      "amount_usd": 0.5
    },
    "events": [
      "event"
    ],
    "settings": {},
    "ui": {},
    "labels": [
      "person"
    ]
  },
  "problems": [
    {
      "path": "path",
      "message": "This API key lacks the cameras:write scope."
    }
  ],
  "readme": "readme",
  "how_to": "how-to",
  "screenshots": [
    "screenshot"
  ],
  "repository": "repository",
  "commit": "commit",
  "builtin": false,
  "install_service": "install-service",
  "free": false,
  "reviewed": false,
  "hardware_check": {
    "fits": false,
    "missing": [
      {
        "code": "arch",
        "need": "need",
        "have": "have",
        "sentence": "sentence"
      }
    ],
    "unknown": [
      "unknown"
    ],
    "needs_gpu": false,
    "warnings": [
      "warning"
    ]
  },
  "warnings": [
    "warning"
  ],
  "installed": {
    "id": "id",
    "name": "Front door",
    "version": "version",
    "commit": "commit",
    "repository": "repository",
    "source": "community",
    "machine": "machine",
    "host_id": 1,
    "state": "queued",
    "step": "step",
    "error": null,
    "service_name": "service-name",
    "created_at": "2026-10-30T14:05:00Z",
    "updated_at": "2026-10-30T14:05:00Z",
    "scopes": [
      "scope"
    ],
    "enrolled": false,
    "token_id": 1,
    "network": "none",
    "privileged": false,
    "suspended_reason": "suspended-reason",
    "update_version": "update-version",
    "reviewed": false
  },
  "suspended_reason": "suspended-reason",
  "fetched_at": "2026-10-30T14:05:00Z",
  "scopes_enforced": {}
}
```

Errors: `401`, `403`, `404`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Install a catalogue add-on

`POST /api/v1/addons/{addon_id}/install`

Installs a community add-on from the catalogue at the commit Vigiora reviewed, on `machine` (`local`, or `host:<id>` of a remembered SSH machine; empty = this server when Docker is usable and the hardware fits, else the first SSH machine that fits). The server fetches the commit, checks the manifest equals the reviewed one and checks the compose file again, then pulls (`run.source: image`) or builds (`build`) and starts it with an override it writes (the author's file is never edited). The add-on enrols with a single-use token limited to its `permissions.scopes`. Answers `202` at once; follow `GET /addons` for the progress and the failure reason. `409 conflict` when it is paid (`reason: paid`; paid community add-ons are not available yet), suspended, does not fit the hardware (the sentence says what is missing), is already installed, or is one of Vigiora's built-in runners. Add-ons asking for elevated access (privileged, host network or the graphics card) are installed from the web app, which asks for the password again (`403 forbidden`, `reason: elevated_access`). Needs approval when human-in-the-loop is on. API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `install_addon`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `addon_id` | path | string | Yes | The add-on's id (its manifest id). |

**Request body** (optional)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `machine` | string | No | `local` or `host:<id>`; empty = the first machine that fits. |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/addons/42/install" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"machine":"machine"}'
```

**Response** `202`: Installing.

```json
{
  "id": "id",
  "name": "Front door",
  "version": "version",
  "commit": "commit",
  "repository": "repository",
  "source": "community",
  "machine": "machine",
  "host_id": 1,
  "state": "queued",
  "step": "step",
  "error": null,
  "service_name": "service-name",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "scopes": [
    "scope"
  ],
  "enrolled": false,
  "token_id": 1,
  "network": "none",
  "privileged": false,
  "suspended_reason": "suspended-reason",
  "update_version": "update-version",
  "reviewed": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Update an add-on

`POST /api/v1/addons/{addon_id}/update`

Installs the newer approved version of an installed catalogue add-on (offered as `update_version` by `GET /addons`; never automatic), on the machine it runs on, with the same checks as an install. `409 conflict` when no newer approved version is listed, when it is suspended, or for a developer-mode add-on (install it again from its git address). Answers `202`; follow `GET /addons`. Needs approval when human-in-the-loop is on. API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `update_addon`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `addon_id` | path | string | Yes | The add-on's id (its manifest id). |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/addons/42/update" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `202`: Updating.

```json
{
  "id": "id",
  "name": "Front door",
  "version": "version",
  "commit": "commit",
  "repository": "repository",
  "source": "community",
  "machine": "machine",
  "host_id": 1,
  "state": "queued",
  "step": "step",
  "error": null,
  "service_name": "service-name",
  "created_at": "2026-10-30T14:05:00Z",
  "updated_at": "2026-10-30T14:05:00Z",
  "scopes": [
    "scope"
  ],
  "enrolled": false,
  "token_id": 1,
  "network": "none",
  "privileged": false,
  "suspended_reason": "suspended-reason",
  "update_version": "update-version",
  "reviewed": false
}
```

Errors: `400`, `401`, `403`, `404`, `409`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Remove an add-on

`DELETE /api/v1/addons/{addon_id}`

Stops and deletes an installed community add-on: its containers and volumes (its data), its folder, and its tokens (it can no longer reach the server). Needs approval when human-in-the-loop is on. API 1.104.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `remove_addon`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `addon_id` | path | string | Yes | The add-on's id (its manifest id). |

**Example request**

```bash
curl -s -X DELETE "https://yourname.vigiora.com/api/v1/addons/42" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `204`: Removed.

Errors: `401`, `403`, `404`, `409`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Runners

GPU runners (API 1.60.0): the vision runners that run beside the server on a GPU machine (`runner-objects` finds any object, `runner-plates` reads number plates, `runner-face` recognises faces, `runner-vision` runs a LiquidAI vision model locally for the floor-plan scan, on a GPU or the CPU, `runner-robotnav` is the Robot navigation add-on for robot cameras, API 1.129.0). List them with the state of the on-device install and the runners that enrolled, and mint the one-time install token behind the copyable install command. The password-gated on-device install and the SSH install stay in the web app.

### GPU runners

`GET /api/v1/runners`

The installable runners (`runner-objects`, `runner-plates`, `runner-face`, `runner-vision`, `runner-robotnav`; on the wire `hal-objects`, `hal-license-plate`, `hal-face`, `hal-vision`, `hal-robotnav`) with `gated` (plates and faces are privacy gated), their `on_device` install state (null when this server's Docker is not reachable; `state` absent, starting, running, crashed or enrolled) and the runners that `enrolled` (hostname, when it enrolled and was last seen). `on_device` at the top says whether this host can install a runner itself (Docker, Compose and the NVIDIA runtime). API 1.60.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:read` |
| Roles | admin |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/runners" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The runners.

```json
{
  "runners": [
    {
      "service": "runner-objects",
      "wire_service": "wire-service",
      "gated": false,
      "on_device": {
        "state": "absent",
        "enrolled": false
      },
      "enrolled": [
        {
          "id": 1,
          "hostname": "hostname",
          "enrolled_at": "2026-10-30T14:05:00Z",
          "last_used_at": "2026-10-30T14:05:00Z",
          "online": false,
          "last_seen_at": "2026-10-30T14:05:00Z",
          "model": "model",
          "device": "device",
          "ready": false
        }
      ]
    }
  ],
  "on_device": {
    "docker": false,
    "compose": false,
    "nvidia": false,
    "gpus": [
      "gpu"
    ],
    "can_install": false,
    "reason": "reason"
  }
}
```

Errors: `401`, `403`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### Mint a runner install token

`POST /api/v1/runners/install-token`

Mints a one-time install token (valid 30 minutes, single use) for `service` and returns it once with the copyable `command` (`curl -fsSL <server>/hal/install.sh | sh -s -- --url … --token … --service …`) to run on the GPU machine. The token only lets a runner of that service enrol; the runner then keeps its own long-lived token. It is a credential: the request is not idempotent-replayable (`Idempotency-Key` refused) and needs approval when human-in-the-loop is on. API 1.60.0. Admins only.

| Requirement | |
| --- | --- |
| Scope | `settings:write` |
| Roles | admin |
| AI agents | Ask the user first while [human in the loop](https://vigiora.com/docs/developers/human-in-the-loop) is on (MCP tool `create_runner_install_token`) |
| Idempotency-Key | Refused (400 `idempotency_not_supported`) |

**Request body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `service` | string: `runner-objects`, `runner-plates`, `runner-face`, `runner-vision`, `runner-robotnav` | Yes |  |

**Example request**

```bash
curl -s -X POST "https://yourname.vigiora.com/api/v1/runners/install-token" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"service":"runner-objects"}'
```

**Response** `201`: The token and the install command.

```json
{
  "service": "runner-objects",
  "token": "preset-1",
  "command": "command",
  "expires_at": "2026-10-30T14:05:30Z"
}
```

Errors: `400`, `401`, `403`, `415`, `429`, `503`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

## Docs

This document.

### This document (YAML)

`GET /api/v1/openapi.yaml`

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/openapi.yaml" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The OpenAPI document. (`application/yaml`)

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

### This document (JSON)

`GET /api/v1/openapi.json`

| Requirement | |
| --- | --- |
| Scope | Any credential |
| Roles | admin, operator, viewer |
| Idempotency-Key | Ignored |

**Example request**

```bash
curl -s "https://yourname.vigiora.com/api/v1/openapi.json" \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

**Response** `200`: The OpenAPI document.

```json
{}
```

Errors: `401`, `429`. See [Errors](https://vigiora.com/docs/developers/api-conventions#errors).

---

Source: https://vigiora.com/ko/docs/developers/api-reference · Last updated 2 Dec 2026, 10:45 UTC
