Regenerate Qiscus Secret Key

The Qiscus Secret Key, together with the App ID, authenticates your systems to Qiscus Omnichannel Chat. You can find both in Settings > App Information (see Settings and Configuration).

Admins can replace the Qiscus Secret Key with a new one on their own. Do this when the key may have leaked, or as part of a regular key rotation.

The current key stops working immediately

As soon as a new key is generated, every integration that still uses the current key fails until it is updated with the new one. Prepare the change in your systems first, regenerate the key, then update them right away.

What uses the Secret Key

Integration

What to update

Qiscus Omnichannel API calls with the Qiscus-Secret-Key header, including the WhatsApp broadcast API

Replace the header value with the new key.

Bot engines that send replies to Qiscus with the QISCUS_SDK_SECRET header (/{AppCode}/bot), such as a custom bot engine or a connected AgentLabs project

Update the Secret Key in the bot configuration.

Webhook signature checks (QISCUS-SIGNATURE-KEY header)

Verify the signature with the new key. Webhooks sent after the change are signed with the new key.

SDK Server API calls with the QISCUS-SDK-SECRET header, and SDK identity tokens (JWT) signed with the Secret Key

Replace the key on your server.

Qiscus OmniForm

Contact Qiscus support before you regenerate the key.

Regenerate the key from the dashboard

  1. Log in to the Qiscus Omnichannel dashboard as an Admin.

  2. Open Settings and select App Information.

  3. In the App Info card, click Regenerate secret key.



  1. Read the warning in the Regenerate secret key? dialog, enter your password in Enter your password to continue, then click Regenerate.



  1. The message Secret key regenerated appears and the new key is shown in Qiscus Secret Key. Copy it and update your integrations.

Limits

  • Only an Admin can regenerate the key. Supervisors and agents don't see the button.

  • The key can be regenerated once every 5 minutes per app.

  • After 5 wrong passwords within 15 minutes, regeneration is blocked for 15 minutes.

Messages you may see

Message

What it means

Incorrect password. Try again.

The password doesn't match your account. Nothing was changed.

The key can be regenerated once every 5 minutes, and 5 wrong passwords block regeneration for 15 minutes. Try again later.

You hit one of the limits above. Nothing was changed.

Couldn't regenerate the secret key. Nothing was changed. Try again.

A temporary failure. The current key still works.

We couldn't confirm whether the key was changed.

Reload the page in a few minutes and check the key before you use it. If the API rejects it, contact Qiscus support.

The new key couldn't be saved

The key was changed but not fully saved, so API calls may fail. Contact Qiscus support before you use the API.

Regenerate the key through the API

You can also rotate the key from your own system, for example on a schedule. The request needs the Admin's password and returns the new key.

curl --location --request POST '{{BaseUrl}}/api/v2/app/secret_key/regenerate' \
--header 'Qiscus-App-Id: {{AppId}}' \
--header 'Qiscus-Secret-Key: {{CurrentSecretKey}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"password": "{{AdminPassword}}"
}'

You can authenticate with the App ID and the current Secret Key as above, or with an Admin's Authorization token and Qiscus-App-Id. The password is the password of the Admin account.

Successful response (200):

{
"data": {
"app": {
"app_code": "{{AppId}}",
"secret_key": "{{NewSecretKey}}"
}
}
}

The current key stops working as soon as this response is returned. Store the new key before you send any other request.

Error responses have the shape {"status": <code>, "errors": {"code": "...", "message": "..."}}:

HTTP status

errors.code

What it means

400

invalid_password

Wrong password. Nothing was changed.

429

too_many_password_attempts

5 wrong passwords within 15 minutes. Try again after 15 minutes.

429

rate_limited

The key was already regenerated in the last 5 minutes.

500

retry

Temporary failure. Nothing was changed. Try again.

500

not_configured

Regeneration isn't available right now. Nothing was changed.

500

out_of_sync, unknown

The key may have changed but wasn't confirmed. Contact Qiscus support before you use the API.


  Last updated