Create a LEAD in ZOHO CRM using API

Create a LEAD in ZOHO CRM using API

In this article, I will explain you that, how we can insert a lead in ZOHO CRM, for this we will create lead with XMLDATA using CURL request. You can create leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and notes also with ZOHO CRM. 

Read: Create Lead with node js in ZOHO CRM API is used to insert a LEAD in ZOHO CRM with XMLDATA . Below is XMLDATA format:


<row no="1">

<FL val="SMOWNERID">2000000016714</FL>
<FL val="Lead Owner"></FL>
<FL val="Company">Zoho</FL>
<FL val="First Name">Peter</FL>
<FL val="Last Name">John</FL>
<FL val="Designation">CEO</FL>
<FL val="Email"></FL>
<FL val="Phone">04422334455</FL>
<FL val="Fax">98889</FL>
<FL val="Mobile">09999999999</FL>
<FL val="Website"></FL>
<FL val="Lead Source">External Referral</FL>
<FL val="Lead Status">Contacted</FL>
<FL val="Industry">Financial Services</FL>
<FL val="No of Employees">100</FL>
<FL val="Annual Revenue">100.0</FL>
<FL val="Email Opt Out">true</FL>
<FL val="Skype ID">peter</FL>
<FL val="Salutation">Mr.</FL>
<FL val="Street">Street One</FL>
<FL val="City">Chennai</FL>
<FL val="State">Tamil Nadu</FL>
<FL val="Zip Code">6000001</FL>
<FL val="Country">India</FL>
<FL val="Description">Sample Description.</FL>





To insert LEAD in ZOHO CRM auth_token is required. I'm using the following code to insert LEAD.

$auth_token = "AUTH TOKEN HERE";
$firstname = 'test';
$lastname = 'user';
$email = '';
$phone = '+91999999999';

//pass fields in xmlData
$xml ="
<row no=\"1\">
<FL val=\"Company\">Your Company</FL>
<FL val=\"Lead Owner\"></FL>
<FL val=\"First Name\">$firstname</FL>
<FL val=\"Last Name\">$lastname</FL>
<FL val=\"Phone\">1234567890</FL>

$url = '';
$fields = "authtoken=".$auth_token."&scope=crmapi&xmlData=".$xml."";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // -H
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

$resp = curl_exec($ch);


Hi, I'm Saurav, the developer behind usingphp. Donate to help me keep usingphp free and maintained.

Please let me know what your thoughts or comments are on this article. If you have any suggestion or found any mistake in this article then please let us know.

Latest Comments

Andrew Clark
Andrew Clark
13 Jan 2021

Does this work for zoho version 2 api?

Saurav Sharma
Saurav Sharma
29 Jan 2021

Yes It is.

Add your comment