# writeCacheEntry

```graphql
mutation WriteCacheEntry($projectReference: String!, $key: String!, $input: WriteCacheEntryInput!) {
  writeCacheEntry(projectReference: $projectReference, key: $key, input: $input) {
    key
    expiresAt
  }
}
```

Create or replace one cache entry, as REST PUT /projects/{project\_reference}/cache/entries/{key}. Requires project.cache.write.

## Arguments

| Name               | Type                  | Required | Description                                                                                   |
| ------------------ | --------------------- | -------- | --------------------------------------------------------------------------------------------- |
| `projectReference` | String!               | Yes      | Project UUID or slug.                                                                         |
| `key`              | String!               | Yes      | Cache key, 1 to 512 characters.                                                               |
| `input`            | WriteCacheEntryInput! | Yes      |                                                                                               |
| `input.value`      | String!               | Yes      | UTF-8 string value. Values over 1 KB are stored compressed.                                   |
| `input.ttlSeconds` | Int                   |          | Seconds until the entry expires, 1 to 86400. Defaults to 300; the previous TTL is never kept. |

## Variables

```json
{
  "projectReference": "string",
  "key": "a",
  "input": {
    "value": "string"
  }
}
```

## Responses

| Status | Description                                     |
| ------ | ----------------------------------------------- |
| 200    | The CacheEntrySummary! in data.writeCacheEntry. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation WriteCacheEntry($projectReference: String!, $key: String!, $input: WriteCacheEntryInput!) {\n  writeCacheEntry(projectReference: $projectReference, key: $key, input: $input) {\n    key\n    expiresAt\n  }\n}",
  "variables": {
    "projectReference": "string",
    "key": "a",
    "input": {
      "value": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "writeCacheEntry": {
      "key": "string",
      "expiresAt": "2026-01-01T00:00:00Z"
    }
  }
}
```
