Data API

You can use these APIs to retrieve information about different objects in a page. Data APIs are supported in the following locations:

Global Data APIs

The following Data APIs can be used on both the ticket and contact details page:

loggedInUser - This API returns the agent information object of the logged in agent.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("loggedInUser").then ( function(data) { // success operation // "data" is {loggedInUser: {‘available’: “true”, ... }} }, function(error) { // failure operation } );

Sample Payload

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
{ "loggedInUser" : { "available": false, "available_since": "2017-04-18T05:27:05.000Z", "contact": { "active": true, "avatar": null, "email": "rachel @freshdesk.com", "id": "6", "job_title": "Investigator", "language": "en", "mobile": null, "name": "Rachel", "phone": null, "time_zone": "chennai" }, "created_at": "2017-03-06T07:53:08.000Z", "group_ids": [], "id": 6, "occasional": false, "role_ids": [], "signature": "<div dir="ltr"><p>rachel</p></div>", "ticket_scope": 1, "updated_at": "2017-05-10T05:56:20.000Z" } }
EXPAND ↓

The following table lists the attributes of the loggedInUser object:

ATTRIBUTE TYPE DESCRIPTION
available boolean If the agent is in a group that has enabled Automatic Ticket Assignment, this attribute will be set to true if the agent is accepting new tickets.
available_since datetime Timestamp that denotes when the agent becomes available or unavailable depending on the value of the available attribute.
contact object Contact is a customer or a potential customer who has raised a support ticket through any channel.
created_at datetime Contact creation timestamp
group_ids array of strings Group IDs associated with the agent
id number User ID of the agent
occasional boolean Set to true if this is an occasional agent (false denotes full-time)
role_ids array of strings Role IDs associated with the agent
signature string Signature of the agent in HTML format
ticket_scope number Ticket permission of the agent:
Global Access = 1
Group Access = 2
Restricted Access = 3
Current logged in agent can't update his/her ticket_scope.
updated_at datetime Agent updated timestamp

The following table lists the attributes of the contact object:
ATTRIBUTE TYPE DESCRIPTION
active boolean Set to true if the contact has been verified
avatar object Avatar of the contact
created_at datetime Contact creation timestamp
email string Primary email address of the contact. If you want to associate additional email(s) with the contact, use the other_emails attribute.
id number ID of the contact
job_title string Job title of the contact
language string Language of the contact
mobile string Mobile number of the contact
name string Name of the contact
phone string Telephone number of the contact
time_zone string Time zone in which the contact resides

The following table lists the attributes of the avatar object:

ATTRIBUTE TYPE DESCRIPTION
attachment_url string Avatar URL
content_type string Content type of the Avatar- the supported file types are .jpg, .jpeg, .jpe, and .png
created_at datetime Avatar creation timestamp
id number Unique ID of the avatar
name string Name of the avatar
size number The maximum file size is 5MB
thumb_url string Avatar’s thumb URL
updated_at datetime Avatar updated timestamp


domainName - This API returns the domain name of the current account. Freshdesk v2 APIs do not support custom CNAMEs. Hence to make API calls, it is highly recommended to use this method to obtain the Freshdesk domain name.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("domainName").then ( function(data) { // success operation // "data" is {domainName: "sample.freshdesk.com"} }, function(error) { // failure operation } );

The following table shows the attribute of the domainName object:

ATTRIBUTE TYPE DESCRIPTION
domainName string Domain of the company. Email addresses of the contacts that contain this domain will be associated with that company automatically.
Ticket Details Page APIs

The following objects can be retrieved using the data API:

ticket - This API returns the ticket object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("ticket").then ( function(data) { // success output // data is {ticket: {"subject": "support needed for..",..}} }, function(error) { // failure operation } );

Sample Payload

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
{ "ticket": { "attachments": [], "cc_emails": [], "company_id": 1, "created_at": "2017-04-12T06:05:56.000Z", "custom_fields": [{ "custom_number": null, "custom_line1": " " }], "description": "<div>Some details on the issue ..</div>", "description_text": "Some details on the issue ...", "due_by": "2017-04-15T06:05:56.000Z", "email_config_id": 3, "fr_due_by": "2017-04-13T06:05:56.000Z", "fr_escalated": true, "fwd_emails ": ["ram@freshdesk.com", "diana@freshdesk.com"], "group_id": null, "id": 25, "is_escalated": true, "priority": 1, "priority_type": "Low", "product_id": null, "reply_cc_emails": [], "requester_id": 12, "responder_id": null, "source": 1, "source_type": "email", "spam ": false, "stats": { "agent_responded_at": null, "closed_at": "2017-04-19T08:39:41.000Z", "first_responded_at": null, "pending_since": null, "requester_responded_at": null, "resolved_at": "2017-04-19T08:39:41.000Z", "status_updated_at": "2017-04-19T08:39:41.000Z" }, "status": 5, "status_type": " ", "subject": "Requesting refund", "survey_result": null, "tags": [], "to_emails": [], "type": null, "updated_at": "2017-04-19T08:39:41.000Z" } }
EXPAND ↓

The following table lists the attributes of the ticket object:

ATTRIBUTE TYPE DESCRIPTION
attachments array of objects Ticket attachments
cc_emails array of strings Email address added in the 'cc' field of the incoming ticket email.
company_id number ID of the company to which this ticket belongs
created_at datetime Ticket creation timestamp
custom_fields object Key value pairs containing the names and values of custom fields.
description string HTML content of the ticket
description_text string Content of the ticket in plain text
due_by datetime Timestamp that denotes when the ticket is due to be resolved
email_config_id number ID of email config which is used for this ticket.
fr_due_by datetime Timestamp that denotes when the first response is due
fr_escalated boolean Set to true if the ticket has been escalated as the result of the first response time being breached
fwd_emails array of strings Email address(e)s added while forwarding a ticket.
group_id number ID of the group to which the ticket has been assigned
id number Unique ID of the ticket
is_escalated boolean Set to true if the ticket has been escalated for any reason
priority number Ticket priority value
priority_label string Ticket priority text
product_id number ID of the product to which the ticket is associated
reply_cc_emails array of strings Email address added while replying to a ticket
requester_id number User ID of the requester. For existing contacts, the requester_id can be passed instead of the requester's email.
responder_id number ID of the agent to whom the ticket has been assigned.
source number The channel through which the ticket was created. This field contains the source value.
source_label string This field contains the source text.
spam boolean Set to true if the ticket has been marked as spam
stats object The stats objects contain the fields listed in table.
status number Ticket status value
status_label string Ticket status text
subject string Subject of the ticket
survey_result object Contains survey information.
tags array of strings Tags that have been associated with the ticket
to_emails array of strings Email addresses to which the ticket was originally sent
type string Helps categorize the ticket according to the different kinds of issues your support team deals with.
updated_at datetime Ticket updated timestamp

Every ticket uses certain fixed numerical values to denote its source, status, and priority. These numerical values along with their meanings are given below.

Source Value
email 1
portal 2
phone 3
forum 4
twitter 5
facebook 6
chat 7
mobihelp 8
feedback_widget 9
outbound_email 10
ecommerce 11
Status Value
Open 2
Pending 3
Resolved 4
Closed 5
Waiting on Customer 6
Waiting on Third Party 7
Priority Value
Low 1
Medium 2
High 3
Urgent 4

The following table lists the attributes of the attachments object:

ATTRIBUTE TYPE DESCRIPTION
attachment_Url string URL of the attachment
content_Type string Information on the type of the attachment, for example - image/png, text, zip, and so on
created_at datetime Attachment file creation timestamp
id number Unique ID of the attachment
name string Attachment file name
size number Attached file size
updated_at datetime Attachment updated timestamp


The following table lists the attributes of the stats object:

ATTRIBUTE TYPE DESCRIPTION
agent_responded_at datetime Agent response timestamp
closed_at datetime Ticket closed timestamp
first_responded_at datetime Agent's first response timestamp
pending_since datetime Time from which the ticket is pending
requester_responded_at datetime Requester response timestamp
resolved_at datetime Ticket resolution timestamp
status_updated_at datetime Ticket status updated timestamp
reopened_at datetime Ticket reopened timestamp


The following table lists the attributes of the survey_result object:

ATTRIBUTE TYPE DESCRIPTION
rating object This object contains default_questionfield that will have the default rating for the survey in case of both custom and classic survey.
survey_id number Survey ID of the satisfaction rating



contact - This API returns the contact object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("contact").then ( function(data) { //Success output //data: {contact: {"active": true, ...}} }, function(error) { // failure operation } );

Sample Payload

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
{ "contact": { "active": true, "address": "221 B, Baker Street, London.", "avatar": [{ "attachment_url": "<AVATAR_URL>", "content_type": "application/octet-stream", "created_at": "2015-08-28T10:27:58Z", "id": 9, "name": "lantern.png", "size": 13036, "thumb_url": "<THUMB_URL>", "updated_at": "2017-04-11T10:01:23Z" }], "created_at": "2017-03-21T09:29:28.000Z", "description": "requesting refund", "email": "rachel @freshdesk.com", "id": 12, "is_agent": false, "job_title": "Investigator", "language": "en", "mobile": "999919191999999999", "name": "Rachel", "other_companies": [], "other_emails": ["Zoeybarn@freshdesk.com", "saul@freshdesk.com"], "phone": "", "tags": ["marketing", "sales"], "time_zone": "", "twitter_id": "1Ac345", "updated_at": "2017 - 04 - 12 T06: 04: 52.000 Z", "view_all_tickets": true } }
EXPAND ↓

The following table lists the attributes of the contact object:

ATTRIBUTE TYPE DESCRIPTION
active boolean Set to true if the contact has been verified
address string Address of the contact
avatar object Avatar of the contact
company_id number ID of the primary company to which this contact belongs
created_at datetime Contact creation timestamp
description string A short description of the contact
email string Primary email address of the contact. If you want to associate additional email(s) with this contact, use the other_emails attribute
id number ID of the contact
is_agent boolean Set to true if the contact is an agent
job_title string Job title of the contact
language string Language of the contact
mobile string Mobile number of the contact
name string Name of the contact
other_companies array of objects Additional companies associated with the contact
other_emails array of strings Additional emails associated with the contact
phone string Telephone number of the contact
tags array of strings Tags associated with this contact
time_zone string Time zone in which the contact resides
twitter_id string Twitter handle of the contact
updated_at datetime Contact updated timestamp
view_all_tickets boolean Set to true if the contact can see all tickets that are associated with the company to which he belong


The following table lists the attributes of the avatar object:

ATTRIBUTE TYPE DESCRIPTION
attachment_url string Avatar URL
content_type string Content type of the Avatar- the supported file types are .jpg, .jpeg, .jpe, and .png
created_at datetime Avatar creation timestamp
id number Unique ID of the avatar
name string Name of the avatar
size number The maximum file size is 5MB
thumb_url string Avatar’s thumb URL
updated_at datetime Avatar updated timestamp


The following table lists the attributes of the other_companies object:

ATTRIBUTE TYPE DESCRIPTION
id number ID of the primary company to which this contact belongs


requester - This API returns the requester object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("requester").then ( function(data) { //Success output //data: {requester: {"active": true, ...}} }, function(error) { // failure operation } );

Sample Payload
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
{ "requester": { "active": true, "address": "221 B, Baker Street, London.", "avatar": [{ "attachment_url": "<AVATAR_URL>", "content_type": "application/octet-stream", "created_at": "2015-08-28T10:27:58Z", "id": 9, "name": "lantern.png", "size": 13036, "thumb_url": "<THUMB_URL>", "updated_at": "2017-04-11T10:01:23Z" }], "created_at": "2017-03-21T09:29:28.000Z", "description": "requesting refund", "email": "rachel @freshdesk.com", "id": 12, "is_agent": false, "job_title": "Investigator", "language": "en", "mobile": "999919191999999999", "name": "Rachel", "other_companies": [], "other_emails": ["Zoeybarn@freshdesk.com", "saul@freshdesk.com"], "phone": "", "tags": ["marketing", "sales"], "time_zone": "", "twitter_id": "1Ac345", "updated_at": "2017 - 04 - 12 T06: 04: 52.000 Z", "view_all_tickets": true } }
EXPAND ↓

Both contact and requester object will return the same payload, to view the list of attributes, see the contact table.


company - This API will return the company object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("company").then ( function(data) { //Success output //data: {company: {"name": "supernova", ...}} }, function(error) { // failure operation } );

Sample Payload

1
2
3
4
5
6
7
8
9
10
11
{ "company": { "created_at": "2017-04-06T09:44:38.000Z", "description": "Acme corp is a multinational technology company that specializes...", "domains": ["Acmecorp.com"], "id": 12, "name": "Acme Corporation", "note": "Company that provides....", "updated_at": "2017-04-11T07:13:23.000Z" } }
EXPAND ↓

The following table lists the attributes of the company object:

ATTRIBUTE TYPE DESCRIPTION
created_at datetime Company created timestamp
description string A short description of the company
domains array of strings Domains of the company. Email addresses of contacts that contain this domain will be associated with that company automatically.
id number Unique ID of the company
name string Name of the company
note string Any specific note about the company
updated_at datetime Company updated timestamp


group - This API will return the group object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("group").then ( function(data) { //Success output //data: {group: {"id": 2, ...}} }, function(error) { // failure operation } );

Sample Payload

1
2
3
4
5
6
7
{ "group": { "agent_ids": [6, 8], "id": 7, "name": "Product Management" } }

The following table lists the attributes of the group object:

ATTRIBUTE TYPE DESCRIPTION
agent_ids array of numbers Array of agent user IDs separated by commas.
id number Unique ID of the group
name string Name of the group

Contact Details Page APIs

The APIs that are supported in Contact Details Page are:

contact - This API returns the contact object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("contact").then ( function(data) { //Success output //data: {contact: {"active": true, ...}} }, function(error) { // failure operation } );

Sample Payload
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
{ "contact": { "active": true, "address": "221 B, Baker Street, London.", "avatar": [{ "attachment_url": "<AVATAR_URL>", "content_type": "application/octet-stream", "created_at": "2015-08-28T10:27:58Z", "id": 9, "name": "lantern.png", "size": 13036, "thumb_url": "<THUMB_URL>", "updated_at": "2017-04-11T10:01:23Z" }], "created_at": "2017-03-21T09:29:28.000Z", "custom_fields": null, "description": "requesting refund", "email": "rachel @freshdesk.com", "id": 12, "is_agent": false, "job_title": "Investigator", "language": "en", "mobile": "999919191999999999", "name": "Rachel", "other_companies": [], "other_emails": ["Zoeybarn@freshdesk.com", "saul@freshdesk.com"], "phone": "", "tags": ["marketing", "sales"], "time_zone": "", "twitter_id": "1Ac345", "updated_at": "2017 - 04 - 12 T06: 04: 52.000 Z", "view_all_tickets": true } }
EXPAND ↓

The following table lists the attributes of the contact object:

ATTRIBUTE TYPE DESCRIPTION
active boolean Set to true if the contact has been verified
address string Address of the contact
avatar object Avatar of the contact
company_id number ID of the primary company to which this contact belongs
created_at datetime Contact creation timestamp
custom_fields object Key value pair containing the name and value of the custom fields.
description string A short description of the contact
email string Primary email address of the contact. If you want to associate additional email(s) with this contact, use the other_emails attribute
id number ID of the contact
is_agent boolean Set to true if the contact is an agent
job_title string Job title of the contact
language string Language of the contact
mobile string Mobile number of the contact
name string Name of the contact
other_companies array of objects Additional companies associated with the contact
other_emails array of strings Additional emails associated with the contact
phone string Telephone number of the contact
tags array of strings Tags associated with this contact
time_zone string Time zone in which the contact resides
twitter_id string Twitter handle of the contact
updated_at datetime Contact updated timestamp
view_all_tickets boolean Set to true if the contact can see all tickets that are associated with the company to which he belong


The following table lists the attributes of the avatar object:

ATTRIBUTE TYPE DESCRIPTION
attachment_url string Avatar URL
content_type string Content type of the Avatar- the supported file types are .jpg, .jpeg, .jpe, and .png
created_at datetime Avatar creation timestamp
id number Unique ID of the avatar
name string Name of the avatar
size number The maximum file size is 5MB
thumb_url string Avatar’s thumb URL
updated_at datetime Avatar updated timestamp


The following table lists the attributes of the other_companies object:

ATTRIBUTE TYPE DESCRIPTION
id number ID of the primary company to which this contact belongs
name string Name of the company
view_all_tickets boolean Set to true if the contact can see all tickets that are associated with the company to which he belong



company - This API will return the company object:

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("company").then ( function(data) { //Success output //data: {company: {"name": "Acme Corporation", ...}} }, function(error) { // failure operation } );

Sample Payload

1
2
3
4
5
6
{ "company": { "id": 12, "name": "Acme Corporation" } }
EXPAND ↓

The following table lists the attributes of the company object:

ATTRIBUTE TYPE DESCRIPTION
id number Unique ID of the company
name string Name of the company

Log in with your Freshdesk account

Enter your helpdesk URL to proceed to login

Proceed

By clicking "Proceed", you agree to our Terms of Use.