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.
Find companies
const { data } = await cbe.companies.find({
zipcode: '1000',
street: 'Rue de la Loi',
houseNumber: '16',
})
for (const company of data) {
console.log(company.enterpriseNumber, company.match)
}
const numbers = await cbe.companies.findNumbers({
zipcode: '1000',
street: 'Rue de la Loi',
})
console.log(`${numbers.meta.total} companies on this street`) find looks companies up by activity (NACE), postcode, municipality, street and house number, name, legal form or legal situation, up to 100 per call. NACE and address filters must match the same registered office or establishment, and match tells you which ones did. findNumbers takes the same filters and returns only enterprise numbers, up to 1000 per page. Use them to look up or verify companies, for instance who is registered at an address; the KBO Open Data licence excludes direct marketing.
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, search and find 1 per company returned, findNumbers 1 per page with results; errors, unknown numbers and empty results 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