Camera Partner API/Reference
Quickstart Support
Partner API · v1

Camera Integration Partner API

Register and manage live camera streams for Animal Friends OS pet-care businesses. Cameras you register appear directly inside the OS camera viewer that boarding & daycare clients already use to watch their pets.

REST · JSON https://animalfriendsos.app Base /api/partner/v1 Sandbox & Live

This API is built for camera hardware and streaming partners. You provision a stream URL for a tenant's facility; Animal Friends OS handles the branded viewer, secure stream proxying, client access links, and audio containment. You never touch customer PII — you work with cameras, stream URLs, and online/offline status.

Animal Friends OS
✕Built for
Integration partner
Camera streaming partner · this reference is provisioned for abcKam
✦
Everything you need to start is in the 5-minute quickstart. Your sandbox credentials were delivered separately by the Animal Friends OS team.

1Base URLs

The API host is the same for both environments. Your credentials decide the environment — a sandbox key operates only against your isolated sandbox tenant; a live key operates against exactly the shops that have connected you, named by their site code.

EnvironmentBase URLSelected by
Sandboxhttps://animalfriendsos.appafos_ck_sandbox_… + afos_sk_sandbox_…
Livehttps://animalfriendsos.appafos_ck_live_… + afos_sk_live_…

All endpoints are versioned under /api/partner/v1. JSON in, JSON out. All requests must be HTTPS.

2Authentication

Every request (except this documentation and the discovery root) is authenticated with a key + secret pair:

  • Key ID — afos_ck_<env>_… — a public identifier, safe to log.
  • Secret — afos_sk_<env>_… — private. We store only a SHA-256 hash of it; treat it like a password and never expose it in client-side code.

Send them as two headers:

headers
X-AFOS-Key: afos_ck_sandbox_0b9bc1a844dec444a7
X-AFOS-Secret: afos_sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Or, equivalently, as a colon-joined bearer token:

headers
Authorization: Bearer afos_ck_sandbox_0b9bc1a844dec444a7:afos_sk_sandbox_xxxx
⚠
Keep secrets server-side. The key and secret must agree on the same environment or the request is rejected. A revoked key returns 403 key_revoked.

3Sandbox

Your sandbox credentials are bound to a single, dedicated sandbox tenant that contains no real customer data. A sandbox key is structurally incapable of reading or mutating any production tenant — the tenant is resolved server-side from your key, never from anything in your request. Build and test freely; nothing you do in sandbox can reach a real business.

When you are ready for production, Animal Friends OS issues live credentials. A live key on its own reaches nothing — each shop connects you itself and gives you a site code. See Connecting a shop; it is the one extra thing a live integration has to implement.

⚠
Sandbox credentials always operate on your sandbox tenant. If you send an X-AFOS-Site header with a sandbox key it is refused (403 site_code_not_for_environment) rather than silently ignored — so a mis-wired environment fails loudly instead of writing to the wrong place.

4Connecting a shop (site codes)

A live credential does not carry a tenant. Each shop grants you access itself, from Dashboard › Cameras inside Animal Friends OS: they pick you as their camera provider, press Connect, and the OS generates a site code that identifies that one location.

a site code looks like this
SITE-7QK4-M2XR-9PD3

The shop copies that code and sends it to you. You store it against that customer and send it back on every request as the X-AFOS-Site header:

headers
X-AFOS-Key: afos_ck_live_481acc0ff25dc1c726
X-AFOS-Secret: afos_sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-AFOS-Site: SITE-7QK4-M2XR-9PD3

Rules, in full:

  • The header selects which linked shop the request applies to. It is an addressing token, not a credential — on its own it grants nothing, and it only ever resolves to a shop that has already connected your key.
  • If you are connected to exactly one shop you may omit it and we resolve that shop. As soon as a second shop connects you, an unaddressed request returns 400 site_code_required rather than guessing.
  • No shop has connected you yet → 403 no_tenant_link. Nothing is wrong with your key; there is simply nobody to talk to yet.
  • The code is unknown, belongs to another partner, or was revoked → 403 unknown_site_code. These are deliberately the same error, so the endpoint cannot be used to probe which codes exist.
  • Formatting is forgiving. Case, spaces and dashes are normalised: site-7qk4-m2xr-9pd3, 7QK4M2XR9PD3 and SITE-7QK4-M2XR-9PD3 are the same code. Store it however you like.
  • Codes change. A shop can press Regenerate (the old code dies immediately) or Disconnect (access is revoked on your very next request — nothing is cached). Handle a sudden 403 unknown_site_code as "ask the customer for their current code", not as an outage.
  • If you prefer a query parameter, ?site_code=SITE-7QK4-M2XR-9PD3 is accepted anywhere the header is. The header is preferred; it does not end up in logs and proxies.
  • external_ref is scoped per shop. Two customers may both use front-1; they are two different cameras and neither can overwrite the other.
✦
Confirm a code without changing anything: call GET /api/partner/v1/ping with the site code. A 200 echoes back the tenant_id and site_code it resolved to; anything else tells you exactly what is wrong. This is the right check to run when a customer first hands you a code.
curl
curl https://animalfriendsos.app/api/partner/v1/ping \
  -H "X-AFOS-Key: $AFOS_KEY" \
  -H "X-AFOS-Secret: $AFOS_SECRET" \
  -H "X-AFOS-Site: SITE-7QK4-M2XR-9PD3"
403 — not connected yet
{
  "error": {
    "type": "authentication_error",
    "code": "no_tenant_link",
    "message": "No shop has connected this partner yet. The shop connects you from Dashboard > Cameras in Animal Friends OS and gives you the site code it generates; send that code as the X-AFOS-Site header."
  }
}

55-minute quickstart

1. Confirm your credentials work.

curl
curl https://animalfriendsos.app/api/partner/v1/ping \
  -H "X-AFOS-Key: $AFOS_KEY" \
  -H "X-AFOS-Secret: $AFOS_SECRET"

# LIVE: add the shop's site code. Omit it only while exactly one shop
# has connected you.
#   -H "X-AFOS-Site: $AFOS_SITE"
200 OK
{
  "object": "response",
  "data": {
    "object": "ping",
    "ok": true,
    "partner": "abcKam",
    "environment": "sandbox",
    "tenant_id": 42,
    "site_code": null,
    "key_id": "afos_ck_sandbox_0b9bc1a844dec444a7",
    "server_time": "2026-01-15T10:30:00.000Z"
  }
}

2. Register a camera. Provide your own stable external_ref (your camera's id in your system) and the stream URL.

curl
curl -X POST https://animalfriendsos.app/api/partner/v1/cameras \
  -H "X-AFOS-Key: $AFOS_KEY" \
  -H "X-AFOS-Secret: $AFOS_SECRET" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: cam-create-001" \
  -H "X-AFOS-Site: SITE-7QK4-M2XR-9PD3" \
  -d '{
    "external_ref": "kennel-7-cam",
    "name": "Kennel 7 — Suite View",
    "stream_url": "https://cdn.abckam.com/streams/kennel-7.mjpg",
    "area_type": "boarding",
    "status": "online"
  }'

3. That's it. The camera is now live in the OS viewer for that tenant. Update its status any time as your stream goes up or down (step 5 below).


6Errors

Every error uses one envelope. HTTP status conveys the class; error.code is a stable machine-readable string.

error envelope
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_stream_url",
    "message": "stream_url is required and must be a valid http(s)/rtsp URL.",
    "param": "stream_url"
  }
}
HTTPtypeMeaning
400invalid_request_errorA parameter is missing or malformed.
401authentication_errorMissing or invalid credentials.
403authentication_errorKey revoked, partner suspended, or no shop has linked this credential.
404invalid_request_errorThe resource does not exist.
409invalid_request_errorIdempotency conflict.
429rate_limit_errorToo many requests.
500api_errorSomething went wrong on our end.

7Idempotency

All write requests (POST, PATCH, DELETE) accept an Idempotency-Key header. Send a unique key per logical operation. If the same key is replayed with the same request body, you receive the original stored response (with an Idempotent-Replayed: true header) instead of the action happening twice. Re-using a key with a different body returns 409 idempotency_key_reuse.

✦
Registering a camera is also naturally idempotent on external_ref: POSTing an existing external_ref updates that camera and returns 200 rather than creating a duplicate.

8Rate limits

Sandbox keys are limited to 600 requests per minute. Every response includes X-RateLimit-Limit and X-RateLimit-Remaining. On 429 a Retry-After header tells you how many seconds to wait.


9Endpoints

GET/api/partner/v1/ping

Also the cheapest way to verify a site code a customer has just given you: the response echoes the tenant_id and site_code the request resolved to, and changes nothing.

Verifies your credentials and returns the resolved partner, environment, and tenant. No side effects.

POST/api/partner/v1/cameras

Registers (or, for an existing external_ref, updates) a camera and makes it appear in the OS viewer.

FieldTypeRequiredNotes
external_refstringyesYour stable id. 1–160 chars: letters, digits, . _ : -
namestringyesDisplay name shown to staff/clients. 1–200 chars.
stream_urlstringyeshttp(s) or rtsp URL of the feed.
area_typestringnoOne of boarding, daycare, grooming, lobby, outdoor, custom. Default boarding.
statusstringnoonline, offline, or maintenance. Default online.
201 Created
{
  "object": "response",
  "data": {
    "object": "camera",
    "id": "pcam_18",
    "external_ref": "kennel-7-cam",
    "environment": "sandbox",
    "name": "Kennel 7 — Suite View",
    "area_type": "boarding",
    "status": "online",
    "online": true,
    "stream_url": "https://cdn.abckam.com/streams/kennel-7.mjpg",
    "tenant": { "id": 42, "environment": "sandbox" },
    "os_camera_id": 91,
    "os_viewer_url": "/api/cameras/91/viewer",
    "created_at": "2026-01-15T10:31:00.000Z",
    "updated_at": "2026-01-15T10:31:00.000Z"
  }
}
GET/api/partner/v1/cameras

Lists your cameras for the current environment. Query params: limit (1–200, default 50) and offset.

GET/api/partner/v1/cameras/:external_ref

Retrieves a single camera by your external_ref.

PATCH/api/partner/v1/cameras/:external_ref

Updates any of name, stream_url, area_type, status. Only send the fields you want to change.

curl
curl -X PATCH https://animalfriendsos.app/api/partner/v1/cameras/kennel-7-cam \
  -H "X-AFOS-Key: $AFOS_KEY" -H "X-AFOS-Secret: $AFOS_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Kennel 7 — Deluxe Suite" }'
POST/api/partner/v1/cameras/:external_ref/status

Reports online/offline health (and optionally a fresh stream_url). Call this whenever a feed changes state. A change fires the camera.status_changed webhook.

curl
curl -X POST https://animalfriendsos.app/api/partner/v1/cameras/kennel-7-cam/status \
  -H "X-AFOS-Key: $AFOS_KEY" -H "X-AFOS-Secret: $AFOS_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "status": "offline" }'
DELETE/api/partner/v1/cameras/:external_ref

Removes a camera from the OS viewer. History (access logs, snapshots) is retained; the camera is deactivated, not purged.


10Webhooks

Register an HTTPS endpoint and we will POST a signed JSON event whenever one of your cameras changes. Events:

EventFires when
camera.registeredA new camera is registered.
camera.updatedA camera's details change.
camera.status_changedA camera goes online/offline/maintenance.
camera.deletedA camera is removed.

Verifying signatures

Each delivery carries an X-AFOS-Signature header of the form t=<timestamp>,v1=<hex>. Compute HMAC-SHA256(signing_secret, "<timestamp>.<raw_body>") and compare in constant time.

⚠
Your webhook endpoint must be a publicly reachable HTTPS host. Loopback, private (RFC-1918), link-local, and cloud-metadata addresses are rejected at registration.
node — verify
const crypto = require('crypto');
function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')));
  const expected = crypto.createHmac('sha256', secret)
    .update(parts.t + '.' + rawBody).digest('hex');
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
POST/api/partner/v1/webhooks

Body: url (required) and an optional events array (defaults to all). The response includes a signing_secret shown once — store it.

curl
curl -X POST https://animalfriendsos.app/api/partner/v1/webhooks \
  -H "X-AFOS-Key: $AFOS_KEY" -H "X-AFOS-Secret: $AFOS_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://hooks.abckam.com/afos", "events": ["camera.status_changed"] }'
GET/api/partner/v1/webhooks   DELETE/api/partner/v1/webhooks/:id

List your webhooks (secrets are never returned again) or delete one by id.


11Error codes

codeHTTPMeaning
missing_credentials401No key/secret supplied.
invalid_credentials401Key/secret invalid or mismatched environment.
key_revoked403The API key has been revoked.
partner_suspended403The partner account is suspended.
no_tenant_link403No shop has connected these credentials yet. See Connecting a shop.
unknown_site_code403The X-AFOS-Site value does not match an active link for these credentials — unknown, another partner's, or revoked. Ask the customer for their current code.
site_code_required400More than one shop has connected you, so the request must name one with X-AFOS-Site.
site_code_not_for_environment403A site code was sent with sandbox credentials. Sandbox always uses the sandbox tenant.
sandbox_unavailable403No sandbox tenant is provisioned.
invalid_external_ref400external_ref missing/malformed.
invalid_name400name missing/too long.
invalid_stream_url400stream_url missing/invalid.
invalid_area_type400area_type not recognised.
invalid_status400status not recognised.
invalid_events / invalid_url400Webhook payload invalid.
camera_not_found / webhook_not_found404Resource does not exist.
idempotency_key_reuse409Key reused with a different body.
request_in_progress409Same key still processing.
rate_limit_exceeded429Slow down.
internal_error500Server error.

12Changelog

VersionDateNotes
v1.12026-08-24Live tenant linking. A shop connects a partner from Dashboard › Cameras and issues a site code; send it as X-AFOS-Site. New errors: no_tenant_link, unknown_site_code, site_code_required, site_code_not_for_environment. external_ref is now scoped per shop. No change to sandbox behaviour or to any request body.
v1.02026-08-17Initial release: camera CRUD, status reporting, webhooks, idempotency, sandbox environment.

13Support

Questions, live-key provisioning, or a bug? Email [email protected]. Include your public key_id (never your secret) and a request timestamp so we can find it in the audit log.

🐾Animal Friends OS · Camera Integration Partner API v1 © 2026 AFPC Industries LLC · Built for abcKam

Base URL https://animalfriendsos.app · This reference: /partners/cameras/docs