Sanity Library Reference Docs
    Preparing search index...

    Function defineDocumentWebhook

    • Beta

      Defines a webhook that is called when document changes occur.

      defineDocumentWebhook({
      name: 'my-webhook',
      on: ['create'],
      url: 'https://example.com/webhook',
      projection: '{_id}',
      dataset: 'production',
      apiVersion: 'v2026-01-01',
      })

      Parameters

      • parameters: BlueprintDocumentWebhookConfig

        The webhook configuration

        Deploying Webhooks via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.

        Configuration for a webhook This feature is subject to breaking changes.

        • BetaapiVersion: string

          Must start with 'v' and use the format YYYY-MM-DD

        • Betadataset: string
        • Optional Betadescription?: string | null
        • Optional BetadisplayName?: string

          Display name shown in the Sanity dashboard

          The name of the resource

        • Optional Betafilter?: string
        • Optional Betaheaders?: Record<string, string>
        • Optional BetahttpMethod?: "POST" | "PUT" | "PATCH" | "DELETE" | "GET"
        • Optional BetaincludeAllVersions?: boolean
        • Optional BetaincludeDrafts?: boolean
        • Betaname: string
        • Betaon: WebhookTrigger[]
        • Optional Betaproject?: string
        • Optional Betaprojection?: string
        • Optional Betasecret?: string
        • Optional Betastatus?: "enabled" | "disabled"
        • Betaurl: string

      Returns BlueprintDocumentWebhookResource

      The webhook resource