26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Issue virtual key to user

Issue a virtual key to a user

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

Issues a BLE controller virtual key to the user with the specified login.

Issuing a key replaces the user's existing key on this controller: the old key is revoked and a new key is created with a new id. Repeating the request reissues the key rather than causing an error.

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.

A user 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
{
    "valid_from": "2026-01-15T10:00:00Z",
    "valid_till": "2026-02-15T10:00:00Z"
}

Method parameters

string login  required , User login (in URL)


string ble_controller  required , BLE controller UUID (in URL)


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

201  Created

Key issued

JSON
{
    "id": 17,
    "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"
}

404  Not Found

User not found

JSON
{
    "error": "wrong api endpoint"
}

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/users/{login}/ble-controllers/{ble_controller}/virtual-keys' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "login": "string",
    "ble_controller": "string",
    "valid_from": "string",
    "valid_till": "string"
}'
PHP
PHP
$data = array (
  'login' => 'string',
  'ble_controller' => 'string',
  '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/users/{login}/ble-controllers/{ble_controller}/virtual-keys', false, $context);