Vigiora

Denne side findes endnu ikke på Dansk. Den vises på engelsk.

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.

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 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:

FromBase address
Anywherehttps://yourname.vigiora.com (your site address)
Your local networkhttp://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:

Terminal
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. 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:

Terminal
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.

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 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:

Terminal
curl -s -X POST https://yourname.vigiora.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"automation","password":"example-password"}'
{ "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:

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

Examples#

Check the server#

/api/health needs no credentials:

Terminal
curl -s https://yourname.vigiora.com/api/health
{ "ok": true, "version": "1.5.1" }

List cameras#

Terminal
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#

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

Read recent alerts#

Terminal
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#

Terminal
curl -s https://yourname.vigiora.com/api/counts/latest \
  -H "X-API-Key: vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
{ "counts": { "3": { "person_count": 4, "unique_count": 57, "timestamp": "2026-10-30 09:41:00" } } }

Search Guardian history#

Terminal
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:

Terminal
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.

Rediger denne side på GitHub