Newer Version Available

This content describes an older version of this product. View Latest

Scratch Orgs

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences. You can share the scratch org configuration file with other team members, so you all have the same basic org in which to do your development.

Scratch orgs drive developer productivity and collaboration during the development process, and facilitate automated testing and continuous integration. You can use the CLI or IDE to open your scratch org in a browser without logging in. Spin up a new scratch org when you want to:

  • Start a new project.
  • Start a new feature branch.
  • Test a new feature.
  • Start automated testing.
  • Perform development tasks directly in an org.
  • Start from “scratch” with a fresh new org.

Scratch Orgs Created in Government Cloud or Public Cloud

The Dev Hub org instance determines where scratch orgs are created.

  • Scratch orgs created from a Dev Hub org in Government Cloud are created in a Government Cloud instance.
  • Scratch orgs created from a Dev Hub org in Public Cloud are created on a Public Cloud instance.

Scratch Org Allocations and Considerations

To ensure optimal performance, your Dev Hub org edition determines your scratch org allocations. These allocations determine how many scratch orgs you can create daily, and how many can be active at a given point. By default, Salesforce deletes scratch orgs and their associated ActiveScratchOrg records from your Dev Hub org when a scratch org expires. A scratch org expires in 7 days unless you set a duration when you create it.

Scratch orgs have these storage limits:
  • 200 MB for data
  • 50 MB for files

To try out scratch orgs, sign up for a Developer Edition org on Salesforce Developers, then enable Dev Hub.

Edition Active Scratch Org Allocation Daily Scratch Org Allocation
Developer Edition or trial 3 6
Enterprise Edition 40 80
Unlimited Edition 100 200
Performance Edition 100 200

If you are a partner or ISV, your scratch org allocations are likely different. See the ISVforce Guide for details.

Note

List Active and Daily Scratch Orgs

If your Salesforce admin provided access to the Dev Hub org using the Free Limited Access license, you don’t have permission to run this command. Contact your admin to provide this information.

Note

To view how many scratch orgs you have allocated, and how many you have remaining:

1sfdx force:limits:api:display -u <Dev Hub username or alias>
1NAME                                   REMAINING  MAXIMUM
2─────────────────────────────────────  ─────────  ─────────
3ActiveScratchOrgs                      25         40
4ConcurrentAsyncGetReportInstances      200        200
5ConcurrentSyncReportRuns               20         20
6DailyApiRequests                       14994      100000
7DailyAsyncApexExecutions               250000     250000
8DailyBulkApiRequests                   10000      10000
9DailyDurableGenericStreamingApiEvents  10000      10000
10DailyDurableStreamingApiEvents         10000      10000
11DailyGenericStreamingApiEvents         10000      10000
12DailyScratchOrgs                       80         80
13DailyStreamingApiEvents                10000      10000
14DailyWorkflowEmails                    75         75
15DataStorageMB                          1073       1073
16DurableStreamingApiConcurrentClients   20         20
17FileStorageMB                          1073       1073
18HourlyAsyncReportRuns                  1200       1200
19HourlyDashboardRefreshes               200        200
20HourlyDashboardResults                 5000       5000
21HourlyDashboardStatuses                999999999  999999999
22HourlyODataCallout                     10000      10000
23HourlySyncReportRuns                   500        500
24HourlyTimeBasedWorkflow                50         50
25MassEmail                              10         10
26PermissionSets                         1489       1500
27SingleEmail                            15         15
28StreamingApiConcurrentClients          20         20