> This page location: /docs.md > /docs/management.md > /docs/atlas/api.md > /docs/atlas/api/atlas-admin-api.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: ui, apikey
-->

# Rotate Service Account Secrets

Service account secrets expire after the duration specified [when created](https://www.mongodb.com/docs/atlas/configure-api-access.md#std-label-see-org-api-keys), anywhere from 8 hours to 365 days. When it's time to rotate the secret, Atlas returns the alert `Service Account Secrets are about to expire`.

**Note:**

By default, this alert applies only to organization-level service account secrets. To receive alerts when project-level service account secrets expire or are about to expire, [configure service account alerts](https://www.mongodb.com/docs/atlas/configure-alerts.md#std-label-configure-alerts) for each project.

**Important:**

If a project-level service account has access to the organization or to other projects, you must have the [`Organization Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner) role to manage its lifecycle, including rotating or revoking its secrets.

To rotate your service account secret, complete the following steps to generate a new client secret, update your application with the new client secret, and delete the old secret.

### Atlas UI

You can generate a new client secret and delete the old one using the Atlas UI.

1. In Atlas, go to the Applications page.

   If it's not already displayed, select your desired organization from the  Organizations menu in the navigation bar.

   Click Applications in the sidebar under the Identity & Access section.

   The [Applications](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Faccess%2FserviceAccounts) page displays.

2. Click the Applications tab.

3. Click Service Accounts.

4. Click the name of a service account.

5. Generate a new client secret.

   Click Generate New Client Secret

   Choose a duration for the client secret from the menu. The client secret expires after this duration.

   Click Generate New.

   Click Copy and save the client secret to a secure location. This is the only time you can view the full client secret.

   Click Close.

6. Update your application with the new client secret.

   **Important:**

   Once you generate a new client secret, the old client secret expires within 7 days. This expiration period can be shorter depending on the old secret's original expiration date.

   - If the old secret is set to expire more than 7 days after the new one is created, its expiration is shortened to 7 days from the new secret's creation date.

   - If the old secret is set to expire in less than 7 days from the new one's creation date, the original expiration date is maintained.

   To avoid losing access to the Atlas Administration API, update your application with the new client secret as soon as possible.

7. Delete the old client secret.

   In the Atlas UI for your service account, click Revoke.

   Confirm you want to delete the secret by typing the prompt in the field, then click Revoke Secret.
