> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Automatic Persisted Queries

You can use this feature to double the `8kb` limit on the query size to `16kb` if you are a customer on our Premium plan and above, plus to cache the query in Contentful to decrease the payload delivered through the network.

* First, you have to send the query and a `sha256Hash` value of that query:

```bash
curl --location --request POST 'https://graphql.contentful.com/content/v1/spaces/{SPACE}/environments/{ENVIRONMENT}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "{__typename}",
    "extensions": { "persistedQuery": { "sha256Hash": "ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38", "version": 1 } }
}'
```

* Then, you can only send the hash to execute the cached query:

```bash
curl --location --request POST 'https://graphql.contentful.com/content/v1/spaces/{SPACE}/environments/{ENVIRONMENT}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "extensions": { "persistedQuery": { "sha256Hash": "ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38", "version": 1 } }
}'
```

> **Info**
>
> **Note:** If you sent a wrong hash you will get a `PersistedQueryMismatch` error. If you sent a hash without caching the query first, you will get a `PersistedQueryNotFound` error.