Phone numbers

Use these methods to manage client phone numbers.

GET[host]/api/v2/phones

Get a list of phone numbers

GET[host]/api/v2/phones/{phoneId}

Get phone number details

POST[host]/api/v2/phones

Add a new phone number

PUT[host]/api/v2/phones/{phoneId}

PATCH[host]/api/v2/phones/{phoneId}

Update a phone number

DELETE[host]/api/v2/phones/{phoneId}

Delete a phone number

Get a list of phone numbers

Use this method to obtain a list of available client phone numbers.

Note

If such a request is made by an admin user that is only permitted to view clients with certain tags, a response includes only the phone numbers of clients marked with these tags.

To obtain detailed information about a specific phone number, use a separate method to get phone number details.

Request

Header parameters:

  • Authorization: Bearer <token>

Query parameters:

The following filter parameters are available for this method:

clientId

The client identifier.

confirmed

If true, a phone number is confirmed, otherwise false.

ext

The phone number extension.

number

The client phone number.

type

The type of a phone number. Possible values:

  • fixed

  • mobile

  • fax

  • voip

  • pager

The following sorting parameters are available for this method:

createTime

The date and time when a phone number was added to a client profile.

updateTime

The date and time when a phone number was last modified.

GET[host]/api/v2/phones

curl --location -g --request GET 'https://host.name/api/v2/phones?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[clientId]=1&filter[confirmed]=true&filter[ext]=812&filter[number]=+79992082115&filter[type]=mobile' \
--header 'Authorization: Bearer <token>'

Response

A response includes an array of Phone Number objects providing information about the phone numbers matching the request parameters.

Get phone number details

Use this method to obtain detailed information about a specified phone number.

To obtain a full list of client phone numbers, use a separate method to get a list of phone numbers.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

phoneId required

The identifier of a phone number.

GET[host]/api/v2/phones/{phoneId}

curl --location --request GET 'https://host.name/api/v2/phones/1' \
--header 'Authorization: Bearer <token>'

Response

A response includes a Phone Number object providing information about the specified phone number.

Add a new phone number

Use this method to add a new phone number to a client profile.

Request

Header parameters:

  • Authorization: Bearer <token>

Body:

Specify the following parameters when adding a phone number:

clientId integer required

The client identifier.

default boolean required

If true, a phone number is marked as the default one for a client, otherwise false.

number string required

The client phone number.

type string required

The type of a phone number. Possible values:

  • fixed

  • mobile

  • fax

  • voip

  • pager

ext string

The phone number extension.

POST[host]/api/v2/phones

curl --location --request POST 'https://host.name/api/v2/phones' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "clientId": 1,
  "default": true,
  "number": "+79992082115",
  "type": "mobile",
  "ext": "812"
}'

Response

A response body includes a Phone Number object providing information about the added phone number.

Update a phone number

Use this method to update a specified phone number.

Note

Instead of the method described below, you can use a similar method that uses the HTTP verbĀ PATCH.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

phoneId required

The identifier of a phone number.

Body:

The following field values can be updated for a specified phone number:

default boolean

If true, a phone number is marked as the default one for a client, otherwise false.

confirmed boolean

If true, a phone number is confirmed, otherwise false.

ext string

The phone number extension.

number string

The client phone number.

type string

The type of a phone number. Possible values:

  • fixed

  • mobile

  • fax

  • voip

  • pager

PUT[host]/api/v2/phones/{phoneId}

curl --location --request PUT 'https://host.name/api/v2/phones/1' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "default": true,
  "confirmed": true,
  "ext": "812",
  "number": "+79992082115",
  "type": "mobile"
}'

Response

A response includes a Phone Number object providing information about the phone number that was updated.

Delete a phone number

Use this method to delete a specified phone number.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

phoneId required

The identifier of a phone number.

DELETE[host]/api/v2/phones/{phoneId}

curl --location --request DELETE 'https://host.name/api/v2/phones/1' \
--header 'Authorization: Bearer <token>'

Response

In case of success, no response body is returned.