# `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. Set it as `userToken` on the client, which sends it in the `Authorization` header. See [setup](/docs/sdks/typescript/setup.md).

## Import

```ts
import { regenerateLicenseeKey } from "@addresszen/sdk";
```

## Path Parameters

| Name       | Type     | Required | Description                                        |
| ---------- | -------- | -------- | -------------------------------------------------- |
| `key`      | `string` | yes      | **API Key** The API Key to retrieve. Begins `ak_`. |
| `licensee` | `string` | yes      | **Licensee Key** Uniquely identifies a licensee.   |

## Query Parameters

*None.*

## Response Type

```ts
import type { RegenerateLicenseeKeyResponse } from "@addresszen/sdk";
```

## Errors

HTTP errors throw an `ApiError` with the HTTP `status` and the API error `code` and `message`. Network failures and aborts reject with the runtime's native error. Pass `throwOnError: false` to get `{ data, error }` instead. See [error handling](/docs/sdks/typescript/errors.md).

## Example

regenerate-licensee-key.tsts

```ts
import { createZenClient, regenerateLicenseeKey } from "@addresszen/sdk";

export const example = async () => {
  const client = createZenClient({
    apiKey: "ak_test",
    userToken: "uk_example",
  });
  const { data } = await regenerateLicenseeKey({
    client,
    path: { key: "ak_test", licensee: "sl_example" },
  });
  return data;
};
```
