Docs Guides
Cameras
Use a phone or laptop, a camera link, a video file, or a camera on your home network through the bridge.
Pick the row that matches what you have.
| You have | Use | Source address |
|---|---|---|
| A spare phone, tablet or laptop | Pair it by link or QR | percia-cam://<id> |
| A camera with a public RTSP or https address | Camera link | the link itself |
| A video file | Upload | percia-file://<id> |
| A camera on your home or office network (ONVIF, RTSP, Frigate, Home Assistant, NVR) | The bridge | percia-cam://<id> |
Phone, tablet or computer#
# 1. Create the camera. pairUrl is single use and valid for 10 minutes.
curl -sS -X POST "$BASE/cameras" -H "Authorization: Bearer $PERCIA_API_KEY" \
-H 'content-type: application/json' -d '{"name":"Hall camera"}'
# {"camera":{...},"pairUrl":"https://.../cam/<token>","pairExpiresAt":"..."}
# 2. Open pairUrl on the device that will be the camera (copy the link or scan the QR code).
# Allow the camera and press Start. The page shows "Percia is watching".
# 3. Wait until status is "online".
curl -sS "$BASE/cameras" -H "Authorization: Bearer $PERCIA_API_KEY"
# 4. Watch it.
curl -sS -X POST "$BASE/watches/owned" -H "Authorization: Bearer $PERCIA_API_KEY" \
-H 'content-type: application/json' \
-d '{"sourceUrl":"percia-cam://CAMERA_ID","goal":"A person is at the door"}'const { camera, pairUrl } = await percia.cameras.create("Hall camera");
console.log("Open on the camera device:", pairUrl);
// later, once it is online:
await percia.watches.create({ sourceUrl: `percia-cam://${camera.id}`, goal: "A person is at the door" });res = client.cameras.create("Hall camera")
print("Open on the camera device:", res.pair_url)percia cameras add "Hall camera" # prints the link and a QR code
percia watches create --source percia-cam://CAMERA_ID --goal "A person is at the door"- The device sends video only, no audio. Keep the screen on; on an iPhone the page must stay open.
- A camera is
onlinewhile its last sign of life is under 60 seconds old, otherwiseoffline(orneverif it never connected). - A watch with no video for 60 minutes pauses itself and emails you. Resume it when the camera is back.
- A new pairing link (
POST /api/cameras/{id}/pair) cancels an unused older one. Deleting a camera that has watches answers409 camera_in_use. - Up to 50 cameras per account, camera links included (
429 camera_limit).
Camera link#
A public rtsp://, rtsps://, http:// or https:// video address works as the sourceUrl directly. It must be reachable from the internet: Percia refuses localhost, 192.168.x.x, 10.x.x.x, 172.16-31.x.x, 169.254.x.x and names ending in .local or .internal.
If the address has a user name and password (rtsp://user:pass@host/...), Percia keeps them for judging only and removes them from every API answer and email.
Video files#
A video file is useful to try Percia without a camera. It plays once and the watch ends (pausedReason: "file_done").
- From a public https address:
POST /api/uploads/from-url {"url":"https://example.com/clip.mp4"}. Percia fetches the file itself (mp4, mov, webm or mkv, public https only) and answersuploadIdandsource. - From a person's device:
POST /api/uploads/linkreturnsuploadUrl, a page valid for 30 minutes where the person picks the file. ThenGET /api/uploadsand take the newest file withstatus: "ready". - In the app: New watch, then Video file.
Use the upload's source (percia-file://<uploadId>) as the watch's sourceUrl. Both API routes need the cameras:write scope and answer 404 while video files are switched off for your host.
Cameras on a private network#
Percia never connects to a private address, and you should not open ports on your router. Instead the Percia bridge runs on an always-on computer in the same network as your cameras, reads each camera once, and pushes it to Percia over an outbound connection. The camera then appears in your Percia camera list and a watch uses percia-cam://<id>.
- Repository: github.com/percia-ai/percia-bridge
- Docker image:
ghcr.io/percia-ai/percia-bridge - Finds ONVIF cameras, reads RTSP, Frigate and Home Assistant; there is a Home Assistant add-on.
- Needs an API key with the scopes
cameras:read,cameras:writeandwatches:delete.
Build your own connector#
If you run an NVR or your own software, register a push camera and send video to it over WHIP:
curl -sS -X POST "$BASE/cameras" -H "Authorization: Bearer $PERCIA_API_KEY" \
-H 'content-type: application/json' \
-d '{"name":"Garage","kind":"push","externalId":"nvr-7-cam-3"}'
# 201 {"camera":{"id":"<uuid>","kind":"push",...},"whipUrl":"https://.../cam/<uuid>/whip","token":"pc_..."}tokenis shown once and can publish to this one camera only. Registering the sameexternalIdagain returns the same camera withtoken: null.POST /api/cameras/{id}/tokenmakes a new token.- Publish with ffmpeg 7.1 or newer (it needs the
whipmuxer), OBS 30 or newer (Service: WHIP, Server: thewhipUrl, Bearer token: the token), or the CLI:percia cameras push run --rtsp rtsp://user:pass@192.168.1.20/stream1. - Always use the
whipUrlPercia returns, never one you remember: Percia may move a camera to another relay, so ask for the address again each time you start publishing (GET /api/cameras/{id}/status). POST /api/cameras/bulkregisters up to 10 cameras at once.- Send a heartbeat about every 20 seconds:
curl -fsS -X POST -H "Authorization: Bearer $PERCIA_CAMERA_TOKEN" "$BASE/cam/heartbeat"(answers 204; no body). Without it a push camera shows offline about 60 seconds after it connects, even while it keeps publishing, and starting a Live session on it answers409 camera_offline.percia cameras push rundoes this for you.
export PERCIA_CAMERA_TOKEN='pc_...'
ffmpeg -rtsp_transport tcp -i rtsp://USER:PASS@LAN-CAMERA/stream -an -c:v copy \
-f whip -authorization "$PERCIA_CAMERA_TOKEN" "<whipUrl>"The camera needs to send H.264 without B-frames. If it does not, re-encode it to H.264 baseline, 720p, 10 fps with no B-frames and no audio, for example ffmpeg ... -an -vf "scale=-2:'min(ih,720)',fps=10,format=yuv420p" -c:v libx264 -profile:v baseline -tune zerolatency -bf 0 -g 20 -b:v 1500k.
Stuck? Ask in the Percia Discord or email support@percia.ai. This page as Markdown: cameras.md.