# Write cache entry

```http
PUT /projects/{project_reference}/cache/entries/{key}
```

Creates or replaces one cache entry. ttl\_seconds defaults to 300. Requires project.cache.write.

## Parameters

| Name                | In   | Required | Description                                                                                                                         |
| ------------------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `project_reference` | path | Yes      | Project slug, UUID, or domain that identifies the project.                                                                          |
| `key`               | path | Yes      | Cache key, 1 to 512 characters: letters, digits, underscore, colon, dot, hyphen and slash. No "." or ".." segments between slashes. |

## Request body

| Field         | Type    | Required | Description                                                                                                |
| ------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `value`       | string  | Yes      | UTF-8 string value. Values over 1 KB are stored compressed.                                                |
| `ttl_seconds` | integer |          | Seconds until the entry expires, 1 to 86400. Defaults to 300 when omitted; the previous TTL is never kept. |

## Responses

| Status | Description        |
| ------ | ------------------ |
| 200    | The written entry. |
| 400    | Bad request        |
| 401    | Unauthorized       |
| 403    | Forbidden          |
| 404    | Not found          |
| 413    | Payload too large  |
| 500    | Server error       |
