Skip to main content

client.RegenerateLicenseeKeyAsync()

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 new IdealPostcodesClient(apiKey, managementKey), or set ManagementKey in the options; the client sends it in the Authorization header. See setup.

Signature​

Task<LicenseeResponse> RegenerateLicenseeKeyAsync(string key, string licensee, CancellationToken cancellationToken = default)

Arguments​

NameTypeRequiredDescription
keystringyesAPI Key
licenseestringyesLicensee Key
cancellationTokenCancellationTokennoCancels the request.

Query Parameters​

None.

Response​

LicenseeResponse. Fields are properties in PascalCase, such as response.Result; fields this SDK version does not know are kept in AdditionalProperties. See responses.

Errors​

An HTTP error throws ApiException with the StatusCode, the API error Code and the raw Body. A success response whose body cannot be read throws UnserializableResponseException. Network failures and cancellation throw HttpClient's own HttpRequestException and OperationCanceledException. See error handling.

Example​

regenerate-licensee-key.cscsharp
using IdealPostcodes;

using var client = new IdealPostcodesClient("ak_test", "uk_test");

var response = await client.RegenerateLicenseeKeyAsync("ak_test", "56a11209ebe230380bf104c3");

Console.WriteLine($"New licensee key: {response.Result.Key}");