
## Search application lines

`POST /v1/telephony-lines/search`

Returns the external lines added by the application, taking its input from the request body instead of the query string. The whole collection of lines arrives in a single page.

The same set of lines is returned by [`GET /v1/telephony-lines`](/docs/telephony/lines/list).

## Request fields (body)

| Field | Type | Required | Default | Description |
|------|-----|:-----:|-----------|---------|
| `limit` | number | no | `50` | Number of records, up to 5000 |
| `select` | string[] | no | — | Field selection in camelCase: `["number", "name"]` |
| `filter` | object | no | — | Only an empty object `{}` is accepted: filtering by line fields is not supported, and any key inside returns `400 UNSUPPORTED_FILTER` |
| `withTotal` | boolean | no | — | Has no effect on the response for application lines: `meta.total` is returned even with `withTotal: false` |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/telephony-lines/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "limit": 3 }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/telephony-lines/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "limit": 3 }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/telephony-lines/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ limit: 3 }),
})

const { success, data, meta } = await res.json()
console.log(`Found ${meta.total} lines`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/telephony-lines/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ limit: 3 }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of application lines. Empty until the application adds a line via [`POST /v1/telephony-lines`](/docs/telephony/lines/create) |
| `data[].number` | string | Line identifier set at creation |
| `data[].name` | string \| null | Display name. `null` if it was not set at creation |
| `data[].crmAutoCreate` | boolean | Auto-create a CRM entity on an outbound call through this line: `true` — create, `false` — do not create |
| `meta.total` | number | Number of application lines |
| `meta.hasMore` | boolean | Whether more records exist beyond `limit` |
| `meta.durationMs` | number | Request duration in milliseconds |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "number": "sip-line-1",
      "name": "Main line",
      "crmAutoCreate": true
    },
    {
      "number": "sip-line-2",
      "name": "Support line",
      "crmAutoCreate": false
    }
  ],
  "meta": {
    "total": 2,
    "hasMore": false,
    "durationMs": 62
  }
}
```

## Error response example

400 — a non-zero offset was passed:

```json
{
  "success": false,
  "error": {
    "code": "UNSUPPORTED_OFFSET",
    "message": "Entity 'telephony-lines' does not support offset — B24 method \"telephony.externalLine.get\" has no pagination and returns the full collection in one page. Remove offset and window the result on your side; limit still applies."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `UNSUPPORTED_OFFSET` | A non-zero `offset` was passed — application lines do not support pagination |
| 400 | `UNSUPPORTED_FILTER` | A `filter` was passed — filtering by line fields is not supported |
| 400 | `INVALID_SORT_FIELD` | A `sort` or `order` was passed — sorting is not supported |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not provided |
| 401 | `INVALID_API_KEY` | The key is not recognized — no such key exists on the platform |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `KEY_INACTIVE` | The API key is inactive or revoked |
| 403 | `SCOPE_DENIED` | The API key lacks the `telephony` scope |
| 429 | `RATE_LIMITED` | Request rate limit exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is temporarily unavailable — retry the request later |

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

## Known specifics

**Switching to POST adds no filtering criteria.** The body of this request accepts the same minimal set of parameters as the query string of the list endpoint. Find the line you need in the returned array by `number` on your side.

**The record key is `number`; a line has no `id` field.** Even when `number` is not named in `select`, it stays in every record of the response: without it a record cannot be told apart from the others or addressed in a [`PATCH /v1/telephony-lines/:number`](/docs/telephony/lines/update) call.

## See also

- [List application lines](/docs/telephony/lines/list)
- [Add a line](/docs/telephony/lines/create)
- [Application line fields](/docs/telephony/lines/fields)
- [Voximplant lines](/docs/telephony/lines/voximplant)
