26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Add keys (v2)

Add keys (v2)

POST  /api/v2/billing/intercoms/{intercom}/keys

With the release of request version v2, version v1 is being moved to legacy.
For new integrations, use the current v2.
Version v1 remains available to support existing integrations.

Saves keys to the platform and delivers them to the panel through a queue. A key is a hexadecimal string of 6 to 14 characters. Case does not matter: the key is stored in uppercase with surrounding spaces removed. A key already registered on this intercom is rejected. The response contains an array of created keys.

JSON
{
    "keys": [
        "fff237b9",
        "00A1B2C3D4"
    ],
    "flat_id": 501
}

Method parameters

int intercom  required , Intercom ID (in the URL)


array keys  required , Key values, up to 100

object array

string keys.  required , Key value


int flat_id, ID of the apartment on this intercom to link the keys to

200  OK

Successful response

JSON
[
    {
        "id": 77,
        "key": "FFF237B9",
        "type": "mifare",
        "flat_id": 501,
        "deleted_at": null,
        "delivery": {
            "status": "pending",
            "error": null,
            "synced_at": null
        }
    }
]

404  Not Found

Intercom not found

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/v2/billing/intercoms/{intercom}/keys' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "intercom": 0,
    "keys": {
        "": "string"
    },
    "keys.": "void",
    "flat_id": 0
}'
PHP
PHP
$data = array (
  'intercom' => 0,
  'keys' => 
  array (
    '' => 'string',
  ),
  'keys.' => 'void',
  'flat_id' => 0,
);
$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/v2/billing/intercoms/{intercom}/keys', false, $context);