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

JSON format

Visitors are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
banned boolean false false Whether the visitor is currently banned or not
created string false false The create date for the visitor
email string false false The email ID of the visitor
external_id string true false The external ID of the visitor
id integer true false The ID of the visitor
name string false false The name to be displayed for the visitor
notes string true false Any additional notes about the visitor
phone string false false The phone number of the visitor (if available)

Example

{  "banned": false,  "created": "2014-09-01T10:29:59Z",  "email": "[email protected]",  "external_id": "john_extid",  "id": 1,  "name": "Visitor 1",  "notes": "This visitor is really cool.",  "phone": "+65 12345678"}

Create Visitor

  • POST /api/v2/visitors

Allows the account owner/administrator to add more visitors

Allowed for

  • Administrator

Code Samples

curl
curl https://www.zopim.com/api/v2/visitors \  -d '{        "name": "Visitor 1",        "email": "[email protected]",        "notes": "This visitor is really cool.",        "phone": "+65 12345678"      }' \  -v -u {email_address}:{password} \  -X POST -H "Content-Type: application/json"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/visitors"	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://support.zendesk.com/api/v2/visitors")		.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://support.zendesk.com/api/v2/visitors',  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://support.zendesk.com/api/v2/visitors"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/visitors")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
{  "banned": false,  "created": "2014-09-01T10:29:59Z",  "email": "[email protected]",  "external_id": "john_extid",  "id": 1,  "name": "Visitor 1",  "notes": "This visitor is really cool.",  "phone": "+65 12345678"}

Show Visitor

  • GET /api/v2/visitors/{visitor_id}

Fetches a visitor by his or her Visitor ID

Allowed for

  • Administrator

Parameters

Name Type In Required Description
visitor_id integer Path true The ID of the visitor

Code Samples

curl
curl https://www.zopim.com/api/v2/visitors/(visitor_id) \  -v -u {email_address}:{password}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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/visitors/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
{  "banned": false,  "created": "2014-09-01T10:29:59Z",  "email": "[email protected]",  "external_id": "john_extid",  "id": 1,  "name": "Visitor 1",  "notes": "This visitor is really cool.",  "phone": "+65 12345678"}

Update Visitor

  • PUT /api/v2/visitors/{visitor_id}

Allows an account owner/admin to update details of visitor.

Allowed for

  • Administrator

Parameters

Name Type In Required Description
visitor_id integer Path true The ID of the visitor

Code Samples

curl
curl https://www.zopim.com/api/v2/visitors/{visitor_id} \  -d '{"name": "John"}' \  -v -u {email_address}:{password} \  -X PUT -H "Content-Type: application/json"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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://support.zendesk.com/api/v2/visitors/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/visitors/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
{  "banned": false,  "created": "2014-09-01T10:29:59Z",  "email": "[email protected]",  "external_id": "john_extid",  "id": 1,  "name": "John",  "notes": "This visitor is really cool.",  "phone": "+65 12345678"}