Skip to main content
Skip table of contents

Generate a code

Generate a code

JSON
{
    "title": "new code",
    "expired_at": "2029-12-31 12:45",
    "flat_id": 1
}

POST /api/admin/v1/intercom/{intercom}/codes

Parameters

int intercom, ID of the intercom for which the code needs to be created


string title, Code title


string expired_at, Date until which the code will be valid


int flat_id, Apartment for which the code will work

200 OK

Successful response

JSON
{
    "id": 7,
    "title": "title",
    "code": "93552",
    "expired_at": "2023-12-22T00:00:00.000000Z",
    "is_expired": false,
    "will_deleted_at": "2023-12-23T00:00:00.000000Z",
    "created_at": "2023-12-21T14:31:14.000000Z",
    "intercom_flat": {
        "id": 2,
        "flat": 2,
        "key_count": null,
        "users_count": null,
        "intercom_id": 5,
        "properties": {
            "is_analog_line_enable": false,
            "is_can_manage_resistance": false,
            "handset_ring_analog_volumes": null,
            "handset_talk_analog_volumes": null,
            "panel_talk_analog_volumes": null,
            "panel_system_volumes": null
        }
    }
}

401 Unauthorized

Authorization token not sent or not valid

422 Unprocessable Entity

Returns a JSON object with an error.

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The cause of the error will be described here"
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/intercom/{intercom}/codes' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "intercom": 0,
    "title": "string",
    "expired_at": "string",
    "flat_id": 0
}'
PHP
PHP
$data = array (
  'intercom' => 0,
  'title' => 'string',
  'expired_at' => 'string',
  '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/admin/v1/intercom/{intercom}/codes', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.