Data export#
The strapi export command is part of the Data Management feature and used to export data from a local Strapi instance. By default, the strapi export command exports data as an encrypted and compressed tar.gz.enc file which includes:
- the project configuration,
- entities: all of your content,
- links: relations between your entities,
- assets: files stored in the uploads folder,
- schemas,
- the
metadata.jsonfile.
The following documentation details the available options to customize your data export. The export command and all of the available options are run using the Strapi CLI.
- Admin users and API tokens are not exported.
Understand the exported archive#
The exported .tar archive contains a flat structure of numbered files arranged in folders for each exported resource:
export_202401011230.tar
├── metadata.json
├── configuration/
│ └── configuration_00001.jsonl
├── entities/
│ └── entities_00001.jsonl
├── links/
│ └── links_00001.jsonl
└── schemas/
└── schemas_00001.jsonl
Each folder (except for metadata.json) contains one or more .jsonl files named sequentially (e.g., entities_00001.jsonl). Each line in these .jsonl files represents a single record, making the archive convenient for line‑by‑line processing or conversion to formats such as CSV. To inspect these files directly, export without compression or encryption:
yarn strapi export --no-encrypt --no-compress -f my-export
npm run strapi export -- --no-encrypt --no-compress -f my-export
The command above creates my-export.tar in the project root. After extracting the archive (tar -xf my-export.tar), open any .jsonl file to view individual records.
Name the export file#
Exported data are contained in a .tar file that is automatically named using the format export_YYYYMMDDHHMMSS. You can optionally name the exported file by passing the --file or -f option with the strapi export command. Do not include a file extension as one will be set automatically depending on options provided.
Example: Export data with a custom filename#
yarn strapi export --file my-strapi-export
npm run strapi export -- --file my-strapi-export
Configure data encryption#
The default strapi export command encrypts your project data using aes-128-ecb encryption and adds the file extension .enc. To use encryption you need to pass an encryption key using the -k or --key option or enter an encryption key when prompted. The encryption key is a string with no minimum character count.
:::tip Encryption keys
Strong encryption keys are encouraged to protect sensitive data in your project. is a resource for generating encryption keys. The following example commands generate encryption keys in a terminal:
openssl rand -base64 48
node -p "require('crypto').randomBytes(48).toString('base64');"
:::
To disable encryption, pass the --no-encrypt option with the strapi export command.
Example: Export data without encryption#
yarn strapi export --no-encrypt
npm run strapi export -- --no-encrypt
Example: Export data with the encryption --key option#
yarn strapi export --key my-encryption-key
npm run strapi export -- --key my-encryption-key
Disable data compression#
The default strapi export command compresses your project data using gzip compression and adds the .gz file extension.
To disable compression, pass the --no-compress option with the strapi export command.
Example: Export data without compression#
yarn strapi export --no-compress
npm run strapi export -- --no-compress
Export only selected types of data#
The default strapi export command exports your content (entities and relations), files (assets), project configuration, and schemas. The --only option allows you to export only the listed items by passing a comma-separated string with no spaces between the types. The available values are content, files, and config. Schemas are always exported, as schema matching is used for strapi import.
Example: Export only entities and relations#
yarn strapi export --only content
npm run strapi export -- --only content
Exclude items from export#
The default strapi export command exports your content (entities and relations), files (assets), project configuration, and schemas. The --exclude option allows you to exclude content, files, and the project configuration by passing these items in a comma-separated string with no spaces between the types. You can't exclude the schemas, as schema matching is used for strapi import.
Example: Export data excluding assets, entities, and relations#
yarn strapi export --exclude files,content
npm run strapi export -- --exclude files,content