Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
GROQ-filter to listen to changes for
Optionalparams: ListenParamsOptional query parameters
Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
GROQ-filter to listen to changes for
Optionalparams: ListenParamsOptional query parameters
Optionaloptions: ListenOptionsOptional listener options
Observable version of the Sanity client, with the same configuration as the promise-based one
Perform action operations against the configured dataset Returns a promise that resolves to the transaction result
Action operation(s) to execute
Optionaloptions: BaseActionOptionsAction options
Clone the client - returns a new instance
Returns the current client configuration
Reconfigure the client. Note that this mutates the current client.
OptionalnewConfig: Partial<ClientConfig>Create a document. Requires a _type property. If no _id is provided, it will be generated by the database.
Returns a promise that resolves to the created document.
Document to create
Mutation options
Create a document. Requires a _type property. If no _id is provided, it will be generated by the database.
Returns a promise that resolves to an array containing the created document.
Document to create
Mutation options
Create a document. Requires a _type property. If no _id is provided, it will be generated by the database.
Returns a promise that resolves to a mutation result object containing the ID of the created document.
Document to create
Mutation options
Create a document. Requires a _type property. If no _id is provided, it will be generated by the database.
Returns a promise that resolves to a mutation result object containing the ID of the created document.
Document to create
Mutation options
Create a document. Requires a _type property. If no _id is provided, it will be generated by the database.
Returns a promise that resolves to the created document.
Document to create
Optionaloptions: BaseMutationOptionsMutation options
Create a document if no document with the same ID already exists. Returns a promise that resolves to the created document.
Document to create
Mutation options
Create a document if no document with the same ID already exists. Returns a promise that resolves to an array containing the created document.
Document to create
Mutation options
Create a document if no document with the same ID already exists. Returns a promise that resolves to a mutation result object containing the ID of the created document.
Document to create
Mutation options
Create a document if no document with the same ID already exists. Returns a promise that resolves to a mutation result object containing the ID of the created document.
Document to create
Mutation options
Create a document if no document with the same ID already exists. Returns a promise that resolves to the created document.
Document to create
Optionaloptions: BaseMutationOptionsMutation options
Create a document if it does not exist, or replace a document with the same document ID Returns a promise that resolves to the created document.
Document to either create or replace
Mutation options
Create a document if it does not exist, or replace a document with the same document ID Returns a promise that resolves to an array containing the created document.
Document to either create or replace
Mutation options
Create a document if it does not exist, or replace a document with the same document ID Returns a promise that resolves to a mutation result object containing the ID of the created document.
Document to either create or replace
Mutation options
Create a document if it does not exist, or replace a document with the same document ID Returns a promise that resolves to a mutation result object containing the created document ID.
Document to either create or replace
Mutation options
Create a document if it does not exist, or replace a document with the same document ID Returns a promise that resolves to the created document.
Document to either create or replace
Optionaloptions: BaseMutationOptionsMutation options
InternalPerform an HTTP request a /data sub-endpoint
NOTE: Considered internal, thus marked as deprecated. Use request instead.
Endpoint to hit (mutate, query etc)
Request body
Optionaloptions: BaseMutationOptionsRequest options
Deletes a document with the given document ID. Returns a promise that resolves to the deleted document.
Document ID to delete
Options for the mutation
Deletes a document with the given document ID. Returns a promise that resolves to an array containing the deleted document.
Document ID to delete
Options for the mutation
Deletes a document with the given document ID. Returns a promise that resolves to a mutation result object containing the deleted document ID.
Document ID to delete
Options for the mutation
Deletes a document with the given document ID. Returns a promise that resolves to a mutation result object containing the deleted document ID.
Document ID to delete
Options for the mutation
Deletes a document with the given document ID. Returns a promise that resolves to the deleted document.
Document ID to delete
Optionaloptions: BaseMutationOptionsOptions for the mutation
Deletes one or more documents matching the given query or document ID. Returns a promise that resolves to first deleted document.
An object with either an id or query key defining what to delete
Options for the mutation
Deletes one or more documents matching the given query or document ID. Returns a promise that resolves to an array containing the deleted documents.
An object with either an id or query key defining what to delete
Options for the mutation
Deletes one or more documents matching the given query or document ID. Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
An object with either an id or query key defining what to delete
Options for the mutation
Deletes one or more documents matching the given query or document ID. Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
An object with either an id or query key defining what to delete
Options for the mutation
Deletes one or more documents matching the given query or document ID. Returns a promise that resolves to first deleted document.
An object with either an id or query key defining what to delete
Optionaloptions: BaseMutationOptionsOptions for the mutation
Perform a GROQ-query against the configured dataset.
GROQ-query to perform
Optionalparams: QueryWithoutParams | QPerform a GROQ-query against the configured dataset.
GROQ-query to perform
Optional query parameters
Optionaloptions: FilteredResponseQueryOptionsOptional request options
Perform a GROQ-query against the configured dataset.
GROQ-query to perform
Optional query parameters
Request options
Perform a GROQ-query against the configured dataset.
GROQ-query to perform
Optional query parameters
Request options
Get a Sanity API URL for the data operation and path provided
Data operation (eg query, mutate, listen or similar)
Optionalpath: stringPath to append after the operation
Fetch a single document with the given ID.
Document ID to fetch
Optionaloptions: { signal?: AbortSignal; tag?: string }Request options
Fetch multiple documents in one request.
Should be used sparingly - performing a query is usually a better option.
The order/position of documents is preserved based on the original array of IDs.
If any of the documents are missing, they will be replaced by a null entry in the returned array
Document IDs to fetch
Optionaloptions: { signal?: AbortSignal; tag?: string }Request options
Get a Sanity API URL for the URI provided
URI/path to build URL for
OptionalcanUseCdn: booleanWhether or not to allow using the API CDN for this route
Perform mutation operations against the configured dataset Returns a promise that resolves to the first mutated document.
Mutation operations to execute
Mutation options
Perform mutation operations against the configured dataset. Returns a promise that resolves to an array of the mutated documents.
Mutation operations to execute
Mutation options
Perform mutation operations against the configured dataset Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
Mutation operations to execute
Mutation options
Perform mutation operations against the configured dataset Returns a promise that resolves to a mutation result object containing the mutated document IDs.
Mutation operations to execute
Mutation options
Perform mutation operations against the configured dataset Returns a promise that resolves to the first mutated document.
Mutation operations to execute
Optionaloptions: BaseMutationOptionsMutation options
Create a new buildable patch of operations to perform
Document ID to patch
Optionaloperations: PatchOperationsOptional object of patch operations to initialize the patch instance with
Patch instance - call .commit() to perform the operations defined
Create a new buildable patch of operations to perform
Array of document IDs to patch
Optionaloperations: PatchOperationsOptional object of patch operations to initialize the patch instance with
Patch instance - call .commit() to perform the operations defined
Create a new buildable patch of operations to perform
An object with query and optional params, defining which document(s) to patch
Optionaloperations: PatchOperationsOptional object of patch operations to initialize the patch instance with
Patch instance - call .commit() to perform the operations defined
Perform a request against the Sanity API NOTE: Only use this for Sanity API endpoints, not for your own APIs!
Request options
Promise resolving to the response body
Clone the client with a new (partial) configuration.
OptionalnewConfig: Partial<ClientConfig>New client configuration properties, shallowly merged with existing configuration
Instance properties