The export modules is available to Administrators from the Prismic UI. It generates a ZIP archive containing a JSON file for each of the documents that are published in the repository.
Only published documents are exported. Drafts and documents stored in a Release are not exported.
The JSON files that are exported are only representing the content. The schema (custom types) or any other information (like the version history) are not exported.
The Import module is available to Administrators from the Prismic UI. It allows:
- importing new documents
- importing a set of localized documents
- updating existing documents
- importing translations for an existing document
The Import module lets you upload a ZIP archive that can contain up to 200 JSON files, each file representing the content for one Prismic document. Import jobs are limited to 10 per hour.
To get an example of the valid JSON format expected by the Import module, just export some existing documents. The ZIP archive can also include any local files (images or assets) that you're making a reference to in the Import JSON files. These assets will be imported into the repository Media Library and they will be attached to the documents you're importing.
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. That's why, for any Import job, we recommend that you populate and publish a sample document, export it to get a sample of the expected JSON format. You might also want to refer to the Import reference.
The maximum file size for each JSON document is 250KB.
The JSON documents for an import batch must be compressed into a ZIP archive that is uploaded from the Import section of your repository settings. To prepare the ZIP, select all the JSON documents and compress them (don't compress a folder containing this JSON files as this will cause some issues). The JSON files (and optional local images or files you need to attach to documents) must be at the root of the archive.
You can bulk upload images to the Media Library, or import images while you import content. Learn more here.
You can also use the Import module to bulk resize, or bulk generate responsive views for existing documents.
Importing new documents
Just ZIP the JSON files with random file name.
Just make sure you don't name the files with an existing document ID as this would be interpreted as an update of an existing document (see below).
Updating existing documents
To update an existing document, start from the exported file and just reimport the updated file by keeping the original document filename, the filenames look like these:
Importing a set of localized documents
You can import a new document along with its translations in one import job. To do this you need to use a specific file naming convention. Find out more here.
Importing translations for an existing document
You can import translations for existing documents. All details here: Import for Multiple Languages.
Duplicating a repository
Import & Export is not a recommended method for duplicating a repository or for instantiating a development environment because of some limitations detailed here. You should use the Environments feature to immediately get a perfect clone of your Prod repository, with no effort (Environments are available on the Platinum tier paid annually).
Launching an import job
Step 1: ZIP upload and validation
When uploading the ZIP, the import module will check the validity of the JSON documents. You'll see a validation report. You can explore the errors by clicking on the documents, a panel will open with the JSON you've imported, hover the error icons to get an explicit error message.
- minor errors (won't prevent the import to launch)
- major errors are preventing the import to proceed, you need to fix the errors (or remove the offender files) to proceed to the import job
Step 2: Import job
When your archive is valid for import, click "Import now". The import will run and documents will be staged into a Release. Once the job is completed, you'll see a confirmation message along with a link to the Import release.
Step 3: reviewing the Import job within the Release
The Release is useful to check that the import job is fine, before publishing the imported content (be careful, once a release is published, there is no one-click rollback option). To verify the imported documents in the release, you can open the documents and check that the data is correctly mapped in the Prismic UI. You can also launch a preview session to verify the presentation of the imported content into your front-end application.
Rollbacking an import job
You can easily remove all imported documents by deleting the Import release. But once the Import release is published, there is no bulk rollback, so make sure you did all your tests before publishing the release.