API Reference
List Companies
Retrieve a paginated list of companies
Endpoint
GET /api/v1/companiesDescription
Returns a paginated list of all companies associated with your organization.
Authentication
Required - Include X-API-Key header
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | integer | No | 50 | Number of results per page (1-100) |
after | string | No | - | Cursor for fetching the next page |
before | string | No | - | Cursor for fetching the previous page |
Request
curl -X GET "https://betalink.dev/api/v1/companies?limit=10" \
-H "X-API-Key: your-api-key"Response
Success (200 OK)
{
"data": [
{
"id": "comp_abc123def456",
"cvr": "12345678",
"name": "Acme ApS",
"address": "Hovedgaden 1, 1000 Copenhagen",
"startDate": "2024-01-01",
"endDate": "2099-12-31",
"status": "REGISTERED",
"senderRegNumber": "1234",
"senderAccountNumber": "0012345678",
"receiverRegNumber": "5678",
"receiverAccountNumber": "0087654321",
"defaultAmountCents": 10000,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-06-20T14:45:00Z"
}
],
"meta": {
"total": 150,
"limit": 10,
"hasMore": true
},
"_links": {
"self": "/api/v1/companies?limit=10",
"next": "/api/v1/companies?limit=10&after=comp_abc123def456",
"prev": null
}
}Company Object
| Field | Type | Description |
|---|---|---|
id | string | Unique company identifier |
cvr | string | 8-digit Danish CVR number |
name | string | Company name |
address | string | null | Company address |
startDate | string | Registration start date |
endDate | string | Registration end date |
status | string | Disposition status (see below) |
senderRegNumber | string | null | Sender bank registration number |
senderAccountNumber | string | null | Sender bank account number |
receiverRegNumber | string | null | Receiver bank registration number |
receiverAccountNumber | string | null | Receiver bank account number |
defaultAmountCents | number | null | Default transaction amount in cents |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 8601 last update timestamp |
Status Values
| Status | Description |
|---|---|
CREATED | Company created, pending registration |
REGISTERED | Active and registered with Mastercard |
MODIFIED | Company details have been modified |
TERMINATED | Company registration has been terminated |
REJECTED | Registration was rejected |
Error Responses
401 Unauthorized
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}429 Too Many Requests
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Try again later.",
"retryAfter": 60
}
}Code Example
import { createBetalinkClient } from "@betalink/api-client";
const client = createBetalinkClient({
baseUrl: "https://betalink.dev/api",
apiKey: "your-api-key",
});
// Get first page
const response = await client.listCompanies({ limit: 25 });
console.log(`Total companies: ${response.meta.total}`);
for (const company of response.data) {
console.log(`${company.cvr}: ${company.name} (${company.status})`);
}
// Get next page if available
if (response.meta.hasMore) {
const lastId = response.data[response.data.length - 1].id;
const nextPage = await client.listCompanies({
limit: 25,
after: lastId,
});
}Pagination Example
Fetch all companies:
async function getAllCompanies() {
const companies = [];
let after: string | undefined;
do {
const response = await client.listCompanies({ limit: 100, after });
companies.push(...response.data);
if (response.meta.hasMore && response.data.length > 0) {
after = response.data[response.data.length - 1].id;
} else {
break;
}
} while (true);
return companies;
}