# Undelete API key

> Restore a deleted N1ED API key together with its configuration, and resolve the error raised when an active key now holds its domain.

Source: https://n1ed.com/docs/admin-api/undelete-api-key  
Section: For developers > Admin API > Undelete API key  
Updated: 2026-09-29  
Every page of n1ed.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://n1ed.com/llms-full.txt

If you deleted an API key by mistake, or a customer returns to your CMS or website builder, restore the key together with its whole configuration using this [Admin API](https://n1ed.com/docs/admin-api) request (available on Studio and higher plans). To find the exact value of a deleted API key, use [List API keys](https://n1ed.com/docs/admin-api/list-api-keys) with the `deleted=true` parameter.

The key is restored as it was at the moment of deletion, with one exception: if other API keys shared blocks specifically to this key, those sharing rules were detached on deletion and are not restored automatically.

An API key cannot be undeleted if it would break your active keys, particularly when its domain is now occupied by another active API key of your account: in this case the request returns the `API-KEY-WITH-THIS-DOMAIN-ALREADY-EXISTS` error and the occupying API key in the `data` section. Delete that key or change its domain first, then retry. Restoring a key also requires a free license slot, same as creating a new one.

## Request format

**URL:** `https://cloud.n1ed.com/a/admin/api-key-undelete`  
**Request type:** `POST`  
**Content type:** `application/x-www-form-urlencoded`  
**Parameters:**

- `adminToken`: Your secret Admin API token
- `apiKey`: Deleted API key on the current account to be restored. Please specify the full (24-character) API key.

## Response format

The server will return an "OK" confirmation in the data section if the request succeeds, or an error code otherwise.

**HTTP code:** `200`  
**Content type:** `application/json`  
**Body:**

```js
{
    error: null,
    data: "OK"
}
```

Possible error codes:

- `NO-SUCH-API-KEY` - there is no deleted API key with this value on your account.
- `API-KEY-IS-NOT-DELETED` - this API key is already active, there is nothing to undelete.
- `UNABLE-TO-CHANGE-NOT-OWN-API-KEY` - the specified API key does not belong to your account.
- `API-KEY-WITH-THIS-DOMAIN-ALREADY-EXISTS` - another active API key of your account now uses the same domain. The response will contain that API key in `data.apiKey`. Delete it or change its domain first.
- `API-KEY-PREFIX-ALREADY-EXISTS` - another active API key of your account starts with the same first 8 characters, so restoring this key would make them ambiguous. This can happen only with API keys created before deleted keys became reserved; please [create a new API key](https://n1ed.com/docs/admin-api/create-api-key) instead.
- `CANT-UNDELETE-API-KEY-WITH-DELETED-PARENT` - this API key inherits its configuration from a [parent](https://n1ed.com/docs/multisite/parent-and-child-api-keys) API key which is deleted. Undelete the parent first.
- `CANT-UNDELETE-API-KEY-WITHOUT-LICENSE` - you have reached your license limit on the account. Please purchase more licenses and retry.
- `INCORRECT-TOKEN` - the `adminToken` parameter has been incorrectly specified.

## Sample request

Here is a sample of how to make this request from the Linux console (sh, bash, or any other shell).

```bash
curl \
    -X POST https://cloud.n1ed.com/a/admin/api-key-undelete \
    -d "adminToken=your-secret-admin-token&apiKey=your-api-key"
```

Please refer to [Admin API](https://n1ed.com/docs/admin-api) to see samples for PHP, JS, and learn how to write code for other languages.
