26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Issue keys for apartment

Issue BLE keys to apartment users

POST  /api/v1/billing/access-points/{access_point}/ble-controllers/{ble_controller}/keys

Creates permanent BLE keys for users of the specified intercom apartment. If users is provided, keys are issued only to the listed apartment users; otherwise, they are issued to all apartment users. The key is created as permanent: its expiration date (valid_till) is set by the server to a long period (approximately 100 years). The valid_till value provided in the request isn't used. A generated access token (key_data) based on master/pid of the BLE controller is returned for each created key.

JSON
{
    "intercom_id": 10,
    "flat": 25,
    "valid_till": "2024-02-01T00:00:00Z",
    "users": [
        42,
        43
    ]
}

Method parameters

string access_point  required , (path) Access point UUID.


string ble_controller  required , (path) UUID of the BLE controller used to generate the token.


integer intercom_id  required , Intercom ID. The intercom must exist.


integer flat  required , Apartment number. The apartment must exist on the specified intercom.


string valid_till  required , Required for validation but isn't used: the permanent key expiration date is set by the server.


array users, Array of apartment user IDs to issue keys to. If omitted, keys are issued to all apartment users.

200  OK

Returns an array of created keys (one per user)

JSON
[
    {
        "id": 1,
        "intercom_id": 10,
        "user_id": 42,
        "intercom_flat_id": null,
        "type": "ble",
        "key": null,
        "title": null,
        "key_data": "0102030405060708090a0b0c0d0e0f10",
        "valid_till": "2124-01-01T00:00:00.000000Z",
        "updated_at": "2024-01-01T00:00:00.000000Z",
        "created_at": "2024-01-01T00:00:00.000000Z"
    }
]

404  Not Found

Intercom or apartment not found

422  Unprocessable Entity

Validation error. For more information, see General information > Validation.

JSON
{
    "message": "Validation failed",
    "errors": {
        "flat": [
            "The selected flat is invalid."
        ]
    }
}
cURL
Bash
curl -k --request POST \
	--url 'https://your-domain/api/v1/billing/access-points/{access_point}/ble-controllers/{ble_controller}/keys' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "access_point": "string",
    "ble_controller": "string",
    "intercom_id": "integer",
    "flat": "integer",
    "valid_till": "string",
    "users": []
}'
PHP
PHP
$data = array (
  'access_point' => 'string',
  'ble_controller' => 'string',
  'intercom_id' => 'integer',
  'flat' => 'integer',
  'valid_till' => 'string',
  'users' => 
  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/access-points/{access_point}/ble-controllers/{ble_controller}/keys', false, $context);