Export and Import

Exporting and importing data in your Enonic XP installation is useful both for securing data and migrating between installations.

Enonic XP ships with a set of Shell Scripts to ease the operation of exporting and importing data from the system. The provided scripts can be found in the $XP_INSTALL/tools folder.


At the moment, exporting and importing data can only be done to and from files on the server running Enonic XP server.


The export operation will extract data for a given content URL and store it as XML in the specified directory. The REST service for export is found at the following URL:


The export REST service accepts a JSON in this format:

  "sourceRepoPath": "<source-repo-path>",
  "targetDirectory": "<absolute-path-to-directory-on-server>",
  "importWithIds": <true|false>,
  "dryRun": <true|false>

To ease the process, we have provided an export tool.


The import will take data from a given export directory and load it into Enonic XP at the desired content path. The REST service for import is found at the following URL:


The import REST service accepts a JSON in this format:

  "sourceDirectory": "<absolute-path-to-source-directory-on-server>",
  "targetRepoPath": "<target-repo-path>",
  "importWithIds": <true|false>,
  "dryRun": <true|false>

To ease the process, we have provided an import tool.

Export data structure

Let’s look at how this works. The following structure will be exported:


Run the export command:

$ ./export.sh -u su:password -s cms-repo:draft:/ -t /tmp/myexport \
  -n -i false

Below is the resulting structure in the export folder /tmp/myexport:

./content/demo-site/case-studies/a-demo-case-study/enonic man.png
./content/demo-site/case-studies/a-demo-case-study/enonic man.png/_
./content/demo-site/case-studies/a-demo-case-study/enonic man.png/_/bin
./content/demo-site/case-studies/a-demo-case-study/enonic man.png/_/bin/Enonic man.png
The base folder of the export. All content in cms-repo has this as root path.
All folders named _ are system folders for the data at the current level.
The definition of the node, e.g. all data for the current node
This is the site from the screenshot above.
Our demo-site has manually ordered children, this file contains an ordered list of children.
This ‘case-studies’ content is the first element in the site.
content/demo-site/case-studies/a-demo-case-study/enonic man.png/_/bin
The A demo case study content has a binary attachment called Enonic man.png. The folder _/bin contains the actual binary files.

Changing export data

It is possible to make manual changes to the exported data before importing.

Using the above export as an example, the demo-site displayName can be changed to something more suitable:

/tmp/myExport $ vi content/demo-site/_/node.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<node xmlns="urn:enonic:xp:export:1.0">
  <childOrder>_manualordervalue DESC</childOrder>
    <boolean name="valid">true</boolean>
    <string name="displayName">My much nicer demo-site!</string>
    <string name="type">portal:site</string>
    <string name="owner">user:system:su</string>

After some data has been changed, it can be imported again:

$ ./import.sh -u su:password -s /Users/rmy/tmp/myExport -t cms-repo:draft:/


Editing exported data is experimental at the moment and will potentially cause trouble if not done carefully. For exports without ids, references will be broken and must be fixed manually. When importing with ids onto existing data, renaming and changing manual order will not yet work as expected.