Salesforce REST API supports the getdeleted endpoints to furnish a list of deleted records for an SObject. The response from the API looks like this

"deletedRecords" : 
        "id" : "a00D0000008pQRAIA2", 
        "deletedDate" : "2013-05-07T22:07:19.000+0000"
"earliestDateAvailable" : "2013-05-03T15:57:00.000+0000",
"latestDateCovered" : "2013-05-08T21:20:00.000+0000"

The problem is that this response does not contain any information about the user who performed the delete. How to get the Id of the user who performed this operation?

We cannot make an API call on the respective SObject Id(to get LastModifiedBy) as it has been deleted and will not appear in the normal API call. What is the solution?

One way could be to use the queryall() functionality of the SOAP API. How can this be done using the REST API? Even if this approach works, it will only work for records that have moved to the recycle-bin after the delete i.e a soft delete. What about the records that have been hard deleted directly?

As an observation, if you go to the recycle-bin it shows the Deleted By and Deleted Date on the deleted records. How does Salesforce show that information because SObjects dont seem to have fields for deleted-by and deleted-date. If there is, how can it be used to solve this problem?

  • I'm a bit confused by your question. At times it appears as though you're asking about deleting custom sObjects and at other times about deleting records. If objects, that's contained under Setup>Security>View Setup Audit Trail. Ditto for an SObject's fields. Wasn't aware one could do a hard delete of a record via REST. Understood all records get moved to recycle bin for 15 days.
    – crmprogdev
    Sep 24, 2014 at 12:52

1 Answer 1


Use the REST API's QueryAll, rather than plain Query. You can even follow the LastModifiedBy relation to drill down into user fields:

$ curl -H 'X-PrettyPrint: 1' -H 'Authorization: Bearer ACCESS_TOKEN' \
  "totalSize" : 1,
  "done" : true,
  "records" : [ {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v31.0/sobjects/Account/001E000000ugw6hIAA"
    "Id" : "001E000000ugw6hIAA",
    "Name" : "DeletedMe",
    "LastModifiedById" : "005E0000000HiFiIAK",
    "LastModifiedBy" : {
      "attributes" : {
        "type" : "User",
        "url" : "/services/data/v31.0/sobjects/User/005E0000000HiFiIAK"
      "Name" : "Pat Patterson"
      "Profile" : {
        "attributes" : {
          "type" : "Profile",
          "url" : "/services/data/v31.0/sobjects/Profile/00eE0000000V6fYIAS"
        "Name" : "System Administrator"
    "LastModifiedDate" : "2014-05-30T21:39:30.000+0000"
  • Thanks @metadaddy. I read somewhere that REST API did not support the QueryALl function. It working for me now. Is it possible to run QueryAll in Bulk API?
    – auny
    Sep 25, 2014 at 6:35
  • No - there's no QueryAll equivalent in the Bulk API. See salesforce.stackexchange.com/q/32914/67
    – metadaddy
    Sep 25, 2014 at 14:52

You must log in to answer this question.

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