Skip to content

Importing cameras through the API

POST /watcher/client-api/v3/streams/import creates and updates cameras from CSV or JSON. Send it as a user permitted to manage cameras in every specified organization. Send a personal API key or session token as Bearer.

Prepare data

When adding a camera, specify its title and organization. inputs holds the source address. Import looks up existing cameras by name: a match is updated; for a new camera, Watcher generates a name from title. A supplied new camera name does not become its ID.

For repeatable updates, first retrieve names through GET /watcher/client-api/v3/streams. Do not repeatedly import rows without names as synchronization: they create new cameras.

CSV

Save cameras.csv as UTF-8 with a header and comma separator:

name,title,organization_id,static,disabled,inputs_0_url,inputs_1_url,dvr_expiration,coordinates_latitude,coordinates_longitude
,Entrance,7,true,false,rtsp://camera-one.example.com/main,rtsp://camera-one.example.com/sub,86400,55.75,37.61
,Parking,7,true,false,rtsp://camera-two.example.com/main,,86400,55.76,37.62

Replace 7 with an existing organization ID. For updates, fill in name from the API.

curl --fail-with-body --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: text/csv' \
  --data-binary @cameras.csv \
  'https://watcher.example.com/watcher/client-api/v3/streams/import'

CSV represents nested fields using underscores. Main fields:

  • title — camera title.
  • name — existing camera ID for updates.
  • organization_id — camera organization; specify explicitly.
  • folder_id — folder inside the organization.
  • preset_id — a preset available to the organization.
  • comment — a note.
  • static — true for continuous ingest, false for on-demand ingest.
  • disabled — administrative camera disabling.
  • inputs_0_url — main source; inputs_1_url is the substream.
  • dvr_expiration — archive retention in seconds.
  • coordinates_latitude and coordinates_longitude — camera coordinates.

Advanced settings must match the Client API StreamConfig schema. For example, nested vision uses vision_ fields and the detector array uses vision_detectors_0_.... Do not copy legacy API field names without checking the schema.

JSON

The JSON body is an object with a streams array. A top-level array is rejected:

{
  "streams": [
    {
      "title": "Entrance",
      "organization_id": 7,
      "inputs": [{"url": "rtsp://camera-one.example.com/main"}],
      "static": true,
      "dvr": {"expiration": 86400}
    }
  ]
}

Save the body as cameras.json, then send:

curl --fail-with-body --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data-binary @cameras.json \
  'https://watcher.example.com/watcher/client-api/v3/streams/import'

Verify the result

Example successful response:

{"created":2,"updated":0}

The response contains counts without camera names. After import, read the target organization's camera list and check titles and settings. If your integration needs an ID immediately after creation, use an individual PUT /streams/{name} and save the response's name; see billing integration.

An empty list or invalid body causes a validation error. Missing permission to manage the specified organization's cameras returns 403. Successfully saved settings do not mean Watcher has received video: check connection state separately.