---
title: "Update a cached response"
method: PATCH
path: "/api/caches/{cache_key}/"
tags: ["Caches"]
---

# Update a cached response

`PATCH /api/caches/{cache_key}/`

## Request

- Base URL: `https://api.respan.ai`
- URL: `https://api.respan.ai/api/caches/{cache_key}/`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Update the expiry date of a cached response identified by its public cache key. An entry that has already expired returns 404 and cannot be revived.

## Path parameters

- `cache_key` string, required

## Request body

- object
  - `expiry_date` string, date-time, nullable: New expiry time. Setting `null` or a past time makes the entry unservable: it is no longer served or listed, and later reads and updates return 404. It can still be deleted.

## Response `200`

Updated cached response.

- object
  - `id` integer: Internal numeric ID. Present only for dashboard-JWT responses.
  - `cache_key` string, required: Organization-scoped public cache key.
  - `prompt_content` string, required: Prompt text extracted from the cached request.
  - `response_content` string, required: Response text extracted from the cached response.
  - `request_content` string: Stored request text preview. The current backend serializer truncates this field to roughly the first 100 characters.
  - `prompt_messages` object[]: Original prompt message array stored with the cache entry.
  - `full_response` object: Full cached provider response object.
  - `hit_count` integer, required: Live cache hit count enriched from ClickHouse.
  - `response_time` number: Stored response time for the cached entry, in seconds.
  - `timestamp` string, date-time, required: When the cache entry was created.
  - `updated_at` string, date-time, required: When the cache entry was last updated.
  - `expiry_date` string, date-time, nullable: When the cache entry expires.

## Other responses

- `400`: Invalid update.
- `403`: The API key is missing, invalid or expired, or it can't update cached responses.
- `404`: Cached response not found.

## Changes

- **2026-10-21** `c30bcb383ee8`: 3 breaking, 5 info
  - request body became required
  - the response property `expiry_date` became nullable for the status `200`
  - the `response_time` response's property format changed from `double` to no format for status `200`
  - api operation id `caches_api_caches_partial_update_2` removed and replaced with `api_caches_partial_update_2`
  - …4 more
- **2026-10-02** `b830b79cfd52`: 3 info
  - removed the non-success response with the status `401`
  - added the required property `detail` to the response with the `403` status
  - added the required property `detail` to the response with the `404` status
- **2026-09-17** `6fa8242da8c2`: 1 warning, 1 info
  - deleted the `header` request parameter `Authorization`
  - the endpoint scheme security `RespanApiKey` was added to the API
- **2026-09-12** `22b868ef3f22`: 1 info
  - api operation id `api-caches-partial-update-2` removed and replaced with `caches_api_caches_partial_update_2`

[Operation history](https://skmtc.dev/respan/apis/respan-api/changes/api/caches/:cache_key/patch.md)

---

[API](https://skmtc.dev/respan/apis/respan-api.md) - [All operations](https://skmtc.dev/respan/apis/respan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/respan/apis/respan-api/revisions/900841387635?raw)
