---
title: "Internal API (/api)"
description: "The web app's own API at /api — when to use it instead of API v1, and how keys, errors and examples work there."
url: https://vigiora.com/docs/developers/rest-api
updated: 2026-11-25T11:37:01.000Z
---

# Internal API (/api)

> The web app's own API at /api — when to use it instead of API v1, and how keys, errors and examples work there.

> **Use API v1 for integrations**
>
> From Vigiora Server 1.6.4, the stable, versioned API for scripts and integrations is [API v1](https://vigiora.com/docs/developers/api-v1) at `/api/v1`, with scoped keys and one consistent style. This page describes `/api`, the **internal** API the web app uses. It may change in any release.

The web app talks to the server through `/api`. You can call it too, for the few things API v1 doesn't cover. API v1 now has people counts, Guardian search and Guardian chat, and from 1.6.13 [Analytics](https://vigiora.com/docs/ai/analytics) counts: prefer v1 for those. Expect `/api` to change with the app.

## Base address

All paths start with `/api`. Use whichever address reaches your server:

| From | Base address |
| --- | --- |
| Anywhere | `https://yourname.vigiora.com` (your site address) |
| Your local network | `http://192.0.2.10:8080` (the server's LAN address) |

## The full reference

Each server serves its own OpenAPI 3.1 description, matching its exact version:

```bash
curl -s https://yourname.vigiora.com/api/openapi.yaml \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" -o vigiora-openapi.yaml
```

`/api/openapi.json` returns the same in JSON. Open it in any OpenAPI viewer, or generate a client from it. Any signed-in caller can read it, including read-only API keys.

## Authentication

Use an **API key** for scripts. Create one in **Settings** → **People and access** → **API keys** on your server. See [API keys](https://vigiora.com/docs/developers/api-keys). Keys **with scopes**, created on API v1, work on `/api/v1` only: `/api` refuses them with `403` and `"code": "api_key_scoped"`.

Send the key in a header, either way:

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

curl -s https://yourname.vigiora.com/api/monitors \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

A key is never accepted in the URL.

A key acts as the user who created it. That user's role and camera permissions apply, and a role change or disabling the user takes effect on the next request. See [Users, roles and groups](https://vigiora.com/docs/admin/users-roles-groups).

### What keys can't do

API keys never work for:

- signing in, and managing API keys, users, groups and passwords,
- Vigiora cloud, remote access and billing settings,
- push subscriptions, [add-on](https://vigiora.com/docs/ai/ai-tools-and-tool-log#add-ons) tokens and AI Tools.

Those need a person signed in to the app. A key used there gets `403` with `"code": "api_key_not_allowed"`.

### Read-only keys

A read-only key can only make `GET`, `HEAD` and `OPTIONS` requests. Anything else gets `403` with `"code": "api_key_read_only"`.

### Credentials are hidden from keys

Responses to API-key requests never include camera passwords. A camera address comes back as `rtsp://REDACTED@10.0.0.64:554/stream1`. If you send such a value back unchanged in an update, the stored password is kept.

### Sign in with a username and password

Scripts can also sign in like the app and use the short-lived token it returns:

```bash
curl -s -X POST https://yourname.vigiora.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"automation","password":"example-password"}'
```

```json
{ "access_token": "eyJhbGciOi...", "refresh_token": "3f9c...", "user": { "id": 7, "username": "automation", "role": "viewer" } }
```

Send `access_token` as `Authorization: Bearer <token>`. When it expires, `POST /api/auth/refresh` with `{"refresh_token": "..."}` gives you a new pair. API keys are simpler for most scripts.

## Errors

Errors are JSON:

```json
{ "error": "Forbidden" }
```

| Status | Meaning |
| --- | --- |
| `400` | Bad request: a missing or invalid field. |
| `401` | No valid credentials, or the key was revoked or expired. |
| `403` | Your role, camera permission or key type doesn't allow this. |
| `404` | Not found, or not visible to you. |
| `409` | Conflict, for example too many API keys. |
| `429` | Too many failed attempts. Wait for the `Retry-After` seconds. |

## Examples

### Check the server

`/api/health` needs no credentials:

```bash
curl -s https://yourname.vigiora.com/api/health
```

```json
{ "ok": true, "version": "1.5.1" }
```

### List cameras

```bash
curl -s https://yourname.vigiora.com/api/monitors \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

You get `{"monitors": [...]}` with the cameras the key's user can view.

### Save a snapshot

```bash
curl -s https://yourname.vigiora.com/api/snapshot/3 \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" -o front-door.jpg
```

### Read recent alerts

```bash
curl -s "https://yourname.vigiora.com/api/detections?alerts_only=1&limit=20" \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

Each detection has a `Label` such as `person`, `face:<name>`, `plate:<text>` or `guardian:<rule name>`, plus `MonitorName`, `Confidence` and `DetectedAt`.

### People counts

```bash
curl -s https://yourname.vigiora.com/api/counts/latest \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

```json
{ "counts": { "3": { "person_count": 4, "unique_count": 57, "timestamp": "2026-10-30 09:41:00" } } }
```

### Search Guardian history

```bash
curl -s -G https://yourname.vigiora.com/api/guardian/search \
  --data-urlencode "q=delivery van" -d limit=10 \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

The search is by meaning (`"mode": "semantic"`, each result with a `similarity` from 0 to 1). If that's unavailable, it falls back to keyword search (`"mode": "keyword"`).

### Ask Guardian

Needs a read-write key:

```bash
curl -s -X POST https://yourname.vigiora.com/api/guardian/chat \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"message":"Were any parcels left at the entrance today?"}'
```

The answer uses your monthly AI allowance, like a question asked in the app.

> **Tip**
>
> Some media URLs, such as Guardian frames and clips, are meant for `<img>` and `<video>` tags. With an API key, fetch them with the key in a header and serve the bytes yourself; don't put keys in page URLs.

---

Source: https://vigiora.com/docs/developers/rest-api · Last updated 25 Nov 2026, 11:37 UTC
