Was this article helpful?
Thanks for your feedback
Contentstack allows you to create a copy of a stack (along with the data) or export all data of a stack into a new or existing empty stack by using the cm:stacks:clone CLI command.
Note: Before executing this command, ensure you have the required permissions for creating or accessing the destination stack. Refer to the Stack Roles documentation to check permissions.
You can clone a stack by performing the following two steps:
Note: By default, the CLI uses the North America region. To set the Europe or Azure North America region, refer to the Set Region command for more details.
You will need the authtoken to perform the clone operations. To generate the authtoken, open your terminal (command prompt), and run the following command to log in to your Contentstack account:
csdx auth:login
It will ask you to provide the email address and password of your Contentstack account. After logging in successfully, an authtoken will be generated and saved to the CLI session until you log out from this session.
Additional Resource: To learn more about the login command, refer to the Login command section.
Now that you are logged into Contentstack, let’s proceed to export content from the source stack and import it into the destination stack instantly by running the following command in your terminal:
csdx cm:stacks:clone
This will prompt you to provide the following details:
Tip: To ensure the above operations are error-free, we recommend that you select the option of creating a new destination stack. This is because the new stack will be empty and you can easily import content to it. If you choose to import content to an existing stack, you first need to ensure that the stack is empty and then proceed with the import operation.
Finally, the content of the source stack will be imported into the destination stack, thus completing the cloning process.
Alternatively, you can also provide the required parameters after the command in a single line as shown below:
csdx cm:stacks:clone -n <"stack_name"> --source-management-token-alias "<>" --destination-management-token-alias "<>" --target-branch "<>" --source-branch "branch_name_of_the_source _stack" --type a|b {choose either a or b} -yOptions:
Note: If the --yes flag is not passed, you are prompted to enter an encryption key while cloning the Marketplace App for the app configurations. You have 3 attempts to enter the correct encryption key for the Marketplace App configurations while using the clone command for import prompt. You must start the clone process from the beginning after 3 failed attempts.
You can export/import public and private Marketplace Apps to a stack using CLI commands.
Note: You must be logged in to your Contentstack account to perform the export/import operation on Marketplace Apps.
- You must have owner or admin rights to perform Marketplace Apps clone.
- The destination organization should have Marketplace Apps support enabled.
- If you use a region other than NA, EU, or Azure NA, you must provide the Developer Hub URL for the specific region when prompted.
Public apps:
If an app with a configuration already exists in the destination organization, then while importing it from one organization to another, you can:
Private apps:
Note: The app name must be 3-20 characters long.
Note: If an error occurs while importing a private or public app, you will be prompted to confirm whether or not you should proceed with the process. If you do not proceed, the import process stops. If you proceed, the entries/content types/global fields may be affected.
Was this article helpful?
Thanks for your feedback