Skip to main content

$client->regenerateLicenseeKey()

Regenerate Key

Regenerates a licensee's key and returns the licensee with the new key. The previous key stops working immediately, so update any integration that uses it.

Endpoint​

POST /keys/{key}/licensees/{licensee}/regenerate-key

This operation needs a Management Key. Pass it as the second argument to IdealPostcodes::client(), which sends it in the Authorization header. See setup.

Signature​

public function regenerateLicenseeKey(string $key, string $licensee): LicenseeResponse

Arguments​

NameTypeRequiredDescription
$keystringyesAPI Key
$licenseestringyesLicensee Key

Query Parameters​

None.

Response​

IdealPostcodes\Responses\LicenseeResponse. Read fields as properties, such as $response->result, or as an array with the API's field names. toArray() returns the decoded body.

Errors​

An HTTP error throws ApiException with the HTTP status, the API error code from getCode() and the decoded body. A transport failure throws TransporterException. See error handling.

Example​

regenerate-licensee-key.phpphp
<?php

declare(strict_types=1);

use IdealPostcodes\IdealPostcodes;

require 'vendor/autoload.php';

$client = IdealPostcodes::client('ak_test', 'uk_test');

$response = $client->regenerateLicenseeKey('ak_test', '56a11209ebe230380bf104c3');

echo 'New licensee key: ', $response->result->key, PHP_EOL;