Namespace: API

API

Methods

staticZOHO.CRM.API.addNotes(config){Promise}

Add Notes to a record
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID Long RecordID to associate the notes.
Title String Notes Title.
Content String Notes Content.
Returns:
Type Description
Promise Resolved with notes creation status
Example
ZOHO.CRM.API.addNotes({Entity:"Leads",RecordID:"1475615000000292033",Title:"Notes Title",Content:"TitleContent"}).then(function(data){
 console.log(data);
});

//prints 
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-20T14:08:56+05:30",
       "Modified_By": {
         "name": "NareshTesting",
         "id": "1000000031157"
       },
       "Created_Time": "2017-12-20T14:08:56+05:30",
       "id": "1000000044101",
       "Created_By": {
         "name": "NareshTesting",
         "id": "1000000031157"
       }
     },
     "message": "record added",
     "status": "success"
   }
 ]
}

staticZOHO.CRM.API.approveRecord(config){Promise}

approve the record
Name Type Description
config object configuration object
Name Type Description
Entity string SysRefName of module
RecordID string id of the record.
actionType string type of action Allowed values "approve" | "delegate" | "resubmit" | "reject"
comments string comments (optional)
user string only for delegate
Returns:
Type Description
Promise Resolved with the details of approval
Example
var config = {
  Entity:"Leads",
  RecordID:"111155000000036014",
  actionType:"approve"
}



ZOHO.CRM.API.approveRecord(config).then(function(data){
   console.log(data);
});


//prints


{
 "code": "SUCCESS",
 "details": {
   "id": "111155000000036014"
 },
 "message": "Record approved successfully",
 "status": "success"
}

staticZOHO.CRM.API.attachFile(config){Promise}

To delink the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
File object File Object
Name Type Description
Name String File Name
Content object File Content
Returns:
Type Description
Promise Resolved user Upload acknowledgement
Example
var filesToLoad  = document.getElementById("fileInputTag").files;
	if(filesToLoad)
	{
		var file = filesToLoad[0];
		ZOHO.CRM.API.attachFile({Entity:"Leads",RecordID:"1000000031092",File:{Name:"myFile.txt",Content:file}})
		.then(function(data){
				console.log(data);
		});
	}
//prints
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-20T14:22:30+05:30",
       "Modified_By": {
         "name": "NareshTesting",
         "id": "1000000031157"
       },
       "Created_Time": "2017-12-20T14:22:30+05:30",
       "id": "1000000044106",
       "Created_By": {
         "name": "NareshTesting",
         "id": "1000000031157"
       }
     },
     "message": "attachment uploaded successfully",
     "status": "success"
   }
 ]
}

staticZOHO.CRM.API.coql(queryObject){Promise}

Get records from the module through COQL query API.
Name Type Description
queryObject Object Config Json.
Name Type Description
select_query String Select query.
Returns:
Type Description
Promise Resolved with list of record(s) matching the query.
Example
var config = {
     "select_query": "select Last_Name, First_Name, Full_Name from Contacts where Last_Name = 'Boyle' and First_Name is not null limit 2"
}
ZOHO.CRM.API.coql(config).then(function(data){
 console.log(data);
});

//prints
{
    "data": [
        {
            "First_Name": null,
            "Last_Name": null,
            "id": "111118000000047003"
        }
    ],
    "info": {
        "count": 1,
        "more_records": false
    }
}

staticZOHO.CRM.API.deleteRecord(config){Promise}

To delete a record from a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with Response to update record
Example
ZOHO.CRM.API.deleteRecord({Entity:"Leads",RecordID: "1000000049031"})
.then(function(data){
    console.log(data)
})

//prints 
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "id": "3000000040015"
     },
     "message": "record deleted",
     "status": "success"
   }
 ]
}      

staticZOHO.CRM.API.delinkRelatedRecord(config){Promise}

To delink the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
RelatedRecordID String Related Record ID
Returns:
Type Description
Promise Resolved user matching userID
Example
ZOHO.CRM.API.delinkRelatedRecord({Entity:"Leads",RecordID:"1000000079113",RelatedList:"Campaigns",RelatedRecordID:"1000000080041"})
 .then(function(data){
     console.log(data)
 })
//prints
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "id": "3000000040055"
     },
     "message": "record deleted",
     "status": "success"
   }
 ]
}

staticZOHO.CRM.API.getAllActions(config){Promise}

We can view all the available actions that can be performed on a particular record.
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefname of module
RecordID String id of the particular record.
Returns:
Type Description
Promise Resolved List of actions be the specified module record.
Example
var config = {
	Entity: "Leads",
	RecordID : "518440000000222778"
}
ZOHO.CRM.API.getAllActions(config)
.then(function(data){
    console.log(data)
})
//prints

{
 "actions": [
   {
     "http_method": "GET",
     "name": "custom_links",
     "href": "/v2/Leads/111155000000036014/actions/custom_links"
   },
   {
     "http_method": "POST",
     "name": "change_owner",
     "href": "/v2/Leads/111155000000036014/actions/change_owner"
   },
   {
     "http_method": "POST",
     "name": "approvals",
     "href": "/v2/Leads/111155000000036014/actions/approvals",
     "params": [
       {
         "name": "action",
         "type": "text",
         "value": [
           "approve",
           "delegate",
           "reject",
           "resubmit"
         ]
       },
       {
         "name": "comments",
         "type": "text"
       }
     ]
   }
 ]
}



The above response is obtained if the record is waiting for the approval and if the caller has administrator access.
If the record has no valid approval pending or the record id is invalid, the following is the response obtained.



{
 "actions": [
   {
     "http_method": "GET",
     "name": "custom_links",
     "href": "/v2/Leads/111155000000036014/actions/custom_links"
   },
   {
     "http_method": "POST",
     "name": "change_owner",
     "href": "/v2/Leads/111155000000036014/actions/change_owner"
   }
 ]
}

staticZOHO.CRM.API.getAllProfiles(){Promise}

To get all the profiles in the app
Returns:
Type Description
Promise Resolved with all the profiles present in the app
Example
ZOHO.CRM.API.getAllProfiles().then(function(data){
	console.log(data);
});

//prints 
 {
   "profiles": [
    {
       "created_time": null,
       "modified_time": null,
       "name": "Administrator",
       "modified_by": null,
      "description": "This profile will have all the permissions. Users with Administrator profile will be able to view and manage all the data within the organization *. *        account by default.",
       "id": "12000000029855",
       "category": false,
       "created_by": null
     },
     {
       "created_time": null,
       "modified_time": null,
       "name": "Standard",
       "modified_by": null,
       "description": "This profile will have all the permissions except administrative privileges.",
       "id": "12000000029858",
       "category": false,
       "created_by": null
     },
     {
       "created_time": "2018-02-05T14:20:38+05:30",
       "modified_time": "2018-02-05T17:44:58+05:30",
       "name": "TestUser",
       "modified_by": {
         "name": "Arun ",
         "id": "12000000032013"
       },
       "description": "TestUser API",
       "id": "12000000033045",
       "category": true,
       "created_by": {
         "name": "Arun ",
         "id": "12000000032013"
       }
    }
   ]
 }

staticZOHO.CRM.API.getAllRecords(config){Promise}

get list of all records in a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
sort_order String optional To sort records. allowed values {asc|desc}
converted String optional To get the list of converted records
cvid String optional To get the list of records based on custom views
fields String optional To list all the module records with respect to fields
approved String optional To get the list of approved records
page String optional To get the list of records from the respective pages
per_page String optional To get the list of records available per page
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
ZOHO.CRM.API.getAllRecords({Entity:"Leads",sort_order:"asc",per_page:2,page:1})
.then(function(data){
   console.log(data)
})

//prints 
{
 "data": [
   {
     "Owner": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Company": "Testrec1",
     "Email": null,
     "Description": null,
     "$currency_symbol": "$",
     "$photo_id": null,
     "Website": null,
     "Twitter": null,
     "$upcoming_activity": null,
     "Salutation": null,
     "Last_Activity_Time": "2017-12-16T09:54:37+05:30",
     "First_Name": null,
     "Full_Name": "Testrec1",
     "Lead_Status": null,
     "Industry": null,
     "Modified_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Skype_ID": null,
     "$converted": false,
     "$process_flow": false,
     "Phone": null,
     "Street": null,
     "Zip_Code": null,
     "id": "3000000032009",
     "Email_Opt_Out": false,
     "$approved": true,
     "Designation": null,
     "$approval": {
       "delegate": false,
       "approve": false,
       "reject": false
     },
     "Modified_Time": "2017-12-16T09:54:37+05:30",
     "Created_Time": "2017-12-16T09:54:37+05:30",
     "$converted_detail": {},
     "$followed": false,
     "$editable": true,
     "City": null,
     "No_of_Employees": null,
     "Mobile": null,
     "Last_Name": "Testrec1",
     "State": null,
     "$status": "cv_1",
     "Lead_Source": null,
     "Country": null,
     "Created_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Fax": null,
     "Annual_Revenue": null,
     "Secondary_Email": null
   },
   {
     "Owner": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Company": "Testrec2",
     "Email": null,
     "Description": null,
     "$currency_symbol": "$",
     "$photo_id": null,
     "Website": null,
     "Twitter": null,
     "$upcoming_activity": null,
     "Salutation": null,
     "Last_Activity_Time": "2017-12-16T09:54:58+05:30",
     "First_Name": null,
     "Full_Name": "Testrec2",
     "Lead_Status": null,
     "Industry": null,
     "Modified_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Skype_ID": null,
     "$converted": false,
     "$process_flow": false,
     "Phone": null,
     "Street": null,
     "Zip_Code": null,
     "id": "3000000032091",
     "Email_Opt_Out": false,
     "$approved": true,
     "Designation": null,
     "$approval": {
       "delegate": false,
       "approve": false,
       "reject": false
     },
     "Modified_Time": "2017-12-16T09:54:58+05:30",
     "Created_Time": "2017-12-16T09:54:58+05:30",
     "$converted_detail": {},
     "$followed": false,
     "$editable": true,
     "City": null,
     "No_of_Employees": null,
     "Mobile": null,
     "Last_Name": "Testrec2",
     "State": null,
     "$status": "c_1",
     "Lead_Source": null,
     "Country": null,
     "Created_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Fax": null,
     "Annual_Revenue": null,
     "Secondary_Email": null
   }
 ],
 "info": {
   "per_page": 2,
   "count": 2,
   "page": 1,
   "more_records": true
 }
}

staticZOHO.CRM.API.getAllRoles(){Promise}

To get the list of all roles in CRM.
Returns:
Type Description
Promise Resolved with list of all the roles.
Example
ZOHO.CRM.API.getAllRoles().then(function(data){
 console.log(data);
});

//prints
{
    "roles": [
        {
            "display_label": "CEO",
            "forecast_manager": null,
            "share_with_peers": true,
            "name": "CEO",
            "description": "User belonging to this role can access data of all other users.",
            "id": "111118000000037201",
            "reporting_to": null,
            "admin_user": true
        },
        {
            "display_label": "Manager",
            "forecast_manager": null,
            "share_with_peers": false,
            "name": "Manager",
            "description": "Users belonging to this role cannot see admin role users data.",
            "id": "111118000000037204",
            "reporting_to": {
                "name": "CEO",
                "id": "111118000000037201"
            },
            "admin_user": false
        }
    ]
}

staticZOHO.CRM.API.getAllUsers(config){Promise}

To retrieve list of users in ZohoCRM
Name Type Description
config object Configuration Object
Name Type Description
Type String Allowed values "AllUsers | ActiveUsers | DeactiveUsers | ConfirmedUsers | NotConfirmedUsers | DeletedUsers | ActiveConfirmedUsers | AdminUsers | ActiveConfirmedAdmins"
page number optional To get the list of users from the respective pages
per_page number optional To get the list of users available per page
Returns:
Type Description
Promise Resolved List of users matching specified Type
Example
ZOHO.CRM.API.getAllUsers({Type:"AllUsers"})
.then(function(data){
    console.log(data)
})
//prints
{
 "users": [
   {
     "confirm": true,
     "full_name": "NareshTesting ",
     "role": {
       "name": "CEO",
       "id": "3000000029719"
     },
     "territories": [],
     "profile": {
       "name": "Administrator",
       "id": "3000000029725"
     },
     "last_name": null,
     "alias": null,
     "id": "3000000031045",
     "first_name": "NareshTesting",
     "email": "naresh.babu+dev2@zylker.com",
     "zuid": "5073288",
     "status": "active"
   }
 ],
 "info": {
   "per_page": 200,
   "count": 1,
   "page": 1,
   "more_records": false
 }
}

staticZOHO.CRM.API.getApprovalById(config){Promise}

To get details of the particular approval.
Name Type Description
config object configuration object
Name Type Description
id string id of the approval
Returns:
Type Description
Promise Resolved details of the approval.
Example
var config = {
      id:"518440000000222786"
}


ZOHO.CRM.API.getApprovalById(config).then(function(d){
  console.log(d);
})



//prints



{
 "data": [
   {
     "owner": {
       "phone": null,
       "name": "milestone2 ",
       "mobile": null,
       "id": "111155000000032023",
       "history": [],
       "email": "uk@zylker.com"
     },
     "initiated_time": "2018-07-16T10:16:54+05:30",
     "criteria": [
       {
         "api_name": "Annual_Revenue",
         "field_label": "Annual Revenue",
         "value": "$1.00"
       }
     ],
     "module": "Leads",
     "rule": {
       "name": "Name",
       "id": "111155000000036006"
     },
     "id": "518440000000222786",
     "type": "approval",
     "entity": {
       "name": "uk",
       "id": "111155000000036014"
     },
     "default_layout": true,
     "waiting_for": {
       "name": "uk ",
       "id": "111155000000035012"
     }
   }
 ],
 "info": {
   "per_page": 200,
   "count": 1,
   "page": 1,
   "more_records": false
 }
}

staticZOHO.CRM.API.getApprovalRecords(config){Promise}

This method is called by the one who has to approve.If it is called by others, they will get 204 response.

"others_awaiting" gives the list of all approvals pending regardless of who has to approve it. Usually, Super Admin and administrator will be able to use this API whereas standard user will still get a 204 empty response.

Name Type Description
config object configuration object
Name Type Description
type string Allowed values "awaiting | others_awaiting"
Returns:
Type Description
Promise Resolved List of records for waiting the approval.
Examples
ZOHO.CRM.API.getApprovalRecords()
.then(function(data){
    console.log(data)
})

It returns the pending approval records of the current user
var config = {type:"others_awaiting"}


ZOHO.CRM.API.getApprovalRecords(config)
.then(function(data){
    console.log(data)
})

It returns the pending approval records which should be approve by other user.
//prints



{
 "data": [
   {
     "owner": {
       "phone": null,
       "name": "milestone2 ",
       "mobile": null,
       "id": "111155000000032023",
       "email": "uk@zylker.com"
     },
     "initiated_time": "2018-07-16T10:16:54+05:30",
     "module": "Leads",
     "rule": {
       "name": "Name",
       "id": "111155000000036006"
     },
     "id": "111155000000036021",
     "type": "approval",
     "entity": {
       "name": "uk",
       "id": "111155000000036014"
     },
     "default_layout": true,
     "waiting_for": {
       "name": "uk ",
       "id": "111155000000035012"
     }
   }
 ],
 "info": {
   "per_page": 200,
   "count": 1,
   "page": 1,
   "more_records": false
 }
}

staticZOHO.CRM.API.getApprovalsHistory(){Promise}

View the history of records put up for approval
Returns:
Type Description
Promise Resolved List of records for waiting the approval.
Example
ZOHO.CRM.API.getApprovalsHistory().then(function(data){
   console.log(data);
});


//prints



{
 "data": [
   {
     "audit_time": "2018-07-16T15:46:54+05:30",
     "done_by": {
       "name": "milestone2 ",
       "id": "111155000000032023"
     },
     "module": "Leads",
     "record": {
       "name": "uk",
       "id": "111155000000036014"
     },
     "related_module": null,
     "action": "Submitted",
     "rule": "111155000000036006",
     "account": null,
     "related_name": "milestone2 ",
     "territory": null
   }
 ],
 "info": {
   "per_page": 200,
   "count": 1,
   "page": 1,
   "more_records": false
 }
}

staticZOHO.CRM.API.getBluePrint(config){Promise}

Get blueprint details
Name Type Description
config object configuration object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
var config = 
{
 "Entity": "Leads",
 "RecordID": "111126000000036019"
}


ZOHO.CRM.API.getBluePrint(config).then(function(data){
 console.log(data)
})


//prints


{
 "blueprint": {
   "process_info": {
     "field_id": "111126000000000885",
     "is_continuous": false,
     "api_name": "Lead_Status",
     "continuous": false,
     "field_label": "Lead Status",
     "name": "Lprint",
     "column_name": "STATUS",
     "field_value": "Pre Qualified",
     "id": "111126000000035049",
     "field_name": "Lead Status"
   },
   "transitions": [
     {
       "next_transitions": [
         {
           "name": "lost lead",
           "id": "111126000000035025"
         }
       ],
       "data": {},
       "next_field_value": "Not Qualified",
       "name": "not qualify",
       "criteria_matched": true,
       "id": "111126000000035019",
       "fields": [],
       "criteria_message": null,
       "percent_partial_save": 0
     },
     {
       "next_transitions": [],
       "data": {},
       "next_field_value": "Contacted",
       "name": "contact",
       "criteria_matched": true,
       "id": "111126000000035007",
       "fields": [],
       "criteria_message": null,
       "percent_partial_save": 0
     }
   ]
 }
}

staticZOHO.CRM.API.getFile(){Promise}

get file from file id
Returns:
Type Description
Promise Resolved with data of file binary string
Example
var config = {
   id:"b12bb1b005f171ac797b3773040438ba7da026eb056f272271d511e95581689b"
}


ZOHO.CRM.API.getFile(config);

staticZOHO.CRM.API.getOrgVariable(){Promise}

get plugins configuration data
Returns:
Type Description
Promise Resolved with Plugin Configuration
Examples
ZOHO.CRM.API.getOrgVariable("variableNamespace").then(function(data){
	console.log(data);
});

//prints 
{
 "Success": {
  "Content": "12345"
 }
}
var data = {apiKeys:["key1","key2","ke3"]};
ZOHO.CRM.API.getOrgVariable(data).then(function(data){
     console.log(data);
});

//prints
{
"Success":
{
  "content": {
     "apikey": {
        "value": "BNMMNBVHJ"
     },
     "authtoken": {
        "value": "IUYTRERTYUI"
     },
     "apiscret": {
        "value": "848ksmduo389jd"
     }
  }
}
}

staticZOHO.CRM.API.getProfile(config){Promise}

To get a particular profile's details with ProfileID as input
Name Type Description
config Object Configuration Object.
Name Type Description
ID String ProfileID
Returns:
Type Description
Promise Resolved with the details of the profile for the given ProfileID
Example
ZOHO.CRM.API.getProfile({ID:"12000000029858"}).then(function(data){
	console.log(data);
});

//prints 
{
	"profiles": [{
		"created_time": null,
		"modified_time": null,
		"permissions_details": [{
				"display_label": "Email Integration ( POP3 / IMAP )",
				"module": null,
				"name": "Crm_Implied_Zoho_Mail_Integ",
				"id": "12000000030788",
				"enabled": true
			},
			{
				"display_label": "BCC Dropbox",
				"module": null,
				"name": "Crm_Implied_BCC_Dropbox",
				"id": "12000000030752",
				"enabled": true
			},
			{
				"display_label": "Show Chat Bar",
				"module": null,
				"name": "Crm_Implied_Chat_Bar",
				"id": "12000000030806",
				"enabled": true
			},
			{
				"display_label": null,
				"module": null,
				"name": "Crm_Implied_Social_Integration",
				"id": "12000000030734",
				"enabled": false
			}
		],
		"name": "Standard",
		"modified_by": null,
		"description": "This profile will have all the permissions except administrative privileges.",
		"id": "12000000029858",
		"category": false,
		"created_by": null,
		"sections": [{
			"name": "template",
			"categories": [{
					"display_label": "Email & Chat Settings",
					"permissions_details": [
						"12000000030788",
						"12000000030752",
						"12000000030806"
					],
					"name": "email_chat"
				},
				{
					"display_label": "Manage Templates",
					"permissions_details": [
						"12000000029984",
						"12000000029987",
						"12000000030698"
					],
					"name": "template"
				}
			]
		}]
	}]
}

staticZOHO.CRM.API.getRecord(config){Promise}

get all Details of a record
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
ZOHO.CRM.API.getRecord({Entity:"Leads",RecordID:"1000000030132"})
.then(function(data){
    console.log(data)
})

//prints 
{
 "data": [
   {
     "Owner": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Company": "ZohoCorp",
     "Email": null,
     "Description": null,
     "$currency_symbol": "$",
     "$photo_id": null,
     "Website": null,
     "Twitter": null,
     "$upcoming_activity": null,
     "Salutation": null,
     "Last_Activity_Time": "2017-12-22T03:27:23+05:30",
     "First_Name": null,
     "Full_Name": "Naresh",
     "Lead_Status": null,
     "Industry": null,
     "Modified_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Skype_ID": null,
     "$converted": false,
     "$process_flow": false,
     "Phone": null,
     "Street": null,
     "Zip_Code": null,
     "id": "3000000040016",
     "Email_Opt_Out": false,
     "$approved": true,
     "Designation": null,
     "$approval": {
       "delegate": false,
       "approve": false,
       "reject": false
     },
     "Modified_Time": "2017-12-22T03:27:23+05:30",
     "Created_Time": "2017-12-22T03:27:23+05:30",
     "$converted_detail": {},
     "$followed": false,
     "$editable": true,
     "City": null,
     "No_of_Employees": 0,
     "Mobile": null,
     "Last_Name": "Naresh",
     "State": null,
     "$status": "cv_1",
     "Lead_Source": null,
     "Country": null,
     "Created_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Fax": null,
     "Annual_Revenue": 0,
     "Secondary_Email": null
   }
 ]
}

staticZOHO.CRM.API.getRelatedRecords(config){Promise}

To retrive related list records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
page Number optional To get the list of related records from the respective page.
per_page Number optional To get the list of related records available per page.
user_id Number optional fetch emails accessible to this specific userId.
type Number optional Type of emails to fetch 1- Entity Emails, 2 - user Emails , 3 - All IMAP EMAILS , 4 - ALL Contact Emails (Accounts)
deals_mail Number optional true/false - either to retrive deals email
Returns:
Type Description
Promise Resolved user matching userID
Examples
//Fetching related Email 
ZOHO.CRM.API.getRelatedRecords({Entity:"Leads",RecordID:"111118000000038099",RelatedList:"Emails",type:"2"})
.then(function(response)
{
		var messageId = response.email_related_list[0].message_id;

		// View a particular email
		return ZOHO.CRM.API.getRelatedRecords({Entity:"Leads",RecordID:"111118000000038099",RelatedList:"Emails",RelatedRecordID:messageId,user_id:"111118000000035850"})				

})
.then(function(MessageContent){
	console.log(MessageContent);
}
//To fetch the record image 
ZOHO.CRM.API.getRelatedRecords({Entity:"Leads",RecordID:"111118000000038099",RelatedList:"photo"})
.then(function(response)
{
		var a = document.createElement("a");
		a.href = window.URL.createObjectURL(response); 
		a.download = "recordImage.png"; 
		a.click();
		window.URL.revokeObjectURL(url);
});
ZOHO.CRM.API.getRelatedRecords({Entity:"Leads",RecordID:"1000000030132",RelatedList:"Notes",page:1,per_page:200})
.then(function(data){
    console.log(data)
})
//prints

{
 "data": [
   {
     "Owner": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Modified_Time": "2017-12-22T03:58:20+05:30",
     "$attachments": null,
     "Created_Time": "2017-12-22T03:58:20+05:30",
     "Parent_Id": {
       "name": "Peterson",
       "id": "3000000040011"
     },
     "$editable": true,
     "$se_module": "Leads",
     "Modified_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "$size": null,
     "$voice_note": false,
     "$status": null,
     "id": "3000000040059",
     "Created_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Note_Title": null,
     "Note_Content": "Notes2"
   },
   {
     "Owner": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Modified_Time": "2017-12-22T03:58:16+05:30",
     "$attachments": null,
     "Created_Time": "2017-12-22T03:58:16+05:30",
     "Parent_Id": {
       "name": "Peterson",
       "id": "3000000040011"
     },
     "$editable": true,
     "$se_module": "Leads",
     "Modified_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "$size": null,
     "$voice_note": false,
     "$status": null,
     "id": "3000000040055",
     "Created_By": {
       "name": "NareshTesting ",
       "id": "3000000031045"
     },
     "Note_Title": null,
     "Note_Content": "Notes1"
   }
 ],
 "info": {
   "per_page": 200,
   "count": 2,
   "page": 1,
   "more_records": false
 }
}

staticZOHO.CRM.API.getRoleById(config){Promise}

To get the details of a specific role.
Name Type Description
config Object Configuration Object.
Name Type Description
id String Role ID
Returns:
Type Description
Promise Resolved with details of the specified role.
Example
var config = {
     "id":"111118000000037201"
}
ZOHO.CRM.API.getRoleById(config).then(function(response){
     console.log(response);
});

//prints
{
    "roles": [
        {
            "display_label": "CEO",
            "forecast_manager": null,
            "share_with_peers": true,
            "name": "CEO",
            "description": "User belonging to this role can access data of all other users.",
            "id": "111118000000037201",
            "reporting_to": null,
            "admin_user": true
        }
    ]
}

staticZOHO.CRM.API.getUser(config){Promise}

To retrieve list of users in ZohoCRM
Name Type Description
config object Configuration Object
Name Type Description
ID String UserID
Returns:
Type Description
Promise Resolved user matching userID
Example
ZOHO.CRM.API.getUser({ID:"3000000029719"})
.then(function(data){
    console.log(data)
})
//prints
{
 "users": [
   {
     "country": null,
     "role": {
       "name": "CEO",
       "id": "3000000029719"
     },
     "customize_info": {
       "notes_desc": null,
       "show_right_panel": null,
       "bc_view": null,
       "show_home": false,
       "show_detail_view": true,
       "unpin_recent_item": null
     },
     "city": null,
     "signature": null,
     "name_format": "Salutation,First Name,Last Name",
     "language": "en_US",
     "locale": "en_US",
     "personal_account": true,
     "ntc_notification_type": [
       3000000020985,
       3000000020988,
       3000000020991,
       3000000020994,
       3000000020997,
       3000000021012,
       3000000021003,
       3000000021006,
       3000000021009,
       3000000021078,
       3000000021072,
       3000000021075,
       3000000021069,
       3000000021081,
       3000000021084,
       3000000021087
     ],
     "default_tab_group": "0",
     "street": null,
     "alias": null,
     "theme": {
       "normal_tab": {
         "font_color": "#FFFFFF",
         "background": "#222222"
       },
       "selected_tab": {
         "font_color": "#FFFFFF",
         "background": "#222222"
       },
       "new_background": null,
       "background": "#F3F0EB",
       "screen": "fixed",
       "type": "default"
     },
     "id": "3000000031045",
     "state": null,
     "country_locale": "en_US",
     "fax": null,
     "first_name": "NareshTesting",
     "email": "naresh.babu+dev2@zylker.com",
     "telephony_enabled": false,
     "imap_status": false,
     "zip": null,
     "decimal_separator": "en_US",
     "website": null,
     "time_format": "hh:mm a",
     "profile": {
       "name": "Administrator",
       "id": "3000000029725"
     },
     "mobile": null,
     "last_name": null,
     "time_zone": "Asia/Kolkata",
     "zuid": "5073288",
     "confirm": true,
     "rtl_enabled": false,
     "full_name": "NareshTesting ",
     "ezuid": "6ca2127e9d60c217",
     "territories": [],
     "phone": null,
     "dob": null,
     "date_format": "MM/dd/yyyy",
     "ntc_enabled": true,
     "status": "active"
   }
 ]
}

staticZOHO.CRM.API.insertRecord(config){Promise}

Insert record to a modue
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
Trigger list The trigger input can be "workflow", "approval" or "blueprint". If the trigger is not mentioned, the workflows, approvals and blueprints related to the API will get executed. Enter the trigger value as [] to not execute the workflows
APIData Object RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with response data
Examples
var recordData = {
        "Company": "Zylker",
        "Last_Name": "Peterson"
  }
ZOHO.CRM.API.insertRecord({Entity:"Leads",APIData:recordData,Trigger:["workflow"]}).then(function(data){
	console.log(data);
	});
//prints
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-22T03:24:39+05:30",
       "Modified_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       },
       "Created_Time": "2017-12-22T03:24:39+05:30",
       "id": "3000000040011",
       "Created_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       }
     },
     "message": "record added",
     "status": "success"
   }
 ]
}
var data = [
{
        "Company": "ZohoCorp",
        "Last_Name": "Babu"
},
{
	"Company": "ZohoCorp",
    	"Last_Name": "Naresh"
}
];
ZOHO.CRM.API.insertRecord({Entity:"Leads",APIData:data,Trigger:["workflow"]}).then(function(data){
	console.log(data);
});

//prints
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-22T03:27:23+05:30",
       "Modified_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       },
       "Created_Time": "2017-12-22T03:27:23+05:30",
       "id": "3000000040015",
       "Created_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       }
     },
     "message": "record added",
     "status": "success"
   },
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-22T03:27:23+05:30",
       "Modified_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       },
       "Created_Time": "2017-12-22T03:27:23+05:30",
       "id": "3000000040016",
       "Created_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       }
     },
     "message": "record added",
     "status": "success"
   }
 ]
}

staticZOHO.CRM.API.searchRecord(config){Promise}

To retrieve the records that matches your search criteria
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of module
Type String Allowed values "email|phone|word|criteria"
Query String query String
converted boolean optional get Converted records, Allowed values "true|false|both"
approved boolean optional get Approved records, Allowed values "true|false|both"
page String optional Pagination - Page number
per_page String optional Pagination - per page limit
delay boolean optional false - bypass Lucean indexing
Returns:
Type Description
Promise Resolved with search result
Examples
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"phone",Query:"123456789",delay:false})
.then(function(data){
    console.log(data)
})
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"email",Query:"test@zoho.com"})
.then(function(data){
    console.log(data)
})
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"word",Query:"ZohoCrop"})
.then(function(data){
    console.log(data)
})
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"criteria",Query:"(Company:equals:Zoho)"})
.then(function(data){
    console.log(data)
})
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"criteria",Query:"((Company:equals:Zoho)or(Company:equals:zylker))"})
.then(function(data){
    console.log(data)
})

staticZOHO.CRM.API.sendMail(config){Promise}

To send mails
Name Type Description
config Object Configuration Object.
Name Type Description
RecordID String RecordID
Entity String SysRefName of the module.
APIData Object config json
Name Type Description
from Object object that contains username and email address
to Object object that contains username and email address
cc List list of objects that contains username and email address
bcc List list of objects that contains username and email address
reply_to String reply email address
subject String subject of the mail
content String content of the mail
mail_format String format of the mail, it should be text or html
scheduled_time String scheduled_time
template_id String email template_id
attachments List list of object that contains encrypted fileid,service_name and file_name.If you use uploadFile api no need to provide service_name and file_name
org_email boolean org_email it can be true or false
consent_email boolean consent_email it can be true or false
in_reply_to String mail id, for which mail you want to reply
layout_id String layout id
paper_type String paper type, it can be USLetter or default or A4
view_type String view type,it can be landscape or portrait
layout_name String layout name
data_subject_request Object object that contains id and type. type can be "access|export|rectify"
See:
  • from and to are mandatory
  • org_email can be use if you configured organization Emails otherwise no need to send this param
  • layout_id,paper_type,view_type,layout_name are mandatory for inventory modules(quotes,sales_order,purchase_order,invoices). No need to send these params for remaining modules
  • If the content contains any inline images upload the image using uploadFile api which gives the encrypted file id and use that id in <img src> tag
  • exmaple of inline image url is like "<img src='https://<base-url>/crm/viewInLineImage?fileContent=3454678908978675434567890876543456789087675645567980'>"
  • in_reply_to is mandatory if you want to reply for previously sent mail.
Returns:
Type Description
Promise Resolved with send mail response
Example
{
  "data" : [
      {
          "from":{ "user_name" : "user1" , "email" : "user1email@zoho.com" } ,
          "to":[ { "user_name" : "user2" , "email" : "user2email@zoho.com" }],
          "cc":[ { "user_name" : "user3" , "email" : "user3email@zoho.com" }],
          "bcc":[ { "user_name" : "user4" , "email" : "user4email@zoho.com" }],
          "reply_to":{ "user_name" : "user5" , "email" : "user5email@zoho.com" },
          "subject":"Mail subject",
          "content":"content of the mail",
          "mail_format" : "text",
          "scheduled_time":"2019-05-5T05:12:12+05:30",
          "template_id":"1230000673432543545446",
          "attachments": [ { "id" : "encrypted_id"}],
          "org_email":true,
          "consent_email":true,
          "in_reply_to" : "123456" ,
          "layout_id" : "1234567654343233223",
          "paper_type" : "USLetter" ,
          "view_type" : "portrait",
          "layout_name" : "QT_layout",
          "data_subject_request" : {
          "id" : "32323232332",
          "type" : "access"
          }
      }
  ]
}
var data = {Entity:"Leads",RecordID:"345678909876",APIData:mailData};
ZOHO.CRM.API.sendMail(data).then(function(data){
     console.log(data);
});

//prints
{
"data":[
  {
      "code": "SUCCESS",
      "details": {
      "message_id" : "werttrew123452sdfg"
  },
  "message": "Your mail has been sent successfully",
  "status": "success"
  }
  ]
}

staticZOHO.CRM.API.updateBluePrint(config){Promise}

update blueprint details for particular record.
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
BlueprintData object blueprint data to update
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
var BlueprintData = 
{
 "blueprint": [
   {
     "transition_id": "111126000000035019",
     "data": {
       "Phone": "8940372937",
       "Notes": "Updated via blueprint"
     }
   }
 ]
}


update attachment with blueprint 


var BlueprintData = 
{
 "blueprint": [
   {
     "transition_id": "1000000031897",
     "data": {
       "Attachments": {
         "$file_id": [
           "59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d623a",
           "59cf260313b6907ffc56957f4241bd94ba3e0b6aad53b50f8b38583a859d624d"
         ]
       }
     }
   }
 ]
}

update link with blueprint


{
 "blueprint": [
   {
     "transition_id": "2000000031536",
     "data": {
       "Attachments": {
         "$link_url": "facebook.com"
       },
       "Notes": "Dileep checking Notes outside"
     }
   }
 ]
}


var config=
{
 Entity:"Leads",
 RecordID:"111126000000036019",
 BlueprintData:BlueprintData
}


ZOHO.CRM.API.updateBluePrint(config).then(function(data){
  console.log(data);
});

//prints 

{
   "code": "SUCCESS",
   "details": {},
   "message": "transition updated successfully",
   "status": "success"
}

staticZOHO.CRM.API.updateProfile(config){Promise}

To update permissions for the given ProfileID
Name Type Description
config Object Configuration Object.
Name Type Description
ID String ProfileID
APIData Object Permission Data (PermissionID : true | false)
Returns:
Type Description
Promise Resolved with a response message (Success or failure ) after updating the permissions
Example
var permissionData = {
    "profiles": [
		{
				"permissions_details": [
				{
					"id": "12000000030827",
					"enabled": false
				},
				{
					"id": "12000000029879",
					"enabled": true
				}
			]
		}
	]
}
ZOHO.CRM.API.updateProfile({ID:"12000000033045",APIData:permissionData}).then(function(data){
	console.log(data);
});

//prints 
{
 "profiles": [
   {
     "code": "SUCCESS",
     "details": {},
     "message": "profile updated successfully",
     "status": "success"
   }
 ]
}

staticZOHO.CRM.API.updateRecord(config){Promise}

To update a record in a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
Trigger list The trigger input can be "workflow", "approval" or "blueprint". If the trigger is not mentioned, the workflows, approvals and blueprints related to the API will get executed. Enter the trigger value as [] to not execute the workflows
APIData String Update Record Data.
Returns:
Type Description
Promise Resolved with data of update Record Response
Example
var config={
  Entity:"Leads",
  APIData:{
        "id": "1000000049031",
        "Company": "Zylker",
        "Last_Name": "Peterson"
  },
  Trigger:["workflow"]
}
ZOHO.CRM.API.updateRecord(config)
.then(function(data){
    console.log(data)
})

//prints 
{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "Modified_Time": "2017-12-22T03:29:57+05:30",
       "Modified_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       },
       "Created_Time": "2017-12-22T03:27:23+05:30",
       "id": "3000000040016",
       "Created_By": {
         "name": "NareshTesting ",
         "id": "3000000031045"
       }
     },
     "message": "record updated",
     "status": "success"
   }
 ]
}            

staticZOHO.CRM.API.updateRelatedRecords(config){Promise}

To update the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
RelatedRecordID String Related Record ID
APIData String Data to be updated in the related record
Returns:
Type Description
Promise Resolved user matching userID
Examples
To upload Record Image
var file = document.getElementById("attachmentinput").files[0];
ZOHO.CRM.API.updateRelatedRecords({Entity:"Leads",RecordID:"111118000000038099",RelatedList:"photo",APIData:file})
.then(function(data)
{
 	console.log(data)
})
var APIData = {
	Description:"Test description"
 }
 ZOHO.CRM.API.updateRelatedRecords({Entity:"Leads",RecordID:"1000000079113",RelatedList:"Campaigns",RelatedRecordID:"1000000080041",APIData:APIData})
 .then(function(data){
     console.log(data)
 })
//prints
{
 "data":[
  {
    "code": "SUCCESS",
    "details": {
      "id": 1000000080041
    },
    "message": "relation updated",
    "status": "success"
  }
	]
}

staticZOHO.CRM.API.updateVoiceURL(config)

To update voice URL (Recording) for a record in calls module (Restricted access)
Name Type Description
config Object Configuration Object.
Name Type Description
RecordID String Call activity ID.
VoiceURL list voice recording url
Example
var config={
  RecordID:"3000000031045",
  VoiceURL:"https://testurl.com/calls/1772649/recording/Aas354465.mp3"
}
ZOHO.CRM.API.updateVoiceURL(config)
.then(function(data){
    console.log(data)
})

//prints 
{
   "code": "SUCCESS",
   "status": "success"
}

staticZOHO.CRM.API.uploadFile(File){Promise}

upload the files in to zoho server
Name Type Description
File Object File object
Returns:
Type Description
Promise Resolved with uploaded file id
Example
var File = document.getElementById("attachmentinput").files[0];
ZOHO.CRM.API.uploadFile(File).then(function(data) {
   console.log(data);
})


//prints

{
 "data": [
   {
     "code": "SUCCESS",
     "details": {
       "name": "desk.png",
       "id": "b12bb1b005f171ac797b3773040438ba7da026eb056f272271d511e95581689b"
     },
     "message": "desk.png uploaded Succeessfully",
     "status": "success"
   }
 ]
} 

staticZOHO.CRM.API.upsertRecord(config){Promise}

Insert record or update matching existing record
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
Trigger list The trigger input can be "workflow", "approval" or "blueprint". If the trigger is not mentioned, the workflows, approvals and blueprints related to the API will get executed. Enter the trigger value as [] to not execute the workflows
APIData Object insert json details
duplicate_check_fields Object this param will update existing record,add multiple fields with comma separated
Returns:
Type Description
Promise Resolved with response data
Example
var data = [
{
       "Company": "zoho",
       "Last_Name": "zylker",
   "Email":"zylker@gmail.com",
   "Mobile":"1234567890",
   "Website":"https://www.zoho.com"

},
{
 "Company": "zoho",
     "Last_Name": "zylker",
 "Email":"zylkder@gmail.com",
 "Website":"http://www.google.com",
 "Mobile":"8393749473934739"
},
];
ZOHO.CRM.API.upsertRecord({Entity:"Leads",APIData:data,duplicate_check_fields:["Website","Mobile"],Trigger : ["workflow"]}).then(function(data){
 console.log(data);
});

//prints
[
 {
   "code": "SUCCESS",
   "duplicate_field": "Mobile",
   "action": "update",
   "details": {
     "Modified_Time": "2018-10-11T12:06:47+05:30",
     "Modified_By": {
       "name": "test ",
       "id": "111134000000033383"
     },
     "Created_Time": "2018-10-11T11:55:10+05:30",
     "id": "111134000000036225",
     "Created_By": {
       "name": "test ",
       "id": "111134000000033383"
     }
   },
   "message": "record updated",
   "status": "success"
 },
 {
   "code": "SUCCESS",
   "duplicate_field": "Website",
   "action": "update",
   "details": {
     "Modified_Time": "2018-10-11T12:06:47+05:30",
     "Modified_By": {
       "name": "test ",
       "id": "111134000000033383"
     },
     "Created_Time": "2018-10-11T11:55:10+05:30",
     "id": "111134000000036226",
     "Created_By": {
       "name": "test ",
       "id": "111134000000033383"
     }
   },
   "message": "record updated",
   "status": "success"
 }
]