> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/how-to-guides/rotate-a-provider-key.md).

# Rotate a provider key

Replace a provider credential without breaking active workloads.

Rotate a provider key by adding its replacement first. Keep the existing key active until requests succeed with the new credential.

{% hint style="info" %}
Provider keys are resolved at request time. Your application's API Keys do not need changes during rotation.
{% endhint %}

***

### When to rotate a provider key <a href="#h_6093af7c9d" id="h_6093af7c9d"></a>

* A provider key has been compromised, or you suspect it has.
* Your organization has a periodic key rotation policy.
* You're migrating traffic to a new provider account.

***

### Rotate the key

1. Create a new API key in your provider's dashboard. Do not revoke the existing key yet.
2. In otari.ai, select **Organization** and then **Providers**.
3. Click **Add provider key**. Select the same provider, enter a distinct **Key Name**, and paste the new API key.
4. Set the new key as the provider's default by clicking its **star icon**.
5. For each workspace that pins the old key, click **Edit** and select **Always use this key** for the new key.
6. Send a test request from each affected workspace. Confirm it completes successfully in the **Usage** tab.

***

### Remove the old key

Once requests are flowing through the new key, revoke the old key in the upstream provider dashboard.

1. Return to **Organization** → **Providers** in Otari.
2. Remove the old provider key.

{% hint style="warning" %}
Update every workspace that pins the old key before revoking it. A workspace can continue using a pinned key even after you change the organization default.
{% endhint %}

If you suspect compromise, create and assign the replacement immediately. Then revoke the exposed key with the provider.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/how-to-guides/rotate-a-provider-key.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
