Update cache expiration

PATCH/v1/cachedContents/{id}

Update a cache’s expiration. Other fields cannot be changed.

/v1 is the default version; equivalent /v1beta paths remain supported.

Authentication

Send your Token360 API key in x-goog-api-key.

Path Parameters

idstringrequired

The ID segment of the name returned at creation. Treat it as opaque.

Query Parameters

updateMaskstring

Optional expiration mask: ttl, expireTime, or expire_time. Use the mask matching the supplied expiration field.

Request Body

ttlstring

New lifetime in seconds, greater than zero and at most 86400s. Mutually exclusive with expireTime.

expireTimestring

New future RFC3339 expiration timestamp, at most 24 hours from now. Mutually exclusive with ttl.

Supply exactly one expiration field. ttl is measured from the update request, not added to the previous expiration. Renew before the cache expires; updating cannot recreate expired content.

Response

namestring

Cache resource name: cachedContents/{id}. Save it for subsequent operations.

modelstring

Model name in models/{model} form.

displayNamestring

Display label, when returned.

createTimestring

Creation timestamp (RFC3339), when returned.

updateTimestring

Last update timestamp (RFC3339), when returned.

expireTimestring

Expiration timestamp (RFC3339), when returned.

usageMetadataobject

Cache usage information, when returned.

usageMetadata.totalTokenCountinteger

Number of cached tokens, when returned.

Requires content-retention permission. A concurrent update or a cache unavailable for this operation returns 409. After an uncertain update outcome, retrieve the cache metadata before deciding whether another update is needed.

Solicitar

Shell
1CACHE_NAME='cachedContents/0123456789abcdef0123456789abcdef'
2curl --fail-with-body -X PATCH "https://api.token360.ai/v1/$CACHE_NAME?updateMask=ttl" \
3  -H "x-goog-api-key: $TOKEN360_API_KEY" \
4  -H 'Content-Type: application/json' \
5  -d '{"ttl":"7200s"}'

Respuesta

JSON
1{
2  "name": "cachedContents/0123456789abcdef0123456789abcdef",
3  "model": "models/gemini-2.5-flash",
4  "displayName": "Reference document",
5  "createTime": "2026-11-06T10:00:00Z",
6  "updateTime": "2026-11-06T10:30:00Z",
7  "expireTime": "2026-11-06T12:30:00Z",
8  "usageMetadata": {
9    "totalTokenCount": 4096
10  }
11}
¿Ha sido de ayuda?
Update cache expiration · Token360