Fields

Company objects have the following fields and links:

Fields

field name description
id string identifier for this object
name Name of the company
domains Array of top level domain names (ie. desk.com, british.co.uk). Pass an array of domains to replace the set of domains for the company. An empty array will clear all domains from the company.
created_at Date the company was created
updated_at Date the company was updated
custom_fields Hash of values for custom fields
external_id unique external identifier to reference this company with an external system

Links

rel class embeddable? description
self company no this company
customers customer no list of customers belonging to this company
cases case no list of cases belonging to this company

List

Retrieve a paginated list of all companies.

GET https://yoursite.desk.com/api/v2/companies

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Limits

The maximum page parameter value for this endpoint is currently 500.

Example Curl Request

1
2
3
$ curl https://yoursite.desk.com/api/v2/companies \
    -u email:password \
    -H 'Accept: application/json'

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  "total_entries": 2,
  "page": 1,
  "_links": {
    "self": {
      "href": "/api/v2/companies?page=1&per_page=50",
      "class": "page"
    },
    "first": {
      "href": "/api/v2/companies?page=1&per_page=50",
      "class": "page"
    },
    "last": {
      "href": "/api/v2/companies?page=1&per_page=50",
      "class": "page"
    },
    "next": null,
    "previous": null
  },
  "_embedded": {
    "entries": [
      {
        "name": "Acme Inc",
        "domains": [
          "acmeinc.com",
          "acmeinc.net"
        ],
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:06:17Z",
        "custom_fields": {
          "employer_id": "123456789"
        },
        "_links": {
          "self": {
            "href": "/api/v2/companies/1",
            "class": "company"
          },
          "customers": {
            "href": "/api/v2/companies/1/customers",
            "class": "customer"
          },
          "cases": {
            "href": "/api/v2/companies/1/cases",
            "class": "case"
          }
        }
      },
      {
        "name": "Desk.com",
        "domains": [
          "desk.com",
          "salesforce.com"
        ],
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:06:17Z",
        "custom_fields": {
          "employer_id": "123456789"
        },
        "_links": {
          "self": {
            "href": "/api/v2/companies/2",
            "class": "company"
          },
          "customers": {
            "href": "/api/v2/companies/2/customers",
            "class": "customer"
          },
          "cases": {
            "href": "/api/v2/companies/2/cases",
            "class": "case"
          }
        }
      }
    ]
  }
}

Show

Retrieve a single company.

GET https://yoursite.desk.com/api/v2/companies/:id

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Example Curl Request

1
2
3
$ curl https://yoursite.desk.com/api/v2/companies/:id \
    -u email:password \
    -H 'Accept: application/json'

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
  "name": "Acme Inc",
  "domains": [
    "acmeinc.com",
    "acmeinc.net"
  ],
  "created_at": "2016-09-22T16:06:17Z",
  "updated_at": "2016-09-22T16:06:17Z",
  "custom_fields": {
    "employer_id": "123456789"
  },
  "_links": {
    "self": {
      "href": "/api/v2/companies/1",
      "class": "company"
    },
    "customers": {
      "href": "/api/v2/companies/1/customers",
      "class": "customer"
    },
    "cases": {
      "href": "/api/v2/companies/1/cases",
      "class": "case"
    }
  }
}

Create

Create a new company.

POST https://yoursite.desk.com/api/v2/companies

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Fields

field name description
name Name of the company
domains Array of top level domain names (ie. desk.com, british.co.uk). Pass an array of domains to replace the set of domains for the company. An empty array will clear all domains from the company.
created_at Date the company was created
updated_at Date the company was updated
custom_fields Hash of values for custom fields

Example Curl Request

1
2
3
4
5
6
$ curl https://yoursite.desk.com/api/v2/companies \
    -u email:password \
    -X POST \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{"name":"Acme Inc"}'

Example Request Body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "name": "Acme Inc",
  "domains": [
    "acmeinc.com",
    "acmeinc.net"
  ],
  "custom_fields": {
    "employer_id": "123456789"
  }
}

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
  "name": "Acme Inc",
  "domains": [
    "acmeinc.com",
    "acmeinc.net"
  ],
  "created_at": "2016-09-22T16:06:17Z",
  "updated_at": "2016-09-22T16:06:17Z",
  "custom_fields": {
    "employer_id": "123456789"
  },
  "_links": {
    "self": {
      "href": "/api/v2/companies/1",
      "class": "company"
    },
    "customers": {
      "href": "/api/v2/companies/1/customers",
      "class": "customer"
    },
    "cases": {
      "href": "/api/v2/companies/1/cases",
      "class": "case"
    }
  }
}

Update

Update a company.

PATCH https://yoursite.desk.com/api/v2/companies/:id

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Example Curl Request

1
2
3
4
5
6
$ curl https://yoursite.desk.com/api/v2/companies/:id \
    -u email:password \
    -X PATCH \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{"name":"Acme Enterprises"}'

Example Request Body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "name": "Acme Enterprises",
  "domains": [
    "acme-ent.com",
    "acmeinc.com",
    "acmeinc.net"
  ],
  "custom_fields": {
    "employer_id": "987654321"
  }
}

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "name": "Acme Enterprises",
  "domains": [
    "acme-ent.com",
    "acmeinc.com",
    "acmeinc.net"
  ],
  "created_at": "2016-09-22T16:06:17Z",
  "updated_at": "2016-09-22T16:06:17Z",
  "custom_fields": {
    "employer_id": "987654321"
  },
  "_links": {
    "self": {
      "href": "/api/v2/companies/1",
      "class": "company"
    },
    "customers": {
      "href": "/api/v2/companies/1/customers",
      "class": "customer"
    },
    "cases": {
      "href": "/api/v2/companies/1/cases",
      "class": "case"
    }
  }
}

List Cases

Retrieve a paginated list of cases for this company.

GET https://yoursite.desk.com/api/v2/companies/:company_id/cases

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Fields

Please see Case Fields for details on the specific fields.

Limits

The maximum page parameter value for this endpoint is currently 500. See Case list for more information.

Example Curl Request

1
2
3
$ curl https://yoursite.desk.com/api/v2/companies/1/cases \
    -u email:password \
    -H 'Accept: application/json'

Example Response

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{
  "total_entries": 2,
  "page": 1,
  "_links": {
    "self": {
      "href": "/api/v2/companies/1/cases?page=1&per_page=50",
      "class": "page"
    },
    "first": {
      "href": "/api/v2/companies/1/cases?page=1&per_page=50",
      "class": "page"
    },
    "last": {
      "href": "/api/v2/companies/1/cases?page=1&per_page=50",
      "class": "page"
    },
    "next": null,
    "previous": null
  },
  "_embedded": {
    "entries": [
      {
        "id": 1,
        "external_id": null,
        "blurb": null,
        "subject": "Welcome",
        "priority": 5,
        "locked_until": null,
        "description": null,
        "status": "new",
        "type": "email",
        "labels": [

        ],
        "label_ids": [

        ],
        "language": "en_us",
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:11:17Z",
        "changed_at": "2016-09-22T16:10:17Z",
        "active_at": "2016-09-22T16:11:17Z",
        "received_at": "2016-09-22T16:06:17Z",
        "first_opened_at": "2016-09-22T16:07:17Z",
        "opened_at": "2016-09-22T16:08:17Z",
        "first_resolved_at": "2016-09-22T16:11:17Z",
        "resolved_at": "2016-09-22T16:11:17Z",
        "custom_fields": {
          "level": "vip"
        },
        "_links": {
          "self": {
            "href": "/api/v2/cases/1",
            "class": "case"
          },
          "message": {
            "href": "/api/v2/cases/1/message",
            "class": "message"
          },
          "customer": {
            "href": "/api/v2/customers/1",
            "class": "customer"
          },
          "assigned_user": {
            "href": "/api/v2/users/2",
            "class": "user"
          },
          "assigned_group": {
            "href": "/api/v2/groups/1",
            "class": "group"
          },
          "locked_by": null,
          "replies": {
            "href": "/api/v2/cases/1/replies",
            "class": "reply"
          },
          "draft": {
            "href": "/api/v2/cases/1/replies/draft",
            "class": "reply"
          },
          "notes": {
            "href": "/api/v2/cases/1/notes",
            "class": "note"
          },
          "history": {
            "href": "/api/v2/cases/1/history",
            "class": "history"
          },
          "macro_preview": {
            "href": "/api/v2/cases/1/macros/preview",
            "class": "macro_preview"
          },
          "attachments": {
            "href": "/api/v2/cases/1/attachments",
            "class": "attachment"
          }
        }
      },
      {
        "id": 1,
        "external_id": null,
        "blurb": null,
        "subject": "Help Please!",
        "priority": 5,
        "locked_until": null,
        "description": null,
        "status": "new",
        "type": "email",
        "labels": [

        ],
        "label_ids": [

        ],
        "language": "en_us",
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:11:17Z",
        "changed_at": "2016-09-22T16:10:17Z",
        "active_at": "2016-09-22T16:11:17Z",
        "received_at": "2016-09-22T16:06:17Z",
        "first_opened_at": "2016-09-22T16:07:17Z",
        "opened_at": "2016-09-22T16:08:17Z",
        "first_resolved_at": "2016-09-22T16:11:17Z",
        "resolved_at": "2016-09-22T16:11:17Z",
        "custom_fields": {
          "level": "vip"
        },
        "_links": {
          "self": {
            "href": "/api/v2/cases/2",
            "class": "case"
          },
          "message": {
            "href": "/api/v2/cases/1/message",
            "class": "message"
          },
          "customer": {
            "href": "/api/v2/customers/1",
            "class": "customer"
          },
          "assigned_user": {
            "href": "/api/v2/users/2",
            "class": "user"
          },
          "assigned_group": {
            "href": "/api/v2/groups/1",
            "class": "group"
          },
          "locked_by": null,
          "replies": {
            "href": "/api/v2/cases/1/replies",
            "class": "reply"
          },
          "draft": {
            "href": "/api/v2/cases/1/replies/draft",
            "class": "reply"
          },
          "notes": {
            "href": "/api/v2/cases/1/notes",
            "class": "note"
          },
          "history": {
            "href": "/api/v2/cases/1/history",
            "class": "history"
          },
          "macro_preview": {
            "href": "/api/v2/cases/1/macros/preview",
            "class": "macro_preview"
          },
          "attachments": {
            "href": "/api/v2/cases/1/attachments",
            "class": "attachment"
          }
        }
      }
    ]
  }
}

List Customers

Retrieve a paginated list of customers for this company.

GET https://yoursite.desk.com/api/v2/companies/:company_id/customers

Applicable Roles

Agent, Reporting Agent, Workflow Manager, Knowledgebase Manager, Content Manager, Business Manager, Administrative Manager, Administrator, Knowledgebase Adminstrator, and Billing Administrator

Fields

Please see Customer Fields for details on the specific fields.

Limits

The maximum page parameter value for this endpoint is currently 500. See Customer list for more information.

Example Curl Request

1
2
3
$ curl https://yoursite.desk.com/api/v2/companies/1/customers \
    -u email:password \
    -H 'Accept: application/json'

Example Response

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
  "total_entries": 2,
  "page": 1,
  "_links": {
    "self": {
      "href": "/api/v2/companies/1/customers?page=1&per_page=50",
      "class": "page"
    },
    "first": {
      "href": "/api/v2/companies/1/customers?page=1&per_page=50",
      "class": "page"
    },
    "last": {
      "href": "/api/v2/companies/1/customers?page=1&per_page=50",
      "class": "page"
    },
    "next": null,
    "previous": null
  },
  "_embedded": {
    "entries": [
      {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "company": "ACME, Inc",
        "title": "Senior Ninja",
        "external_id": null,
        "background": "This guy can be a challenge to work with",
        "language": "en_us",
        "locked_until": null,
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:06:17Z",
        "custom_fields": {
          "level": "vip"
        },
        "access_private_portal": true,
        "access_company_cases": true,
        "emails": [
          {
            "type": "work",
            "value": "john@acme.com"
          },
          {
            "type": "home",
            "value": "john@home.com"
          }
        ],
        "phone_numbers": [
          {
            "type": "work",
            "value": "123-456-7890"
          }
        ],
        "addresses": [
          {
            "type": "work",
            "value": "123 Main St, San Francisco, CA 94105"
          }
        ],
        "_links": {
          "self": {
            "href": "/api/v2/customers/1",
            "class": "customer"
          },
          "cases": {
            "href": "/api/v2/customers/1/cases",
            "class": "case"
          },
          "company": {
            "href": "/api/v2/companies/1",
            "class": "company"
          },
          "facebook_user": {
            "href": "/api/v2/facebook_users/1",
            "class": "facebook_user"
          },
          "twitter_user": {
            "href": "/api/v2/twitter_users/1",
            "class": "twitter_user"
          },
          "locked_by": null
        }
      },
      {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "company": "ACME, Inc",
        "title": "Senior Ninja",
        "external_id": null,
        "background": "This guy can be a challenge to work with",
        "language": "en_us",
        "locked_until": null,
        "created_at": "2016-09-22T16:06:17Z",
        "updated_at": "2016-09-22T16:06:17Z",
        "custom_fields": {
          "level": "vip"
        },
        "access_private_portal": true,
        "access_company_cases": true,
        "emails": [
          {
            "type": "work",
            "value": "john@acme.com"
          },
          {
            "type": "home",
            "value": "john@home.com"
          }
        ],
        "phone_numbers": [
          {
            "type": "work",
            "value": "123-456-7890"
          }
        ],
        "addresses": [
          {
            "type": "work",
            "value": "123 Main St, San Francisco, CA 94105"
          }
        ],
        "_links": {
          "self": {
            "href": "/api/v2/customers/2",
            "class": "customer"
          },
          "cases": {
            "href": "/api/v2/customers/1/cases",
            "class": "case"
          },
          "company": {
            "href": "/api/v2/companies/1",
            "class": "company"
          },
          "facebook_user": {
            "href": "/api/v2/facebook_users/1",
            "class": "facebook_user"
          },
          "twitter_user": {
            "href": "/api/v2/twitter_users/1",
            "class": "twitter_user"
          },
          "locked_by": null
        }
      }
    ]
  }
}