Our architecture uses Salesforce to send some emails to clients automatically, so to reproduce the full architecture in a demo environment we need to have an identical instance of Salesforce.

We can use a Sandbox, we have found the SandboxProcess and Sandbox. How do we query all the instances via rest api?


The trick we had to understand is that sObjects are not implementing REST resource "collection" default behaviour, i.e.

GET /services/data/v40.0/tooling/sobjects/SandboxInfo/

will non return all the Sandbox Info. Therefore one has to use the QUERY endpoint:

GET /services/data/v40.0/tooling/query/?q=

We now have the Name and Id (they are stable, so one could check them the UI) and we can issue a

PATCH /services/data/v40.0/tooling/sobjects/SandboxInfo/ID

with body

{ “licenseType”: “DEVELOPER” }
  • 1
    Small bug in the above query @Emondo1984 name isn't a valid field, its "SandboxName" instead -- but this was a big help! Oct 27 '17 at 20:09
  • @Edmondo1984 do you want to mark your answer as accepted to get this out of the unanswered questions queue.
    – Dave Humm
    Oct 29 '17 at 21:25

With an accesstoken/session id to the corresponding production org you can use the tooling api via REST to query the SandboxInfo.

  • 2
    I tried to query from the workbench but was unable to query the records ( I was only able to query the sObject definition of SandboxInfo) Sep 25 '17 at 5:35

If I have the ID, shouldn't I be able to query sandbox records to get the sandboxname?

When I try


I get a 404 and

GET /services/data/v40.0/tooling/query/?q=

never returns any records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.