# Export and import environments

> Move an environment between Cloud Management Platform (CMP) instances as a zip file, in the UI or through the API

---

Site [llms.txt](/llms.txt)

---

An export includes the environment along with its parameters, limits, OS builds, and rates. On import, CMP reuses any existing matching objects and creates the rest. Exporting requires administrator access.

## Export an environment

1. Go to **Admin** > **Environments** and select the environment's name.
1. Select **Export**.
1. To encrypt the secrets this environment holds, enter a password of at least 12 characters. See [Secrets in an exported environment](#secrets-in-an-exported-environment).
1. Select **Next**.
1. Choose a format: sanitized, or instance-specific.

CMP downloads the zip file to your machine.

<div class="alert alert-info" role="alert">


CMP discards the export password after the file is built and prompts for a new one on each export. Record it somewhere safe: without it, the secrets in this file cannot be decrypted on another instance.
</div>


## Import an environment

Importing is the **Upload Environment** option on the Environments page. See [Upload an environment](/docs/cmp/configure/infrastructure/environments/add-an-environment/#upload-an-environment) for the steps, including what happens when CMP cannot match a resource handler.

## Export and import through the API

Both operations are POST requests. Find the environment's global ID on its **Overview** tab; it looks like `ENV-x57nm3w2`.

| Operation | Request | Parameters |
| --- | --- | --- |
| Export | `POST /api/v3/cmp/environments/{globalId}/export/` | `instance_specific_info`: set to true for the instance-specific format. Defaults to false, the sanitized format.<br>`password`: encrypts the secrets in the file.<br>The response is the zip file. |
| Import | `POST /api/v3/cmp/environments/` | Send the file as multipart form data.<br>`zipFile`: required, the exported archive.<br>`password`: decrypts the secrets in the file.<br>`replaceExisting`: set to true to overwrite an environment of the same name. Defaults to false. |

See [REST API](/docs/cmp/developer-resources/rest-api/) for authentication.

## Sanitized and instance-specific formats

- **Sanitized.** Omits details specific to the instance the file came from. Use it to share an environment with a CMP installation you do not own.
- **Instance-specific.** Includes data specific to this installation, making it useful for moving content between your own instances, such as from dev to prod. May include sensitive information.

## Secrets in an exported environment

Any password or encrypted text parameter value stored in the environment is encrypted on export and decrypted on import. Enter the same password at both ends.

- If you export without one, CMP encrypts with a default key. Those secrets can then only be decrypted by importing back into the instance that produced the file.
- If the password is missing or wrong at import time, the environment still imports, but without its secrets.

## Global IDs during export and import

If you reference environments by global ID through the API, select **Replace an existing environment if one is found with the same name** during import, so the environment retains a consistent global ID across instances. Clear it, and CMP creates a second environment with the same name and a different global ID.

## Related

- [Add an environment](/docs/cmp/configure/infrastructure/environments/add-an-environment/): Create one from scratch, or upload an exported file.
- [REST API](/docs/cmp/developer-resources/rest-api/): Authentication and conventions for the requests above.
