Lines

This API lets you list the available lines (phone numbers and digital lines) in your Zendesk voice account. See Managing Zendesk Talk lines in Zendesk help.

JSON format

Lines are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
countintegerfalsefalse
linesarrayfalsefalseArray of lines
next_pagestringfalsefalse
previous_pagestringfalsefalse

List Lines

  • GET /api/v2/channels/voice/lines

Allowed For

  • Agents

Minimizing the results

You can reduce the number of properties per line in the response with the minimal_mode=true query string parameter. Example:

/api/v2/channels/voice/lines?minimal_mode=true

The minimized result is a mix of phone numbers and digital lines. Some entries might have different properties but all entries will have the following properties:

  • id
  • country_code
  • external
  • nickname
  • priority
  • brand_id
  • line_type

Parameters

NameTypeInRequiredDescription
minimal_modebooleanQueryfalseEnable minimized results

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/lines.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/channels/voice/lines?minimal_mode="	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/lines")		.newBuilder()		.addQueryParameter("minimal_mode", "");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://support.zendesk.com/api/v2/channels/voice/lines',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'minimal_mode': '',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/lines?minimal_mode="headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://support.zendesk.com/api/v2/channels/voice/lines")uri.query = URI.encode_www_form("minimal_mode": "")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 2,  "lines": [    {      "capabilities": {        "emergency_address": true,        "mms": false,        "sms": true,        "voice": true      },      "categorised_greetings": {        "1": "voicemail_en",        "2": "available_en"      },      "categorised_greetings_with_sub_settings": {        "1": {          "voicemail_off_inside_business_hours": "voicemail_en_voicemail_config,",          "voicemail_off_outside_business_hours": "voicemail_en_voicemail_config",          "voicemail_on_inside_business_hours": "voicemail_en"        },        "2": {          "voicemail_off": "available_en_voicemail_config",          "voicemail_on": "available_en"        }      },      "country_code": "US",      "created_at": "2013-04-13T16:02:33Z",      "default_greeting_ids": [        "voicemail_en",        "available_jp"      ],      "default_group_id": 1,      "display_number": "+353 76 680 1402",      "external": false,      "greeting_ids": [        1,        2      ],      "group_ids": [        1,        2      ],      "id": 6,      "line_type": "phone",      "location": "TX",      "name": "Awesome Support Line",      "nickname": "Awesome Support Line",      "number": "+353766801402",      "recorded": true,      "sms_group_id": 7,      "toll_free": false,      "transcription": false    },    {      "brand_id": 1,      "call_recording_consent": "always",      "categorised_greetings_with_sub_settings": {        "1": {          "voicemail_off_inside_business_hours": "voicemail_en_voicemail_config",          "voicemail_off_outside_business_hours": "voicemail_en_voicemail_config",          "voicemail_on_inside_business_hours": "voicemail_en"        },        "2": {          "voicemail_off": "available_en_voicemail_config",          "voicemail_on": "available_en,"        }      },      "created_at": "2013-04-13T16:02:33Z",      "default_greeting_ids": [        "voicemail_en",        "available_jp"      ],      "default_group_id": 1,      "greeting_ids": [        1,        2      ],      "group_ids": [        1,        2      ],      "id": 6,      "line_id": "56e4cf3a49112b3494b3b70f0506bdfa",      "line_type": "digital",      "nickname": "Awesome Support Line",      "recorded": true,      "transcription": false    }  ],  "next_page": null,  "previous_page": null}