CompanyBelgium

Webhooks API

Beheer uw webhooks programmatisch: aanmaken, bijwerken, verwijderen, abonneren op entiteiten en leveringsgeschiedenis bekijken.

Parameter

{id}Webhook-ID (UUID)

Beschikbare endpoints

GET/api/v2/webhooks

Alle webhooks weergeven

POST/api/v2/webhook

Een webhook aanmaken

GET/api/v2/webhook/{id}

Webhookdetails ophalen

PUT/api/v2/webhook/{id}

Webhook bijwerken (naam, URL, status)

DELETE/api/v2/webhook/{id}

Webhook verwijderen

GET/api/v2/webhook/{id}/subscriptions

Gevolgde entiteiten weergeven

POST/api/v2/webhook/{id}/subscriptions

Entiteiten toevoegen om te volgen

DELETE/api/v2/webhook/{id}/subscriptions

Gevolgde entiteiten verwijderen

GET/api/v2/webhook/{id}/events

Leveringsgeschiedenis (laatste 100)

PATCH/api/v2/webhook/{id}/hmac-secret

HMAC-geheim roteren

POST/api/v2/webhook/{id}/trigger

Testevenement triggeren

Request body (POST /webhook)

bash
curl -X POST https://companybelgium.be/api/v2/webhook \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production listener",
    "url": "https://hooks.example.com/companybelgium",
    "entityNumbers": ["1033022383", "0202239951"]
  }'

⚠️ Het veld `hmacSecret` wordt slechts één keer geretourneerd. Bewaar het veilig.

json
{
  "success": true,
  "data": {
    "id": "cl9abc123...",
    "name": "Production listener",
    "url": "https://hooks.example.com/companybelgium",
    "disabled": false,
    "hmacSecret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "createdAt": "2026-04-15T10:00:00.000Z"
  },
  "timestamp": "2026-04-15T10:00:00.000Z"
}

PUT /api/v2/webhook/{id}

bash
curl -X PUT https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID} \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production listener v2",
    "url": "https://hooks.example.com/v2/companybelgium",
    "disabled": false
  }'

Request body (POST/DELETE /subscriptions)

bash
# Ajouter des entités à surveiller
curl -X POST https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID}/subscriptions \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}" \
  -H "Content-Type: application/json" \
  -d '{
    "entityNumbers": ["0417497106", "0403170701"]
  }'

# Retirer des entités
curl -X DELETE https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID}/subscriptions \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}" \
  -H "Content-Type: application/json" \
  -d '{
    "entityNumbers": ["0417497106"]
  }'

GET /api/v2/webhook/{id}/events

bash
curl https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID}/events \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}"
json
{
  "success": true,
  "data": [
    {
      "id": "evt_abc123...",
      "event": "update",
      "entityNumber": "1033022383",
      "entityType": "enterprise",
      "status": "delivered",
      "httpStatus": 200,
      "attempts": 1,
      "createdAt": "2026-04-15T09:30:00.000Z",
      "deliveredAt": "2026-04-15T09:30:01.000Z"
    },
    {
      "id": "evt_def456...",
      "event": "update",
      "entityNumber": "0202239951",
      "entityType": "enterprise",
      "status": "failed",
      "httpStatus": 503,
      "attempts": 3,
      "createdAt": "2026-04-15T08:00:00.000Z",
      "lastAttemptAt": "2026-04-15T08:00:10.000Z"
    }
  ],
  "timestamp": "2026-04-15T10:00:00.000Z"
}

PATCH /api/v2/webhook/{id}/hmac-secret

bash
curl -X PATCH https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID}/hmac-secret \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}"
json
{
  "success": true,
  "data": {
    "hmacSecret": "whsec_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
  },
  "timestamp": "2026-04-15T10:00:00.000Z"
}

POST /api/v2/webhook/{id}/trigger

bash
curl -X POST https://companybelgium.be/api/v2/webhook/${WEBHOOK_ID}/trigger \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-API-Secret: ${API_SECRET}" \
  -H "Content-Type: application/json" \
  -d '{
    "entityNumber": "1033022383",
    "data": {"note": "Manual test from dashboard"}
  }'

Hulp nodig?

Ons supportteam helpt u graag met de API-integratie.