bcquality/microsoft/knowledge/web-services/webhook-eligibility-and-validationtoken-renewal.md
Jesper Schulz-Wedde 0bb1065bc3
Add P0 integration and control add-in runtime guidance (#100)
* Add P0 integration and control add-in guidance

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02baffe8-0600-430d-81fa-a9993685e7cb

* Correct API part multiplicity guidance

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02baffe8-0600-430d-81fa-a9993685e7cb

* Refine API part multiplicity guidance

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1c37924e-9749-4e63-9d58-bd73d659f736

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
2026-07-14 12:53:26 +02:00

2.4 KiB

bc-version domain keywords technologies countries application-area
all
web-services
webhook
subscription
validationtoken
expirationdatetime
webhook-supported-resources
api-page
sourcetabletemporary
querytype
al
javascript
w1
all

Verify webhook eligibility and complete every validationToken handshake

Description

Business Central can subscribe only to eligible API pages, not every endpoint that can be read through an API. Webhooks exclude API queries, temporary API pages, pages with composite OData keys, pages over system tables, and pages over Job Queue Entry (table 472); the environment's webhookSupportedResources endpoint is authoritative. Creating and renewing a subscription both call the notificationUrl with validationToken, and both fail unless the subscriber returns that token in the response body with 200 OK.

Best Practice

Before creating a subscription, confirm the resource appears in webhookSupportedResources and that a custom endpoint is an API page with a single stable key over an eligible persistent table. Use one validation path that echoes validationToken for both create (POST) and renew (PATCH) handshakes. Track expirationDateTime and renew before expiry: online subscriptions expire after three days, while on-premises lifetime defaults to three days and can be changed with ApiSubscriptionExpiration.

See samples: webhook-eligibility-and-validationtoken-renewal.good.al and webhook-eligibility-and-validationtoken-renewal.good.js.

Anti Pattern

Attempting to subscribe to an API query, temporary/composite/system-table/Job Queue Entry API page, or assuming a successful create handshake makes renewal automatic. Composite includes an explicit multi-field ODataKeyFields and a missing ODataKeyFields when the source table's primary key has multiple fields. A renewal issues the same validation challenge; a notification handler that ignores the query-string token cannot create or renew the subscription.

See samples: webhook-eligibility-and-validationtoken-renewal.bad.al and webhook-eligibility-and-validationtoken-renewal.bad.js.

Source

Working with webhooks and Update subscriptions.