---
title: "Update Gemini cached content"
method: PATCH
path: "/v1beta/cachedContents/{cacheId}"
tags: ["Gemini Resources"]
---

# Update Gemini cached content

`PATCH /v1beta/cachedContents/{cacheId}`

## Request

- Base URL: `https://api.tokenlab.sh`
- URL: `https://api.tokenlab.sh/v1beta/cachedContents/{cacheId}`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-goog-api-key`

Updates the cache lifetime. Invalid lifetime or unsupported fields return a Gemini-format error. Resources can only be read, referenced, changed, or deleted in their owning Workspace. Missing, expired, or inaccessible resources return a Gemini-format error.

## Path parameters

- `cacheId` string, required

## Query parameters

- `key` string
- `updateMask` string

## Request body

- GeminiCachedContentUpdateRequest: Update cached content lifetime using the fields accepted by the service.
  - `ttl` string: Positive duration such as 3600s.
  - `expireTime` string, date-time

## Response `200`

Success

- GeminiCachedContentResource: Cached content belonging to the current Workspace. Use the returned name as cachedContent in Gemini generation.
  - `name` string: Resource name such as cachedContents/{cacheId}.
  - `model` string: TokenLab model ID associated with the cached content.
  - `displayName` string: Human-readable cache name.
  - `createTime` string, date-time
  - `updateTime` string, date-time
  - `expireTime` string, date-time
  - `usageMetadata` object

## Other responses

- `400`: Gemini-format resource error
- `401`: Gemini-format resource error
- `403`: Gemini-format resource error
- `404`: Gemini-format resource error
- `409`: Gemini-format resource error
- `429`: Gemini-format resource error
- `502`: Gemini-format resource error
- `503`: Gemini-format resource error

---

[API](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway.md) · [All operations](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway/revisions/3208bfbcda22?raw)
