26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Update user by external system

Update a user

PATCH  /api/v1/billing/user/manage

This method allows an external system to update a user. The user is identified by id or login. Omitted parameters remain unchanged, except for properties: if omitted, all user attributes are deleted.

JSON
{
    "id": 1,
    "login": "test@mail.com",
    "password": "qweasdzxc",
    "status": "active",
    "billing_info": {
        "billing_id": "123123123",
        "billing_extra": []
    },
    "properties": [
        {
            "type": "phone",
            "value": "+80283289362"
        }
    ],
    "permissions_to_attach": [
        "archives-show",
        "archives-download"
    ],
    "permissions_to_detach": [
        "archives-preview-download"
    ],
    "session_limits": {
        "intercom": 10,
        "cctv": 5
    }
}

Method parameters

int id  required , User ID (required if `login` is omitted). Returns 422 for the ID of an administrator, special user, subuser, deleted user, or system account


string login  required , User login (required if `id` is omitted). Returns 422 for the login of an administrator, special user, subuser, deleted user, or system account. The external system sets the login when creating the user; this method cannot change it


string password, New password, up to 100 characters. VMS stores only its hash


bool can_update_password, Whether the user can change their own password


string status, User status: `active` — the user can access VMS; `blocked` — access is denied


array billing_info, Arbitrary object containing user data from the external billing system (for example, `billing_id`, `billing_extra`). Replaces the stored object entirely; an empty value is ignored


array properties, Complete list of user attributes (for example, phone, email, address), up to 10 items. Attributes whose types are omitted are deleted; if this parameter is omitted, all attributes are deleted. Returned in the `billing_properties` response field

object array

string properties.type, Attribute type (for example, `phone`, `email`), up to 100 characters. Required in every item


string properties.value, Attribute value (for example, `+80283289362`), up to 255 characters. Required in every item


array permissions_to_attach, Permission names to grant to the user. Each name must be a user permission from the list in VMS Billing / Settings (billing) / Static data. Video analytics permissions can be added only if video analytics is configured on the platform. Legacy device permission names `bridges`, `bridges-archive`, `camera-agents`, and `camera-agents-archive` are accepted here and in `permissions_to_detach` and mapped to detailed `bridges-*` / `camera-agents-*` permissions


array permissions_to_detach, Permission names to revoke from the user. Each name must be a user permission from the same list


array session_limits, User session limits by module. An omitted module receives a limit of 0; at least one limit must be greater than 0. Any key other than `intercom` or `cctv` is rejected with 422. `null` removes the user's individual limits

object array

int session_limits.cctv, Session limit for the "Video surveillance" module, 0 to 100


int session_limits.intercom, Session limit for the "Intercom" module, 0 to 100


200  OK

Returns a user object

JSON
{
    "id": 1,
    "login": "test@mail.com",
    "name": null,
    "type": "type_value",
    "status": "active",
    "created_at": "2023-05-02T10:18:50.000000Z",
    "updated_at": "2023-05-02T10:18:50.000000Z",
    "deleted_at": null,
    "can_update_password": false,
    "billing_properties": [
        {
            "type": "phone",
            "value": "+80283289362"
        }
    ]
}

422  Unprocessable Entity

Returns a JSON error object.

For more information, see General information > Validation.

JSON
{
    "message": "No informative message is provided here",
    "errors": {
        "any_key": [
            "The reason for the error is described here"
        ]
    }
}
cURL
Bash
curl -k --request PATCH \
	--url 'https://your-domain/api/v1/billing/user/manage' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "id": 0,
    "login": "string",
    "password": "string",
    "can_update_password": true,
    "status": "string",
    "billing_info": [],
    "properties": {
        "type": "string",
        "value": "string"
    },
    "properties.type": "void",
    "properties.value": "void",
    "permissions_to_attach": [],
    "permissions_to_detach": [],
    "session_limits": {
        "intercom": 0,
        "cctv": 0
    },
    "session_limits.intercom": "void",
    "session_limits.cctv": "void"
}'
PHP
PHP
$data = array (
  'id' => 0,
  'login' => 'string',
  'password' => 'string',
  'can_update_password' => true,
  'status' => 'string',
  'billing_info' => 
  array (
  ),
  'properties' => 
  array (
    'type' => 'string',
    'value' => 'string',
  ),
  'properties.type' => 'void',
  'properties.value' => 'void',
  'permissions_to_attach' => 
  array (
  ),
  'permissions_to_detach' => 
  array (
  ),
  'session_limits' => 
  array (
    'intercom' => 0,
    'cctv' => 0,
  ),
  'session_limits.intercom' => 'void',
  'session_limits.cctv' => 'void',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'PATCH',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/billing/user/manage', false, $context);