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

Terminal
curl "https://vibecode.bitrix24.com/v1/companies/3123/contacts" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
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

javascript
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

javascript
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

JSON
{
  "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:

JSON
{
  "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 200 with an empty data array, as for a company without contacts. To check that the company exists, use GET /v1/companies/:id: it returns 404 for 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=contact returns the company and the full records of the linked contacts in data._included.contacts. The include value is contact, singular: include=contacts returns 400 INVALID_INCLUDE. The IDs of all linked contacts are returned in the company's contactIds field.

See also