[SalesForce] way to query sandbox configuration info? (e.g. Location, sandbox name, etc)

I would like to be able to query the Sandbox configuration data. For example, if you go to the "Sandboxes" link in the setup of your production org, I want to be able to query that info (Name, Type, Location, Current Org Id, etc) via soql or via an API call.

Does anyone know if there's a way this can be done? Tooling API, metadata API, native soql, etc?

Best Answer

Maybe not directly what you are looking for, but I stumbled across the Sandbox EventLogFile.

Description from the docs:

Sandbox events contain details about sandbox copies.

Of particular interest were some of the fields that it captures:

  • CURRENT_SANDBOX_ORG_ID - The 15-character ID of the current sandbox organization.
  • PENDING_SANDBOX_ORG_ID - The 15-character ID of the target sandbox org.
  • SANDBOX_ID - The 15-character ID of the sandbox organization.
  • STATUS - The status of the sandbox copy.

The catch here is that Event Logs are a paid feature. Still, it may be useful if you can get it. When available, you can access it with both the REST and SOAP apis.

Related Topic