Skip to main content
Skip table of contents

Creating a sub-user

When creating a sub-user, you can select the cameras, permissions, groups, and layouts that will be available to the sub-user.

If the permissions include analytics-related permissions, you will also need to provide the number of licenses of that type that the sub-user will have access to.

Currently, only users who are legal entities can create sub-users. Before adding a sub-user, a billing request is made. If the request is successful, the sub-user is created, otherwise, a 400 error is returned.

When creating users with a large number of cameras, you may need to send multiple requests. Each request can contain up to 500 cameras. For more details, please refer to the parameter description below.

POST/api/v1/users/subusers

Headers

Authorization

Bearer token

Accept

application/json

X-Client

ios-cctv|android-cctv|thick-legal|web

X-UUID

unique device id

Body

json

JSON
{
    "name": "User",
    "email": "user@mail.com",
    "password": "password",
    "password_confirmation": "password",
    "analytic_l2": 1,
    "analytic_l3": 1,
    "cameras_to_attach": [
        752,
        758
    ],
    "layouts": [
        209
    ],
    "groups": [
        43
    ],
    "permissions": [
        15,
        13
    ],
    "marks": [
        19
    ]
}

namerequired

string

Sub-user's name

emailrequired

string

Unique login (used as email) for the sub-user

passwordrequired

string

Password for the sub-user

password_confirmationrequired

string

Confirm the password to ensure it is entered correctly

analytic_l1required

int

The number of level one analytics licenses that the sub-user will be able to create, only required if there are permissions for cases of this license type

analytic_l2required

int

The number of level two analytics licenses that the sub-user will be able to create, only required if there are permissions for cases of this license type

analytic_l3required

int

The number of level three analytics licenses that the sub-user will be able to create, only required if there are permissions for cases of this license type

cameras_to_attachrequired

array

An array of camera IDs that will be available to the sub-user. You can include up to 500 elements in a single request. If you need more, you will need to send an Sub-user update after creation with the remaining cameras

layoutsrequired

array

An array of layout IDs that will be available to the sub-user

groupsrequired

array

An array of group IDs that will be available to the sub-user. Access is granted to the group entity itself, not to the cameras within the group. Separate access needs to be granted to the cameras

marksrequired

array

An array of label IDs that will be available to the sub-user. This functionality is not available on the web interface, but the API allows it. However, access to the label requires access to the corresponding camera

Response

200

Successful response

JSON
{
    "id": 44,
    "login": "user@mai.com",
    "name": "user@mai.com",
    "parent_id": 13,
    "permissions": [
        {
            "id": 22,
            "name": "camera-events-index",
            "display_name": "View camera events"
        },
        {
            "id": 240,
            "name": "analytic-cases-camera-obstacle",
            "display_name": "Business case - camera damage / overlap / vandalism detection"
        },
        {
            "id": 239,
            "name": "analytic-cases-line-intersection",
            "display_name": "Business case - line crossing detection"
        },
        {
            "id": 49,
            "name": "analytic-cases-index",
            "display_name": "List of business cases"
        }
    ],
    "cameras": [
        {
            "id": 765,
            "group_id": 100,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "2022-04-06 12:13:58",
            "created_at": "2022-01-27 20:16:28",
            "billing_id": null,
            "pretty_name": "Camera 1",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "is_archive_recording": true,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 1"
        },
        {
            "id": 761,
            "group_id": 100,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "2022-04-06 12:13:58",
            "created_at": "2022-01-27 20:10:24",
            "billing_id": null,
            "pretty_name": "Camera 2",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "is_archive_recording": true,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 2"
        }
    ],
    "groups": [
        {
            "id": 43,
            "name": "Group"
        }
    ],
    "layouts": [
        {
            "id": 209,
            "name": "01",
            "layout_template_id": 11,
            "layout_template": "Grid91",
            "user_id": 13,
            "grid": [
                null,
                {
                    "id": 753,
                    "group_id": 101,
                    "status": "active",
                    "type": "media_server_v2",
                    "start_at": "2022-04-06 12:13:58",
                    "created_at": "2022-01-27 19:48:31",
                    "billing_id": null,
                    "pretty_name": "Camera 3",
                    "pretty_text": "Cameras",
                    "short_address": "Cameras",
                    "full_address": "Cameras",
                    "lat": null,
                    "lng": null,
                    "azimuth": null,
                    "streams": [
                        {
                            "id": 748,
                            "type": "high",
                            "camera_id": 753,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "reserve",
                            "width": 2048,
                            "height": 1536
                        },
                        {
                            "id": 749,
                            "type": "low",
                            "camera_id": 753,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "main",
                            "width": 2048,
                            "height": 1536
                        }
                    ],
                    "services": {
                        "ptz": false,
                        "motion_detect": false
                    },
                    "has_sound": false,
                    "is_archive_recording": true,
                    "is_bridge": false,
                    "is_favorite": false,
                    "user_status": "active",
                    "name": "Camera 3"
                },
                null,
                {
                    "id": 765,
                    "group_id": 100,
                    "status": "active",
                    "type": "media_server_v2",
                    "start_at": "2022-04-06 12:13:58",
                    "created_at": "2022-01-27 20:16:28",
                    "billing_id": null,
                    "pretty_name": "Camera 1",
                    "pretty_text": "Cameras",
                    "short_address": "Cameras",
                    "full_address": "Cameras",
                    "lat": null,
                    "lng": null,
                    "azimuth": null,
                    "streams": [
                        {
                            "id": 772,
                            "type": "high",
                            "camera_id": 765,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "reserve",
                            "width": 1920,
                            "height": 1080
                        },
                        {
                            "id": 773,
                            "type": "low",
                            "camera_id": 765,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "main",
                            "width": 704,
                            "height": 576
                        }
                    ],
                    "services": {
                        "ptz": false,
                        "motion_detect": false
                    },
                    "has_sound": false,
                    "is_archive_recording": true,
                    "is_bridge": false,
                    "is_favorite": false,
                    "user_status": "active",
                    "name": "Camera 1"
                },
                null,
                null,
                null
            ],
            "created_at": "2021-09-15 18:50:19",
            "updated_at": "2022-02-08 09:41:30"
        }
    ],
    "marks": [
        {
            "id": 485887,
            "type": "mark",
            "type_pretty": "Mark",
            "title": "New mark",
            "can_delete": true,
            "from": "2022-02-18 07:43:40",
            "to": null,
            "camera_id": 752,
            "created_at": "2022-02-18 16:43:07",
            "updated_at": "2022-02-18 16:43:07"
        }
    ],
    "created_at": "2021-11-24 23:52:20",
    "updated_at": "2021-12-09 18:44:38",
    "access_token_id": null,
    "can_update_password": false,
    "analytic_license": [
        {
            "type": "analytic_l1",
            "type_pretty": "LIC-XXXX-YY-L1",
            "all": 1,
            "free": 1,
            "used": 0
        },
        {
            "type": "analytic_l2",
            "type_pretty": "LIC-XXXX-YY-L2",
            "all": 1,
            "free": 1,
            "used": 0
        },
        {
            "type": "analytic_l3",
            "type_pretty": "LIC-XXXX-YY-L3",
            "all": 1,
            "free": 1,
            "used": 0
        }
    ]
}
400

If the user is not a legal entity and the billing request fails

401

Authorization token not provided or invalid, see Obtaining a token

Example

JSON
curl -k --location --request POST 'https://vms.local/api/v1/users/subusers' \
--header 'Authorization:Bearer token' \
--header 'Accept:application/json' \
--header 'X-Client:ios-cctv|android-cctv|thick-legal|web' \
--header 'X-UUID:unique device id' \
--header 'Content-Type: application/json \
--data-raw '{
    "name": "User",
    "email": "user@mail.com",
    "password": "password",
    "password_confirmation": "password",
    "analytic_l2": 1,
    "analytic_l3": 1,
    "cameras_to_attach": [
        752,
        758
    ],
    "layouts": [
        209
    ],
    "groups": [
        43
    ],
    "permissions": [
        15,
        13
    ],
    "marks": [
        19
    ]
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.