Documentation / Webhooks API

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#

GET/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

Fictitious companies served by the test API (/test/v2). Try 0999.999.229 (bankruptcy) or 0999.999.526 (quota exceeded): see the test numbers in the Test mode page.

GET /test/v2/webhooks
cURL
curl "/test/v2/webhooks" \
  -H "X-API-Key: $API_BCE_KEY" -H "X-API-Secret: $API_BCE_SECRET"

Create a webhook#

POST/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#

GET/webhook/{id}

A single webhook by id.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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

Fictitious companies served by the test API (/test/v2). Try 0999.999.229 (bankruptcy) or 0999.999.526 (quota exceeded): see the test numbers in the Test mode page.

GET /webhook/{id}
cURL
curl "" \
  -H "X-API-Key: $API_BCE_KEY" -H "X-API-Secret: $API_BCE_SECRET"

Update a webhook#

PUT/webhook/{id}

Update name, url or disabled flag.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

DELETE/webhook/{id}

Deletes the webhook and cascades its subscriptions and delivery events.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

PATCH/webhook/{id}/hmac-secret

Generates a new HMAC secret, returned only once. The old secret stops being valid immediately.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

POST/webhook/{id}/trigger

Manually triggers a test event so you can verify your endpoint and signature handling.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

GET/webhook/{id}/subscriptions

Entity numbers this webhook is subscribed to.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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

Fictitious companies served by the test API (/test/v2). Try 0999.999.229 (bankruptcy) or 0999.999.526 (quota exceeded): see the test numbers in the Test mode page.

GET /webhook/{id}/subscriptions
cURL
curl "" \
  -H "X-API-Key: $API_BCE_KEY" -H "X-API-Secret: $API_BCE_SECRET"

Add entity subscriptions#

POST/webhook/{id}/subscriptions

Subscribe the webhook to one or more enterprise/establishment numbers.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

DELETE/webhook/{id}/subscriptions

Unsubscribe the webhook from given entity numbers.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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#

GET/webhook/{id}/events

The most recent delivery attempts, newest first (100 by default, up to 500 with ?limit=), with response code, retries and error message.

Parameters

NameIn/TypeRequiredDescription
idpath stringRequiredWebhook 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

Fictitious companies served by the test API (/test/v2). Try 0999.999.229 (bankruptcy) or 0999.999.526 (quota exceeded): see the test numbers in the Test mode page.

GET /webhook/{id}/events
cURL
curl "" \
  -H "X-API-Key: $API_BCE_KEY" -H "X-API-Secret: $API_BCE_SECRET"

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, a name, a url and the entityNumbers to watch, then store hmacSecret.
  • Next, send a test delivery with POST /webhook/{id}/trigger to check your receiver.
  • Then, add or remove numbers with POST and DELETE on /webhook/{id}/subscriptions.
  • During maintenance, pause it with PUT /webhook/{id} and disabled set 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.