For AI agents: markdown of this page — /docs-content-en/entities/companies/contacts-list.md documentation index — /llms.txt
List company contacts
GET /v1/companies/:id/contacts
Returns all contacts linked to a company, so you know the current set before linking, replacing, or unlinking.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionCompany ID. List: GET /v1/companies |
No pagination: the response contains all of the company's links in one call.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/companies/3123/contacts" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/companies/3123/contacts" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/3123/contacts', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
const contactIds = data.map((link) => link.contactId)
console.log('Company contacts:', contactIds)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/3123/contacts', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typearray | DescriptionThe company's links to contacts in sort order. An empty array for a company without contacts |
Fielddata[].contactId |
Typenumber | DescriptionContact ID. Get the contact: GET /v1/contacts/:id |
Fielddata[].isPrimary |
Typeboolean | DescriptionThis is the contact's primary company: its ID is returned in the contact's companyId field |
Fielddata[].sort |
Typenumber | DescriptionThe contact's position in the list |
Fielddata[].roleId |
Typenumber | DescriptionThe contact's role in the company. The link methods do not save it |
Response example
{
"success": true,
"data": [
{ "contactId": 2987, "sort": 10, "isPrimary": true, "roleId": 0 },
{ "contactId": 2989, "sort": 20, "isPrimary": true, "roleId": 0 },
{ "contactId": 2991, "sort": 30, "isPrimary": true, "roleId": 0 }
]
}
Error response example
400 — id is not a positive integer:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "id must be a positive integer"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a positive integer, for example abc |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no Bitrix24 tokens configured |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key has no crm scope |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the x-ratelimit-limit header. Retry after the delay in the Retry-After header |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable. Retry the request later |
For the full list of common API errors, see Errors.
Known specifics
- A non-existent company returns an empty list. For an ID that does not belong to any company, the method returns
200with an emptydataarray, as for a company without contacts. To check that the company exists, useGET /v1/companies/:id: it returns404for such an ID. - An ID from the list may not lead to a contact. Linking does not check the contact ID, so the list can contain an ID that does not belong to any contact. Before working with a contact, request it with
GET /v1/contacts/:id. - Contacts together with the company.
GET /v1/companies/:id?include=contactreturns the company and the full records of the linked contacts indata._included.contacts. Theincludevalue iscontact, singular:include=contactsreturns400 INVALID_INCLUDE. The IDs of all linked contacts are returned in the company'scontactIdsfield.