---
title: "[Contentstack Command-line Interface (CLI)] - Export Content Using the CLI"
description: Export content from a source stack using the Contentstack CLI `cm:stacks:export` command, including options, configuration files, and management token usage.
url: https://www.contentstack.com/docs/developers/cli/export-content-using-the-cli
product: Contentstack
doc_type: cli-guide
audience:
  - developers
version: "2.x.x-beta (Progress Manager toggle section); CLI supports Stacks from v1.42.0"
last_updated: 2026-03-25
---

# [Contentstack Command-line Interface (CLI)] - Export Content Using the CLI

This page explains how to export content from a Contentstack stack using the Contentstack Command-line Interface (CLI), including exporting via direct command options, configuration files, and management tokens. It is intended for developers or administrators migrating content between stacks or creating export backups, and should be used when preparing data for import into another stack or environment.

## Export Content Using the CLI

To migrate content from one [stack](/docs/developers/set-up-stack/about-stack) to another, begin by exporting content from the source stack, then import it into the destination stack.

This guide explains how to use the `cm:stacks:export` command by logging in to the CLI (or using a management token), using configuration files, or using direct CLI parameters.

## Prerequisites
- [Contentstack account](https://www.contentstack.com/login/)
- Contentstack CLI [installed](/docs/developers/cli/install-the-cli/)
- CLI [authenticated](/docs/developers/cli/cli-authentication#login)
- [Configured management token](/docs/developers/cli/cli-authentication#add-management-token) (alias) *(optional)*

## Supported Modules
- [Assets](/docs/content-managers/working-with-assets/about-assets/)
- [Locales](/docs/developers/multilingual-content/about-languages/)
- [Environments](/docs/developers/set-up-environments/about-environments/)
- [Stacks](/docs/developers/set-up-stack/about-stack) *(CLI supports Stacks from v1.42.0)*
- [Extensions](/docs/developers/experience-extensions-overview)
- [Marketplace](/docs/developers/marketplace-platform-guides/about-marketplace/) Apps
- [Webhooks](/docs/developers/set-up-webhooks/about-webhooks/)
- [Global Fields](/docs/developers/global-field/about-global-field/) *(CLI supports *[*Nested Global Fields*](/docs/developers/global-field/about-global-field#nested-global-fields)* from v1.42.0)*
- [Content Types](/docs/developers/create-content-types/about-content-types/)
- [Entries](/docs/content-managers/working-with-entries/about-entries/)
- [Labels](/docs/developers/create-content-types/about-labels/)
- [Workflow](/docs/developers/set-up-workflows-and-publish-rules/about-workflows/)
- [Custom Role](/docs/developers/invite-users-and-assign-roles/types-of-roles#custom-role)
- [Taxonomy](/docs/developers/taxonomy/about-taxonomy)
- [Personalize](/docs/personalize/about-personalize)
- [Studio](/docs/studio/about-studio)

## Commands

The `cm:stacks:export` command lets you export content from one stack to another.

**Usage**

```
csdx cm:stacks:export -k > -d >
```

**Options**

Use the following options with any applicable export command:

| Option | Description |
|---|---|
| `-k, --stack-api-key=stack-api-key` | API key of the source stack. |
| `-a, --alias=alias` | Management token alias of the source stack. |
| `-d, --data-dir=data-dir` | Absolute path to the folder to store the exported content. |
| `--branch=branch` | [default: all branches] Name of the branch where you want to export content. If not specified, all branches are exported by default. |
| `-b, --branch-alias=branch-alias` | Alias of the branch where you want to export content. |
| `--module=module` | (optional) Export a specific module from the source stack. If not specified, all modules are exported.**Available modules:** *assets, content-types, entries, environments, stacks, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, personalize, and studio* |
| `--content-types=content-types` | (optional) The UID of the content type(s) whose content you want to export. For multiple types, separate IDs with spaces. |
| `--secured-assets=secured-assets` | [optional] Required if the [secured assets](/docs/developers/security) feature is enabled. |
| `--backup-dir=backup-dir` | (optional) Backup directory name for a specific module. |
| `-y, --yes` | Force override all Marketplace prompts. |
| `-c, --config=config` | Path to the configuration JSON file containing all options for a single run. |

**Note:**

If the `--yes` flag is not passed, you are prompted to enter an encryption key while exporting the Marketplace app for the app configurations.

- Ensure to add the `--secured-assets` flag to avoid errors while exporting content for the stack where the [secured assets](/docs/content-managers/secure-assets/) feature is enabled.

**Examples**
- To export all modules from a stack:
```
csdx cm:stacks:export -d "C:\Users\Name\Desktop\cli\content" -k bltxxxxxx
```
- To export all modules from a specific branch (e.g., develop):
```
csdx cm:stacks:export -d "C:\Users\Name\Desktop\cli\content" -k bltxxxxxx --branch develop
```
- To export all modules from a branch using an alias:
```
csdx cm:stacks:export -d "C:\Users\Name\Desktop\cli\content" -k bltxxxxxx --branch-alias developAlias
```
- To export only content types:
```
csdx cm:stacks:export -d "C:\Users\Name\Desktop\cli\content" --module content-types -k bltxxxxxx
```

**Note:** When exporting modules individually, follow this module sequence:

assets → environments → stacks → locales → extensions → marketplace-apps → webhooks → taxonomies → global-fields → content-types → workflows → entries → labels → custom-roles → personalize → studio

For example, before exporting entries, you must have already exported assets, environments, stacks, locales, extensions, marketplace-apps, webhooks, taxonomies, global-fields, content-types, and workflows.

### Using Configuration File

You can also export content using a configuration file.

To get started, follow the steps below:
- Download the [configuration file](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/example_config/auth_config.json).
- Add your values.
- Note the path where the file is saved.

**Usage**

```
csdx cm:stacks:export -c >
```

**Example**
- To export content using a configuration file:
```
csdx cm:stacks:export -c "C:\Users\Name\Desktop\cli\config.json"
```

**Note:**
- Mac OS users must use "/" for paths in a JSON file.
- Windows OS users must use "\\" for paths in a JSON file.

**Configuration File Options**

The following are the possible file options in the [configuration file](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/example_config/auth_config.json):

| Option | Description |
|---|---|
| `versioning` | Export versioned entries. [options: true\|false] |
| `host` | Set the host for the export operation. [option: Any valid base URL from the Content Management API] |
| `preserveStackVersion` | Preserve stack version while exporting the data. [options: true\|false] |
| `fetchConcurrency` | Number of files to fetch per request. [option: any natural number] |
| `writeConcurrency` | Number of files to write per request. [option: any natural number] |
| `source_stack` | UID of the stack to export from. [option: <stack_uid>] |
| `data` | File path where the data must be stored. [option: <path-where-data-is-stored>] |
| `branchName` | Name of the branch to export from. [option: <branch-name>] |
| `branchAlias` | Alias of the branch to export from. |
| `moduleName` | Module name to export. [options: stack\|assets\|locales\|environments\|extensions\|webhooks\|global-fields\|content-types\|custom-roles\|workflows\|entries\|labels\|marketplace-apps] |
| `securedAssets` | Fetch only secured assets. [options: true\|false] |

## Export Content Using Management Token

You can also export content from your stack using a [management token](/docs/developers/cli/cli-authentication#token-management).

**Usage**

```
csdx cm:stacks:export -a >
```

Alternatively, refer to the following command to add several parameters or options in a single line:

```
csdx cm:stacks:export -a > -d >
```

You can also **export content by using a management token and a **[**configuration file**](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/example_config/management_config.json) that contains the parameters or options and the associated values.

By doing so, you don’t need to separately provide parameters or options in the command.

**Usage**

```
csdx cm:stacks:export -a > -c >
```

**Example**
- To export content using a configuration file:
```
csdx cm:stacks:export -a mytoken -c "C:\Users\Name\Desktop\cli\config.json"
```

## Toggle Between Console Logs and Progress Manager View (2.x.x-beta)

Contentstack CLI lets you toggle between the raw console logs and the visual Progress Manager UI during export or plugin workflows.

**Default Usage:**

```
csdx cm:stacks:export -d "./export-data" -k bltxxxxxx
```

**Note:** By default, the Progress Manager UI displays when you run the `export` command and does not require any configuration.

**Example for Progress Manager View (Default Mode):**

```
STACK:
   ├─ Settings             |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)
   ├─ Locale               |████████████████████████████████████████| 100% | 1/1 | ✓ Complete (1/1)

LOCALES:
    └─ Locales             |████████████████████████████████████████| 100% | 2/2 | ✓ Complete (2/2)

CONTENT TYPES:
    └─ Content types       |████████████████████████████████████████| 100% | 6/6 | ✓ Complete (6/6)

ENTRIES:
   ├─ Entries              |████████████████████████████████████████| 100% | 12/12 | ✓ Complete (12/12)
```

**Steps to Switch to Console Logs (Optional):**
- Run the following command to switch to console log mode:
```
csdx config:set:log --show-console-logs
```
- Run the export command:
```
csdx cm:stacks:export -d "./export-data" -k bltxxxxxx
```

The screen displays the console logs for the export operation.

**Tip:** Use `--show-console-logs` for detailed debugging when troubleshooting export issues.
- Run the following command to switch back to default mode:
```
csdx config:set:log --no-show-console-logs
```

**Options:**
- `--show-console-logs`: Displays the console logs for the operation.
- `--no-show-console-logs`: Hides the console logs and displays the Progress Manager view.

**Example for Console Log Mode:**

```
[2025-08-22 16:12:23] INFO: Exporting content from branch main
[2025-08-22 16:12:23] INFO: Started to export content, version is 2
[2025-08-22 16:12:23] INFO: Exporting module: stack
[2025-08-22 16:12:24] INFO: Exporting stack settings
[2025-08-22 16:12:25] SUCCESS: Exported stack settings successfully!
```

## Limitations
- If multiple assets have the same UID and file name, only the first asset will be exported.
- To resolve the `maxContentLength` and `maxBodyLength` errors, include these parameters in the configuration JSON with values specified in bytes. The default limit is **100MB**. For implementation details, refer to the [example configuration file](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/example_config/management_config.json).
- To manage API request timing and prevent concurrency issues, add the `delayMs` parameter to your configuration file.For example, use `delayMs: 1000` (for a 1-second delay).
- Currently, only the latest version of entries and assets is exported.
- Currently, the following modules cannot be exported:
  - [Users](/docs/developers/invite-users-and-assign-roles/about-stack-users/)
- [Releases](/docs/content-managers/create-and-manage-releases/about-releases/)

**Additional Resource:** Learn more about the CLI-supported export operations in the [CLI-Supported Features for Export, Import, and Clone Operations](/docs/developers/cli/cli-supported-features-for-export-import-and-clone-operations) document.

## Common questions

### How do I export only a single module (for example, content types)?
Use the `--module=module` option, for example: `csdx cm:stacks:export -d "C:\Users\Name\Desktop\cli\content" --module content-types -k bltxxxxxx`.

### When do I need to use the `--secured-assets` flag?
Use `--secured-assets=secured-assets` when the [secured assets](/docs/developers/security) feature is enabled to avoid errors while exporting content.

### Can I export from a specific branch?
Yes, use `--branch=branch` to export from a named branch, or `-b, --branch-alias=branch-alias` to export using a branch alias.

### How do I switch from the Progress Manager UI to console logs during export?
Run `csdx config:set:log --show-console-logs`, then run the export command; switch back with `csdx config:set:log --no-show-console-logs`.