26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Issue virtual keys to specified users

Issue virtual keys to a list of users

POST  /api/v1/billing/ble-controllers/{ble_controller}/virtual-keys

Issues BLE controller virtual keys to the specified users. Recipients are identified by logins (logins) and/or IDs (user_ids ). At least one list is required. If any recipient isn't found, the request is rejected with a 422 error under users.

The key type is determined by valid_till:

  • valid_till is provided – a temporary key is issued for the period from valid_from to valid_till; without valid_from the period starts at the current time;

  • valid_till isn't provided – a permanent key is issued: valid_from in the response is null, and valid_till is set far into the future (100 years by default). The supplied valid_from isn't used in this case.

Issuing a key replaces the recipient's existing key on this controller: the old key is revoked and a new key is created with a new id.

A recipient with an expired account (or an expired parent account, for a subuser) is rejected with a 422 error under user_ids.

The key format is described in Get a virtual key by ID.

JSON
{
    "logins": [
        "170300101"
    ],
    "user_ids": [
        43
    ],
    "valid_till": "2026-02-15T10:00:00Z"
}

Method parameters

string ble_controller  required , BLE controller UUID (in URL)


array logins, Recipient logins. Required if `user_ids` isn't provided

object array

string logins.  required , Recipient login


array user_ids, Recipient IDs. Required if `logins` isn't provided

object array

int user_ids.  required , Recipient ID


string valid_from, Temporary key validity start date. Defaults to the current time


string valid_till, Key expiration date: later than the current time and no earlier than `valid_from`. If provided, the key is temporary; otherwise, it's permanent

200  OK

Successful response – array of issued keys

JSON
[
    {
        "id": 16,
        "ble_device_id": "00000000-0000-0000-0000-000000000001",
        "user": {
            "id": 42,
            "login": "170300101",
            "name": "Ivan Petrov"
        },
        "type": "temporary",
        "valid_from": "2026-01-15T10:00:00.000000Z",
        "valid_till": "2026-02-15T10:00:00.000000Z",
        "is_active": true,
        "is_valid_now": true,
        "created_by": {
            "id": 2,
            "login": "billing"
        },
        "created_at": "2026-01-15T10:00:00.000000Z",
        "updated_at": "2026-01-15T10:00:00.000000Z"
    }
]

404  Not Found

BLE controller not found

JSON
{
    "error": "resource not found"
}

422  Unprocessable Entity

Returns a JSON error object. For more information, see General information > Validation.

JSON
{
    "message": "Unknown users: ivanov, 17",
    "errors": {
        "users": [
            "Unknown users: ivanov, 17"
        ]
    }
}
cURL
Bash
curl -k --request POST \
	--url 'https://your-domain/api/v1/billing/ble-controllers/{ble_controller}/virtual-keys' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "ble_controller": "string",
    "logins": {
        "": "string"
    },
    "logins.": "void",
    "user_ids": {
        "": 0
    },
    "user_ids.": "void",
    "valid_from": "string",
    "valid_till": "string"
}'
PHP
PHP
$data = array (
  'ble_controller' => 'string',
  'logins' => 
  array (
    '' => 'string',
  ),
  'logins.' => 'void',
  'user_ids' => 
  array (
    '' => 0,
  ),
  'user_ids.' => 'void',
  'valid_from' => 'string',
  'valid_till' => 'string',
);
$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/ble-controllers/{ble_controller}/virtual-keys', false, $context);