SaaS API Token Rotation

When you feel your SaaS API token (a key for accessing SaaS API) might have been suddenly exposed to 3rd persons, or as part of periodically changing secrets for security purposes, you can change (rotate) it. SaaS token rotation may be used only with the help of SaaS API available on Studio adn higher plans.

When you change SaaS API token it will be rotated immediately, so you must immediately save it in the DB or you lose access to SaaS API, and only support may help you then.

Request format

URL: https://cloud.n1ed.com/a/saas/saas-token-rotate
Request type: POST
Content type: application/x-www-form-urlencoded
Parameters:

  • saasToken

    Your secret SaaS token that acts as an API key for SaaS API

Response format

The server will return the new SaaS token in the data section if the request succeeds, or an error code otherwise.

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

{
    error: null,
    data: {
        saasToken: "rotated-saas-token"
    }
}

Possible error codes:

  • INCORRECT-TOKEN - the saasToken parameter has been incorrectly specified. Are you trying to rotate the same old SaaS token a second time?

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/saas-token-rotate \
    -d "saasToken=your-secret-saas-token"

Please refer to SaaS API basics to see samples for PHP, JS, and learn how to write code for other languages.