> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox

> Test changes in an isolated sandbox environment before promoting to your workspace

export const BrowserFrame = props => {
  const {url = "xano.run", maxWidth = 820, className = "", lightSrc, darkSrc, alt = "", children} = props || ({});
  const style = typeof maxWidth === "number" ? {
    maxWidth: `${maxWidth}px`,
    margin: "16px 0"
  } : {
    maxWidth,
    margin: "16px 0"
  };
  const hasSwapImages = Boolean(lightSrc && darkSrc);
  return <div className={`browser-frame ${className}`.trim()} style={style}>
      <div className="browser-frame__top">
        <div className="browser-frame__controls" aria-hidden="true">
          <span className="browser-frame__dot browser-frame__dot--red" />
          <span className="browser-frame__dot browser-frame__dot--yellow" />
          <span className="browser-frame__dot browser-frame__dot--green" />
        </div>
        <div className="browser-frame__address">{url}</div>
      </div>

      <div className="browser-frame__body">
        {hasSwapImages ? <>
            <img className="browser-frame__img--light" src={lightSrc} alt={alt} />
            <img className="browser-frame__img--dark" src={darkSrc} alt={alt} />
          </> : children}
      </div>
    </div>;
};

The sandbox is an isolated copy of your workspace where you can push and test changes without affecting your live environment. Once you're satisfied, you can review and promote changes from the sandbox to your workspace through the browser.

<Note>
  Sandbox commands operate on your personal sandbox environment, which is tied to your profile. You don't need to specify a workspace or tenant — the CLI manages this automatically.
</Note>

## Get Your Sandbox

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox get
  ```
</BrowserFrame>

This returns your sandbox details. If you don't have one yet, it creates one automatically. Use `-o json` for the full JSON response.

***

## Pull & Push

The sandbox supports the same pull and push workflow as [workspace pull & push](/xano-cli/push-pull), using the [multidoc](/xanoscript/multidoc) format behind the scenes.

### Pull from Sandbox

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox pull -d ./my-sandbox
  ```
</BrowserFrame>

| Flag        | Description                         |
| ----------- | ----------------------------------- |
| `--env`     | Include environment variables       |
| `--records` | Include database records            |
| `--draft`   | Include draft versions of resources |

### Push to Sandbox

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox push -d ./my-sandbox
  ```
</BrowserFrame>

| Flag               | Description                                        |
| ------------------ | -------------------------------------------------- |
| `--env`            | Include environment variables in import            |
| `--records`        | Include records in import                          |
| `--truncate`       | Truncate all table records before importing        |
| `--no-transaction` | Skip wrapping the import in a database transaction |

<Tip>
  This is the recommended way to deploy changes to tenants. Instead of pushing directly to a tenant (which is not supported), push to your sandbox first, review the changes, then promote them.
</Tip>

***

## Review & Promote

Open your sandbox in the browser to review changes and promote them to the workspace:

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox review
  ```
</BrowserFrame>

To get the URL without opening the browser (useful for scripting):

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox review --url-only
  ```
</BrowserFrame>

***

## Reset

Reset your sandbox to clear all workspace data and drafts, returning it to a clean state:

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox reset
  ```
</BrowserFrame>

Add `-f` to skip the confirmation prompt.

<Warning>
  Resetting a sandbox clears all data and drafts. This cannot be undone.
</Warning>

***

## Delete

Delete your sandbox environment entirely. It will be re-created automatically the next time you access it.

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox delete
  ```
</BrowserFrame>

Add `-f` to skip the confirmation prompt.

***

## Environment Variables

Manage environment variables on your sandbox, just like [tenant environment variables](/xano-cli/tenants#tenant-environment-variables).

### List Env Var Keys

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env list
  ```
</BrowserFrame>

### Get a Single Env Var

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env get --name DATABASE_URL
  ```
</BrowserFrame>

### Set an Env Var

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env set --name DATABASE_URL --value "postgres://..."
  ```
</BrowserFrame>

### Delete an Env Var

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env delete --name DATABASE_URL
  ```
</BrowserFrame>

### Export All Env Vars

Export all environment variables to a YAML file:

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env get_all
  xano sandbox env get_all --file ./env.yaml
  xano sandbox env get_all --view
  ```
</BrowserFrame>

### Import All Env Vars

Import environment variables from a YAML file (replaces existing):

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox env set_all
  xano sandbox env set_all --file ./env.yaml --clean
  ```
</BrowserFrame>

***

## Sandbox License

<BrowserFrame url="Terminal">
  ```bash theme={null}
  # Get sandbox license (saves to file by default)
  xano sandbox license get
  xano sandbox license get --view

  # Set sandbox license from file
  xano sandbox license set --file ./license.yaml
  xano sandbox license set --value "inline-license-content"
  ```
</BrowserFrame>

***

## Sandbox Tests

Run unit tests and workflow tests against your sandbox environment.

### Unit Tests

<BrowserFrame url="Terminal">
  ```bash theme={null}
  # List unit tests
  xano sandbox unit_test list

  # Run a single unit test
  xano sandbox unit_test run UNIT_TEST_ID

  # Run all unit tests
  xano sandbox unit_test run_all
  ```
</BrowserFrame>

Filter by branch or object type:

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox unit_test list --branch dev --obj-type function
  xano sandbox unit_test run_all --branch dev --obj-type function
  ```
</BrowserFrame>

### Workflow Tests

<BrowserFrame url="Terminal">
  ```bash theme={null}
  # List workflow tests
  xano sandbox workflow_test list

  # Run a single workflow test
  xano sandbox workflow_test run TEST_ID

  # Run all workflow tests
  xano sandbox workflow_test run_all
  ```
</BrowserFrame>

Filter by branch with `-b`:

<BrowserFrame url="Terminal">
  ```bash theme={null}
  xano sandbox workflow_test list -b dev
  xano sandbox workflow_test run_all -b dev
  ```
</BrowserFrame>

***

## Typical Workflow

A common pattern for deploying changes through the sandbox:

<Steps>
  <Step title="Pull your workspace">
    <BrowserFrame url="Terminal">
      ```bash theme={null}
      xano workspace pull -d ./my-workspace
      ```
    </BrowserFrame>
  </Step>

  <Step title="Make changes locally">
    Edit `.xs` files in your editor or with AI tools.
  </Step>

  <Step title="Push to your sandbox">
    <BrowserFrame url="Terminal">
      ```bash theme={null}
      xano sandbox push -d ./my-workspace
      ```
    </BrowserFrame>
  </Step>

  <Step title="Test in the sandbox">
    Review and test your changes in the sandbox environment.
  </Step>

  <Step title="Promote to your workspace">
    Open the sandbox in the browser to review and promote:

    <BrowserFrame url="Terminal">
      ```bash theme={null}
      xano sandbox review
      ```
    </BrowserFrame>
  </Step>
</Steps>
