Organizations
Just as agents can be segmented into groups in Zendesk Support, your customers (end-users) can be segmented into organizations. You can manually assign customers to an organization or automatically assign them to an organization by their email address domain. Organizations can be used in business rules to route tickets to groups of agents or to send email notifications.
JSON format
Organizations are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | true | false | The time the organization was created |
details | string | false | false | Any details obout the organization, such as the address |
domain_names | array | false | false | An array of domain names associated with this organization |
external_id | string | false | false | A unique external id to associate organizations to an external record. The id is case-insensitive. For example, "company1" and "Company1" are considered the same |
group_id | integer | false | false | New tickets from users in this organization are automatically put in this group |
id | integer | false | false | Automatically assigned when the organization is created |
name | string | false | true | A unique name for the organization |
notes | string | false | false | Any notes you have about the organization |
organization_fields | object | false | false | Custom fields for this organization. See Custom organization fields |
shared_comments | boolean | false | false | End users in this organization are able to comment on each other's tickets |
shared_tickets | boolean | false | false | End users in this organization are able to see each other's tickets |
tags | array | false | false | The tags of the organization |
updated_at | string | true | false | The time of the last update of the organization |
url | string | true | false | The API url of this organization |
Custom organization fields
The examples on this page use standard fields for various requests. If you want to use custom organization fields (organization_fields
) in your updates, see the organization_fields
property in the following example to properly format your requests.
Example
{
"created_at": "2009-07-20T22:55:29Z",
"details": "This is a kind of organization",
"domain_names": [
"example.com",
"test.com"
],
"external_id": "ABC123",
"group_id": null,
"id": 35436,
"name": "One Organization",
"notes": "",
"organization_fields": {
"org_decimal": 5.2,
"org_dropdown": "option_1"
},
"shared_comments": true,
"shared_tickets": true,
"tags": [
"enterprise",
"other_tag"
],
"updated_at": "2011-05-05T10:38:52Z",
"url": "https://company.zendesk.com/api/v2/organizations/35436.json"
}
List Organizations
GET /api/v2/organizations
GET /api/v2/users/{user_id}/organizations.json
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Returns a maximum of 100 records per page.
Allowed For
- Agents, with certain restrictions
If the agent has a custom agent role that restricts their access to only users in their own organization, a 403 Forbidden error is returned. See Creating custom agent roles in Zendesk help.
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/organizations.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/organizations"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
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://example.zendesk.com/api/v2/organizations")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/organizations',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/organizations"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/organizations")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"count": 2,
"next_page": null,
"organizations": [
{
"created_at": "2018-11-14T00:14:52Z",
"details": "caterpillar =)",
"domain_names": [
"remain.com"
],
"external_id": "ABC198",
"group_id": 1835962,
"id": 4112492,
"name": "Groablet Enterprises",
"notes": "donkey",
"organization_fields": {
"datepudding": "2018-11-04T00:00:00+00:00",
"org_field_1": "happy happy",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"smiley",
"teapot_kettle"
],
"updated_at": "2018-11-14T00:54:22Z",
"url": "https://example.zendesk.com/api/v2/organizations/4112492.json"
},
{
"created_at": "2017-08-14T20:13:52Z",
"details": "test",
"domain_names": [
"test.com"
],
"external_id": "TTV273",
"group_id": null,
"id": 1873,
"name": "Willy Wonkas Chocolate Factory",
"notes": "",
"organization_fields": {
"datepudding": "2018-11-02T00:00:00+00:00",
"org_field_1": "malarky",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"teapot_kettle"
],
"updated_at": "2019-05-16T01:27:46Z",
"url": "https://example.zendesk.com.com/api/v2/organizations/1873.json"
}
],
"previous_page": null
}
Count Organizations
GET /api/v2/organizations/count
GET /api/v2/users/{user_id}/organizations/count.json
Returns an approximate count of organizations. If the count exceeds 100,000, it is updated every 24 hours.
The refreshed_at
property of the count
object is a timestamp that indicates
when the count was last updated.
When the count exceeds 100,000, the refreshed_at
property may
occasionally be null. This indicates that the count is being
updated in the background and the value
property of the count
object is limited to
100,000 until the update is complete.
Allowed For
- Agents
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/organizations/count.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/organizations/count"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
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://example.zendesk.com/api/v2/organizations/count")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/organizations/count',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/organizations/count"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/organizations/count")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"count": {
"refreshed_at": "2020-04-06T02:18:17Z",
"value": 102
}
}
Autocomplete Organizations
GET /api/v2/organizations/autocomplete?name={name}
Returns an array of organizations whose name starts with the
value specified in the name
parameter.
Pagination
- Offset pagination only
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
field_id | string | Query | false | The id of a lookup relationship field. The type of field is determined by the source param |
name | string | Query | true | A substring of an organization to search for |
source | string | Query | false | If a field_id is provided, this specifies the type of the field. For example, if the field is on a "zen:user", it references a field on a user |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/organizations/autocomplete.json?name=imp \
-u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/organizations/autocomplete?field_id=&name=imp&source="
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
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://example.zendesk.com/api/v2/organizations/autocomplete")
.newBuilder()
.addQueryParameter("field_id", "")
.addQueryParameter("name", "imp")
.addQueryParameter("source", "");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/organizations/autocomplete',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'field_id': '',
'name': 'imp',
'source': '',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/organizations/autocomplete?field_id=&name=imp&source="
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/organizations/autocomplete")
uri.query = URI.encode_www_form("field_id": "", "name": "imp", "source": "")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"count": 2,
"next_page": null,
"organizations": [
{
"created_at": "2018-11-14T00:14:52Z",
"details": "caterpillar =)",
"domain_names": [
"remain.com"
],
"external_id": null,
"group_id": 1835962,
"id": 35436,
"name": "Important Customers",
"notes": "donkey",
"organization_fields": {
"datepudding": "2018-11-04T00:00:00+00:00",
"org_field_1": "happy happy",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"smiley",
"teapot_kettle"
],
"updated_at": "2018-11-14T00:54:22Z",
"url": "https://example.zendesk.com/api/v2/organizations/4112492.json"
},
{
"created_at": "2017-08-14T20:13:52Z",
"details": "test",
"domain_names": [
"test.com"
],
"external_id": null,
"group_id": null,
"id": 20057623,
"name": "Imperial College",
"notes": "",
"organization_fields": {
"datepudding": "2018-11-02T00:00:00+00:00",
"org_field_1": "malarky",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"teapot_kettle"
],
"updated_at": "2019-05-16T01:27:46Z",
"url": "https://example.zendesk.com.com/api/v2/organizations/1873.json"
}
],
"previous_page": null
}
400 Bad Request
// Status 400 Bad Request
{
"errors": [
{
"code": "QueryError",
"title": "Invalid type:sample_type"
}
]
}
429 Too Many Requests
// Status 429 Too Many Requests
{
"errors": [
{
"code": "TooManyRequests",
"title": "Too many requests to autocomplete"
}
]
}
500 Internal Server Error
// Status 500 Internal Server Error
{
"errors": [
{
"code": "Unavailable",
"title": "Internal Server Error"
}
]
}
Search Organizations
GET /api/v2/organizations/search
Returns an array of organizations matching the criteria. You may search by an organization's external_id
or name
, but not both:
Searching by external_id
If you set the external_id
value of an organization to associate it to an external record, you can use it to search for the organization.
For an organization to be returned, its external_id
must exactly match the value provided (case insensitive).
Searching by name
For an organization to be returned, its name
must exactly match the value provided (case insensitive).
Allowed For:
- Admins
- Agents assigned to a custom role with permissions to add or modify organizations (Enterprise only)
See Creating custom agent roles in the Support Help Center.
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
external_id | integer | Query | false | The external id of an organization |
name | string | Query | false | The name of an organization |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/organizations/search.json?external_id={external_id} \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/organizations/search?external_id=1234&name=ACME+Incorporated"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
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://example.zendesk.com/api/v2/organizations/search")
.newBuilder()
.addQueryParameter("external_id", "1234")
.addQueryParameter("name", "ACME Incorporated");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/organizations/search',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'external_id': '1234',
'name': 'ACME+Incorporated',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/organizations/search?external_id=1234&name=ACME+Incorporated"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/organizations/search")
uri.query = URI.encode_www_form("external_id": "1234", "name": "ACME Incorporated")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
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
{
"count": 2,
"next_page": null,
"organizations": [
{
"created_at": "2018-11-14T00:14:52Z",
"details": "caterpillar =)",
"domain_names": [
"remain.com"
],
"external_id": "ABC198",
"group_id": 1835962,
"id": 4112492,
"name": "Groablet Enterprises",
"notes": "donkey",
"organization_fields": {
"datepudding": "2018-11-04T00:00:00+00:00",
"org_field_1": "happy happy",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"smiley",
"teapot_kettle"
],
"updated_at": "2018-11-14T00:54:22Z",
"url": "https://example.zendesk.com/api/v2/organizations/4112492.json"
},
{
"created_at": "2017-08-14T20:13:52Z",
"details": "test",
"domain_names": [
"test.com"
],
"external_id": "TTV273",
"group_id": null,
"id": 1873,
"name": "Willy Wonkas Chocolate Factory",
"notes": "",
"organization_fields": {
"datepudding": "2018-11-02T00:00:00+00:00",
"org_field_1": "malarky",
"org_field_2": "teapot_kettle"
},
"shared_comments": false,
"shared_tickets": false,
"tags": [
"teapot_kettle"
],
"updated_at": "2019-05-16T01:27:46Z",
"url": "https://example.zendesk.com.com/api/v2/organizations/1873.json"
}
],
"previous_page": null
}
Show Organization's Related Information
GET /api/v2/organizations/{organization_id}/related
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
organization_id | integer | Path | true | The ID of an organization |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/organizations/{organization_id}/related.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/organizations/16/related"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
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://example.zendesk.com/api/v2/organizations/16/related")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/organizations/16/related',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/organizations/16/related"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"