I have been looking for an answer but cant find one so thought I would ask here.

I am currently using the Salesforce REST API.

I am able to: 1. Get Authentication Token 2. Create Lead 3. Update Lead - via ID retrieved after creation success.

To update the lead I am currently using: https://na10.salesforce.com/services/data/v37.0/sobjects/Lead/ID_OF_ENTRY

I am guessing I could use the following to update a contact? https://na10.salesforce.com/services/data/v37.0/sobjects/Contact/ID_OF_ENTRY

My problem now is that there might be cases where the LEAD might be converted to a Contact in our use case. If we then wanted to update the Entry via the API how can we determine if the Entry is now a LEAD or CONTACT? Or are we able to simple update using the ID alone?

  • 1
    You can use trick way -- if you have an id, id prefix is responsible for object type. Search for sObject prefixes. Important note -- if Lead has been converted, that doesnt mean that it is not accessible via old id. If contact has been created during lead convert process, it will get his own uniq id.
    – kurunve
    Commented Jun 15, 2016 at 7:47
  • @kurunve can we retrieve sobject type through rest api or outside of salesforce??
    – Mr.Frodo
    Commented Jun 15, 2016 at 7:49
  • 1
    @kurunve - Ok thanks - so it seems that once the lead is converted the ID does change ... so I would not be able to update it anymore using the OLD ID .. that sucks - any way to determine if a Lead was converted to a Contact and also get the new ID?
    – Dieskim
    Commented Jun 15, 2016 at 8:13
  • @DavidVanDeMeer yes on lead query the field and you will get the if lead is converted. Commented Jun 15, 2016 at 8:30
  • 1
    @Mr.Frodo I meant actually that prefix ids for standard objects are the same for all orgs -- help.salesforce.com/apex/…. @ David Van De Meer check ConvertedContactId field on Lead if IsConverted is true on lead.
    – kurunve
    Commented Jun 15, 2016 at 10:53

1 Answer 1


Thanks for @kurunve above I will add the answer also:

When a Lead gets converted the Lead Record will still remain and can still be accessed by the same ID as before.

You can simply check the Lead for the IsConverted + ConvertedContactId

You just run a GET to the following using the REST API:


And then if IsConverted is true you can get and use the ConvertedContactId to update the Contact rather than the converted Lead etc

You must log in to answer this question.

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