Functions new document change events and filtering options!
Published: August 20, 2025
We are excited to give developers more document change events to trigger their Functions! The new events are:
create
: Emitted when a document is created.delete
: Emitted when a document is deleted.update
: Emitted when a document is updated.
Additionally, two new boolean toggles are available when defining the triggering event for your Functions:
includeDrafts
: Whether the event should be emitted with respect to draft documents. Defaults tofalse
.includeAllVersions
: Whether the event should be emitted with respect to version documents (documents part of a Content Release). Defaults tofalse
.
Keep in mind that combining update
with includeDrafts
and/or includeAllVersions
may result in many, rapid, invocations whenever changes are synced. See the rate limits and use with caution.
Note that these new events and options have significant overlap with the existing publish
event. In fact, publish
can be defined as:
on: ['create', 'update']
, andincludeAllVersions: true
The publish
event was an early beta attempt at encapsulating a useful, initial first-pass at a Functions source event.
These new additions set up a deprecation of the publish
event, so keep an eye out for that to officially land sometime in the near future. If you want to get ahead of things, you can update any existing function events that use on: ['publish']
to instead use the on
and includeAllVersions
values mentioned above—or make them more specific for your needs.
Support for these new events and filters landed in the following tools under the specified versions. Upgrade to at least these versions to take advantage of the changes:
@sanity/blueprints
v0.2.0sanity
CLI v4.5.0