For AI agents: markdown of this page — /docs-content-en/telephony/lines/delete.md documentation index — /llms.txt

Delete a line

DELETE /v1/telephony-lines/:number

Deletes an external application line by its number identifier. A deleted line cannot be restored via the API — create a new one with the same number if needed.

Parameters

Parameter Type Required Description
number (path) string yes Line identifier set at creation. If it contains special characters — URL-encode it

Examples

curl — personal key

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
    },
  }
)

if (res.status === 204) {
  console.log('Line deleted')
}

JavaScript — OAuth application

javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)

if (res.status === 204) {
  console.log('Line deleted')
}

Response

On a successful deletion the response is HTTP status 204 No Content with an empty body — success is checked by the response code.

Response example

http
HTTP/1.1 204 No Content

Error response example

422 — Bitrix24 error:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "External line not found"
  }
}

Errors

HTTP Code Description
422 BITRIX_ERROR Bitrix24 returned an error — text in error.message. Occurs, among other cases, when attempting to delete a nonexistent line
401 MISSING_API_KEY The X-Api-Key header was not provided
401 INVALID_API_KEY Invalid API key
401 TOKEN_MISSING The key has no configured tokens
401 KEY_INACTIVE The API key is inactive or revoked
403 SCOPE_DENIED The key lacks the telephony scope
429 RATE_LIMITED Request rate limit exceeded
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable

Full list of common API errors — Errors.

See also

Update a line

PATCH /v1/telephony-lines/:number

Updates the parameters of an existing external application line. The number identifier is set at creation and does not change. Fields are passed flat at the JSON root — without a fields wrapper.

Parameters

Parameter Type Required Description
number (path) string yes Line identifier set at creation. If it contains special characters — URL-encode it

Request fields (body)

Field Type Required Description
name string no New display name of the line
crmAutoCreate boolean no Auto-create a CRM entity on an outbound call: true / false

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Main line (updated)"
  }'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Main line (updated)"
  }'

JavaScript — personal key

javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'PATCH',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Main line (updated)',
    }),
  }
)

const { success, data } = await res.json()
console.log('Line identifier:', data.id)

JavaScript — OAuth application

javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'PATCH',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Main line (updated)',
    }),
  }
)

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

Response fields

Field Type Description
success boolean Always true on success
data.id string Identifier of the updated line (the number value from the URL)

Response example

JSON
{
  "success": true,
  "data": {
    "id": "sip-line-1"
  }
}

Error response example

422 — line not found or Bitrix24 error:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "NUMBER should not be empty"
  }
}

Errors

HTTP Code Description
422 BITRIX_ERROR Bitrix24 returned an error — text in error.message
401 MISSING_API_KEY The X-Api-Key header was not provided
401 INVALID_API_KEY Invalid API key
401 TOKEN_MISSING The key has no configured tokens
401 KEY_INACTIVE The API key is inactive or revoked
403 SCOPE_DENIED The key lacks the telephony scope
429 RATE_LIMITED Request rate limit exceeded
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable

Full list of common API errors — Errors.

Known specifics

At least one updatable field is required. Only name and crmAutoCreate are recognized. A body without them (empty or with only unrecognized fields) responds 422 "There are no fields to update".

serverName is not updated. The field is present in GET /v1/telephony-lines/fields, but a PATCH with serverName alone responds 422 "There are no fields to update" — it is not recognized as updatable. The value is neither stored nor returned on read.

data.id is the number from the URL, not an integer. Unlike the POST /v1/telephony-lines response, where data.id is the internal numeric record identifier, the update response returns a string — the number value from the request path.

You cannot change number via an update. The identifier is fixed at creation. To change number — delete the line and create a new one with the desired value.

See also