Skip to main content
DELETE
/
dir
/
{dir_id}
/
phone_numbers
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const phoneNumber = await client.dir.phoneNumbers.remove('16635d38-75a6-4481-82e8-69af60e05011', {
  phone_numbers: ['+19493253498'],
});

console.log(phoneNumber.data);
{
  "data": [
    "+19493253498"
  ],
  "meta": {
    "errors": [
      {
        "phone_number": "+19493253498",
        "code": "not_associated",
        "title": "Phone number not associated",
        "detail": "Phone number not associated with this DIR."
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

dir_id
string<uuid>
required

The DIR id. Lowercase UUID.

Example:

"16635d38-75a6-4481-82e8-69af60e05011"

Body

application/json
phone_numbers
string[]
required
Required array length: 1 - 15 elements

Response

Bulk-delete response. Inspect both deleted and errors.

Bulk-delete partial-success response. data is the list of phone numbers that were soft-deleted. meta.errors holds per-number failures (e.g. number not associated with this DIR). When EVERY number in the request fails, the endpoint instead returns 400 with the canonical Telnyx error envelope and data/meta are absent.

data
string[]
required

Phone numbers that were successfully soft-deleted. Bare E.164 strings.

meta
object
required