## List lead contacts

`GET /v1/leads/:id/contacts`

Returns the links between a lead and its contacts: contact ID, position, and primary flag, so you know who is linked before changing the set of contacts.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Lead ID. List: [`GET /v1/leads`](/docs/entities/leads/list) |

There is no pagination: the response contains all of the lead's links in one call.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/leads/1001321/contacts" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/leads/1001321/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/leads/1001321/contacts', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
const primary = data.find((link) => link.isPrimary)
console.log('Primary contact:', primary?.contactId)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/leads/1001321/contacts', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | array | Links between the lead and its contacts, in `sort` order. An empty array for a lead without contacts and for a lead that does not exist |
| `data[].contactId` | number | Contact ID. Get the contact: [`GET /v1/contacts/:id`](/docs/entities/contacts/get) |
| `data[].isPrimary` | boolean | Primary contact of the lead. For a lead with contacts, `true` on exactly one link |
| `data[].sort` | number | Position of the contact in the list |
| `data[].roleId` | number | Role of the contact in the lead. The link methods do not store it |

## Response example

```json
{
  "success": true,
  "data": [
    { "contactId": 2937, "sort": 10, "isPrimary": false, "roleId": 0 },
    { "contactId": 2939, "sort": 20, "isPrimary": true, "roleId": 0 },
    { "contactId": 2941, "sort": 30, "isPrimary": false, "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 |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer, for example `abc` or `0` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens attached |
| 403 | `SCOPE_DENIED` | The key does not have the `crm` scope |
| 429 | `RATE_LIMITED` | Rate limit exceeded: 300 requests per minute per portal, all API keys of the portal share one limit. The exact value arrives in the `x-ratelimit-limit` header (the cap is divided across replicas). Retry after the delay in the `Retry-After` header |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable. Retry the request later |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **An empty list does not prove the lead exists.** For a deleted lead and for an ID that never existed, the response is the same as for a lead without contacts. Check that the lead exists with [`GET /v1/leads/:id`](/docs/entities/leads/get): it responds with `404` for a missing lead.
- **An ID in the list may not point to a contact.** Linking does not check the contact ID, so the list can contain an ID that matches no contact. Before working with a contact, request it with [`GET /v1/contacts/:id`](/docs/entities/contacts/get).
- **Contacts together with the lead.** [`GET /v1/leads/:id?include=contactBinding`](/docs/entities/leads/get) returns the lead and the full records of the linked contacts in `data._included.contactBindings`. With `include=contact`, `data._included.contact` carries a single object — the primary contact. The primary contact's ID is returned in the lead's `contactId` field, and the IDs of all linked contacts in `contactIds`.

## See also

- [Lead contacts](/docs/entities/leads/contacts)
- [Link a contact to a lead](/docs/entities/leads/contacts-create)
- [Replace lead contacts](/docs/entities/leads/contacts-set)
- [Unlink a contact from a lead](/docs/entities/leads/contacts-delete-delete)
- [Unlink all contacts from a lead](/docs/entities/leads/contacts-delete)
- [Get lead](/docs/entities/leads/get)
- [Contacts](/docs/entities/contacts)
