After exporting content from a source stack, unzip the exported file and then use the Contentstack CLI to import it into the destination stack.
This guide covers how to use the cm:stacks:import command with:
Note: Imported content gets published to the same environment and locale as in the source stack. Unpublished content in the source stack remains unpublished after import.
The cm:stacks:import command lets you import content into your destination stack.
Note: By default, an audit fix is performed on the exported content before import. This helps identify and address potential issues in the exported data.
Usage
csdx cm:stacks:import -k <<stack_ApiKey>> -d <<path_of_folder_where_content_is_stored>>Use the following options with any applicable import command:
Available modules: assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, personalize, and studio.
Note:
Use the --module flag in the import command to import individual modules into the target stack. If you do not use the flag, the import command includes all available modules by default.
Some modules depend on others. When importing modules individually, follow this sequence to avoid errors:
Locales → Environments → Assets → Taxonomies → Extensions → Marketplace Apps → Webhooks → Global Fields → Content Types → Personalize → Workflows → Entries → Labels → Custom Roles → Studio.
Note: Before importing a module, ensure all its dependencies have been imported.
Example:
csdx cm:stacks:import --stack-api-key bltxxxxxx -d "C:\Users\Name\Desktop\cli\content" --module localesWhen importing modules individually with the import command, include the --backup-dir flag to prevent errors caused by inter-module dependencies. This flag stores mapping files that are required by dependent modules in future imports.
csdx cm:stacks:import --stack-api-key <<stack_ApiKey>> -d <<path_of_folder_where_content_is_stored>> --module <<module>> --backup-dir <<backup_dir>>During each module import, the system saves updated mapping files in the specified backup folder. These mappings are reused by dependent modules to ensure consistent and successful imports.
Note: The parent backup folder created during the initial import can be reused for subsequent module imports. To avoid errors, always include the --backup-dir flag when importing modules one at a time.
Examples
You can also import content using a configuration file that stores all required parameters and values.
To get started, follow the steps below:
Usage
csdx cm:stacks:import -c <<config_file_path>>Example
Note:
Using a configuration file simplifies the import process by storing all required parameters and values in one place. This removes the need to enter each option manually and is helpful for repeated or complex imports.
Use a management token to import content into a stack when you prefer token-based authentication instead of CLI login. You can pass the token directly through the command line or reference it from a configuration file.
Usage
csdx cm:stacks:import -a <<alias>>Optional Parameters:
Examples:
Use the --replace-existing flag in the import command to overwrite the existing content in the target stack. This prevents import failures caused by module collisions and ensures that existing items are overwritten while new items are added.
When the import process detects a module that already exists in the target stack, the CLI replaces it instead of throwing an error. If the module does not exist, the CLI creates it as a new item.
Example:
csdx cm:stacks:import --replace-existing --backup-dir <backup-dir-path> --stack-api-key <value> -d <content-dir-path>For more details, refer Overwrite Existing Content using CLI Import document.
Contentstack CLI lets you toggle between the raw console logs and the visual Progress Manager UI during import or plugin workflows.
Default Usage:
csdx cm:stacks:import -d "./export-data" --stack-api-key bltxxxxxxNote: By default, the Progress Manager UI displays when you run the import command and does not require any configuration.
Example for Progress Manager View (Default Mode):
LOCALES:
├─ Master Locale |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
├─ Locales Create |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (0/1)
├─ Locales Update |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
ENVIRONMENTS:
└─ Environments |████████████████████████████████████████| 100% | 2/2 | ✓ Complete (2/2)
STACK:
└─ Stack |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
ASSETS:
├─ Folders |████████████████████████████████████████| 100% | 2/2 | ✓ Complete (2/2)
├─ Upload |████████████████████████████████████████| 100% | 12/12 | ✓ Complete (12/12)
├─ Publish |████████████████████████████████████████| 100% | 12/12 | ✓ Complete (12/12)
TAXONOMIES:
└─ Taxonomies |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
EXTENSIONS:
├─ Extensions Create |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
Steps to Switch to Console Logs (Optional):
csdx config:set:log --show-console-logscsdx cm:stacks:import -d "./export-data" --stack-api-key bltxxxxxxThe screen displays the console logs for the import operation.
Tip: Use --show-console-logs for detailed debugging when troubleshooting import issues.
csdx config:set:log --no-show-console-logsOptions:
Example for Console Log Mode:
[2025-09-10 19:19:02] INFO: Audit process completed
[2025-09-10 19:19:03] INFO: Starting to import content version 2
[2025-09-10 19:19:03] INFO: Starting import of locales module
[2025-09-10 19:19:05] INFO: Created locale: 'fr-fr'
[2025-09-10 19:19:07] INFO: Updated locale: 'fr-fr'
[2025-09-10 19:19:07] SUCCESS: Languages have been imported successfully!
[2025-09-10 19:19:07] INFO: Starting import of environments moduleAdditional Resource: Learn more about the CLI-supported import operations in the Support for CLI-Based Stack Import Operations document.