Compatibility and upgrade policy
What this is. What a client of the headless features may rely on across Exponential releases, what may change, how changes are announced and phased out, which PHP and Exponential versions are supported, and how to upgrade an installation (and its clients) safely.
When to use it. Before you build on a field, a header or an event field you want to rely on for years; before every upgrade of the kernel, the library or the SDK; when you maintain the kernel and are about to change something clients see.
Quick example: the checks to run before and after an upgrade.
./console exp:graphql:status --siteaccess=site # library, limits, schema hash
./console exp:graphql:schema --siteaccess=site --output=var/tmp/schema-before.graphql
# ... upgrade ...
./console exp:graphql:schema --siteaccess=site --output=var/tmp/schema-after.graphql
diff var/tmp/schema-before.graphql var/tmp/schema-after.graphql
./console exp:graphql:persist queries/ # every stored query still fits the schema (stores nothing)Contents
- The contract
- What may change
- Versioning
- Deprecations
- Supported versions
- The schema of your installation is yours
- Upgrading safely
- Upgrading clients and the SDK
- The history of the headless features
The contract
These are stable: they keep their name, type and meaning in every later release, and are only ever added to.
| Surface | Stable |
|---|---|
| End points | /api/graphql, /api/graphql/subscribe, /graphql/query; GET and POST; the request formats (JSON, application/graphql, form, multipart) |
| Error codes | every extensions.code once released (PARSE, VALIDATION, BAD_USER_INPUT, DEPTH_LIMIT, COMPLEXITY_LIMIT, INTROSPECTION_DISABLED, RATE_LIMITED, DISABLED, INTERNAL, FORBIDDEN, NOT_FOUND, PERSISTED_QUERY_NOT_FOUND, PERSISTED_QUERY_NOT_SUPPORTED, PERSISTED_QUERY_REQUIRED, SUBSCRIPTION_LIMIT); the rule is written at the constants in expGraphQLError: a code once released stays |
| Kernel types and fields | the root queries, Content, Location, ContentConnection, PageInfo, the value types of datatypes, ContentPayload, MutationStatus, ContentEvent and their fields and arguments |
| Headers | X-Request-Id, X-GraphQL-Schema, X-GraphQL-Cache, X-Exponential-Cache-Tags, X-RateLimit-*, Retry-After, ETag |
| Cache tag vocabulary | ez-all, c, ct, s, l, pl, p, dq (shared with the kernel's HTTP cache) |
| Webhooks | the body's shape (data.contentEvent, extensions with schema: "exp-graphql-webhook/1"), the headers, the signature (sha256= HMAC of timestamp.body), the 300 s tolerance |
| Event kinds and fields | publish, update, trash, delete, move, hide, reveal, mutation, clear, ping; the fields of the event record; the journal line format "v": 1 |
| Keys | the format expk_<12>_<40>, the header Authorization: Bearer, the scopes graphql:read and graphql:write |
| Preview tokens | the prefix exp1. (a new format gets a new prefix; old tokens simply expire) |
| SSE | graphql-sse "distinct connections", event: next/complete, positions as id: |
| Console commands | the names exp:graphql:* and their documented options; --apply as the only way to write |
| Settings | the names in graphql.ini, the [ApiKeySettings] and [CorsSettings] of rest.ini, and their meanings |
Messages are not part of the contract. Error messages are translated and may be reworded; decide by
extensions.code.
What may change
| Change | Allowed in | Clients must |
|---|---|---|
| a new root query, field, argument with a default, type, enum value, header, event field, error code | any release | ignore what they do not know (unknown enum values and event kinds included) |
| a new event kind of the kernel | any release, only delivered to receivers that name it (as clear was) | nothing |
| a default value of a setting, a limit | a release, with a note in the changelog | not depend on defaults; set what they rely on |
new datatype mappings (a datatype that was a String gets a type of its own) | a release, announced | regenerate types; the schema hash changes |
| a deprecated field or argument removed | only after its deprecation period (below) | move away while it is deprecated |
| a change of meaning or type of a stable field | never; a new field is added instead | |
| security fixes that refuse what was wrongly allowed | any release, as needed | handle the documented refusal |
Clients that follow these rules (ignore unknowns, decide by codes, regenerate types on a new schema hash) survive every release.
Versioning
- Exponential releases are numbered
6.0.<n>on the current line; the headless features arrived with 6.0.15. Releases are tags on the kernel repository and versions on Packagist; a published version is never changed: a mistake is fixed by the next version. - The schema of an installation has no version number; its identity is the schema hash (12 hexadecimal
characters,
X-GraphQL-Schema,extensions.schemaHash,siteaccess { schemaHash }). It changes when a content class or attribute, the naming, a schema setting or a schema extension changes, and with kernel releases that add to the schema. - Wire formats carry their own versions: the webhook body
exp-graphql-webhook/1, the journal line"v": 1, preview tokensexp1., the webhookUser-AgentExponential-GraphQL-Webhooks/1. A version is raised only for an incompatible change, and the old one stays readable for at least one release line. - Schema extensions report a version in
exp:graphql:status(eztags/1,explayouts/1); a raise means their part of the schema changed. - The SDK (
@exponentialcms/*) follows semantic versioning: a major version for breaking changes of its API; each package states the kernel features it needs.
Deprecations
This is the rule for maintainers of the kernel (see the Maintainer guide); as of 6.0.15 no field, argument or setting of the headless features is deprecated.
- A field or argument to be removed is first marked
@deprecated(reason: "...")in the schema (introspection shows it; code generators warn), named in the changelog of the release, and kept for at least two releases and twelve months, whichever is longer. - A setting to be removed is still read for the same period, and the changelog says so.
- An event field is never removed from the version-1 formats; a replacement is added beside it.
- An error code is never removed.
Your code generator (@exponentialcms/codegen, graphql-codegen) shows deprecated fields your queries use.
Supported versions
| Component | Supported |
|---|---|
| Exponential | 6.0.15 and later on the 6.0 line (the headless features do not exist before 6.0.15) |
| PHP | the kernel's composer.json accepts PHP 7.4 and every 8.x; the continuous integration runs the test suites on PHP 8.1 to 8.5 and checks the syntax of every file with PHP 8.0 and 7.4. Recommended for production: PHP 8.3 or later |
| GraphQL library | webonyx/graphql-php 15 (^15.32.3); version 14 and older are refused (exp:graphql:status says so) |
| Databases | every database the kernel supports (MySQL/MariaDB, PostgreSQL, SQLite, Oracle, MongoDB); the API has no tables of its own except the keys (expapikey) |
| Web servers | Apache or nginx with PHP-FPM, LiteSpeed, Velocity; WebSocket subscriptions need Velocity |
| Search | the kernel's search engine; Solr through ezfind (facets) |
| Browsers (SDK) | those with fetch, ReadableStream and Web Crypto |
| Node.js (SDK) | 20 and later; also Deno, Bun, Cloudflare Workers and other edge runtimes |
Never drop the newest PHP: a release supports the newest PHP version available when it is made.
The schema of your installation is yours
The kernel's part of the schema follows the contract above. The class types are generated from your content classes, so your editors and developers change them:
| Your change | Effect on clients |
|---|---|
| a new class or attribute | added to the schema; nothing breaks |
| an attribute removed or renamed | its field disappears: queries that ask for it fail with VALIDATION |
| a class identifier renamed | its type is renamed: inline fragments on the old name fail |
| a datatype changed | the field's type changes |
NamingStyle changed | every class type and field is renamed |
a class added to ExcludedClassList[], a field to HiddenFieldList[] | removed from the schema |
Treat your content model like a public API: add rather than rename; when you must rename, add the new attribute,
migrate the data, keep the old one hidden for a while (HiddenFieldList[] hides it from the API at once; delete it
later), and tell the client teams. Check every stored query before you publish a class change:
./console exp:graphql:persist queries/ (no --apply) exits 1 when one no longer fits.
Upgrading safely
Before.
- Read the changelogs between your version and the target (
doc/changelogs/6.0/), and the upgrade notes of the headless features (doc/eng-us/bc/6.0/: api-keys, rest-cors, request-shield). - Save the current state:
exp:graphql:status --format=json, the schema of each siteaccess (exp:graphql:schema --output=...),exp:graphql:persist --list --format=json,exp:graphql:keys --list --format=json,exp:graphql:webhooks --format=json. - Back up the database and
var/<site>/graphql/persisted/, the settings overrides and the secret store. - Let the webhook outbox drain (
exp:graphql:webhooks --deliver --applyuntil nothing waits), or accept that it is sent after the upgrade.
During.
- Upgrade on a staging copy first. Run the kernel's upgrade steps (the upgrade guide,
exp:upgrade:*, the database updates; the tableexpapikeycomes with 6.0.15). - Keep
webonyx/graphql-phpwithin^15(Composer does, from the kernel'scomposer.json). - Regenerate autoloads, clear the INI, template and content caches, reload PHP-FPM, restart Velocity
(
exp:velocity deploydoes all of it).
After.
exp:graphql:statusmustPASS; compare the schema with the saved one (diff): additions are fine; a removed field is a break you must handle before clients see it.exp:graphql:persist queries/(without--apply) against the new schema; store them again if the deployment does (--apply).- Run the client's contract tests against staging (the SDK:
EXPONENTIAL_CONTRACT_URL=https://staging... npm run test:contract). exp:graphql:webhooks --test=<name> --applyfor each end point.- Watch the error log and the rate of
INTERNALfor a day.
Rolling back. The API keeps no state that a rollback breaks: the journal and outbox files stay readable (format version 1), keys are in the database you restore. Clients see the old schema hash again; generated types made for the new one may need the old ones back.
Upgrading clients and the SDK
- Pin the SDK with a caret (
^1.0.0) and read its changelog before a major version. - Regenerate types (
@exponentialcms/codegen) wheneverX-GraphQL-Schemachanges; let your build fail when the hash differs from the one the types were made for. - Keep queries in
.graphqlfiles and persist them on every deploy of the front end (exp:graphql:persist --applyas a deploy step), so the server checks them against its schema before traffic arrives. - Test receivers with a
ping(--test) after every change of either side.
The history of the headless features
| Release | Added |
|---|---|
| 6.0.15 | the GraphQL API (/api/graphql, schema from content classes, persisted queries, response cache with early answer, cache tags, rate limits), mutations (create, update, translate, publish drafts, delete, move, hide, reveal, locations, sections, object states, restore, uploads, preview tokens), the event journal, signed webhooks with retries and job-queue delivery, subscriptions over SSE and WebSocket, event kinds of packages, personal API keys with scopes, keys limited to siteaccesses, public read keys, CORS for the REST layer, the request shield |
Later releases list their additions in their changelogs; this table is extended with each.
Related pages
- Start here and glossary · Operations · Maintainer guide
- Upgrading · The feature page: The GraphQL API