Record Count in a Module
Purpose
To fetch the total number of records in the module or the number of records that match the criteria. You can also get the number of records from a custom view of a module.
GET /{module_api_name}/actions/count?cvid={custom_view_ID_here}
GET /{module_api_name}/actions/count?criteria={criterion_here}
GET /{module_api_name}/actions/count?email={email_here}
GET /{module_api_name}/actions/count?phone={phone_number_here}
GET /{module_api_name}/actions/count?word={search_word_here}
Request Details
Request URL
{api-domain}/crm/{version}/{module_api_name}/actions/count
Supported modules
Leads, Accounts, Contacts, Deals, Tasks, Meetings, Calls, Products, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, Campaigns, Vendors, Cases, Solutions, Services, Appointments, Appointments Rescheduled History and Custom
Header
Authorization: Zoho-oauthtoken <access_token>
Scope
Scope = ZohoSearch.securesearch.READ
(and)
ZohoCRM.modules.{module_name}.READ
(and)
scope=ZohoCRM.settings.layouts.READ/ALL
(or)
scope=ZohoCRM.settings.ALL
Parameters
- cvidstring, optional
The ID of the custom view from which you want to get the record count. Use the Custom Views Metadata API to get the custom views available in the module. Example: cvid=5690xxxx980.
Note that you cannot combine search parameters with this parameter; it will result in the "AMBIGUITY_DURING_PROCESSING" error. - criteriastring, optional
The condition to obtain the number of records that match the criterion. You can filter the records based on the API name of the field. The supported operators are equals, starts_with, in, not_equal, greater_equal, greater_than, less_equal, less_than and between. The supported data types are picklist, id, owner_lookup, user_lookup, lookup, phone, email, date, datetime, integer, currency, decimal and double.
- phonestring, optional
The total number of records you want to retrieve that contain the given phone number in their Phone field.
Example: phone=9876543210. - emailstring, optional
The total number of records you want to retrieve that contain the given email ID in their Email field. Ensure that you encode any special characters in the email ID.
Example: email=p%2Bboyle@abc.com (the encoded form for the email p+boyle@abc.com). - wordstring, optional
The total number of records you want to retrieve that contain the given word in any of their fields.
Example: word=fin.
Note
- Apart from the above parameters, you can also use other optional parameters mentioned on the Search records page.
- There would be a 1-10 minute delay in refreshing the statistics.
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v7/Leads/actions/count?cvid=554023000000430419"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Possible Errors
- AMBIGUITY_DURING_PROCESSING HTTP 400
Reason:
You have specified "cvid" and one of the search parameters like "criteria", "phone", "email", or "word" in the request.
Resolution: You can only include either "cvid" or one of the search parameters in the request.
- INVALID_QUERYHTTP 400
Reasons:
- You have formed an invalid search query.
- The operator is not supported for that field in the query.
Resolution: Refer to the "details" key in the response.
- OAUTH_SCOPE_MISMATCHHTTP 401
You do not have the scope required to use this API.
Resolution: Use the correct scope and generate the grant and access tokens.
Sample Response
Copied{
"count": 694
}