26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Create user by external system

Create a user

POST  /api/v1/billing/user/manage

When a user is created, they receive the default permissions for their user type, as defined by the system setting default_permissions_<user type>. Module permissions specified in modules are added to these defaults. Video analytics permissions are not assigned if video analytics is not configured on the platform. User permissions can be changed using VMS Billing / User (billing) / Update a user by an external system or in the VMS Administrator interface.

JSON
{
    "login": "test@mail.com",
    "password": "qweasdzxc",
    "type": "type_value",
    "billing_info": {
        "billing_id": "123123123",
        "billing_extra": []
    },
    "status": "active",
    "properties": [
        {
            "type": "phone",
            "value": "+80283289362"
        }
    ],
    "modules": [
        "bridges",
        "camera-agents"
    ]
}

Method parameters

string login  required , Login used to sign in to VMS. Any unique string; it does not have to be an email address. The external system sets the login


string password  required , Password, up to 100 characters. The external system sets the password; VMS stores only its hash


bool can_update_password, Whether the user can change their own password. Defaults to `true`


string type  required , User type, up to 50 characters. Allowed values are defined by the `USER_TYPES` environment variable during platform installation; contact the installation specialist for the current list. The `special` and `subuser` types are not allowed


array billing_info, Arbitrary object containing user data from the external billing system (for example, `billing_id`, `billing_extra`). VMS stores it unchanged


array properties, User attributes (for example, phone, email, address), up to 10 items. 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


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


array modules, Modules to enable immediately for the user: `bridges`, `camera-agents`. The user receives permissions for these modules in addition to the default permissions

201  Created

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 POST \
	--url 'https://your-domain/api/v1/billing/user/manage' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "login": "string",
    "password": "string",
    "can_update_password": true,
    "type": "string",
    "billing_info": [],
    "properties": {
        "type": "string",
        "value": "string"
    },
    "properties.type": "void",
    "properties.value": "void",
    "status": "string",
    "modules": []
}'
PHP
PHP
$data = array (
  'login' => 'string',
  'password' => 'string',
  'can_update_password' => true,
  'type' => 'string',
  'billing_info' => 
  array (
  ),
  'properties' => 
  array (
    'type' => 'string',
    'value' => 'string',
  ),
  'properties.type' => 'void',
  'properties.value' => 'void',
  'status' => 'string',
  'modules' => 
  array (
  ),
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'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);