Data API

You can use these APIs to retrieve information about different objects on a page.

Global Data APIs

The following objects can be used in all locations and retrieved using data APIs:

loggedInUser - Returns information of a logged in user.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("loggedInUser").then ( function(data) { // success operation }, function(error) { // failure operation } );
Sample Payload EXPAND ↓
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
{ "loggedInUser":{ "id":21628, "display_name":"Sample user", "email":"sample@freshsales.io", "is_active":true, "work_number":null, "mobile_number":null, "confirmed":true, "privileges":"562123121086407", "job_title":null, "language":"en", "last_login_at":"2018-08-16T11:35:18+05:30", "time_zone":"Chennai", "avatar":null, "signature":null, "email_tracking":true, "access_scope":"global", "abilities":[ "manage_leads", "view_leads", "create_leads", "edit_all_leads", "convert_all_leads", "delete_all_leads", "manage_contacts", "view_contacts", "create_contacts", "edit_all_contacts", "delete_all_contacts", "view_sales_accounts", "create_sales_accounts", "edit_all_sales_accounts", "delete_all_sales_accounts", "view_deals", "create_deals", "edit_all_deals", "delete_all_deals", "common_user_actions", "import_csv", "manage_tasks", "manage_all_notes", "manage_phone", "manage_emails", "manage_user_settings", "view_reports", "manage_admin_settings", "manage_documents", "manage_activities", "manage_sales_accounts", "manage_deals", "export_record", "forget_all_leads", "forget_all_contacts", "forget_all_sales_accounts", "forget_all_deals" ], "auto_create_entity":1, "email_association":true, "reply_to":"sample@demo.freshsales.io", "from":"sample@demo.freshsales.io", "plan_name":"estate_jan_18", "imap_configured_email":"", "deal_pipeline_id":12977, "created_at":"2018-06-29T13:00:05+05:30", "report_access":true, "freshchat_restore_id":null, "is_forgotten":false, "report_export":true, "forget_entity_access":true, "role_ids":[ 23 ], "territory_ids":[ ], "email_setting_id":21646, "email_imap_detail_ids":[ ], "account_id":7, "user_column_ids":[ ], "sales_activity_type_ids":[ 5, 12599, 50234, 12604, 50241, 12611, 12627, 12632, 12636, 12637, 50269, 12644, 12693, 12742 ] } }

The following table lists the attributes of the loggedInUser object.

ATTRIBUTE TYPE DESCRIPTION
id number User ID of the user.
created_at datetime User creation timestamp.
territory_ids array of strings Territory IDs associated with the user.
signature string Signature of the user in HTML format.

domainName - Returns the domain name of the current account. As Freshsales v2 APIs do not support custom CNAMEs, it is highly recommended to use this method to obtain the Freshsales domain name and to make API calls.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("domainName").then ( function(data) { // success operation // "data" is {"domainName":"sample.freshsales.io"} }, function(error) { // failure operation } );
The following table shows the attribute of the domainName object.
Attribute Type Description
domainName string Domain of the company.
Lead Details Page

The currentEntityInfo object can be retrieved using data APIs.

currentEntityInfo - Returns lead information when an agent is on the Lead Details page.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("currentEntityInfo").then ( function(data) { // success output for lead // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "lead"}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
6
{ "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "lead" } }

The following table lists the attributes of the lead object.

ATTRIBUTE TYPE DESCRIPTION
currentEntityId number ID of the lead.
currentEntityType string Page type.

Contact Details Page

The currentEntityInfo object can be retrieved using data APIs.

currentEntityInfo - Returns contact information when an agent is on the Contact Details page.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("currentEntityInfo").then ( function(data) { // success output for contact // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "contact"}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
6
{ "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "contact" } }

The following table lists the attributes of the contact object.

ATTRIBUTE TYPE DESCRIPTION
currentEntityId number ID of the contact.
currentEntityType string Page type.

Deal Details Page

The currentEntityInfo object can be retrieved using data APIs.

currentEntityInfo - Returns deal information when an agent is on the Deal Details page.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("currentEntityInfo").then ( function(data) { // success output for deal // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "deal"}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
6
{ "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "deal" } }

The following table lists the attributes of the deal object.

ATTRIBUTE TYPE DESCRIPTION
currentEntityId number ID of the deal.
currentEntityType string Page type.

Sales Account Details Page

The currentEntityInfo object can be retrieved using data APIs.

currentEntityInfo - Returns account information when an agent is on the Sales Account Details page.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("sales_account").then ( function(data) { // success output for account // data: { "currentEntityInfo": { "currentEntityId": 12, "currentEntityType": "sales_account"}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
6
{ "currentEntityInfo":{ "currentEntityId": 12, "currentEntityType": "sales_account" } }

The following table lists the attributes of the account object.

ATTRIBUTE TYPE DESCRIPTION
currentEntityId number ID of the account.
currentEntityType string Page type.