Authentication
Learn how to authenticate your API requests with your API keys.
API Key
The API uses API key authentication. You must include your key in the X-API-Key header of each request.
| Header | Format | Description |
|---|---|---|
X-API-Key | pk_live_... | Public key required |
X-API-Secret | sk_live_... | Secret key optional |
Authentication example
cURL with authentication
curl -X GET "https://companybelgium.be/api/companies/search?name=Proximus" \ -H "X-API-Key: pk_live_votre_cle_publique" \ -H "X-API-Secret: sk_live_votre_cle_secrete"
JavaScript
// JavaScript / Node.js
const response = await fetch(
'https://companybelgium.be/api/companies/search?name=Proximus',
{
headers: {
'X-API-Key': 'pk_live_votre_cle_publique',
'X-API-Secret': 'sk_live_votre_cle_secrete',
},
}
);
const data = await response.json();Python
# Python
import requests
response = requests.get(
'https://companybelgium.be/api/companies/search',
params={'name': 'Proximus'},
headers={
'X-API-Key': 'pk_live_votre_cle_publique',
'X-API-Secret': 'sk_live_votre_cle_secrete',
}
)
data = response.json()Obtain your API keys
- 1Create an account on companybelgium.be
- 2Access your dashboard and create a company
- 3Generate an API key pair in the "My API Keys" section
- 4Copy your API Key and API Secret — the secret is only shown once
Authentication error
If the API key is missing or invalid, the API returns a 401 error:
401 Unauthorized
{
"success": false,
"error": "Invalid or missing API key",
"timestamp": "2026-02-08T12:00:00.000Z"
}Security best practices
- Never share your API keys in public code (GitHub, etc.)
- Use environment variables to store your keys
- Make API calls server-side, never client-side
- Disable or regenerate a compromised key immediately