Data API

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

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 } );
Attribute Type Description
domainName string Domain of the company.
Lead Details Page

The lead object can be retrieved using data APIs.

lead - Returns the lead object.

Copied Copy
1
2
3
4
5
6
7
8
9
client.data.get("lead").then ( function(data) { // success output // data is {change: {"subject": "Getting ES3 back..",..}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
{ "lead":{ "id":1 } }

The following table lists the lead object attribute.

ATTRIBUTE TYPE DESCRIPTION
id number ID of the lead.

Contact Details Page

The contact object can be retrieved using data APIs.

contact - 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: {requester: {…}} }, function(error) { // failure operation } );

Payload Response

1
2
3
4
5
{ "contact":{ "id":1 } }
EXPAND ↓

The following table lists the contact object attribute:

ATTRIBUTE TYPE DESCRIPTION
id number ID of the contact.

Deal Details Page

The deal object can be retrieved using data APIs.

deal - Returns the deal object.

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

Payload Response

1
2
3
4
5
{ "deal":{ "id":1 } }

The following table lists the contact object attribute.

ATTRIBUTE TYPE DESCRIPTION
id number ID of the deal.

Sales Account Details Page

The account object can be retrieved using data APIs.

sales_account - Returns the account object.

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

Payload Response

1
2
3
4
5
{ "sales_account":{ "id":1 } }

The following table lists the contact object attribute.

ATTRIBUTE TYPE DESCRIPTION
id number ID of the account.

Log in with your Freshsales account

Enter your helpdesk URL to proceed to login

Proceed

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