Introduction to Import/Export

The Prismic import module is still in beta, you can ask the prismic team to activate this feature for your content migration or import.

As this new feature is still beta, the number of documents you can import per batch is limited to 200 documents. And there is a limit of 10 import batches per hour.

The Import/Export module lets you export, create new documents or update existing ones directly from your content repository's UI.

The module takes ZIP files as the input. The ZIP files must contain one JSON file per document to be created or updated. It also requires all the local files that need to be added to the media library (such as the image files).

Exporting your content

Go to settings: Import / Export

Click on “Export your documents”. The export module will send an email when the export is ready. Once it’s done, click on the provided link to download your archive.

Preparing the JSON for import

The document data to be imported must be represented by a JSON file that has the same structure as an export JSON output file of the same custom type.

An example

Here are the steps you need to take:

  • Create a Document Custom Type that uses all existing prismic.io fields, or use this example.
  • Publish a document of that type. Make sure to populate it with sample content using all editor formatting options (for a Rich Text field, for example).
  • Create a snapshot of the repository using the Export feature from the Import page (/settings/import)
  • The Export feature will create a ZIP file that contains a JSON file for each document contained in the repository. The JSON export files are named with the ID of the document (ex. VcidGCIAACIAX-sW.json)

Here is an example of the JSON file we get from exporting the full sample document we’ve manually populated.

You can refer to this output file syntax to generate the input JSON file for importing your new documents.

Assets

In the JSON import file, you must specify an original path (URL) for all the assets to be imported (such as images). The importer will download the resources from the provided urls and add them to your repository’s media library. If a given asset is used several times in one import batch, that asset will be added only once to the media library.

Importing documents

The JSON documents for an import batch must be compressed in a zip file that is uploaded from the Import page.

It’s important that you select all your document and zip them. The JSON files should be at the root of the zip. There shouldn’t be a folder in the zip file.

When uploading the zip file, the import module will check the documents and warn the user if any of the JSON files contain any errors. All major errors have to be fixed before the import can be completed.