Beam Help
Get help now

How-to · Zoho DESK

How to get search results count in Zoho Desk

Retrieve the total number of records matching your search criteria.

Retrieving the total count of search results in Zoho Desk is done via a single GET request to the Desk search count endpoint, requiring the Desk.search.READ OAuth scope to be authorised first.


Why this matters


When building dashboards, automations, or AI-driven assistants on top of Zoho Desk, you often need to know *how many* records match a query before deciding whether to paginate or surface a summary. Knowing the count upfront avoids unnecessary data fetches and keeps your integration efficient. This is also the foundation for any "how many tickets match X?" style natural-language query routed through a Zoho Desk integration. As independent expert support for Zoho — not official Zoho support — Beam Help walks you through the exact steps below.


---


Step-by-step


Step 1. Ensure the correct OAuth scope is granted.


Before any search operation can succeed, your OAuth token must include the Desk.search.READ scope. This scope sits alongside other Desk permission groups such as tickets, contacts, tasks, and settings in your application's scope configuration. [4] Without it, the API will reject the request with an authorisation error.


Step 2. Confirm your token covers the right Desk organisation.


Your connected session should carry the correct deskorgid and desk_portal values so that requests are routed to the intended Zoho Desk portal. [8] If you are working across multiple data centres (EU, AU, IN, etc.), make sure the base URL reflects the correct regional domain — for example https://desk.zoho.eu rather than the default https://desk.zoho.com. [8]


Step 3. Call the search count endpoint.


Issue a GET request to:


GET /api/v1/search/count

Pass your search parameters as a query-string dictionary (the p argument in the SDK wrapper). The operation name is getsearchresults_count and it returns the total number of records matching your search criteria. [3]


In Python, using the Desk client wrapper, the call looks like this:


result = desk_client.get_search_results_count(p={"searchStr": "billing issue"})

The method issues a GET to /api/v1/search/count with whatever key-value pairs you supply in p. [3]


Step 4. Handle the response and extract the count.


The API returns a result dictionary. In an AI-assistant context, a helper such as extractrecord_count can parse this dictionary and surface a plain integer. [5] If the result contains an error key, treat it as a failed request and inspect the error message before retrying. [5]


Step 5. (Optional) Feed the count into downstream logic.


Once you have the integer count, you can branch your logic — for example, displaying "You have *N* records matching that filter" to an end user, or deciding whether to trigger a paginated fetch. [6] If the count comes back as None or the result is ambiguous, surface a clarifying message rather than silently failing. [6]


---


Common pitfalls


  • Missing Desk.search.READ scope. This is the most frequent cause of a 401 or 403 response on the search count endpoint. Double-check that Desk.search.READ is explicitly listed in your OAuth scope string — it is not implied by Desk.tickets.ALL or any other group. [1] [4]

  • Wrong portal or org identifier. If deskportal is set, it takes precedence over deskorg_id when constructing the base URL. Passing the wrong value will route your request to the wrong portal and return unexpected results or a 404. [8]

  • Passing None as the parameter dictionary. The getsearchresults_count method accepts p=None as a default, but omitting search parameters entirely may return a count for all records rather than a filtered subset — confirm this matches your intent. [3]

  • Zoho rejecting the request after a parameter error. If the API returns an error object inside the result dictionary, the recommended pattern is to surface a message such as "Zoho rejected the request — what should I adjust so I can retry?" rather than swallowing the error silently. [5]

---


What to check


  • Scope list: Verify that Desk.search.READ appears in your active OAuth token's scope string before making the call. [4]
  • Endpoint response shape: Confirm the returned dictionary contains a count field (not an error key) before passing it to downstream logic. [5]
  • Portal/org routing: After a successful call, cross-reference the count against the Zoho Desk UI at https://desk.zoho.{dc}/agent/{portal} to make sure results belong to the correct organisation. [8]

Sources cited

  1. [1] config.py
  2. [2] server.py: chat_stream
  3. [3] GET /api/v1/search/count
  4. [4] server.py: chat
  5. [5] server.py: _count_shortcut_outcome
  6. [6] server.py: build_zoho_links
Get Search Results Count | Beam Help