Sub topic 5
Identifying an org: Org ID, My Domain, and instance
This chapter assumes you know what an org is and the difference between data and metadata. It covers the three identifiers you will meet most often when you work with an org: the Org ID, the My Domain name, and the instance.
Why identifiers matter
Many orgs can look the same. You may have a production org, several sandboxes, and a Developer Edition org, all with similar names and similar data. Before you deploy, file a support case, or configure an integration, you need to be sure which org you are in. Each identifier answers a different question.
| Identifier | Question it answers | Example |
|---|---|---|
| Org ID | Which org is this, exactly? | `00D5g000001AbCdEAK` |
| My Domain | What is this org's own web address? | `acme.my.salesforce.com` |
| Instance | Which Salesforce server group hosts it? | `NA123` |
Org ID
The Org ID is a unique identifier for one org. It is a 15-character case-sensitive string, or an 18-character case-insensitive form. The 18-character form is the 15-character one plus a 3-character checksum, so tools that ignore case can still tell IDs apart.
Org IDs start with 00D. That prefix marks the record as an organization. Two orgs never share an Org ID. A sandbox gets a new Org ID when you create it from production, even though it starts as a copy. Support teams and AppExchange partners ask for the Org ID because it points to exactly one org.
You can find it in Setup under Company Information, or by querying the Organization object (see the last chapter section on inspecting an org).
My Domain
My Domain is a custom subdomain that gives your org its own login and access URL. Without it, users reach the org through a shared instance URL such as na123.salesforce.com. With it, they use a name that belongs to the org, such as acme.my.salesforce.com.
Sandboxes include the sandbox name in the address, for example acme--uat.sandbox.my.salesforce.com. The part after the double hyphen is the sandbox name. This makes a sandbox easy to tell from production in the browser address bar.
Two points to remember:
- The My Domain name is chosen by the admin, so it is readable but can be changed. Do not use it as a permanent key. Use the Org ID for that.
- Salesforce now requires My Domain in all orgs, and some features depend on it.
Instance
The instance is the group of servers where Salesforce hosts the org's data and runs its code. Names look like NA123, EU45, or CS89. Sandboxes often sit on instances that start with CS.
Multi-tenancy is why this matters. Many orgs share one instance. The instance shows up in:
- Salesforce Trust status pages, where you check whether an outage affects your instance.
- Release schedules, because instances are upgraded in waves.
- Allowlists, in older setups that rely on instance URLs.
An org can be moved to another instance, for example during a migration. The Org ID stays the same, and the instance name changes. Treat the instance as a location, not an identity.
Common errors
- Using the My Domain name as an identity. If the admin renames it, scripts and documents that stored it will break. Store the Org ID.
- Mixing up production and sandbox. Check the address bar. A
.sandbox.segment means a sandbox. - Comparing 15-character and 18-character IDs as strings. They refer to the same org but are not equal as text. Convert to one form first.
- Confusing the instance with the org. An outage notice for
NA123affects the orgs on that instance, not every org.
Exercise
A deployment script targets an org by its My Domain URL. An admin renames the My Domain, and the script starts failing. Which identifier should the script store instead, and why?
Show answer
The Org ID. It is unique to the org and does not change when the My Domain name or the instance changes, so it identifies the org reliably.