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.
Available in: Salesforce Classic and Lightning Experience
Dev Hub available in: Enterprise, Performance, and Unlimited Editions
Scratch orgs available in: Developer, Enterprise, Group, and Professional Editions

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. You might 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.

Partners can create partner edition scratch orgs: Partner Developer, Partner Enterprise, Partner Group, and Partner Professional. This feature is available only if creating scratch orgs from a Dev Hub in a partner business org. See Supported Scratch Org Editions for Partners in the ISVforce Guide for details.

Note

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 when you’re using Salesforce DX, 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
Edition Active Scratch Org Allocation Daily Scratch Org Allocation
Enterprise Edition 40 80
Unlimited Edition 100 200
Performance Edition 100 200
Dev Hub trial 20 40

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

Note

To try out Salesforce DX, sign up for a Dev Hub trial org. Trial Dev Hubs expire after 30 days, and each trial Dev Hub gets 10 user licenses.

List Active and Daily Scratch Orgs

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         25
4ConcurrentAsyncGetReportInstances      200        200
5ConcurrentSyncReportRuns               20         20
6DailyApiRequests                       14994      15000
7DailyAsyncApexExecutions               250000     250000
8DailyBulkApiRequests                   10000      10000
9DailyDurableGenericStreamingApiEvents  10000      10000
10DailyDurableStreamingApiEvents         10000      10000
11DailyGenericStreamingApiEvents         10000      10000
12DailyScratchOrgs                       50         50
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