---
title: "POST /api/v2/secret-rotations/litellm-api-key"
method: POST
path: "/api/v2/secret-rotations/litellm-api-key"
tags: ["Secret Rotations"]
---

# POST /api/v2/secret-rotations/litellm-api-key

`POST /api/v2/secret-rotations/litellm-api-key`

Create a LiteLLM API Key Rotation for the specified project.

## Request body

- object
  - `name` string, required — The name of the LiteLLM API Key Rotation to create. Must be slug-friendly.
  - `projectId` string, required — The ID of the project to create the rotation in.
  - `description` string, nullable — An optional description for the LiteLLM API Key Rotation.
  - `connectionId` string, uuid, required — The ID of the LiteLLM Connection to use for rotation.
  - `environment` string, required — The slug of the project environment to create the rotation in.
  - `secretPath` string, required — The secret path of the project to create the rotation in.
  - `isAutoRotationEnabled` boolean — Whether secrets should be automatically rotated when the specified rotation interval has elapsed.
  - `rotationInterval` number, required — The interval, in days, to automatically rotate secrets.
  - `rotateAtUtc` object — The hours and minutes rotation should occur at in UTC. Defaults to Midnight (00:00) UTC.
    - `hours` number, required
    - `minutes` number, required
  - `parameters` object, required
    - `name` string, required — The name for the generated LiteLLM API key. Infisical appends a timestamp to keep each rotated key unique and record its creation time.
    - `additionalOptions` string — A JSON object of additional LiteLLM /key/generate options (e.g. max_budget, tpm_limit, metadata). Reserved fields (key_alias, auto_rotate, rotation_interval, duration, send_invite_email, key_type, user_id, team_id, models) are managed by Infisical or set via dedicated fields and cannot be set here.
    - `userId` string — The ID of the LiteLLM user to associate the generated key with.
    - `teamId` string — The ID of the LiteLLM team to associate the generated key with.
    - `models` string[] — The list of model names the generated key is allowed to access. An empty list allows all models.
  - `secretsMapping` object, required
    - `apiKey` string, required — The name of the secret that the rotated LiteLLM API key will be mapped to.

## Response `200`

Default Response

- object
  - `secretRotation` object, required
    - `id` string, uuid, required
    - `name` string, required
    - `description` string, nullable
    - `isAutoRotationEnabled` boolean
    - `activeIndex` number
    - `folderId` string, uuid, required
    - `connectionId` string, uuid, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
    - `rotationInterval` number, required
    - `rotationStatus` string, required
    - `lastRotationAttemptedAt` string, date-time, required
    - `lastRotatedAt` string, date-time, required
    - `lastRotationJobId` string, nullable
    - `nextRotationAt` string, date-time, nullable
    - `isLastRotationManual` boolean
    - `connection` object, required
      - `app` 'litellm', required
      - `name` string, required
      - `id` string, uuid, required
    - `environment` object, required
      - `slug` string, required
      - `name` string, required
      - `id` string, uuid, required
    - `projectId` string, required
    - `folder` object, required
      - `id` string, required
      - `path` string, required
    - `rotateAtUtc` object, required
      - `hours` number, required
      - `minutes` number, required
    - `lastRotationMessage` string, nullable
    - `type` 'litellm-api-key', required
    - `parameters` object, required
      - `name` string, required — The name for the generated LiteLLM API key. Infisical appends a timestamp to keep each rotated key unique and record its creation time.
      - `additionalOptions` string — A JSON object of additional LiteLLM /key/generate options (e.g. max_budget, tpm_limit, metadata). Reserved fields (key_alias, auto_rotate, rotation_interval, duration, send_invite_email, key_type, user_id, team_id, models) are managed by Infisical or set via dedicated fields and cannot be set here.
      - `userId` string — The ID of the LiteLLM user to associate the generated key with.
      - `teamId` string — The ID of the LiteLLM team to associate the generated key with.
      - `models` string[] — The list of model names the generated key is allowed to access. An empty list allows all models.
    - `secretsMapping` object, required
      - `apiKey` string, required — The name of the secret that the rotated LiteLLM API key will be mapped to.

## Other responses

- `400` — Default Response
- `401` — Default Response
- `403` — Default Response
- `404` — Default Response
- `422` — Default Response
- `500` — Default Response

---

[API](https://skmtc.net/infisical/apis/infisical-api.md) · [All operations](https://skmtc.net/infisical/apis/infisical-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/infisical/infisical-api/versions/885aef3e6c11/schema)
