---
schema_version: "1"
id: 79d9eb98b83a8247a1c4acc293eac46f64a0c5cff4fd1818c6d29f3f8c367cf9
title: Deploying Apex to a Sandbox Organization
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_intro_deploying_to_sandbox.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_deploying_to_sandbox.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b3b3c95560f2c30626c1b357b0c48107c523471b8a2b2619822186eaa65713ef
description: Sandboxes create copies of your Salesforce org in separate environments. Use them for development, testing, and training without compromising the data and applications in your production org. Sandboxes are isolated from your production org, so operations that you perform in your sandboxes don’t affect your production org.
---
# Deploying Apex to a Sandbox Organization

Sandboxes create copies of your Salesforce org in separate environments. Use them for development, testing, and training without compromising the data and applications in your production org. Sandboxes are isolated from your production org, so operations that you perform in your sandboxes don’t affect your production org.

To deploy Apex from a local project in the Salesforce extension for Visual Studio Code to a Salesforce organization, see [Salesforce Extensions for Visual Studio Code](https://developer.salesforce.com/tools/vscode/).

You can also use the deploy() Metadata API call to deploy your Apex from a developer organization to a sandbox organization.

A useful API call is runTests(). In a development or sandbox organization, you can run the unit tests for a specific class, a list of classes, or a namespace.

You can also use Salesforce CLI. See [Develop Against Any Org](https://developer.salesforce.com/docs/atlas.en-us.264.0.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop_any_org.htm) for details.

For more information, see [Deploying Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_deploying.htm "You can't develop Apex in your Salesforce production org. Your development work is done in a sandbox, in a scratch org, or in a Developer Edition org.").