CBE2JSON JavaScript & TypeScript SDK
Access Belgian CBE / BCE / KBO company data from Node.js and TypeScript with the official CBE2JSON SDK: typed results, clear errors, and your credits on every call.
Install
npm install @cbe2json/sdk Node.js 20 or later. Works with import and require, ships its own TypeScript types, and has no dependencies.
Look up a company
Create an API key in your dashboard and keep its client ID and secret key in environment variables. Use the SDK on your server: the secret key must not reach a browser.
import { CBE2JSON } from '@cbe2json/sdk'
const cbe = new CBE2JSON({
clientId: process.env.CBE2JSON_CLIENT_ID!,
secretKey: process.env.CBE2JSON_SECRET_KEY!,
})
const { data: company, meta } = await cbe.companies.get('0202.239.951')
console.log(company.enterpriseNumber, company.denominations[0]?.denomination)
console.log(`${meta.creditsRemaining} credits left`)Search by name
const { data, meta } = await cbe.companies.search({ name: 'Proximus', limit: 20 })
console.log(`${meta.total} matches`, meta.hasNext) Search looks at company and establishment names, up to 100 results per call. No match returns an empty list.
Credits
Every result tells you the credits the call used, the credits left, your monthly allowance and when it resets. A lookup uses 1 credit, a search 1 per company returned; errors, unknown numbers and empty searches use none.
Errors
Each API answer has its own error class:
NotFoundError— no company has this numberCreditsExhaustedError— not enough credits left this month, with the reset dateAuthenticationError— wrong client ID or secret keyValidationError— a malformed number or search