Skip to main content
StickyTutorial

Freshsales API Commands - Spotlight

Freshsales API Commands - Spotlight
pradipta.chandra
Community Manager
Forum|alt.badge.img+4

Hi everyone.

 

APIs are the backbone of modern applications, enabling seamless communication between systems and services. While basic commands offer powerful capabilities, diving into detailed API commands can unlock even more potential for the integrations you might need to make your daily work much more efficient.

 

I believe you are already aware of our publicly available API document: https://developers.freshworks.com/crm/api/#introduction

 

In this article, we will explore a selected list of API commands and delve deeper into the additional features that could be beneficial, in simplifying tasks and improving integrations to overcome intricate obstacles efficiently. Whether you are a developer or embarking on your API learning journey afresh, this compilation of commands offers resources to broaden your horizons and achieve more effective outcomes, for your audience.

 

Filtering Contacts [https://developers.freshworks.com/crm/api/#list_all_contacts]

If you would like to filter records based on certain conditions that are not saved as a view and prefer using the filters on API in real-time, the “filterize” option would be your go-to.

 

Sample API CURL

Single filter condition:

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "cf_city", "operator":"contains", "value":"Chennai"}]}'

 

Multiple filter conditions:

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "cf_linkedin", "operator":"is_in", "value":"Yes"}, {"attribute":"cf_code", "operator":"is_in","value":"XS345"}]}'

 

Following are all the attributes that you can use to filter your records[applicable for Contacts, Accounts and Deals]:

 

Field types Applicable

Operator Name

Operator used in API

Value

Multi-select, Radio button, Drop-down, Text, Text area, Date, Lookup, URL

Contains

contains

Value that you would like to add

Does not contains

not_contains

Value that you would like to add

Multi-select, Radio button, Drop-down, Text, Text area, Date, URL

Contains all (matches all selections)

contains_all

Value that you would like to add

Multi-select, Radio button, Drop-down, Text, Text area, Date, Lookup, Number, URL

is not empty

is_provided

-1005

is empty

is_not_provided

-1005

Text, Text area, URL

is

is

Value that you would like to add

is not

is_not

Value that you would like to add

Date

last 30 minutes

is_after

-123

last 60 minutes

is_after

-124

last 2 hours

is_after

-125

last 24 hours

is_after

-101

yesterday

is_after

-111

today

is_after

-112

last week

is_after

-113

this week

is_after

--114

last month

is_after

-115

this month

is_after

-116

last 7 days

is_after

-102

last 30 days

last 30 days

-103

last 60 days

is_after

-121

last 90 days

is_after

-122

last 180 days

is_after

-126

last 365 days

is_after

-127

last quarter

is_after

-194

this quarter

is_after

-195

last year

is_after

-197

this year

is_after

-198

is before

is_before

Date that you would like to add

is after

is_after

Date that you would like to add

Date, Number

is between

is_in_the_range

Date range you would like to add

Checkbox, Formula

is

is

1 [for yes]

is

is

0 [for no]

Number

less than

is_less_than

Value you would like to add

greater than

is_greater_than

Value you would like to add

equal to

is

Value you would like to add

 


API CURL for passing the values in the lookup field in a Contact

curl --location --request PUT 'https://domain.myfreshworks.com/crm/sales/api/contacts/402110740404' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{"contact":{"custom_field":{"cf_cmlookup":402106703017}}}'

 

“cf_cmlookup” is a field looking up to the contacts module. Hence, “402106703017” is actually a contact ID.

 

API CURL for passing the values in the multi-select field in a Contact

curl --location --request PUT 'https://domain.myfreshworks.com/crm/sales/api/contacts/402110740404' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{"contact":{"custom_field":{"cf_code":"tnj;che;try"}}}'

 

The multi-select choices need to be already configured on the field level before you can update the records with these value. In case the choice doesn’t match, the API fails.

 

API CURL for passing the values in the tags field in a Contact

curl --location --request PUT 'https://domain.myfreshworks.com/crm/sales/api/contacts/402110740404' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{"contact":{"tags":"Field contact,Contacted,Customer"}}'

 

If the tag exist, this API call will add the tag to the record. If not, it creates a new tag automatically and associates it to the record.

 

API CURL for adding multiple lists to a Contact

curl --location --request PUT 'https://domain.myfreshworks.com/crm/sales/api/contacts/402082323753' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{"contact": {"list_ids":["402000061060","402000074502"]}}'

 

API CURL for sales owner filter

  1. Sales owner is in “Me”

    curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

    --header 'Authorization: Token token=sfg999666t673t7t82' \

    --header 'Content-Type: application/json' \

    --data '{ "filter_rule" : [{"attribute" : "owner_id", "operator":"is_in", "value":["-1001"]}]}'

  2. Sales owner is in “Unassigned”

    curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

    --header 'Authorization: Token token=sfg999666t673t7t82' \

    --header 'Content-Type: application/json' \

    --data '{ "filter_rule" : [{"attribute" : "owner_id", "operator":"is_in", "value":["-1002"]}]}'

 

API CURL for updating the contact lifecycle stage

curl --location --request PUT 'https://domain.myfreshworks.com/crm/sales/api/contacts/402055162791' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{"contact": {"lifecycle_stage_id": "403011787769"}}'

 

Pass IDs for the following fields - Lifecycle Stage, Contact Status, Source, Account - Industry type, Deal - Lost Reason

 

API CURL for filtering contacts using subscription status

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "subscription_status", "operator":"is_in", "value":["1"]}]}'

 

Field

Value in Freshsales

Value passed in API

Subscription status, Whatsapp subscription status, SMS subscription status

Subscribed

1

Not subscribed

2

Unsubscribed

0

Subscription status

Reported as spam

3

Bounced

4


 

API CURL for filtering contacts using the contact teams field

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "team_user_ids", "operator":"is_in", "value":["-1001"]}]}'

 

For “me” option, it should be passed as -1001 and for other users, it should be passed as user IDs.

Did this topic help you find an answer to your question?
100% found this helpful

10 replies

Bernardo Castro
Apprentice
Forum|alt.badge.img

Great,

But looking at the current access points, compared to Freshdesk, the Freshsales is quite limited.

Please add an endpoint that allows update the user email signature. So, we can integrate Freshsales + Bybrand.


pradipta.chandra
Community Manager
Forum|alt.badge.img+4

Hi ​@Bernardo Castro 
Thank you for your reply. We always strive to collect valuable feedbacks such as yours so that we can enhance our product and also our documentations.

We will pass on your feedback to our Product team and keep you posted when we have an update on the same. 

Your feedbacks and continual support is greatly appreciated.


Daniel Söderlund
Skilled Expert
Forum|alt.badge.img+14

Hello, as Bernardo say Freshdesk and Freshservice have a lot more to offer. 

I’m looking for way’s to automate our SOP when we close a deal. 
We are using Freshdesk Omni

My first step is to create a ticket in our Freshdesk, it’s easy with API call. 
Assigned it a consultant to plan the implementation with the customer.   
But I want to send a e-mail to our license manager and to our finance manager. 


pradipta.chandra
Community Manager
Forum|alt.badge.img+4
Daniel Söderlund wrote:

Hello, as Bernardo say Freshdesk and Freshservice have a lot more to offer. 

I’m looking for way’s to automate our SOP when we close a deal. 
We are using Freshdesk Omni

My first step is to create a ticket in our Freshdesk, it’s easy with API call. 
Assigned it a consultant to plan the implementation with the customer.   
But I want to send a e-mail to our license manager and to our finance manager. 

 

Hi ​@Daniel Söderlund 

Hope you are doing well. Thank you for your reply.

I understand and acknowledge what you are mentioning and that why we are trying to collect our valuable customers’ feedbacks to help improve the documentation. It would be great if you can share your suggestions by dropping us an email so that we can pass on the feedback to our team.

 

Also, regarding your use-case, are you making use of Freshsales and would you like to send an email via Freshsales when you close a deal? If you can give more details on your use-case I will definitely be able to help you.

As an alternate, if you would like an email conversation regarding this or need to schedule a call with us, I would request you to drop us an email at crm-support@freshworks.com referencing this post so that I can get in touch with you asap.

 

Awaiting your reply.


Kerawill1122
Community Debut
  • Community Debut
  • 3 replies
  • January 21, 2025

APIs indeed play a crucial role in improving workflows and enabling efficient integrations. It’s great that you’re diving deeper into advanced API commands to maximize their potential. For those already familiar with basic commands, expanding knowledge in this area can significantly enhance how applications and services interact.

The link to Freshworks’ API documentation is a valuable resource for anyone looking to deepen their API skills. Exploring additional features and commands can definitely help overcome challenges and optimize integrations, especially as you work towards more complex tasks.

Looking forward to seeing how this knowledge can benefit the community!


pradipta.chandra
Community Manager
Forum|alt.badge.img+4
Kerawill1122 wrote:

APIs indeed play a crucial role in improving workflows and enabling efficient integrations. It’s great that you’re diving deeper into advanced API commands to maximize their potential. For those already familiar with basic commands, expanding knowledge in this area can significantly enhance how applications and services interact.

The link to Freshworks’ API documentation is a valuable resource for anyone looking to deepen their API skills. Exploring additional features and commands can definitely help overcome challenges and optimize integrations, especially as you work towards more complex tasks.

Looking forward to seeing how this knowledge can benefit the community!

 

Thank you for your comment ​@Kerawill1122 
We are looking to enhance this knowledge base to cover more of such in-depth options available on our APIs. If you have any suggestions for us, please let us know. We will keep our Community updated.

Do have a great day ahead!


Kerawill1122
Community Debut
  • Community Debut
  • 3 replies
  • January 22, 2025

@pradipta.chandra You're welcome! I'm glad to hear you're enhancing the knowledge base. I’ll keep an eye out for any opportunities to contribute further suggestions. Have a great day too!


  • Community Debut
  • 2 replies
  • January 29, 2025

Thank you ​@pradipta.chandra for this tutorial. Very helpful. 
Can you share some more information about the filterize endpoint for contacts? I cannot find any information in the API documentation.

Looking forward to your reply.


pradipta.chandra
Community Manager
Forum|alt.badge.img+4
ivo.leiss wrote:

Thank you ​@pradipta.chandra for this tutorial. Very helpful. 
Can you share some more information about the filterize endpoint for contacts? I cannot find any information in the API documentation.

Looking forward to your reply.

Hi ​@ivo.leiss 

Please find the information as follows that I have shared on the post above:
 

Sample API CURL

Single filter condition:

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "cf_city", "operator":"contains", "value":"Chennai"}]}'

 

Multiple filter conditions:

curl --location 'https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact' \

--header 'Authorization: Token token=sfg999666t673t7t82' \

--header 'Content-Type: application/json' \

--data '{ "filter_rule" : [{"attribute" : "cf_linkedin", "operator":"is_in", "value":"Yes"}, {"attribute":"cf_code", "operator":"is_in","value":"XS345"}]}'

 

Hope this helps. I have highlighted the endpoint URL above. Please feel free to let us know if you need anything else or if you have any suggestions for us to enhance the API knowledge-base!

Cheers!


  • Community Debut
  • 2 replies
  • January 29, 2025

Thank you, ​@pradipta.chandra , for your reply. But I refer to the statement:

If you would like to filter records based on certain conditions that are not saved as a view and prefer using the filters on API in real-time, the “filterize” option would be your go-to.

Monitoring the network traffic of the Freshsales web application, I see that there is an endpoint like 

https://domain.myfreshworks.com/crm/sales/contacts/filterize

I opposite this endpoint would provide the custom_fields that I need for my use case, but are not part of the response in the endpoint like

https://domain.myfreshworks.com/crm/sales/api/filtered_search/contact 

Looking forward to your answer.

Ivo


Reply