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

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

JSON format

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

Name Type Read-only Mandatory Description
agent_id integer true false The ID of the agent who created the client
client_identifier string true false The identifier for this client
client_secret string true false The client secret. Generated automatically when created. Returned in full only during create and generate
client_type string false false Can be "public" (default) or "confidential". If you resave the client using the UI, reverts to "public"
company string false false The company name of the client
create_date string true false The time the client was created
id integer true false The ID of the client. Automatically assigned when created
name string false true The name of the client
redirect_uris false true A list of the valid redirect URIs for this client
scopes string false true Allowed scopes for this client. Only supports "read" or "write"
update_date string true false The 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

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients"method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'GET',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.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:truedo|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

Name Type In Required Description
oauth_client_id integer Path true The ID of the OAuth Client

Code Samples

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id}\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients/1"method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients/1").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'GET',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.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:truedo|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

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients\-d'{"name": "client2", \"company": "client2 company" \“范围”:“read write", \"redirect_uris": "{your_redirect_url}"}'\-v -u{email_address}:{password}\-X POST -H"Content-Type: application/json"
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients"method:="POST"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("POST",body).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'POST',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.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:truedo|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

Name Type In Required Description
oauth_client_id integer Path true The ID of the OAuth Client

Code Samples

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id}\-d'{"name": "client two"}'\-v -u{email_address}:{password}\-X PUT -H"Content-Type: application/json"
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients/1"method:="PUT"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients/1").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("PUT",body).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'PUT',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.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:truedo|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"}

删除OAuth Client

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

删除s the specified client.

Allowed for

  • Administrator

Parameters

Name Type In Required Description
oauth_client_id integer Path true The ID of the OAuth Client

Code Samples

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id}\-v -u{email_address}:{password}-X DELETE
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients/1"method:="DELETE"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients/1").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("DELETE",null).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'DELETE',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.com/api/v2/oauth/clients/1")request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

204 No Content
              
// Status 204 No Contentnull

Generate OAuth Client Secret

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

Generates a new secret for the specified client.

Allowed for

  • Administrator

Parameters

Name Type In Required Description
oauth_client_id integer Path true The ID of the OAuth Client

Code Samples

旋度
              
旋度https://www.zopim.com/api/v2/oauth/clients/{oauth_client_id}/client_secret\-v -u{email_address}:{password}\-X POST -H"Content-Type: application/json"
Go
              
import("fmt""io""net/http")funcmain(){url:="https://support.zendesk.com/api/v2/oauth/clients/1"method:="POST"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")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/oauth/clients/1").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("POST",body).addHeader("Content-Type","application/json").build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'POST',url:'https://support.zendesk.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
              
importrequestsurl="https://support.zendesk.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://support.zendesk.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:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"client_secret":"n0pvvn3Mrzt5JO88nTL7pHvrHcp3zI8K13eaP2ZGeLIudA9wUnGo0vQyhOFaiKnj // full generated secret"}