Undelete API key
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 request (available on Studio and higher plans). To find the exact value of a deleted API key, use 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:
-
adminTokenYour 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:
{
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 indata.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 instead.CANT-UNDELETE-API-KEY-WITH-DELETED-PARENT- this API key inherits its configuration from a parent 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- theadminTokenparameter 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).
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 to see samples for PHP, JS, and learn how to write code for other languages.