> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-deploy/17.latest/deployment-workflow/import-export.md).

# Import and Export

How to import and export content and schema between Umbraco environments and projects

## What is import and export?

The import and export feature of Umbraco Deploy allows you to transfer content and schema between Umbraco environments. A `.zip` file is exported from one environment and imported into another to update its Umbraco data.

## When to use import and export

Umbraco Deploy provides two primary workflows for managing different types of Umbraco data:

* Umbraco schema (such as document types and data types) are transferred [as `.uda` files serialized to disk](/umbraco-deploy/17.latest/deployment-workflow/deploying-changes.md). They are deployed to refresh the schema information in a destination environment along with code and template updates.
* Umbraco content (such as content and media) are [transferred by editors using backoffice operations](/umbraco-deploy/17.latest/deployment-workflow/content-transfer.md).

It is recommended to use these approaches for day-to-day editorial and developer activities.

Import and export is intended more for larger transfer options, project upgrades, or one-off tasks when setting up new environments.

As import and export is a two-step process, it doesn't require inter-environment communication. This allows us to process much larger batches of information without running into hard limits imposed by Cloud hosting platforms.

Hooks are also provided to allow for migrations of artifacts (such as data types) and property data when importing. This should allow you to migrate your Umbraco data from one Umbraco major version to a newer one.

## Accessing import and export

**Import** and **Export** are actions on the **Content** section, available when you click the **...** context menu:

* On the Content root, the **...** menu includes **Import**, **Environment export**, and **Export**.
* On any individual content item (in the tree, or from within its workspace), the **...** menu includes **Export** only.

![Import and Export Icons](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-16f1b8b7e6310ef50307687553dce7510ef82eb3%2Fimport-export-actions.png?alt=media)

## Exporting content and schema

To export content and schema, you can select either a specific item of content, a tree, workspace, or an environment.

### Exporting a specific item or tree

Selecting **Export** on an individual content item opens the **Export tree** dialog. It lets you choose if you want to add any additional dependencies:

* Include content dependencies (for example, related media and content)
* Include content file dependencies (for example, media files)
* Include schema dependencies (for example, document and data types)
* Include schema file dependencies (for example, templates, scripts and stylesheets)

![Tree export](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-8b1bf012d434aa49c4d7da2bc46a4c5fccdff732%2Ftree-export-modal.png?alt=media)

Bear in mind that including content file dependencies (media files) for a large site can lead to a big zip file. So even with this option, you might want to consider a different method for transferring large amounts of media. For example using direct transfer between Cloud storage accounts or File Transfer Protocol (FTP).

If your account has access to the Settings section, you can also choose to include the schema information and related files as well.

### Exporting an environment

Selecting **Environment export** from the **Content** root opens the **Export environment** dialog. All deployable items in the environment are selected by default, and you choose which categories to include:

* Include all content (checked by default) and/or Include all schema
* Include content dependencies (for example, related media and content)
* Include content file dependencies (for example, media files)
* Include schema dependencies (for example, document and data types)
* Include schema file dependencies (for example, templates, scripts and stylesheets)

When exporting an environment, you can include *all* schema, regardless of whether any content uses it.

![Environment export](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-de6e7a3eeea035fbb1df333c74194752b509936b%2Fenvironment-export-modal.png?alt=media)

### Completing the export

Select **Export** to run it. Umbraco Deploy serializes all the selected items to individual files and archives them into a zip file. The **Export complete** dialog provides confirmation, with the export date and two actions:

* **Download export**: downloads the zip file via the browser.
* **Delete export**: removes the archive from the server immediately.

![Export complete](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-e07eea65fde0af8e22931222c216a652219039e5%2Fexport-complete.png?alt=media)

If you miss doing this, you can also clean up archive files from the Umbraco Deploy dashboard in the *Settings* section.

![Delete exports](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-4df7e09de95539a11310c38340b79683e4bdfb79%2Fdelete-exports.png?alt=media)

{% hint style="info" %}
The exported archive files are saved to the Umbraco temp folder in the `Deploy\Export` sub-directory. This is a temporary (non-persistent) location, local to the backoffice server and therefore shouldn't be used for long-term storage of exports. You can also only download the file from the export dialog in the backoffice.
{% endhint %}

If you close the dialog without deleting the archive, you can clean it up later. See [Cleaning up export archives](#cleaning-up-export-archives) section below.

## Importing content and schema

Having previously exported content and schema to a zip file, you can import this into a new environment. Select **Import** from the **...** menu on the Content root.

![Import (step 1)](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-3c746aeb94c1e8a4e816b7084243a797f6795554%2Fimport-modal.png?alt=media)

You can upload the file via the browser. You can choose to import everything from the archive file, or only content, schema, or files.

{% hint style="info" %}
Deploy does not touch the default maximum upload size, but you can [configure this yourself by following the CMS documentation](https://docs.umbraco.com/umbraco-cms/reference/configuration/maximumuploadsizesettings). On Umbraco Cloud, the upload size limit is 500 MB.
{% endhint %}

![Import (step 2)](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-58e80d6031474fa70b3fd67f6e16339790369b20%2Fimport-modal-2.png?alt=media)

The file is validated before importing. Schema items that content depends on must either be in the upload itself or already exist on the target environment with the same details. If there are any issues that mean the import cannot proceed, it will be reported. You may also be given warnings for review. You can choose to ignore these and proceed if they aren't relevant to the action you are carrying out.

The import then proceeds, processing all the items provided in the zip file.

![Import complete](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-be4fa6e8c195c9b5fef67787861a75ce08d56f8e%2Fimport-complete.png?alt=media)

Once complete or on close of the dialog, the imported file will be deleted from the server. If this is missed, perhaps via a closed browser, you can also delete archive files from the Umbraco Deploy dashboard in the *Settings* section.

### Cleaning up export archives

Go to **Settings** → **Deploy**. Once you've run at least one export, a **Delete all exported ZIP archives** section appears. It shows the number of archive files currently stored and a **Delete export archives** button to remove them all at once.

![Delete exported archives](https://3380034848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Febsxdo6rn5b86Y4JvrrZ%2Fuploads%2Fgit-blob-be4fa6e8c195c9b5fef67787861a75ce08d56f8e%2Fimport-complete.png?alt=media)

## The Deploy dashboard in Settings

If your account has access to the **Settings** section, a **Deploy** dashboard is available. It contains:

* **Deploy Status**: Shows the current Deploy version, last operation status and time, with a **Refresh status** button.
* **Deploy operations**: Allows to Update Umbraco schema (from .uda files on disk), Verify and clean schema, Export schema (to .uda files on disk), Clear cached signatures, Set cached signatures, and Delete all exported ZIP archives.
* **Download Deploy artifacts** — Downloads a zip of all Deploy artifacts representing Umbraco schema as `.uda` files. This is separate from a content export archive, and is intended for moving schema to another Umbraco instance.
* **Schema comparison**: A table per schema kind (Data Type, Document Type, Language, Media Type, Member type, Relation Type, Template, and their container types). It compares what's In Umbraco, whether the File exists on disk, and whether it's Up to date. It contains a **Hide up to date** toggle and **Jump to** quick-navigation. Each row has a **View details** dropdown with **Create file** and **Delete item** actions.
* **Configuration details**: A read-only view of the current environment's Deploy configuration (for example, **Excluded Entity Types**, **Allow Ignore Dependencies**, and so on). Changes must be made in `appsettings.json` file. This section is for reference only.

## Migrating whilst importing

It is possible to migrate schema and content whilst importing. For example, to change Data Type using Nested Content to Block List and ensure content data is imported to the correct Block Editor format.

Deploy contains base classes and implementations to handle common migrations that need to be registered in code, as explained in [Import with migrations](/umbraco-deploy/17.latest/deployment-workflow/import-export/import-with-migrations.md).

### Migrating from Umbraco 7

The import and export feature is not available in Deploy 2 for Umbraco 7. We have though released a package to allow creating an export. This needs to be done in code and requires additional legacy migrators to be able to import into a newer version. This is explained in [Migrating from Umbraco 7](/umbraco-deploy/17.latest/deployment-workflow/import-export/import-export-v7.md).

## Service details (programmatically importing and exporting)

Underlying the functionality of import/export with Deploy is the import/export service, defined by the `IArtifactImportExportService`.

You may have need to make use of this service directly if building something custom with the feature. For example you might want to import from or export to some custom storage.

The service interface defines two methods:

* `ExportArtifactsAsync` - takes a collection of artifacts and a storage provider defined by the `IArtifactExportProvider` interface. The artifacts are serialized and exported to storage.
  * `IArtifactExportProvider` defines methods for creating streams for writing serialized artifacts or files handled by Deploy (media, templates, stylesheets etc.).
* `ImportArtifactsAsync` - takes storage provider containing an import defined by the `IArtifactImportProvider` interface. The artifacts from storage are imported into Umbraco.
  * `IArtifactImportProvider` defines methods for creating streams for reading serialized artifacts or files handled by Deploy (media, templates, stylesheets etc.).

Implementations for `IArtifactExportProvider` and `IArtifactImportProvider` are provided for:

* A physical directory.
* An Umbraco file system.
* A zip file.

These are all accessible for use via extension methods available on `IArtifactImportExportService` found in the `Umbraco.Deploy.Infrastructure.Extensions` namespace.

The following example shows this service in use, importing and exporting from a zip file on startup:

<details>

<summary><code>ArtifactImportExportComposer.cs</code> (import and export on startup)</summary>

```csharp
using System.IO.Compression;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Deploy;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Extensions;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Deploy.Core;
using Umbraco.Deploy.Core.Connectors.ServiceConnectors;
using Umbraco.Deploy.Infrastructure;
using Umbraco.Deploy.Infrastructure.Extensions;
​
internal class ArtifactImportExportComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
        => builder.AddNotificationAsyncHandler<UmbracoApplicationStartedNotification, ArtifactImportExportStartedAsyncHandler>();
​
    private sealed class ArtifactImportExportStartedAsyncHandler : INotificationAsyncHandler<UmbracoApplicationStartedNotification>
    {
        private readonly IHostEnvironment _hostEnvironment;
        private readonly IArtifactImportExportService _diskImportExportService;
        private readonly IServiceConnectorFactory _serviceConnectorFactory;
        private readonly IFileTypeCollection _fileTypeCollection;
​
        public ArtifactImportExportStartedAsyncHandler(IHostEnvironment hostEnvironment, IArtifactImportExportService diskImportExportService, IServiceConnectorFactory serviceConnectorFactory, IFileTypeCollection fileTypeCollection)
        {
            _hostEnvironment = hostEnvironment;
            _diskImportExportService = diskImportExportService;
            _serviceConnectorFactory = serviceConnectorFactory;
            _fileTypeCollection = fileTypeCollection;
        }
​
        public async Task HandleAsync(UmbracoApplicationStartedNotification notification, CancellationToken cancellationToken)
        {
            var deployPath = _hostEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data + "/Deploy");
            await ImportAsync(Path.Combine(deployPath, "import.zip"));
​
            Directory.CreateDirectory(deployPath);
            await ExportAsync(Path.Combine(deployPath, $"export-{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}.zip"));
        }
​
        private async Task ImportAsync(string zipFilePath)
        {
            if (File.Exists(zipFilePath))
            {
                using ZipArchive zipArchive = ZipFile.OpenRead(zipFilePath);
                await _diskImportExportService.ImportArtifactsAsync(zipArchive);
            }
        }
​
        private async Task ExportAsync(string zipFilePath)
        {
            using ZipArchive zipArchive = ZipFile.Open(zipFilePath, ZipArchiveMode.Create);
​
            IEnumerable<Udi> udis = DeployEntityTypes.GetEntityTypes(_fileTypeCollection, DeployEntityTypeCategories.ContentAndSchema).Select(Udi.Create);
            var contextCache = new DictionaryCache();
            string[] dependencyEntityTypes = DeployEntityTypes.GetEntityTypes(_fileTypeCollection, DeployEntityTypeCategories.All);
​
            await _diskImportExportService.ExportArtifactsAsync(_serviceConnectorFactory, udis, Constants.DeploySelector.ThisAndDescendants, contextCache, zipArchive, dependencyEntityTypes: dependencyEntityTypes);
        }
    }
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-deploy/17.latest/deployment-workflow/import-export.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
