Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

End-to-end field service management platform for service businesses.

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

Create, edit, and share slides with a sleek presentation app.

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho One
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Marketplace
Skip to main content

GET Records

Purpose

A record is an entity which stores all the combined information of a particular contact or company, which is acquired from various sources. The information may be acquired from a web-form, social media services, advertisements etc. The records API allows the user to get, create, update, delete, or search records.

To retrieve the records that match your search criteria.

Request Details

Request URL

{api-domain}/crm/{version}/{module_api_name}
To get specific record:
https://www.zohoapis.com/crm/{version}/{module_api_name}/{record_id}

Supported modules

Leads, Accounts, Contacts, Deals, Campaigns, Tasks, Cases, Events, Calls, Solutions, Products, Vendors, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, Custom, and Activities

Custom Modules

For custom modules, use their respective API names in the request URL. You can obtain the API name from Setup -> Developer Hub -> APIs & SDKs -> API Names. You can also use the respective custom module's api_name key in the Modules API's response to get the API name of the custom module.

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

If-Modified-Since: 2019-07-25T15:26:49+05:30

Scope

scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}

Possible module names

leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and activities.

Possible operation types

ALL - Full access to the record
READ - Get records from the module

Parameters
  • fieldsstring

    To list all the module records with respect to fields.
    Possible values: Multiple field API names, comma separated. For example: Last_Name, Email.

    Note: The "full_name" field contains the concatenated values of the First Name and Last Name fields. 
    This is a read-only field available only in the Leads, Contacts, and Users modules.

  • sort_orderstring

    To sort the available list of records in either ascending or descending order.
    Possible values: asc - ascending order, desc - descending order.

  • idsstring, optional

    To retrieve specific records based on their unique ID.
    Possible values: Valid unique IDs of records. Example: 4150868000001944196
    Multiple IDs can be comma separated. Example:4150868000001944196,4150868000001944187,4150868000001944134

  • sort_bystring

    To sort the available list of records based on the given field. The default value is id. If you provide invalid values, default sorting will take place.
    Possible values: Field API name. Example: Email.

  • convertedstring

    To get the list of converted records. Default value is false.
    Possible values: true - get only converted records, false - get only non-converted records, both - get all records.

  • approvedstring, optional

    To retrieve the list of approved records. Default value is true.
    Possible values:true - get only approved records; false - get only records which are not approved; both - get all records

  • approval_statestring, optional

    To retrieve the list of records based on various approval stages.

    • approved : To list the approved records.
    • approval_process_pending : To list all the records whose approval process is pending.
    • approval_process_rejected : To list all the records whose approval was rejected.
    • review_process_pending : To list all the records whose review process is pending.
    • review_process_rejected : To list all the records whose review process is rejected.
    • webform_unapproved : To list all the unapproved records created via webforms.
    • webform_invalid : To list all the invalid records created through the webform.  
    • webform_invalid_approval : To list all the invalid records created through the webform that are waiting for approval.
    • webform_double_optin : To list all records created via webforms with Double Opt-in enabled. Check here for more details.
    • merge_pending : To list all the records whose merge process is pending.
    • zia_vision_pending : To list all the records whose Zia Vision process is pending.
    • zia_vision_validation : To list all the records whose Zia Vision process is in a validation state.
    • zia_vision_rejected : To list all the records whose Zia Vision process is rejected.
  • pageinteger

    To get the list of records from the respective pages. Default value is 1.
    Possible values: Positive Integer values only.

  • per_pageinteger

    To get the list of records available per page. The default and the maximum possible value is 200.
    Possible values: Positive Integer values only.

  • cvidlong

    To get the list of records based on custom views.You can get custom view id from Custom View Meta API
    Possible values: {custom_view_id}.

  • territory_idlong

    To get the list of records based on the territory.
    Possible values: {territory_id}.

  • include_childboolean

    To include records from the child territories.Default value is false.
    Possible values: true - includes child territory records, false - does not include child territory records.

Note

  • sort_order applies to given sort_by field.
  • If sort_by field is not provided, then it applies to the system-defined field.
  • The page and per_page parameter is used to fetch records according to their position in the CRM. Let's assume that the user has to fetch 400 records. The maximum number of records that one can get for an API call is 200. So, for records above the 200th position, they cannot be fetched. By using the page (1, 2) and per_page (200) parameter, the user can fetch all 400 records using 2 API calls.
  • To get the record details in a subform, you need to fetch the specific record information in a module.
  • Only while fetching a specific record from one of the inventory modules, the response will contain one of the following subforms:
    • Quoted_Items (for a Quote)
    • Invoiced_Items (for an Invoice)
    • Ordered_Items (for a Sales Order)
    • Purchased_Items (for a Purchase Order)
  • You can get the values of multi-select lookup fields and multi-user lookup fields in the response only when a specific record is fetched.
  • The $has_more JSON object in the response renders the API names of the multi-select lookup fields and multi-user lookup fields in the module with boolean values to indicate whether or not there are more records in these fields in the module. This key is rendered in the response only when you fetch a specific record.
  • Use the $event_cancelled key in the fields param to retrieve the cancellation status of the Meeting. The $event_cancelled key in the response represents the cancellation status of the Meeting.
  • To get the list of territories enabled for your organization, refer to the Territories API.
  • Territory is supported only for the modules Deals, Contacts, and Accounts.
  • Only admin users can fetch the records from the Notes module. The system throws an error when non-admin users try to fetch the records from the Notes module.
  • The value of the fields with sensitive health data will be retrieved only when Restrict Data access through API option in the compliance settings is disabled. If the option is enabled, the value will be null. Refer to HIPAA compliance for more details.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2.1/Leads/1306462000000888026"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
4.0.04.x
Copied//Get instance of RecordOperations Class
$recordOperations = new RecordOperations();
//Get instance of ParameterMap Class
$paramInstance = new ParameterMap();
// $paramInstance->add(GetRecordParam::approved(), "false");
// $paramInstance->add(GetRecordParam::converted(), "false");
// $fieldNames = array("Deal_Name", "Company");
// foreach($fieldNames as $fieldName)
// {
// 	$paramInstance->add(GetRecordParam::fields(), $fieldName);
// }
// $startdatetime = date_create("2020-06-27T15:10:00");
// $paramInstance->add(GetRecordParam::startDateTime(), $startdatetime);
// $enddatetime = date_create("2020-06-29T15:10:00");
// $paramInstance->add(GetRecordParam::endDateTime(), $enddatetime);
// $paramInstance->add(GetRecordParam::territoryId(), "34770613051357");
// $paramInstance->add(GetRecordParam::includeChild(), "true");
$headerInstance = new HeaderMap();
// $ifmodifiedsince = date_create("2020-06-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $headerInstance->add(GetRecordHeader::IfModifiedSince(), $ifmodifiedsince);
//Call getRecord method that takes paramInstance, moduleAPIName and recordID as parameter
$response = $recordOperations->getRecord( $recordId,$moduleAPIName,$paramInstance, $headerInstance);



//Get instance of RecordOperations Class that takes moduleAPIName as parameter
$recordOperations = new RecordOperations();
$paramInstance = new ParameterMap();
// $paramInstance->add(GetRecordsParam::approved(), "true");
// $paramInstance->add(GetRecordsParam::converted(), "1234");
// $paramInstance->add(GetRecordsParam::cvid(), "34770610089005");
// $ids = array("34770615623115", "34770614352001");
// foreach($ids as $id)
// {
// 	$paramInstance->add(GetRecordsParam::ids(), $id);
// }
// $paramInstance->add(GetRecordsParam::uid(), "34770615181008");
// $fieldNames = array("Last_Name", "City");
// foreach($fieldNames as $fieldName)
// {
	// $paramInstance->add(GetRecordsParam::fields(), "id");
// }
// $paramInstance->add(GetRecordsParam::sortBy(), "Email");
// $paramInstance->add(GetRecordsParam::sortOrder(), "desc");
// $paramInstance->add(GetRecordsParam::page(), 1);
// $paramInstance->add(GetRecordsParam::perPage(), 3);
// $startdatetime = date_create("2020-06-27T15:10:00+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $paramInstance->add(GetRecordsParam::startDateTime(), $startdatetime);
// $enddatetime = date_create("2020-06-29T15:10:00+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $paramInstance->add(GetRecordsParam::endDateTime(), $enddatetime);
// $paramInstance->add(GetRecordsParam::territoryId(), "34770613051357");
// $paramInstance->add(GetRecordsParam::includeChild(), true);
$headerInstance = new HeaderMap();
// $datetime = date_create("2021-02-26T15:28:34+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $headerInstance->add(GetRecordsHeader::IfModifiedSince(), $datetime);
//Call getRecords method
$response = $recordOperations->getRecords($moduleAPIName, $paramInstance, $headerInstance);
Copied<?php
class GetRecords{
    
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/Leads?";
        $parameters = array();
        $parameters["page"]="1";
        $parameters["per_page"]="2";
        $parameters["sort_by"]="Email2";
        $parameters["sort_order"]="desc2";
        $parameters["include_child"]="false";

        
        foreach ($parameters as $key=>$value){
            $url =$url.$key."=".$value."&";
        }
        $curl_options[CURLOPT_URL] = $url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "GET";
        $headersArray = array();
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " ."1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        $headersArray[] = "If-Modified-Since".":"."2021-10-12T17:59:50+05:30";
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new GetRecords())->execute();
2.1.0
Copied# Get instance of RecordOperations Class
ro = Record::RecordOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# module_api_name = "Leads"
# record_id = 3524033000005662018
# pm.add(Record::RecordOperations::GetRecordParam.approved,"false")
# pm.add(Record::RecordOperations::GetRecordParam.converted,"false")
# field_names =["Company","Email"]
# field_names.each do |field_name|
# pm.add(Record::::RecordOperations::GetRecordParam.fields,field_name)
# end
# Get instance of HeaderMap Class
hm = HeaderMap.new
# hm.add(Record::RecordOperations::GetRecordHeader.If_modified_since,"")
# Call getRecord method that takes param_instance, header_instance, module_api_name and record_id as parameter
response = ro.get_record(record_id,module_api_name,pm, hm)



# Get instance of RecordOperations Class
ro = Record::RecordOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# record_id = 3524033000005495066
# Add the per_page to ParameterMap instance
pm.add(Record::RecordOperations::GetRecordsParam.per_page, 1)
pm.add(Record::RecordOperations::GetRecordsParam.converted, 'false')
# field_names =["Company","Email"]
# field_names.each do |field_name|
# pm.add(Record::::RecordOperations::GetRecordParam.fields,field_name)
# end
# Get instance of HeaderMap Class
hm = HeaderMap.new
# hm.add(Record::RecordOperations::GetRecordHeader.If_modified_since,"")
# Call getRecords method that takes ParameterMap Instance, HeaderMap Instance and module_api_name as parameters
response = ro.get_records(module_api_name,pm, hm)
Copiedrequire 'net/http'
require 'json'

class GetRecords 

    def execute
        parameters ={}
        parameters["per_page"]="2";
        parameters["page"]="1";
        parameters["sort_by"]="Email2";
        parameters["sort_order"]="desc2";
        parameters["include_child"]="false";
        query_string = parameters.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join('&')
        url= "https://www.zohoapis.com/crm/v2.1/Leads"
        url += '?' + query_string if !query_string.nil? && (query_string.strip != '')
        url = URI(url)
        req = Net::HTTP::Get.new(url.request_uri)
        http = Net::HTTP.new(url.host, url.port)
        http.use_ssl = true
        headers={}
        headers["Authorization"]="Zoho-oauthtoken 1000.dfa7XXXXXXXXXXXXXXXXXX84f9665840.c176aeXXXXXXXXXXXX13f3d37a84d"
        headers["If-Modified-Since"]="2019-10-12T17:59:50+05:30"
        headers&.each { |key, value| req.add_field(key, value) }
        response=http.request(req)
        status_code = response.code.to_i
        headers = response.each_header.to_h
        print status_code
        print headers
        unless response.body.nil?
            print  response.body
        end
    end
end
GetRecords.new.execute

Show full

Show less

Sample Response

Copied{
    "data": [
        {
            "Owner": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "Company": "SolutionsTech",
            "Email": null,
            "$currency_symbol": "$",
            "$field_states": null,
            "$sharing_permission": "full_access",
            "Last_Activity_Time": "2022-02-03T10:55:15+05:30",
            "Industry": null,
            "$state": "save",
            "Unsubscribed_Mode": null,
            "$converted": false,
            "$process_flow": false,
            "Test": null,
            "Street": null,
            "Data_Processing_Basis_Details": null,
            "Zip_Code": null,
            "id": "1306462000000888026",
            "Data_Source": "API",
            "$approved": true,
            "$approval": {
                "delegate": false,
                "approve": false,
                "reject": false,
                "resubmit": false
            },
            "$data_source_details": {},
            "Created_Time": "2022-02-02T17:09:49+05:30",
            "$wizard_connection_path": null,
            "$editable": true,
            "City": null,
            "No_of_Employees": null,
            "Related": [],
            "State": null,
            "Country": null,
            "Created_By": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "Annual_Revenue": null,
            "Secondary_Email": null,
            "Description": null,
            "Rating": null,
            "$review_process": {
                "approve": false,
                "reject": false,
                "resubmit": false
            },
            "Website": null,
            "Twitter": null,
            "Information": null,
            "$canvas_id": null,
            "Salutation": null,
            "Marital_Status_1": null,
            "Birthday_1": null,
            "First_Name": null,
            "Full_Name": "Sam",
            "Lead_Status": null,
            "Record_Image": null,
            "Modified_By": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "$review": null,
            "Lead_Conversion_Time": null,
            "Skype_ID": null,
            "Phone": null,
            "Lead_Class": "Class S",
            "Email_Opt_Out": false,
            "Designation": null,
            "Modified_Time": "2022-02-03T10:55:15+05:30",
            "$converted_detail": {},
            "Unsubscribed_Time": null,
            "Referred_By": null,
            "Mobile": null,
            "$orchestration": false,
            "$stop_processing": false,
            "Last_Name": "Sam",
            "Layout": {
                "id": "1306462000000095055"
            },
            "$in_merge": false,
            "Lead_Source": null,
            "Tag": [],
            "Fax": null,
            "$approval_state": "approved",
            "Wizard": null,
            "$has_more": {
                "Related": false
            }
        }
    ]
}
4.0.04.x
Copied//Get instance of RecordOperations Class
$recordOperations = new RecordOperations();
//Get instance of ParameterMap Class
$paramInstance = new ParameterMap();
// $paramInstance->add(GetRecordParam::approved(), "false");
// $paramInstance->add(GetRecordParam::converted(), "false");
// $fieldNames = array("Deal_Name", "Company");
// foreach($fieldNames as $fieldName)
// {
// 	$paramInstance->add(GetRecordParam::fields(), $fieldName);
// }
// $startdatetime = date_create("2020-06-27T15:10:00");
// $paramInstance->add(GetRecordParam::startDateTime(), $startdatetime);
// $enddatetime = date_create("2020-06-29T15:10:00");
// $paramInstance->add(GetRecordParam::endDateTime(), $enddatetime);
// $paramInstance->add(GetRecordParam::territoryId(), "34770613051357");
// $paramInstance->add(GetRecordParam::includeChild(), "true");
$headerInstance = new HeaderMap();
// $ifmodifiedsince = date_create("2020-06-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $headerInstance->add(GetRecordHeader::IfModifiedSince(), $ifmodifiedsince);
//Call getRecord method that takes paramInstance, moduleAPIName and recordID as parameter
$response = $recordOperations->getRecord( $recordId,$moduleAPIName,$paramInstance, $headerInstance);



//Get instance of RecordOperations Class that takes moduleAPIName as parameter
$recordOperations = new RecordOperations();
$paramInstance = new ParameterMap();
// $paramInstance->add(GetRecordsParam::approved(), "true");
// $paramInstance->add(GetRecordsParam::converted(), "1234");
// $paramInstance->add(GetRecordsParam::cvid(), "34770610089005");
// $ids = array("34770615623115", "34770614352001");
// foreach($ids as $id)
// {
// 	$paramInstance->add(GetRecordsParam::ids(), $id);
// }
// $paramInstance->add(GetRecordsParam::uid(), "34770615181008");
// $fieldNames = array("Last_Name", "City");
// foreach($fieldNames as $fieldName)
// {
	// $paramInstance->add(GetRecordsParam::fields(), "id");
// }
// $paramInstance->add(GetRecordsParam::sortBy(), "Email");
// $paramInstance->add(GetRecordsParam::sortOrder(), "desc");
// $paramInstance->add(GetRecordsParam::page(), 1);
// $paramInstance->add(GetRecordsParam::perPage(), 3);
// $startdatetime = date_create("2020-06-27T15:10:00+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $paramInstance->add(GetRecordsParam::startDateTime(), $startdatetime);
// $enddatetime = date_create("2020-06-29T15:10:00+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $paramInstance->add(GetRecordsParam::endDateTime(), $enddatetime);
// $paramInstance->add(GetRecordsParam::territoryId(), "34770613051357");
// $paramInstance->add(GetRecordsParam::includeChild(), true);
$headerInstance = new HeaderMap();
// $datetime = date_create("2021-02-26T15:28:34+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
// $headerInstance->add(GetRecordsHeader::IfModifiedSince(), $datetime);
//Call getRecords method
$response = $recordOperations->getRecords($moduleAPIName, $paramInstance, $headerInstance);
Copied<?php
class GetRecords{
    
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/Leads?";
        $parameters = array();
        $parameters["page"]="1";
        $parameters["per_page"]="2";
        $parameters["sort_by"]="Email2";
        $parameters["sort_order"]="desc2";
        $parameters["include_child"]="false";

        
        foreach ($parameters as $key=>$value){
            $url =$url.$key."=".$value."&";
        }
        $curl_options[CURLOPT_URL] = $url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "GET";
        $headersArray = array();
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " ."1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        $headersArray[] = "If-Modified-Since".":"."2021-10-12T17:59:50+05:30";
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new GetRecords())->execute();
2.1.0
Copied# Get instance of RecordOperations Class
ro = Record::RecordOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# module_api_name = "Leads"
# record_id = 3524033000005662018
# pm.add(Record::RecordOperations::GetRecordParam.approved,"false")
# pm.add(Record::RecordOperations::GetRecordParam.converted,"false")
# field_names =["Company","Email"]
# field_names.each do |field_name|
# pm.add(Record::::RecordOperations::GetRecordParam.fields,field_name)
# end
# Get instance of HeaderMap Class
hm = HeaderMap.new
# hm.add(Record::RecordOperations::GetRecordHeader.If_modified_since,"")
# Call getRecord method that takes param_instance, header_instance, module_api_name and record_id as parameter
response = ro.get_record(record_id,module_api_name,pm, hm)



# Get instance of RecordOperations Class
ro = Record::RecordOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# record_id = 3524033000005495066
# Add the per_page to ParameterMap instance
pm.add(Record::RecordOperations::GetRecordsParam.per_page, 1)
pm.add(Record::RecordOperations::GetRecordsParam.converted, 'false')
# field_names =["Company","Email"]
# field_names.each do |field_name|
# pm.add(Record::::RecordOperations::GetRecordParam.fields,field_name)
# end
# Get instance of HeaderMap Class
hm = HeaderMap.new
# hm.add(Record::RecordOperations::GetRecordHeader.If_modified_since,"")
# Call getRecords method that takes ParameterMap Instance, HeaderMap Instance and module_api_name as parameters
response = ro.get_records(module_api_name,pm, hm)
Copiedrequire 'net/http'
require 'json'

class GetRecords 

    def execute
        parameters ={}
        parameters["per_page"]="2";
        parameters["page"]="1";
        parameters["sort_by"]="Email2";
        parameters["sort_order"]="desc2";
        parameters["include_child"]="false";
        query_string = parameters.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join('&')
        url= "https://www.zohoapis.com/crm/v2.1/Leads"
        url += '?' + query_string if !query_string.nil? && (query_string.strip != '')
        url = URI(url)
        req = Net::HTTP::Get.new(url.request_uri)
        http = Net::HTTP.new(url.host, url.port)
        http.use_ssl = true
        headers={}
        headers["Authorization"]="Zoho-oauthtoken 1000.dfa7XXXXXXXXXXXXXXXXXX84f9665840.c176aeXXXXXXXXXXXX13f3d37a84d"
        headers["If-Modified-Since"]="2019-10-12T17:59:50+05:30"
        headers&.each { |key, value| req.add_field(key, value) }
        response=http.request(req)
        status_code = response.code.to_i
        headers = response.each_header.to_h
        print status_code
        print headers
        unless response.body.nil?
            print  response.body
        end
    end
end
GetRecords.new.execute

Show full

Show less

Converted Records

To retrieve the converted records, the converted parameter should be true or both. The converted_detail key in the response renders the conversion details which includes the deal (deal id), convert_date, contact (converted contact id), converted_by and account (account id). Please refer to the sample response for more details.

Possible Errors

  • INVALID_MODULEHTTP 400

    The module name given seems to be invalid.
    Resolution: Specify a valid module API name. Refer to possible modules section above.

  • INVALID_MODULEHTTP 400

    The given module is not supported in API.
    Resolution: The modules such as Documents and Projects are not supported in the current API. (This error will not be shown, once these modules are supported). Specify a valid module API name. Refer to possible modules section above.

  • INVALID_MODULEHTTP 400

    Territory is not supported for the given module.
    Resolution: The given module is not territory-supported. Territory is supported only for the modules Deals, Contacts, and Accounts.

  • NO_PERMISSIONHTTP 403

    Permission denied to read records
    Resolution: The user does not have permission to read records. Contact your system administrator.

  • NOT_SUPPORTEDHTTP 403

    This API is supported only for admin users.
    Resolution: Only admin users can fetch records from the Notes module.

Sample request

Copiedcurl "https://www.zohoapis.com/crm/v2.1/Leads?converted=true&approved=true"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"

Sample Response

Copied{
    "data": [
        {
            "Owner": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "Company": null,
            "Email": "j.smith@xyz.com",
            "$currency_symbol": "$",
            "$field_states": null,
            "Last_Activity_Time": "2021-10-05T14:37:26+05:30",
            "Industry": "Service Provider",
            "$state": "save",
            "Unsubscribed_Mode": null,
            "$converted": true,
            "$process_flow": false,
            "Test": null,
            "Street": "37275 St Rt 17m M",
            "Data_Processing_Basis_Details": null,
            "Zip_Code": "11953",
            "id": "1306462000000391002",
            "Data_Source": "API",
            "$approved": true,
            "$approval": {
                "delegate": false,
                "approve": false,
                "reject": false,
                "resubmit": false
            },
            "$data_source_details": {},
            "Created_Time": "2021-08-24T14:52:07+05:30",
            "$editable": true,
            "City": "Middle Island",
            "No_of_Employees": null,
            "State": "NY",
            "Country": "United States",
            "Created_By": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "Annual_Revenue": 850000,
            "Secondary_Email": null,
            "Description": null,
            "Rating": null,
            "$review_process": {
                "approve": false,
                "reject": false,
                "resubmit": false
            },
            "Website": "http://www.rangoniofflorence.com",
            "Twitter": "christophermaclead_sample",
            "Information": null,
            "Salutation": "Mr.",
            "Marital_Status_1": null,
            "Birthday_1": null,
            "First_Name": "Jim",
            "Full_Name": "Mr. Jim Smith",
            "Lead_Status": "Lost Lead",
            "Record_Image": "02b9e93996ad174d0c685bd56b94e9d760497ba52e17145a73c18292ae60c1d81915036312ccaf1faaf8c8168eeff1cf427c96c3020bcd3da31280be451e09164c5ce0a2e1ff5d13109c3d1eac14bfdd",
            "Modified_By": {
                "name": "Patricia Boyle",
                "id": "1306462000000374001",
                "email": "p.boyle@abc.com"
            },
            "$review": null,
            "Skype_ID": "christopher-maclead",
            "Phone": "555-555-5555",
            "Lead_Class": null,
            "Email_Opt_Out": false,
            "Designation": "VP Accounting",
            "Modified_Time": "2021-10-05T14:37:26+05:30",
            "$converted_detail": {
                "deal": "1306462000000519017",
                "convert_date": "2021-10-05T20:07:26+05:30",
                "contact": "1306462000000396035",
                "converted_by": "1306462000000374001",
                "account": "1306462000000497010"
            },
            "Unsubscribed_Time": null,
            "Referred_By": null,
            "Mobile": "9400000001",
            "$orchestration": false,
            "$stop_processing": false,
            "Last_Name": "Maclead (Sample)",
            "$in_merge": false,
            "Lead_Source": "Cold Call",
            "Tag": [],
            "Fax": "1234123415",
            "$approval_state": "approved"
        }
    ],
    "info": {
        "call": false,
        "per_page": 200,
        "count": 1,
        "page": 1,
        "email": false,
        "more_records": false
    }
}

Show full

Show less