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

# Fireworks API key rotation

> Learn how to automatically rotate Fireworks AI API keys.

> [!NOTE]
>
> **Rotation Type: Dual-Phase**
>
> This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.

## Prerequisites

* Create a [Fireworks Connection](https://infisical.com/docs/integrations/app-connections/fireworks.md) using an **API Key** and **Account ID**. That connection is used to create and delete API keys on your behalf during rotation.
* A **Fireworks Service Account** whose API keys will be rotated. See [Create a Fireworks Service Account](#create-a-fireworks-service-account) below.

## Create a Fireworks service account

**1. Navigate to Settings**

In your [Fireworks AI account](https://fireworks.ai/), select **Settings** in the left sidebar.

![Fireworks Settings](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/fireworks/settings.png)

**2. Navigate to Users & Access**

In the Settings sidebar, click **Users & Access**.

![Fireworks Users & Access](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/users-and-access.png)

**3. Add a Service Account**

Click **+ Add** and select **Service Account** from the dropdown.

![Add Service Account](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/add-service-account.png)

**4. Configure the Service Account**

Enter a **Service Account ID** (lowercase letters, numbers, and hyphens only) and click **Add**. You will need this ID when configuring the rotation in Infisical.

![Service Account ID](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/service-account-id.png)

## Create a Fireworks API key rotation in Infisical

> [tab] Infisical UI
>
> 1. Navigate to your Secrets Management Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
>
>    ![Secrets Management Dashboard](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/generic/add-secret-rotation.png)
>
> 2. Select the **Fireworks Secret** option.
>
>    ![Select Fireworks Secret](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/select-fireworks-api-key.png)
>
> 3. Configure the rotation behavior, then click **Next**.
>
>    ![Rotation Configuration](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/configuration.png)
>
> * **Fireworks Connection** -- The connection (with an API key) that will create and delete API keys during rotation.
>
> * **Rotation Interval** -- The interval, in days, after which a rotation is triggered.
>
> * **Rotate At** -- The local time of day when rotation runs once the interval has elapsed.
>
> * **Auto-Rotation Enabled** -- Whether to rotate automatically on the interval. Turn off to rotate only manually or pause rotation.
>
> 4. Select the **Service Account** whose API keys will be rotated, then click **Next**. This is the service account you [created in Fireworks](#create-a-fireworks-service-account) earlier.
>
>    ![Rotation Parameters](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/parameters.png)
>
> * **Service Account** -- The Fireworks service account created in the prerequisites step above.
>
> 5. Specify the secret name that the rotated API key will be mapped to. Then click **Next**.
>
>    ![Rotation Secrets Mapping](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/secrets-mapping.png)
>
> * **API Key** -- The name of the secret in Infisical where the rotated API key value will be stored.
>
> 6. Give your rotation a name and description (optional). Then click **Next**.
>
>    ![Rotation Details](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/details.png)
>
> * **Name** -- A slug-friendly name for this rotation configuration.
>
> * **Description** (optional) -- Notes about this rotation.
>
> 7. Review your configuration, then click **Create Secret Rotation**.
>
>    ![Rotation Review](https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/review.png)

> [tab] API
>
> To create a Fireworks API Key rotation, call the [Create Fireworks API Key Rotation](https://infisical.com/docs/api-reference/endpoints/secret-rotations/fireworks-api-key/create.md) API endpoint.
>
> ### Sample request
>
> ```bash Request theme={"dark"}
> curl --request POST \
>   --url https://us.infisical.com/api/v2/secret-rotations/fireworks-api-key \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "name": "my-fireworks-rotation",
>     "projectId": "<project-id>",
>     "description": "Fireworks API key rotation",
>     "connectionId": "<fireworks-connection-id>",
>     "environment": "dev",
>     "secretPath": "/",
>     "isAutoRotationEnabled": true,
>     "rotationInterval": 30,
>     "rotateAtUtc": {
>       "hours": 0,
>       "minutes": 0
>     },
>     "parameters": {
>       "serviceAccountUserId": "<fireworks-user-id>"
>     },
>     "secretsMapping": {
>       "apiKey": "FIREWORKS_API_KEY"
>     }
>   }'
> ```
>
> ### Sample response
>
> ```bash Response theme={"dark"}
> {
>   "secretRotation": {
>     "id": "<rotation-id>",
>     "name": "my-fireworks-rotation",
>     "description": "Fireworks API key rotation",
>     "secretsMapping": {
>       "apiKey": "FIREWORKS_API_KEY"
>     },
>     "isAutoRotationEnabled": true,
>     "activeIndex": 0,
>     "connectionId": "<fireworks-connection-id>",
>     "rotationInterval": 30,
>     "rotateAtUtc": { "hours": 0, "minutes": 0 },
>     "type": "fireworks-api-key",
>     "parameters": {
>       "serviceAccountUserId": "<fireworks-user-id>"
>     }
>   }
> }
> ```


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