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

JSON format

Visitors are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
bannedbooleanfalsefalseWhether the visitor is currently banned or not
createdstringfalsefalseThe create date for the visitor
emailstringfalsefalseThe email ID of the visitor
external_idstringtruefalseThe external ID of the visitor
idintegertruefalseThe ID of the visitor
namestringfalsefalseThe name to be displayed for the visitor
notesstringtruefalseAny additional notes about the visitor
phonestringfalsefalseThe 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 -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/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://www.zopim.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://www.zopim.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://www.zopim.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://www.zopim.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

NameTypeInRequiredDescription
visitor_idintegerPathtrueThe ID of the visitor

Code Samples

curl
curl https://www.zopim.com/api/v2/visitors/(visitor_id) \  -v -H "Authorization: Bearer {token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://www.zopim.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://www.zopim.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://www.zopim.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://www.zopim.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://www.zopim.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

NameTypeInRequiredDescription
visitor_idintegerPathtrueThe ID of the visitor

Code Samples

curl
curl https://www.zopim.com/api/v2/visitors/{visitor_id} \  -d '{"name": "John"}' \  -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/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://www.zopim.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://www.zopim.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://www.zopim.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://www.zopim.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"}