> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Write cache entry

> Create or replace one cache entry, as REST PUT /projects/{project_reference}/cache/entries/{key}.

`writeCacheEntry(projectReference: String!, key: String!, input: WriteCacheEntryInput!): CacheEntrySummary!`

Requires project.cache.write.

## Arguments

| Argument | Type | Required | Description |
| - | - | - | - |
| `projectReference` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Project UUID or slug. |
| `key` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Cache key, 1 to 512 characters. |
| `input` | [`WriteCacheEntryInput!`](https://veryfront.com/docs/cloud/graphql/types/writecacheentryinput) | Yes | |

## Input fields

### input

[`WriteCacheEntryInput`](https://veryfront.com/docs/cloud/graphql/types/writecacheentryinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `value` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | UTF-8 string value. Values over 1 KB are stored compressed. |
| `ttlSeconds` | [`Int`](https://veryfront.com/docs/cloud/graphql/types/int) | No | Seconds until the entry expires, 1 to 86400. Defaults to 300; the previous TTL is never kept. |

## Response

Returns [`CacheEntrySummary!`](https://veryfront.com/docs/cloud/graphql/types/cacheentrysummary). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `key` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Cache key. |
| `expiresAt` | [`DateTime`](https://veryfront.com/docs/cloud/graphql/types/datetime) | Time the entry expires; null for an entry written through the legacy no-expiry path (ttl=0). |

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
mutation WriteCacheEntry($projectReference: String!, $key: String!, $input: WriteCacheEntryInput!) {
  writeCacheEntry(projectReference: $projectReference, key: $key, input: $input) {
    expiresAt
    key
  }
}
```

```json title="variables.json" theme={null}
{
  "projectReference": "00000000-0000-4000-8000-000000000001",
  "key": "example",
  "input": {
    "value": "example"
  }
}
```

<details>
  <summary>Try this mutation</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Mutation

  Variables (JSON)
</details>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.