unstale

npm / @sanity/client

@sanity/client

What changed in @sanity/client 4 to 8, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-20.

27 breaking1 deprecations43 new APIs and options1 performance21 behavior and defaults4 tooling25 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@sanity/client 885 changes

Breaking changes 21

  • Context issues now have only the conflict and update_required kinds.

    8.12.0release notes

  • Each action addresses a variant document by the publishedId, variantId and bundleId triple rather than by document ID.

    8.2.0release notes

  • Adds variant action types to the Action union, so client.action() accepts them; exhaustive switches on Action['actionType'] must handle the new cases.

    8.1.0release notesrelease notes

  • DNS ENOTFOUND errors are retried for idempotent requests; set maxRetries to 0 to fail immediately.

    8.0.0release notes

  • Consumers must resolve the package through exports after the main and module package fields are removed.

    8.0.0release notes

  • Changes to this environment variable after process startup no longer affect requests.

    8.0.0release notes

  • This event type is removed; observable asset uploads now emit UploadEvent<T>.

    8.0.0release notes

  • The main package field is removed; consumers must resolve the package through exports.

    8.0.0release notes

  • The module package field is removed; consumers must resolve the package through exports.

    8.0.0release notes

  • Node 22.12 or higher is required to use the package.

    8.0.0release notes

  • Progress events are emitted only in browsers; Node and edge runtimes emit only the terminal response event.

    8.0.0release notes

  • The per-request proxy option is removed; configure proxy on the client or through proxy environment variables.

    8.0.0release notes

  • The client config option is removed; use headers configuration and a custom fetch instead.

    8.0.0release notes

  • The deprecated internal client config option is removed.

    8.0.0release notes

  • The RequestHandler type is removed.

    8.0.0release notes

  • The package is ESM-only and no longer ships CommonJS runtime or declaration files.

    8.0.0release notes

  • typesVersions declarations are removed; TypeScript moduleResolution must be node16, nodenext, or bundler.

    8.0.0release notes

  • The UMD bundle is removed from the distribution; use a bundler or a service such as esm.sh.

    8.0.0release notes

  • The unstable__adapter export is removed.

    8.0.0release notes

  • The unstable__environment export is removed.

    8.0.0release notes

  • Observable asset uploads now emit UploadEvent<T> instead of the removed event types.

    8.0.0release notes

Deprecations 1

  • range, top-level fieldValue, and range: null are deprecated; they are still accepted and sent as anchor.

    8.8.0release notes

New APIs and options 28

  • Context can check and draft instructions, and branch on typed API error codes.

    8.16.0release notes

  • Build stages publish their order and weight.

    8.15.0release notes

  • Knowledge bases, imports, and sources now report their source chunks.

    8.14.0release notes

  • MCP endpoint dataset sources now carry workspace, perspective, and semanticSearch.

    8.13.0release notes

  • Adds a reactive auth config option for credentials that change during the client's lifetime; requests and reconnects wait for pending credential renewal.

    8.12.0release notes

  • Resolves to the credential the client would send right now.

    8.12.0release notes

  • Emits the current credential and every change.

    8.12.0release notes

  • Adds support for Durable function callbacks.

    8.12.0release notes

  • Adds a type that reads params from the query's __groqParams brand.

    7.28.0, 8.11.0release notesrelease notes

  • Can create, edit, and delete endpoints.

    8.11.0release notes

  • Reads an endpoint by name.

    8.11.0release notes

  • Adds conversations.delete.

    8.10.0release notes

  • Comment create and update now accept a typed anchor with type "portable-text" and optional fieldValue.

    8.8.0release notes

  • Exported from @sanity/client/collaboration to build a collaboration comment's global document reference from a resource and document ID without a client.

    8.8.0release notes

  • Adds a per-resource projection registry with a document-type level because projections resolve against the caller's document handle.

    8.7.0release notes

  • Adds a per-resource query registry for consumers that perform resource-aware lookups.

    8.7.0release notes

  • Adds a per-resource schema registry so consumers can register different result types for resources whose schemas disagree.

    8.7.0release notes

  • Adds context APIs for knowledge bases, builds, triage, telemetry, and GROQ reads.

    8.4.0release notes

  • Supports status, importId, and ids filters.

    8.4.0release notes

  • Datasets now have a description field.

    8.4.0release notes

  • Invocation now accepts an options argument and supports durable and queue functions. Calls are queued by default and resolve with undefined once accepted; {sync: true} waits for a pubsub function to finish and returns its value.

    8.3.0release notes

  • Adds a collaboration comments client, marked alpha.

    8.2.0release notes

  • Invoke deployed sanity.function.pubsub functions by name; the promise-based form resolves with the function's return value.

    8.1.0release notes

  • Observable invocation emits the function result and accepts an event.data payload, a per-call timeout and an AbortSignal.

    8.1.0release notes

  • Exports the Media Library asset shape, which tracks uploaded versions via currentVersion and versions.

    8.1.0release notes

  • Reach stacks deployed at organization scope with a client config option; organizationId takes precedence over projectId, which becomes optional.

    8.1.0release notes

  • A request handler is available for client integrations.

    8.1.0release notes

  • Configure a stackId on the client to resolve function names, which are unique only within a stack; resolution costs one extra request per call.

    8.1.0release notes

Behavior and default changes 14

  • The Context API is called through one request typed from its spec.

    8.15.0release notes

  • Knowledge bases no longer have a document limit.

    8.15.0release notes

  • The comments API is promoted to beta.

    8.14.0release notes

  • Under reactive auth, config().token is undefined because config() describes what was configured; use client.getAuth() to read the credential the client sends.

    8.12.0release notes

  • Infers result and params types from a query branded with __groqResult and __groqParams, without a generic argument or SanityQueries entry; brand reading is experimental.

    7.28.0, 8.11.0release notesrelease notes

  • Follows the citation redesign.

    8.11.0release notes

  • Checks params from a query's __groqParams brand; brand reading is experimental.

    7.28.0, 8.11.0release notesrelease notes

  • instructions.delete can start a rebuild and returns its job.

    8.10.0release notes

  • The default filter denylist now includes mux video machine fields.

    8.10.0release notes

  • Comment writes now send clientVersion.

    8.8.0release notes

  • Debug output is dropped for browser uploads.

    8.4.0release notes

  • Error messages now include the HTTP status text.

    8.0.0release notes

  • A caller-provided internal config.resolveFetch takes precedence over the environment resolver.

    8.0.0release notes

  • Set maxRetries to 0 to fail immediately on DNS ENOTFOUND errors.

    8.0.0release notes

Tooling 4

  • Types each job's kind and result.

    8.11.0release notes

  • Types are updated with the latest Context API descriptions, helping developers use the current context API accurately.

    8.8.0release notesrelease notes

  • Use TypeScript moduleResolution set to node16, nodenext, or bundler.

    8.0.0release notes

  • Editor autocomplete is restored for its template literal patterns without changing assignability.

    8.0.0release notes

Fixes and other changes 17

  • Checks EventSource compatibility before using it.

    8.16.0release notes

  • Restores the context namespaces called by Sanity CLI 8.27, alongside request.

    8.15.1release notes

  • When retrying, treats a request with a body and no method as POST.

    8.15.1release notes

  • Supports Node.js stream bodies in Deno, workerd and react-server.

    8.15.1release notes

  • Fixes requests and asset uploads using Node.js streams in Bun, resolving “Unsupported body type: object” errors during Studio deployments.

    8.15.0release notes

  • Context API types now include the error body and every path parameter.

    8.10.0release notes

  • The underlying EventSource request is aborted when the response fails validation.

    8.7.0release notes

  • Requests are retried on React Native.

    8.7.0release notes

  • A nullish apiHost now uses the default host.

    8.4.0release notes

  • The DatasetsResponse type was updated.

    8.4.0release notes

  • Collaboration resolves a comment range from the optional fieldValue.

    8.3.0release notes

  • Uploads against a Media Library now resolve to the uploaded asset instead of undefined; Content Lake responses continue to unwrap document.

    8.1.0release notes

  • The /check/cors probe now uses the same resolved fetch as the EventSource connection, applying custom resolveFetch or an explicit proxy.

    8.1.0release notes

  • Without options, delete() now correctly types as resolving to MultipleMutationResult rather than SanityDocument<R>, matching unchanged runtime behavior.

    8.1.0release notes

  • Server-sent event IDs are now populated on Cloudflare Workers for client.live.events() and client.listen().

    8.1.0release notes

  • Without options, mutate() now correctly types as resolving to MultipleMutationResult rather than SanityDocument<R>, matching unchanged runtime behavior.

    8.1.0release notes

  • Editor autocomplete is restored for published and drafts without changing assignability.

    8.0.0release notes

@sanity/client 727 changes

Breaking changes 2

  • The resource guard was removed from the live client.

    7.14.1release notes

  • Support for Node.js versions below 20 was dropped; Node.js 20 or later is required.

    7.0.0release notes

New APIs and options 14

  • Query result types can be registered on a global SanityQueries interface, and client return types resolve registrations from either the global interface or the existing module augmentation.

    7.27.0release notes

  • Queries can now use multiple variant conditions.

    7.26.0release notes

  • Adds branded string types for stega-encoded results, allowing developers to distinguish those results in types.

    7.25.0release notes

  • Adds variant querying.

    7.24.0release notes

  • Adds documentsExists for batch existence checks.

    7.23.0release notes

  • Adds a waitFor option to defer live events until Sanity Function processing.

    7.21.0release notes

  • Adds an internal requestHandler configuration option for intercepting requests.

    7.21.0release notes

  • Listing projects accepts more query options, allowing developers to customize project-listing queries.

    7.20.0release notes

  • Adds VideoSubtitleInfo types to playback info.

    7.19.0release notes

  • Adds VideoRenditionInfo types with typed resolution.

    7.18.0release notes

  • Adds the onlyExplicitMembership option to projects.list().

    7.17.0release notes

  • Added embeddings configuration options for datasets.

    7.16.0release notes

  • Adds support for resuming listener events.

    7.15.0release notes

  • Adds thumbHash support to AssetMetadataType, using the corrected field casing.

    7.14.0release notes

Behavior and default changes 4

  • Improves get-it HTTP stacktraces.

    7.23.0release notes

  • Trace IDs from backend responses are exposed on errors, helping developers identify and investigate requests.

    7.22.0release notes

  • Improves Media Library API support.

    7.14.0release notes

  • The event type returned by listen is based on options.events.

    7.13.0release notes

Fixes and other changes 7

  • Symbol-keyed properties are kept unbranded in StegaBranded.

    7.26.1release notes

  • Rejected live/listen connections with a 4xx response are no longer reconnected.

    7.23.1release notes

  • The live client verifies CORS via /check/cors with credentials awareness before reporting CorsOriginError.

    7.22.1release notes

  • Stega now allows zero-width space characters in content.

    7.18.0release notes

  • Fixed resolution of root path mappings in CSM.

    7.13.2release notes

  • Stega encoding was improved, which may affect its performance.

    7.13.1release notes

  • The releaseId parameter is now optional when calling createVersion.

    7.12.1release notes

@sanity/client 63 changes

Breaking changes 1

  • useCdn now defaults to true, so queries made from the front end use the CDN; set useCdn: false when every query needs fresh data.

    6.0.0release notes

Behavior and default changes 2

  • The client automatically retries GET/HEAD requests and queries after 429, 502, or 503 responses and socket/DNS errors. Applications with custom retry code can disable client retries with maxRetries: 0 or adjust retryDelay and maxRetries.

    6.0.0release notes

  • request() is no longer deprecated.

    6.0.0release notes

@sanity/client 55 changes

Breaking changes 2

  • A named createClient export replaces the default export for creating a client.

    5.0.0release notes

  • The default export was removed; import the client using the named createClient export instead.

    5.0.0release notes

New APIs and options 1

  • httpRequest on SanityClient is configurable, intended for libraries wishing to extend the client.

    5.0.0release notes

Performance 1

  • The package ships modern syntax to reduce bundle size.

    5.0.0release notes

Behavior and default changes 1

  • The client now has full Node.js ESM runtime support.

    5.0.0release notes

@sanity/client 42 changes

Breaking changes 1

  • ESM support was expanded; backward compatibility cannot be guaranteed across all conditions, environments, and runtime versions.

    4.0.0release notes

Fixes and other changes 1

  • ESM output was improved to support Deno, Bun, and Edge runtimes.

    4.0.0release notes