Lines

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

JSON format

Lines are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
count integer false false
lines array false false Array of lines
next_page string false false
previous_page string false false

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 theminimal_mode=truequery 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

Name Type In Required Description
minimal_mode boolean 查询 false Enable minimized results

Code Samples

旋度
              
旋度https://{subdomain}.zendesk.com/api/v2/channels/voice/lines.json\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/channels/voice/lines?minimal_mode="method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/lines").newBuilder().addQueryParameter("minimal_mode","");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'GET',url:'https://support.zendesk.com/api/v2/channels/voice/lines',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},params:{'minimal_mode':'',},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://support.zendesk.com/api/v2/channels/voice/lines?minimal_mode="headers={"Content-Type":"application/json",}response=requests.request("GET",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"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")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|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}