API BCE webhooks reference: create and manage endpoints
API BCE webhooks reference: create, list, update and delete a webhook, manage its subscriptions, rotate the HMAC secret and read the delivery log.
Endpoints for the Webhooks API resource. All calls require authentication and return the standard JSON envelope.
Base URL: https://companybelgium.be/api/v2 · Authentication
List all webhooks#
Every webhook registered for the authenticated company.
This endpoint takes no parameters.
Request
curl https://companybelgium.be/api/v2/webhooks \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": [
{
"id": "...",
"name": "Prod listener",
"url": "https://example.be/hooks/bce",
"disabled": false,
"createdAt": "...",
"lastTriggeredAt": null,
"subscriptionCount": 1
}
],
"timestamp": "..."
}â–¶ Try this request
Create a webhook#
Registers an outbound webhook. The HMAC signing secret is returned only once, in this response. Store it securely.
Request body
{
"name": "Prod listener",
"url": "https://example.be/hooks/bce",
"entityNumbers": [
"1033.022.383"
]
}Request
curl -X POST https://companybelgium.be/api/v2/webhook \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET" \
-H "Content-Type: application/json" \
-d '{"name":"Prod listener","url":"https://example.be/hooks/bce","entityNumbers":["1033.022.383"]}'Response
{
"success": true,
"data": {
"id": "...",
"name": "Prod listener",
"url": "https://example.be/hooks/bce",
"hmacSecret": "...",
"createdAt": "..."
},
"timestamp": "..."
}Retrieve a webhook#
A single webhook by id.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl https://companybelgium.be/api/v2/webhook/WEBHOOK_ID \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": {
"id": "...",
"name": "Prod listener",
"url": "https://example.be/hooks/bce",
"disabled": false,
"createdAt": "...",
"lastTriggeredAt": null
},
"timestamp": "..."
}â–¶ Try this request
Update a webhook#
Update name, url or disabled flag.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request body
{
"name": "Prod listener (paused)",
"disabled": true
}Request
curl -X PUT https://companybelgium.be/api/v2/webhook/WEBHOOK_ID \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET" \
-H "Content-Type: application/json" \
-d '{"name":"Prod listener (paused)","disabled":true}'Response
{
"success": true,
"data": {
"id": "...",
"name": "Prod listener (paused)",
"url": "https://example.be/hooks/bce",
"disabled": true,
"createdAt": "...",
"lastTriggeredAt": null
},
"timestamp": "..."
}Delete a webhook#
Deletes the webhook and cascades its subscriptions and delivery events.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl -X DELETE https://companybelgium.be/api/v2/webhook/WEBHOOK_ID \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": {
"id": "...",
"deleted": true
},
"timestamp": "..."
}Rotate the HMAC signing secret#
Generates a new HMAC secret, returned only once. The old secret stops being valid immediately.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl -X PATCH https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/hmac-secret \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": {
"id": "...",
"hmacSecret": "..."
},
"timestamp": "..."
}Send a test delivery#
Manually triggers a test event so you can verify your endpoint and signature handling.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl -X POST https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/trigger \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": {
"id": "...",
"triggered": true
},
"timestamp": "..."
}List subscribed entity numbers#
Entity numbers this webhook is subscribed to.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/subscriptions \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": [
{
"entityNumber": "1033022383",
"entityType": null,
"createdAt": "..."
}
],
"timestamp": "..."
}â–¶ Try this request
Add entity subscriptions#
Subscribe the webhook to one or more enterprise/establishment numbers.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request body
{
"entityNumbers": [
"1033.022.383"
]
}Request
curl -X POST https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/subscriptions \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET" \
-H "Content-Type: application/json" \
-d '{"entityNumbers":["1033.022.383"]}'Response
{
"success": true,
"data": {
"added": 1,
"entityNumbers": [
"1033022383"
]
},
"timestamp": "..."
}Remove entity subscriptions#
Unsubscribe the webhook from given entity numbers.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request body
{
"entityNumbers": [
"1033.022.383"
]
}Request
curl -X DELETE https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/subscriptions \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET" \
-H "Content-Type: application/json" \
-d '{"entityNumbers":["1033.022.383"]}'Response
{
"success": true,
"data": {
"removed": 1
},
"timestamp": "..."
}Delivery log#
The most recent delivery attempts, newest first (100 by default, up to 500 with ?limit=), with response code, retries and error message.
Parameters
| Name | In/Type | Required | Description |
|---|---|---|---|
id | path string | Required | Webhook id. |
Request
curl https://companybelgium.be/api/v2/webhook/WEBHOOK_ID/events \
-H "X-API-Key: $API_BCE_KEY" \
-H "X-API-Secret: $API_BCE_SECRET"Response
{
"success": true,
"data": [
{
"id": "...",
"url": "https://example.be/hooks/bce",
"entityNumbers": [
"1033022383"
],
"eventType": "manual",
"retryCount": 0,
"responseCode": 200,
"errorMessage": null,
"createdAt": "...",
"deliveredAt": "..."
}
],
"timestamp": "..."
}â–¶ Try this request
Lifecycle of a webhook in API BCE#
The reference lists each route on its own. In practice, they follow a clear order, from creation to deletion.
- First, create the webhook with
POST /webhook, aname, aurland theentityNumbersto watch, then storehmacSecret. - Next, send a test delivery with
POST /webhook/{id}/triggerto check your receiver. - Then, add or remove numbers with
POSTandDELETEon/webhook/{id}/subscriptions. - During maintenance, pause it with
PUT /webhook/{id}anddisabledset to true. - If the secret leaks, rotate it with
PATCH /webhook/{id}/hmac-secret. - Finally, remove it with
DELETE /webhook/{id}.
Keeping subscriptions in sync#
Your subscriptions should mirror your portfolio. For example, when a new customer enters your CRM, add its enterprise number. Likewise, remove the number when the customer leaves. In addition, run a regular reconciliation that compares GET /webhook/{id}/subscriptions with your own database. The subscriptionCount in the webhook list gives a quick sanity check. Both enterprise and establishment numbers can be subscribed.
Pitfalls when managing webhooks#
Deleting a webhook also deletes its subscriptions and its delivery events. Therefore, prefer the disabled flag for a temporary pause. Rotation is also immediate: the old secret stops working at once, so deploy the new one right away. Moreover, a lastTriggeredAt that stays null for a long time can reveal a webhook nobody needs. Finally, use separate webhooks for staging and production URLs.
Debugging deliveries with the log#
The delivery log is your first stop when an event seems missing. Each entry lists the url, the entityNumbers, the eventType, the retryCount, the responseCode, the errorMessage and the timestamps. Therefore, you can tell at once whether your server answered with an error or never answered. For example, a 500 with several retries points to a bug in your handler. In contrast, no entry at all suggests the number is not subscribed. Then, fix the cause and use the trigger route to confirm.
In addition, give each webhook a clear name, such as the environment and the owning team. As a result, the list stays readable when several teams use API BCE.
API BCE webhooks reference FAQ#
How do I pause a webhook without losing its subscriptions?
Call PUT /webhook/{id} with disabled set to true. Later, set it back to false to resume.
How many entries does the delivery log return?
The 100 most recent attempts by default, newest first. With ?limit=, you can read up to 500.
Can API BCE webhooks watch establishments?
Yes. Subscriptions accept enterprise numbers and establishment numbers.