Convert Lead
Purpose
To convert a lead into a contact or an account.
Request Details
Request URL
{api-domain}/crm/v2/Leads/{record_id}/actions/convert
Header
Authorization: Zoho-oauthtoken 100xx.d92d4xxxxxxxxxxxxx15f52
If-Modified-Since: Use this header to get the list of recently modified records. Example: 2019-07-25T15:26:49+05:30
Scope
scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.leads.{operation_type}
Possible operation types
ALL - Full access to the record
WRITE - Edit records in the module
CREATE - Create records in the module
Sample Request
In the request, "@convertlead.json" contains the sample input.
Input JSON Keys
To convert leads, send a POST request with request body containing the following attributes:
- overwriteboolean, optional
Specify if the Lead details must be overwritten in the Contact/Account/Deal based on lead conversion mapping configuration.
true: Overwrite the lead details in Contact/Account/Deal. Note that when this value is true and you have specified an account ID, only the account name will be overwritten with the company name of that contact. Rest of the details are unchanged.
false: Do not overwrite the lead details to Contact/Account/Deal. - notify_lead_ownerboolean, optional
Specify whether the lead owner must get notified about the lead conversion via email.
true: The lead owner gets notified about the conversion via email.
false: The lead owner does not get notified about the conversion via email. The default value is false. - notify_new_entity_ownerboolean, optional
Specify whether the user to whom the contact/account is assigned to must get notified about the lead conversion via email.
true: The user gets notified about the conversion via email.
false: The user does not get notified about the conversion via email. The default value is false. - Accountsstring, optional
Use this key to associate an account with the lead being converted. Pass the unique and valid account ID.
Example: "Accounts": "4000000373187" - Contactsstring, optional
Use this key to associate a contact with the lead being converted. Pass the unique and valid contact ID.
Example: "Contacts": "4000000372131" - assign_tostring, optional
Use this key to assign record owner for the new contact and account. Pass the unique and valid user ID.
Example: "assign_to": "4000000219019" - DealsJSON object, optional
Use this key to create a deal for the newly created Account. The "Deal_Name", "Closing_Date", and "Stage" are default mandatory keys to be passed in the JSON object.
- carry_over_tagsJSON object, optional
Use this key to carry over tags of the lead to contact, account, and deal. Refer to sample input for format.
In the input, the assign_to value can only be the User ID.
You can associate the existing contact or account to the converting lead even if the lead is converted or not converted to a deal. To achieve this, you have to send the account ID and contact ID in your input data.
If both account ID and overwrite values are true, then the account name will be replaced by the company name, while associating it with the existing account. However, the data of that account will remain the same.
If overwrite value is set to false, then association will only happen. However, if you set the overwrite value without account ID, the working of this method remains unchanged.
If contact ID is given in your input, then the converting lead will be associated to the existing contact.
You must use only Field API names in the input. You can obtain the field API names from
Fields metadata API (the value for the key “api_name” for every field). (Or)
Setup > Developer Space > APIs > API Names > {{Module}}. Choose “Fields” from the “Filter By” drop-down.
Sample Input
Copied
Possible Errors
- DUPLICATE_DATAHTTP 202
Duplicate data
Resolution: There already exists a contact with the unique field details present in lead. Ensure you specify unique values for unique fields (both system and user-defined). To know which fields are unique, refer to Fields Metadata API. - ID_ALREADY_CONVERTEDHTTP 202
id already converted
Resolution: The lead you are trying to convert has already been converted. Specify a valid lead ID. Refer to Get Records API to get valid lead IDs. - INVALID_URL_PATTERNHTTP 404
Please check if the URL trying to access is a correct one
Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above. - OAUTH_SCOPE_MISMATCHHTTP 401
Unauthorized
Resolution: Client does not have ZohoCRM.modules.{module_name}.CREATE. Create a new client with valid scope. Refer to scope section above. - NO_PERMISSIONHTTP 403
Permission denied to create
Resolution: The user does not have permission to create records. Contact your system administrator. - INTERNAL_ERRORHTTP 500
Internal Server Error
Resolution: Unexpected and unhandled exception in the server. Contact support team. - INVALID_REQUEST_METHODHTTP 400
The http request method type is not a valid one
Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to create records
Resolution: The user does not have the permission to create records. Contact your system administrator. - INVALID_DATAHTTP 202
invalid data
Resolution: The input specified is incorrect. Specify valid input.
Sample Respnse
Copied