Vigiora

Den här sidan finns ännu inte på Svenska. Den visas på engelska.

API conventionsSedan 1.6.4

The rules every API v1 operation follows — errors and error codes, cursor pagination, Idempotency-Key, rate limits, times, ids and actions.

Every operation of API v1 follows the same rules. Learn them once and every endpoint behaves the way you expect.

Requests and responses#

TopicRule
NamesJSON properties and query parameters are snake_case. Paths use plural nouns (/cameras, /api-keys) and name their ids after the resource ({camera_id}).
BodiesRequest bodies are JSON. Unknown fields are refused (400 validation_error), so a typo never silently does nothing.
IdsIntegers for cameras, alerts, recordings, shares and API keys; strings for clips, network scans and PTZ preset tokens. Treat them as opaque.
Missing valuesOptional values are present as null, never left out.
Booleans in queriestrue or false only. 1 and 0 are refused.
MethodsGET reads, POST creates (201, or 202 for a job such as a clip export, with a Location header), PATCH changes only the fields you send, DELETE deletes or revokes (204). PUT is never used.
MediaSnapshots and recordings answer the image or video on success and the JSON error on failure. Video supports range requests. Signed media links (/api/v1/media/<token>/..., from API 1.17) carry their own short-lived token and need no header.

Times#

All times are RFC 3339. Responses are always in UTC, for example 2026-10-30T14:05:00Z (with fractional seconds when there are any). In requests you may use any offset, such as 2026-10-30T21:05:00+07:00, but a time without an offset is refused with 400 validation_error. Durations are whole seconds (duration_seconds) and sizes whole bytes (size_bytes).

Actions#

Things that aren't plain create, read, update or delete are actions: POST to …/actions/<verb>.

ActionExample
On one resourcePOST /api/v1/cameras/3/actions/enable-ai, POST /api/v1/alerts/1201/actions/acknowledge
On a collectionPOST /api/v1/alerts/actions/acknowledge (bulk)
On a sub-resourcePOST /api/v1/cameras/3/ptz/actions/move, POST /api/v1/clips/{clip_id}/actions/create-download-url

An action answers the updated resource when there is one, else a small result object. Send no body or {} to actions without parameters.

Errors#

Every error, from every endpoint (including unknown paths and media endpoints), has the same shape:

{
  "error": {
    "code": "insufficient_scope",
    "message": "This API key lacks the cameras:write scope.",
    "details": { "required_scope": "cameras:write", "granted_scopes": ["cameras:read"] }
  }
}
  • code is stable and meant for your code. New codes may be added within v1.
  • message is for people and may change.
  • details is an object, possibly empty. Its keys depend on the code.

Error codes#

HTTPcodeMeaning
400validation_errorA bad body field or parameter. details.field names it when one field is at fault.
400invalid_cursorThe cursor is malformed, or comes from another endpoint or other filters.
400idempotency_not_supportedIdempotency-Key was sent to an operation that refuses it.
401unauthenticatedNo credential, or an invalid, expired or revoked key or session.
402limit_reachedA plan limit. details.limit, details.allowed, details.used, details.pending.
402insufficient_creditsThe AI credits ran out (camera analysis, Guardian chat).
403insufficient_scopeThe key lacks the scope. details.required_scope, details.granted_scopes.
403forbiddenThe user's role or camera permission is too low.
403api_key_not_allowedThe operation needs a user session (key management), or a key may not write that field.
404not_foundNo such resource, or not visible to you. Also unknown paths.
404no_recordingNo recorded footage at the requested time (frames from recordings). details.nearest_before and details.nearest_after are the closest recorded moments, or null.
404no_previewA recording has no preview pictures: it has no video (a microphone) or is still being written.
405method_not_allowedThe Allow header lists the methods.
409conflictA state conflict; details depends on the operation.
409idempotency_key_in_progressA request with the same Idempotency-Key is still running.
409dependency_not_metAn AI service needs another one first (details.requires_any).
409dependent_service_assignedAnother AI service depends on this one (details.dependent).
409ptz_not_supportedThe camera has no PTZ (has_ptz is false).
409onvif_disabledThe camera's Use ONVIF switch is off (onvif_enabled is false).
409not_a_robotThe camera is not a Vigiora Robot, so robot actions do not apply.
409robot_unsupportedThe robot's firmware lacks this feature. Update the robot's firmware.
409light_unsupportedThe robot's firmware has no light control.
409robot_busyThe robot is moving, on a route or away on a Bluetooth job. Retry when it stands still.
409ble_unsupportedThe robot's firmware has no Bluetooth jobs.
409battery_lowThe robot's battery is too low for the job. Charge it first.
409ptz_busyAnother PTZ command for this camera is running. Retry shortly.
409clip_not_readyThe clip export hasn't finished yet.
409clip_too_oldThe clip is too old to share.
409ai_not_enabledThe camera has no AI, so it can't be analysed.
409protect_limitProtected recordings already use their share of the disk (20% by default). Unprotect some first.
409network_unavailableThe network tools can't see the LAN here (hosted server, a container without host networking…). details.reason says why.
409scan_in_progressA network scan is already running. details.scan_id is its id. (A Bluetooth scan already running answers the same code.)
409bluetooth_unavailableThe server can't scan Bluetooth here (not Linux, no adapter, the adapter is off, or it's denied). details.reason says why.
409entry_protectedA protected recording covers the moment's clip, so it can't be deleted. Unprotect the recording first.
409entry_sharedAn active clip export or public share link covers the moment. details.reasons, details.recording_ids, details.clip_ids, details.share_ids, details.can_force. An admin can delete it anyway with force=true, which revokes the covering share links.
403user_declinedMCP only: the user chose Deny on the approval prompt (human in the loop). Don't retry unless the user asks.
428confirmation_requiredMCP only: human in the loop is on and the action needs the user's approval. Show details.action, and only if the user agrees call again with confirm: true.
413payload_too_largeThe body is over the operation's limit.
415unsupported_media_typeThe body is not JSON, or an uploaded image is not JPEG, PNG or WebP.
422idempotency_key_reusedThe same Idempotency-Key was used for a different request.
422clip_too_longThe clip asks for more than 30 minutes.
422clip_no_recordingsThere is no recording in the requested time.
422timelapse_too_longThe timelapse asks for a range of more than 7 days.
422timelapse_too_shortThe range holds too little footage for the length you chose.
422speaker_not_supportedThe camera's speaker check found no audio backchannel, so it can't speak.
429rate_limitedToo many requests, or too many failed key attempts. Retry-After is set.
429relay_limitThe free plan's remote video allowance is used up (recording media through Vigiora's relay).
429clip_busyThe server is busy exporting other clips. Retry-After is set.
429timelapse_busyThe server is already making a timelapse. Retry-After is set.
429clip_user_busyYou already have a clip export running. Retry-After is set.
429stream_limitToo many open event streams (3 per key, 200 per server).
502ptz_failedThe camera refused or didn't answer a PTZ command. message is safe to show.
503addon_offlineThe add-on the operation needs is not installed or not running.
502detector_failedThe object recognition service failed on the frame or image.
502device_failedHome Assistant refused or failed a device command, or can't be reached when connecting.
503device_unreachableA device on the local network, such as a Vigiora Robot, did not answer. Sent with Retry-After; try again later. From API 1.147.0.
503ptz_unavailablePTZ isn't available on this server right now.
503snapshot_unavailableNo current frame and no recent one to serve.
503capture_failedThe camera gave no clip to analyse.
503stream_unavailableThe camera's live stream isn't available on this server right now, so no stream link can be made.
503preview_busyThe server is busy making other preview pictures. Retry-After is set.
503preview_unavailableThe preview pictures can't be made now: the camera's privacy masks can't be read (nothing unmasked is ever served) or the picture tool failed.
503ai_unavailableThe AI service didn't answer. Retry later.
503service_unavailableA feature is not enabled or temporarily unavailable.
503no_detectorNo object recognition add-on is online for this camera (see Add-ons).
504detector_timeoutThe object recognition service didn't answer within 10 seconds. Retry later.
503network_busyAutomatic camera following is using the network, or the server's lookup budget is spent (details.reason). Retry-After is set.
507clip_no_spaceNot enough disk space for the clip.
507clip_quotaYour clip storage quota is used.
507disk_lowThe disk is critically low, so no new recording can be protected. Existing protections stay.
500internal_errorLogged on the server with details.request_id. Include it if you report the problem.

Handle unknown codes by their HTTP status.

Pagination#

Lists answer a page:

{ "data": [ { "id": 1 }, { "id": 2 } ], "next_cursor": "eyJ2IjoxLCJlIjoiY2FtZXJhcyIsImsiOlsyXX0" }
  • ?limit= sets the page size, 1–200 (default 50).
  • To get the next page, send ?cursor=<next_cursor> with the same filters. A cursor used with another endpoint or other filters is 400 invalid_cursor.
  • next_cursor is null on the last page.
  • Pages stay stable while new rows arrive: you never see a row twice or skip one because of an insert.
  • There are no totals.
  • Cursors are opaque. Don't build or parse them; their format may change.

Each list has a fixed order: cameras by id, alerts newest first, recordings oldest first within the range, clips newest first.

Fetch every alert of a day
URL="https://yourname.vigiora.com/api/v1/alerts?from=2026-10-30T00:00:00Z&to=2026-10-31T00:00:00Z&limit=200"
CURSOR=""
while :; do
  PAGE=$(curl -s "$URL${CURSOR:+&cursor=$CURSOR}" -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx")
  echo "$PAGE" | jq -c '.data[]'
  CURSOR=$(echo "$PAGE" | jq -r '.next_cursor // empty')
  [ -z "$CURSOR" ] && break
done

Idempotency-Key#

Network errors happen. To retry a write safely, send an Idempotency-Key header with a value you choose (1–255 printable ASCII characters, for example a UUID):

Terminal
curl -s -X POST https://yourname.vigiora.com/api/v1/clips \
  -H "Authorization: Bearer vgk_xxxxxxxx_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: 0c6c2d1e-5b0f-4f43-9d8e-7b1f0a3c2e11" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"from":"2026-10-30T14:00:00Z","to":"2026-10-30T14:05:00Z"}'
  • It is honoured on POST /cameras, POST /clips, POST /alerts and every …/actions/… operation. The reference says so per operation.
  • The first response is stored for 24 hours, per credential. Retrying the same request with the same key returns the stored response with the header Idempotent-Replayed: true, without doing the work twice. Before replaying a success, the server checks that you may still access the camera, alert or clip.
  • The same key with a different request is 422 idempotency_key_reused. While the first request is still running, it is 409 idempotency_key_in_progress.
  • Server errors (5xx) are not stored, so you can simply retry them.
  • Operations whose answer contains a secret shown once (creating an API key, creating a share link) refuse the header with 400 idempotency_not_supported.
  • At most 10,000 responses are kept per credential; past that, the oldest are dropped.

Rate limits#

Each credential (an API key, or a user for sessions) has a bucket of 120 requests, refilled at 10 per second (600 a minute sustained). Every response carries:

HeaderMeaning
RateLimit-LimitThe bucket size.
RateLimit-RemainingRequests left now.

When the bucket is empty, the answer is 429 rate_limited with a Retry-After header (seconds) and details.retry_after_seconds. Wait that long, then retry. Other 429 codes (relay_limit, clip_busy, clip_user_busy) work the same way.

AI operations have extra limits per credential: at most 6 camera analyses (POST /cameras/{camera_id}/actions/analyze) and 10 Guardian chats a minute, and 2 AI operations at once. Non-admins also wait 5 minutes between analyses of the same camera (429 rate_limited with details.reason: camera_cooldown).

Frames and object recognition have their own limits per credential, and share the limit of 2 AI operations at once:

OperationLimit
GET /cameras/{camera_id}/frame (a frame from the recordings)30 a minute
POST /cameras/{camera_id}/actions/detect-objects20 a minute
POST /images/actions/analyze6 a minute with describe (the analysis limit), 20 a minute for detection only

Live media and device actions have their own limits:

OperationLimit
POST /cameras/{camera_id}/actions/stream-url and snapshot-url (signed links)60 links a minute per credential
Requests to the signed media links (/api/v1/media/...)6000 a minute per credential
POST /cameras/{camera_id}/actions/speak12 a minute per credential
Home Assistant device commands10 a minute per device, 30 a minute per credential, 60 a minute in all

The network tools allow at most 2 scans and 30 lookups a minute per credential (a camera relocate counts as a lookup).

Through Vigiora's relay on the free plan, playing recordings counts against the monthly remote video allowance, like in the app. See Free plan remote video limit.

Redigera sidan på GitHub