Skip to content

Migrating an integration to API v3

Use API v3 to integrate with current Watcher. Migrate authentication, the permission model and response handling. Changing only the base URL is insufficient: camera creation and permission assignment requests have a different structure.

Full contracts are published in the Client API and Admin API references. A separate service management example is provided in billing integration.

Client API and Admin API

  • Client API — /watcher/client-api/v3. User operations on organizations, folders and cameras, and episode retrieval. Requests check the caller's permissions for specific objects.
  • Admin API — /watcher/admin-api/v3. Administrative operations, including presets and camera settings. Administrative /login requires admin access. Certain read requests allow domain administrators; this does not grant them access to all Admin API operations.

Choose the API according to the action and required authority. A Watcher administrator account can be denied by Client API when a request separately requires organization permissions.

Authentication

For a user integration, create a separate account and grant the required permissions. Obtain tokens through POST /watcher/client-api/v3/login with Basic authentication, or issue a personal key through POST /watcher/client-api/v3/users/{user_id}/apikey.

In both cases, subsequent requests use:

Authorization: Bearer <access_token_or_apikey>

access_token lasts one hour. Refresh it through the same /login, sending refresh_token as Bearer. A personal key does not require time-based refresh; issuing it again replaces the previous key. See API authentication.

Scoped API tokens are available for specific server operations. They work only for operations that support them, such as autologin/generate; do not use them as general-purpose user keys.

Behavioral changes

  • Cameras use the streams resource. PUT /streams/{name} creates a missing camera or updates an existing one. When creating an ordinary camera, Watcher generates its name from title. Save the actual name from the response for subsequent operations. Repeating a request with an arbitrary previous name can create another camera.
  • JSON import has a streams wrapper. POST /streams/import accepts {"streams":[...]}, not a top-level array. The response contains created and updated, without camera names.
  • The login is sent in name. The display name is fullname; the notification address is email.
  • Blocking uses disabled. Use true to disable and false to enable.
  • Passwords are changed by updating the user. Send password in PUT /users/{user_id}. Disabling deletes the user's sessions; changing the password from another account also deletes the target user's sessions.
  • Organization permissions have specific field names. For example, can_edit_streams and can_edit_users go directly in PUT /organizations/{id}/users/{user_id}. This request creates membership if it does not exist.
  • Access to selected cameras is assigned to folders. Use PUT /organizations/{id}/folders/{folder_id}/users/{user_id} with can_view, can_view_dvr and can_use_ptz. Permissions apply recursively to subfolders. Membership without viewing permissions does not grant video access.
  • Camera management permission includes viewing. Do not grant can_edit_streams when access to selected folders is all that is required. Organization-level can_view_streams grants access to every camera in the organization.
  • Organization limits are nested in limits. Use limits.streams and limits.users. Specify the owner as owner: {"id":15}; if omitted during creation, the creator becomes owner.
  • Lists use cursors. Process the corresponding collection array and pass next as cursor. The domain user list uses users_list; the organization user list uses users.
  • readonly prohibits writes. Write requests by a user with this flag are rejected regardless of other permissions.

Mapping v2 requests to v3

The left column is only for finding legacy integration code. Send working requests using the v3 column and check bodies against the current schema.

Legacy request or field v3 request or field
X-Vsaas-Api-Key, X-Vsaas-Session Authorization: Bearer <token>; see token selection above
POST /vsaas/api/v2/auth/login POST /watcher/client-api/v3/login
GET /vsaas/api/v2/profile GET /watcher/client-api/v3/profile
POST /vsaas/api/v2/users/{id}/apikey POST /watcher/client-api/v3/users/{user_id}/apikey
GET /vsaas/api/v2/cameras GET /watcher/client-api/v3/streams
POST /vsaas/api/v2/cameras PUT /watcher/client-api/v3/streams/{name}; save name from the response
PUT/DELETE /vsaas/api/v2/cameras/{name} PUT/DELETE /watcher/client-api/v3/streams/{name}
POST /vsaas/api/v2/cameras/import POST /watcher/client-api/v3/streams/import with the current CSV/JSON structure
GET/POST /vsaas/api/v2/users GET/POST /watcher/client-api/v3/users; Admin API for administrative operations
PUT/DELETE /vsaas/api/v2/users/{id} PUT/DELETE /watcher/client-api/v3/users/{user_id} within permissions, or Admin API
GET/POST /vsaas/api/v2/organizations GET/POST /watcher/client-api/v3/organizations
PUT/DELETE /vsaas/api/v2/organizations/{id} PUT/DELETE /watcher/client-api/v3/organizations/{id}
POST /vsaas/api/v2/organizations/{id}/users PUT /watcher/client-api/v3/organizations/{id}/users/{user_id}
GET/POST /vsaas/api/v2/presets Read: Client API /presets; create: POST /watcher/admin-api/v3/presets
POST /vsaas/api/v2/agent-activation-tokens POST /watcher/client-api/v3/agent_activation_token
GET /vsaas/api/v2/events GET /watcher/client-api/v3/episodes; adapt event handling to the episode model
POST /vsaas/api/v2/auth/generate-autologin-token POST /watcher/client-api/v3/autologin/generate with login; user sessions only for themselves, billing requires a token with autologin/generate scope
POST /vsaas/autologin Exchange a JSON token through POST /watcher/client-api/v3/autologin or use a web interface link
POST /vsaas/api/v2/my/subscriptions with notification_type: http The v3 subscription resource accepts push; this request has no direct HTTP webhook equivalent

This row describes the difference between historical and current subscription contracts. To retrieve episodes through Client API v3, use episode collection.

An integration sending complete face or vehicle recognition events to Central uses the separate PUT /central/api/v3/episodes/{episode_id} contract with Central authentication. It is not replaced by POST /watcher/client-api/v3/episodes: that POST creates generic episodes, while Client PUT changes only the title and description. See the contract boundaries in external analytics integration.

Migration sequence

  1. List the integration's actions and existing requests.
  2. Choose Client API or Admin API for each action. Create a test service account with the required permissions.
  3. Migrate authentication and check session refresh or personal key replacement.
  4. Adapt request bodies and response handling. Save IDs issued by Watcher.
  5. Test creation, updates and deletion with fictitious data in a test installation. Test repeated requests separately.
  6. Test denied cases: another organization's data, missing folder permissions and a disabled account.
  7. For events and commands sent to external systems, confirm delivery, duplicate handling and the external result before switching the live integration.