Represents the availability state of an agent and call status.

JSON format

Availabilities are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
agent_state string false false The availability state of the agent. If omnichannel routing is enabled, agent_state can not be updated through the API. Allowed values are "online", "offline", "away", or "transfers_only".
call_status string false false The call status of the agent. Allowed values are "on_call", "wrap_up", or "null".
via string false false The channel (client/phone) the agent is registered to. If omnichannel routing is enabled, only via can be updated through the API.

Example

{  "agent_state": "online",  "call_status": "wrap_up",  "via": "phone"}

Show Availability

  • GET /api/v2/channels/voice/availabilities/{agent_id}

Allowed For

  • Agents

Parameters

Name Type In Required Description
agent_id integer Path true ID of an agent

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/availabilities/{agent_id}.json \-v -u {email_address}:{password} -X GET
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372"	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 "username:password"
	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/availabilities/385473779372")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.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/availabilities/385473779372',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372"headers = {	"Content-Type": "application/json",}
response = requests.request(	"GET",	url,	auth=('<username>', '<password>'),	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372")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: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "availability": {    "agent_state": "online",    "via": "client"  }}

Update Availability

  • PUT /api/v2/channels/voice/availabilities/{agent_id}

Allowed For

  • Agents

Parameters

Name Type In Required Description
agent_id integer Path true ID of an agent

Example body

{  "availability": {    "agent_state": "online",    "via": "client"  }}

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/availabilities/{agent_id}.json \-H "Content-Type: application/json" -d '{"availability": {"via": "client", "agent_state":  "online"}}' \-v -u {email_address}:{password} -X PUT
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372"	method := "PUT"	payload := strings.NewReader(`{  "availability": {    "agent_state": "online",    "via": "client"  }}`)	req, err := http.NewRequest(method, url, payload)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
	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/availabilities/385473779372")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"availability\": {    \"agent_state\": \"online\",    \"via\": \"client\"  }}""");
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("PUT", body)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", Credentials.basic("your-email", "your-password"))		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({  "availability": {    "agent_state": "online",    "via": "client"  }});
var config = {  method: 'PUT',  url: 'https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"  },  data : data,};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsimport json
url = "https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372"
payload = json.loads("""{  "availability": {    "agent_state": "online",    "via": "client"  }}""")headers = {	"Content-Type": "application/json",}
response = requests.request(	"PUT",	url,	auth=('<username>', '<password>'),	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"uri = URI("https://support.zendesk.com/api/v2/channels/voice/availabilities/385473779372")request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")request.body = %q({  "availability": {    "agent_state": "online",    "via": "client"  }})request.basic_auth "username", "password"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
{  "availability": {    "agent_state": "online",    "via": "client"  }}