Am a bit new to Salesforce, integrating with our existing systems which uses Python, so I'm making use of the simple_salesforce module. It's working great, except I cannot figure out how you convert a Lead to a Contact/Account via the API. Is there some endpoint to do this?

  • 1
    The SOAP API supports this with convertLead(), the REST API does not as of V32. You'll need an Apex REST service as answered by A-d below
    – cropredy
    Commented Sep 22, 2014 at 3:05

2 Answers 2


You can try using the answer in this Question

global with sharing class RestLeadConvert {            

global static String doGet() {
    String ret = 'fail';
    RestRequest req = RestContext.request;
    RestResponse res = RestContext.response;
    String leadId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);              
    Database.LeadConvert lc = new Database.LeadConvert();

    LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
    Database.LeadConvertResult lcr ;
        lcr = Database.convertLead(lc);
        ret = 'ok';
    catch(exception ex){
        system.debug('***NOT CONVERTED**');           
    return ret;

And use this as given in "Using Apex" section in the simple_salesforce module guide.

  • Thanks, looks like for some reason we don't have Apex available so I'll follow up with that, but I think this is the correct solution
    – Greg Hinch
    Commented Sep 22, 2014 at 9:16

Here is a class that exposes all the features of the Apex LeadConvert functionality.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .