---
title: "Bulk Update Keys"
method: POST
path: "/key/bulk_update"
tags: ["key management"]
---

# Bulk Update Keys

`POST /key/bulk_update`

Bulk update multiple keys at once.

This endpoint allows updating multiple keys in a single request. Each key update
is processed independently - if some updates fail, others will still succeed.

Parameters:
- keys: List[BulkUpdateKeyRequestItem] - List of key update requests, each containing:
    - key: str - The key identifier (token) to update
    - budget_id: Optional[str] - Budget ID associated with the key
    - max_budget: Optional[float] - Max budget for key
    - team_id: Optional[str] - Team ID associated with key
    - tags: Optional[List[str]] - Tags for organizing keys

Returns:
- total_requested: int - Total number of keys requested for update
- successful_updates: List[SuccessfulKeyUpdate] - List of successfully updated keys with their updated info
- failed_updates: List[FailedKeyUpdate] - List of failed updates with key_info and failed_reason

Example request:
```bash
curl --location 'http://0.0.0.0:4000/key/bulk_update'     --header 'Authorization: Bearer sk-1234'     --header 'Content-Type: application/json'     --data '{
    "keys": [
        {
            "key": "sk-1234",
            "max_budget": 100.0,
            "team_id": "team-123",
            "tags": ["production", "api"]
        },
        {
            "key": "sk-5678",
            "budget_id": "budget-456",
            "tags": ["staging"]
        }
    ]
}'
```

## Headers

- `litellm-changed-by` string, nullable — The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability

## Request body

- BulkUpdateKeyRequest — Request for bulk key updates
  - `keys` BulkUpdateKeyRequestItem[], required
    - `key` string, required
    - `budget_id` string, nullable
    - `max_budget` number, nullable
    - `team_id` string, nullable
    - `tags` string[], nullable

## Response `200`

Successful Response

- BulkUpdateKeyResponse — Response for bulk key update operations
  - `total_requested` integer, required
  - `successful_updates` SuccessfulKeyUpdate[], required
    - `key` string, required
    - `key_info` object, required
  - `failed_updates` FailedKeyUpdate[], required
    - `key` string, required
    - `key_info` object, nullable
    - `failed_reason` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/flock/apis/litellm-api.md) · [All operations](https://skmtc.net/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flock/litellm-api/revisions/8fbaab4fc7c5/schema)
