> ## 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

> 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.
</Note>

## Prerequisites

* Create a [Fireworks Connection](/integrations/app-connections/fireworks) 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

<Steps>
  <Step title="Navigate to Settings">
    In your [Fireworks AI account](https://fireworks.ai/), click **Settings** in the left sidebar.

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/app-connections/fireworks/settings.png" alt="Fireworks Settings" />
  </Step>

  <Step title="Navigate to Users & Access">
    In the Settings sidebar, click **Users & Access**.

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/users-and-access.png" alt="Fireworks Users & Access" />
  </Step>

  <Step title="Add a Service Account">
    Click **+ Add** and select **Service Account** from the dropdown.

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/add-service-account.png" alt="Add Service Account" />
  </Step>

  <Step title="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.

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/service-account-id.png" alt="Service Account ID" />
  </Step>
</Steps>

## Create a Fireworks API Key Rotation in Infisical

<Tabs>
  <Tab title="Infisical UI">
    1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/generic/add-secret-rotation.png" alt="Secret Manager Dashboard" />

    2. Select the **Fireworks Secret** option.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/select-fireworks-api-key.png" alt="Select Fireworks Secret" />

    3. Configure the rotation behavior, then click **Next**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/configuration.png" alt="Rotation Configuration" />

    * **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.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/parameters.png" alt="Rotation Parameters" />

    * **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**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/secrets-mapping.png" alt="Rotation Secrets Mapping" />

    * **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**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/details.png" alt="Rotation Details" />

    * **Name** -- A slug-friendly name for this rotation configuration.
    * **Description** (optional) -- Notes about this rotation.

    7. Review your configuration, then click **Create Secret Rotation**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical/images/secret-rotations-v2/fireworks-api-key/review.png" alt="Rotation Review" />
  </Tab>

  <Tab title="API">
    To create a Fireworks API Key rotation, call the [Create Fireworks API Key Rotation](/api-reference/endpoints/secret-rotations/fireworks-api-key/create) 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>"
        }
      }
    }
    ```
  </Tab>
</Tabs>
