> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cimento.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotating secrets

> Replace a service account's client secret without downtime, cut off one that has leaked, and know what stops working and when.

Rotating gives a service account a new client secret. The one it replaces keeps working for 24 hours, so you can move your system over without it going down.

## Rotate a client secret

**1. Rotate**

Go to **Admin → Integrations → API access**. Open the **⋯** menu on the service account and click **Rotate secret**, then confirm.

**2. Copy the new client secret**

Cimento shows the new client secret once. Copy it, store it somewhere safe, and click **Done**.

**3. Update your system**

Give your system the new client secret within 24 hours. The client ID does not change.

Until the 24 hours are up, both client secrets work. The **Client secrets** column shows the old one with how long it has left.

> [!WARNING]
>
> Finish moving over before you rotate again. A service account has at most two client secrets that work. Rotating while a replaced secret still has time left ends that older secret at once. Cimento names it before you confirm: **Secret ending in XXXX will stop working immediately.**

To rotate, you must hold every scope the service account has. If you don't, Cimento says which one you lack.

## A secret has leaked

Rotate, move your system to the new client secret, then end the leaked one without waiting for its 24 hours:

1. Click **Rotate secret** and copy the new client secret.
2. Update your system.
3. Open the **⋯** menu again and click **Revoke previous secret**.

To cut everything off at once, before you have a replacement in place, **Disable** the service account instead. It then gets no new access tokens with any client secret until you **Enable** it.

## Adding a scope

A client secret holds the scopes its service account had when the secret was made. When you add a scope to a service account, its current client secret does not gain it.

Cimento marks the new scope **Needs rotation**, and no access token carries it until you rotate. When you add a scope, the edit form offers:

* **Save**, to add the scope now and rotate later.
* **Save and rotate**, to add it and get a new client secret straight away.

Removing a scope needs no rotation.

## What stops, and when

| You do this | New access tokens | Access tokens already issued |
| - | - | - |
| Rotate | The new client secret works at once. The old one works for 24 more hours. | Keep working until they expire. |
| Rotate again within 24 hours | The oldest client secret stops at once. | Keep working until they expire. |
| Revoke the previous secret | That client secret stops at once. | Keep working until they expire. |
| Disable the service account | None are issued. | Keep working until they expire. |
| Delete the service account | None are issued, for good. | Keep working until they expire. |
| Remove a scope | Issued without that scope. | Keep the scope until they expire. |

An access token lasts up to an hour and cannot be taken back. Whatever you do to a service account, a token it already has keeps working until it expires. Allow for that hour when you respond to a leak.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.