API Key Rotation
When you feel your API key might have been accidentally exposed, or as part of periodically changing secrets for security purposes, you can change API keys used on your websites. API key rotation may be used only with the help of SaaS API available on Studio and higher plans.
Be careful when calling this request, because the specified key will be rotated immediately, and if your script loses the response and doesn't save it to the DB, you'll be left with an outdated API key. However, you can retrieve it manually from the Dashboard.
This request will change only characters 9–24 of the API key, keeping positions 1–8 intact. The first 8-character part is a constant public part and should never be changed.
Request format
URL: https://cloud.n1ed.com/a/saas/api-key-rotate
Request type: POST
Content type: application/x-www-form-urlencoded
Parameters:
-
saasTokenYour secret SaaS token that acts as an API key for SaaS API
-
apiKey
API key on the current account to be rotated (changed).
Response format
The server will return the new API key in the data section if the request succeeds, or an error code otherwise.
HTTP code: 200
Content type: application/json
Body:
{
error: null,
data: {
apiKey: "rotated-api-key"
}
}
Possible error codes:
NO-SUCH-API-KEY- theapiKeyparameter has been incorrectly specified. Are you trying to rotate the same old API key a second time?INCORRECT-TOKEN- thesaasTokenparameter 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/saas/api-key-rotate \
-d "saasToken=your-secret-saas-token&apiKey=your-api-key"
Please refer to SaaS API basics to see samples for PHP, JS, and learn how to write code for other languages.