You can use the API to get or set account information.

If you created your Zendesk Chat account in Zendesk Support, access to the Chat Accounts and Agents APIs is restricted to GET requests. You can still use the other Chat APIs normally.

JSON format

Accounts are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
account_keystringtruefalseThe widget key for the account
billingobjectfalsefalseThe billing information of the account (only available to the owner of the account)
create_datestringtruefalseThe date of creation of the account
planobjecttruefalseInformation about the package of the account
statusstringtruefalseThe status of the account

Example

{  "account_key": "zendesk-chat-account-key",  "billing": {},  "create_date": "2014-08-06T11:02:09Z",  "plan": {},  "status": "active"}

Show Account

  • GET /api/v2/account

Shows all the information about your account.

Allowed for

  • Admin

Code Samples

curl
curl https://www.zopim.com/api/v2/account \  -v -H "Authorization: Bearer {token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.com/api/v2/account"	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/account")		.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/account',  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/account"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/account")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
{  "account_key": "zendesk-chat-account-key",  "billing": {    "additional_info": "",    "address1": "123 Fictional Street",    "address2": "",    "city": "West Fiction",    "company": "John and Friends",    "country_code": "US",    "cycle": 1,    "email": "[email protected]",    "first_name": "Jonathan",    "last_name": "Doe",    "phone": "+12(1)123456",    "postal_code": "12345",    "state": "Oklahoma"  },  "create_date": "2014-08-06T11:02:09Z",  "plan": {    "analytics": false,    "file_upload": true,    "integrations": true,    "long_desc": "Ideal for most Lean Teams to Engage Customers.",    "max_advanced_triggers": 2,    "max_agents": 2,    "max_basic_triggers": 2,    "max_concurrent_chats": "unlimited",    "max_departments": 2,    "max_history_search_days": "unlimited",    "name": "team",    "operating_hours": false,    "short_desc": "Great for Lean Teams",    "weekly_reports": false,    "widget_customization": "full"  },  "status": "active"}

Update Account

  • PUT /api/v2/account

Updates the details of your account.

Allowed for

  • Owner

Example body

{  "billing": {    "email": "[email protected]",    "first_name": "John"  }}

Code Samples

curl
curl https://www.zopim.com/api/v2/account \  -d '{"billing": {"email": "[email protected]", "first_name": "John"}}' \  -v -H "Authorization: Bearer {token}" \  -H "Content-Type: application/json" -X PUT
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://www.zopim.com/api/v2/account"	method := "PUT"	payload := strings.NewReader(`{  "billing": {    "email": "[email protected]",    "first_name": "John"  }}`)	req, err := http.NewRequest(method, url, payload)
	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/account")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"billing\": {    \"email\": \"johndoe@zendesk.com\",    \"first_name\": \"John\"  }}""");
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 data = JSON.stringify({  "billing": {    "email": "[email protected]",    "first_name": "John"  }});
var config = {  method: 'PUT',  url: 'https://www.zopim.com/api/v2/account',  headers: {	'Content-Type': 'application/json',  },  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://www.zopim.com/api/v2/account"
payload = json.loads("""{  "billing": {    "email": "[email protected]",    "first_name": "John"  }}""")headers = {	"Content-Type": "application/json",}
response = requests.request(	"PUT",	url,	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"uri = URI("https://www.zopim.com/api/v2/account")request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")request.body = %q({  "billing": {    "email": "[email protected]",    "first_name": "John"  }})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
{  "account_key": "zendesk-chat-account-key",  "billing": {    "first_name": "John",    "last_name": "[email protected]"  },  "create_date": "2014-08-06T11:02:09Z",  "plan": {    "file_upload": true  },  "status": "active"}