# `client.DeleteLicenseeAsync()`

Cancel

Cancels a licensee. Its key stops working and it drops out of the licensee list. Contact us to reverse it.

## Endpoint

`DELETE /keys/{key}/licensees/{licensee}`

See the [API reference](/docs/api/delete-licensee.md) for this endpoint.

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](/docs/sdks/dotnet/setup.md).

## Signature

```csharp
Task<DeleteLicenseeResponse> DeleteLicenseeAsync(string key, string licensee, CancellationToken cancellationToken = default)
```

## Arguments

| Name                | Type                | Required | Description          |
| ------------------- | ------------------- | -------- | -------------------- |
| `key`               | `string`            | yes      | API Key              |
| `licensee`          | `string`            | yes      | Licensee Key         |
| `cancellationToken` | `CancellationToken` | no       | Cancels the request. |

## Query Parameters

*None.*

## Response

`DeleteLicenseeResponse`. Fields are properties in PascalCase, such as `response.Result`; fields this SDK version does not know are kept in `AdditionalProperties`. See [responses](/docs/sdks/dotnet/responses.md).

## 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](/docs/sdks/dotnet/errors.md).

## Example

delete-licensee.cscsharp

```csharp
using IdealPostcodes;

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

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

Console.WriteLine($"Deleted: {response.Result.Deleted}");
```
