You can use this API to work with API clients for Zendesk Chat.

To create API clients using the Dashboard in Chat, see Adding an API client.

JSON format

OAuth Clients are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
agent_idintegertruefalseThe ID of the agent who created the client
client_identifierstringtruefalseThe identifier for this client
client_secretstringtruefalseThe client secret. Generated automatically when created. Returned in full only during create and generate
client_typestringfalsefalseCan be "public" (default) or "confidential". If you resave the client using the UI, reverts to "public"
companystringfalsefalseThe company name of the client
create_datestringtruefalseThe time the client was created
idintegertruefalseThe ID of the client. Automatically assigned when created
namestringfalsetrueThe name of the client
redirect_urisfalsetrueA list of the valid redirect URIs for this client
scopesstringfalsetrueAllowed scopes for this client. Only supports "read" or "write"
update_datestringtruefalseThe time of the last update of the client

Example

{  "agent_id": 100000201,  "client_identifier": "X0l3DNZexuASH7gvJOdmnXyS1Rv1w5ARjqXvlLzff3894hscYx",  "client_secret": "Ay0b5u23pTuTyieXuXdoqb66xRDs1zaPEpunUD7MT4SXvx7ReWbOGPDTkinWpfgO",  "client_type": "confidential",  "company": "client company",  "create_date": "2014-09-01T10:29:59Z",  "id": 1,  "name": "client one",  "redirect_uris": "http://localhost/redirect",  "scopes": "read write",  "update_date": "2014-09-11T18:36:29Z"}

List OAuth Clients

  • GET /api/v2/oauth/clients

Lists all clients under an agent.

Allowed for

  • Administrator

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients \  -v -H "Authorization: Bearer {token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://www.zopim.com/api/v2/oauth/clients',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients"headers = {	"Content-Type": "application/json",}
response = requests.request(	"GET",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")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
[  {    "agent_id": 100000203,    "client_identifier": "X0l3DNZexuASH7gvJOdmnXyS1Rv1w5ARjqXvlLzff3894hscYx",    "client_secret": "Ay0b5u23",    "client_type": "confidential",    "company": "zendesk",    "create_date": "2014-09-01T10:29:59Z",    "id": 1,    "name": "zendesk",    "redirect_uris": "http://localhost/redirect",    "scopes": "read",    "update_date": "2014-09-11T18:36:29Z"  },  {    "agent_id": 100000200,    "client_identifier": "yaFcvgPB1a9woOt5JKSkOXu6RI5iYPGJlQKinpsI3zx4ihwVR0",    "client_secret": "KmlUs0oM",    "client_type": "confidential",    "company": "zendesk",    "create_date": "2015-09-01T10:29:59Z",    "id": 2,    "name": "zopim",    "redirect_uris": "http://localhost/redirect",    "scopes": "read write",    "update_date": "2015-09-11T18:36:29Z"  }]

Show OAuth Client

  • GET /api/v2/oauth/clients/{oauth_client_id}

Shows detail of the specified client.

Allowed for

  • Administrator

Parameters

NameTypeInRequiredDescription
oauth_client_idintegerPathtrueThe ID of the OAuth Client

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id} \  -v -H "Authorization: Bearer {token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients/1"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients/1")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://www.zopim.com/api/v2/oauth/clients/1',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients/1"headers = {	"Content-Type": "application/json",}
response = requests.request(	"GET",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients/1")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")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
{  "agent_id": 100000200,  "client_identifier": "tN1UHkG2GrmbHkgiyn3WY80acJxebbmwPimLXeIdPDgn6TCBjgD0Bhhbx4iS604s",  "client_secret": "lRmLFvyD // truncated secret",  "client_type": "confidential",  "create_date": "2015-09-01T10:29:59Z",  "id": 3,  "name": "sunshine",  "redirect_uris": "http://localhost/redirect",  "scopes": "read write",  "update_date": "2015-09-11T18:36:29Z"}

Create OAuth Client

  • POST /api/v2/oauth/clients

Creates a new OAuth2 client.

Allowed for

  • Administrator

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients \  -d '{        "name": "client2", \        "company": "client2 company" \        "scopes": "read write", \        "redirect_uris": "{your_redirect_url}"      }' \  -v -H "Authorization: Bearer {token}" \  -H "Content-Type: application/json" -X POST
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients"	method := "POST"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""""");
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("POST", body)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'POST',  url: 'https://www.zopim.com/api/v2/oauth/clients',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients"headers = {	"Content-Type": "application/json",}
response = requests.request(	"POST",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

201 Created
// Status 201 Created
{  "agent_id": 100000203,  "client_identifier": "5k6aN8tp4x53AQhRrki5UyqR271k7bhgp5tPkVXfXuFESd3XIi",  "client_secret": "ZptjrMFLAHx8846HS4astI4lcnTC0xeqScudHbuBl9fm9envuP1mUqDC5QJHVPn7 // full generated secret",  "client_type": "confidential",  "company": "client2 company",  "create_date": "2014-09-01T10:29:59Z",  "id": 256,  "name": "client2",  "redirect_uris": "{your_redirect_url}",  "scopes": "read write",  "update_date": null}

Update OAuth Client

  • PUT /api/v2/oauth/clients/{oauth_client_id}

Updates details of the specified client.

Allowed for

  • Administrator

Parameters

NameTypeInRequiredDescription
oauth_client_idintegerPathtrueThe ID of the OAuth Client

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id} \  -d '{"name": "client two"}' \  -v -H "Authorization: Bearer {token}" \  -H "Content-Type: application/json" -X PUT
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients/1"	method := "PUT"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients/1")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""""");
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("PUT", body)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'PUT',  url: 'https://www.zopim.com/api/v2/oauth/clients/1',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients/1"headers = {	"Content-Type": "application/json",}
response = requests.request(	"PUT",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients/1")request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")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
{  "agent_id": 100000203,  "client_identifier": "5k6aN8tp4x53AQhRrki5UyqR271k7bhgp5tPkVXfXuFESd3XIi",  "client_secret": "ZptjrMFL // truncated secret",  "client_type": "confidential",  "company": "client2 company",  "create_date": "2014-09-01T10:29:59Z",  "id": 256,  "name": "client two",  "redirect_uris": "{your_redirect_url}",  "scopes": "read write",  "update_date": "2014-09-11T18:36:29Z"}

Delete OAuth Client

  • DELETE /api/v2/oauth/clients/{oauth_client_id}

Deletes the specified client.

Allowed for

  • Administrator

Parameters

NameTypeInRequiredDescription
oauth_client_idintegerPathtrueThe ID of the OAuth Client

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id} \  -v -H "Authorization: Bearer {token}" -X DELETE
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients/1"	method := "DELETE"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients/1")		.newBuilder();
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("DELETE", null)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'DELETE',  url: 'https://www.zopim.com/api/v2/oauth/clients/1',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients/1"headers = {	"Content-Type": "application/json",}
response = requests.request(	"DELETE",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients/1")request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

204 No Content
// Status 204 No Content
null

Generate OAuth Client Secret

  • POST /api/v2/oauth/clients/{oauth_client_id}

Generates a new secret for the specified client.

Allowed for

  • Administrator

Parameters

NameTypeInRequiredDescription
oauth_client_idintegerPathtrueThe ID of the OAuth Client

Code Samples

curl
curl https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id}/client_secret \  -v -H "Authorization: Bearer {token}" \  -H "Content-Type: application/json" -X POST
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/oauth/clients/1"	method := "POST"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")
	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://www.zopim.com/api/v2/oauth/clients/1")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""""");
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("POST", body)		.addHeader("Content-Type", "application/json")		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'POST',  url: 'https://www.zopim.com/api/v2/oauth/clients/1',  headers: {	'Content-Type': 'application/json',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requests
url = "https://www.zopim.com/api/v2/oauth/clients/1"headers = {	"Content-Type": "application/json",}
response = requests.request(	"POST",	url,	headers=headers)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/oauth/clients/1")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")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
{  "client_secret": "n0pvvn3Mrzt5JO88nTL7pHvrHcp3zI8K13eaP2ZGeLIudA9wUnGo0vQyhOFaiKnj // full generated secret"}