---
title: "Export/Import Commands & Data Formats"
description: "Troubleshoot failed CLI imports, missing asset links, global field export issues, and unsupported data formats like CSV."
url: "https://www.contentstack.com/docs/headless-cms/export-import-commands-data-formats"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-05-12"
---

# Export/Import Commands & Data Formats

## 1\. CLI Import to New Locale Fails After Renaming Exported File

The customer wanted to import content into a new language (locale) and thought that simply renaming the exported content files would change their locale. However, after renaming the files, the import process failed. The customer asked for help to import content correctly into the intended new locale.

**Root Cause**

In this case, support observed an **incorrect locale identifier** (or mismatch with the stack’s configured locales) during the import workflow. Renaming files alone does not retarget locale. The failure was tied to locale configuration/format as used in the workflow, not necessarily a generic CLI defect.

**Resolution**

1.  Review the locale identifier the customer is using in the export/import workflow.
2.  Correct the locale format to match the stack’s configured locale format (the exact format used in the stack configuration).
3.  Re-run the import using the corrected locale format, following the same steps the customer was attempting.

The CLI import completes successfully after correcting the locale format, and the content is imported into the intended locale without error.

* * *

## 2\. CLI Import: Entries Imported but Assets Not Linked (Publish Failures)

Entries were imported successfully but failed to publish because linked assets were missing. Errors included:

Entry publishing failed. Please enter valid data.
list\_no\_products\_found.images.0.image is a required field.

**Root Cause**

The import process included entries but did not include the **backup directory containing assets** (when assets are imported via the module/backup flow). As a result:

*   Entries were imported
*   Asset references existed
*   Actual asset files were not imported
*   Required asset fields failed validation during publish

**Resolution**

1.  Ensure the import directory includes:
    *   Entries
    *   Content types
    *   Assets (backup folder) per import flags (--module, --backup-dir as applicable)
2.  Re-run import including the full backup directory. Prefer long-form flags so behavior matches current CLI help, for example:

csdx cm:stacks:import --stack-api-key <stack-api-key> --data-dir "<path-to-export-data>" --module assets --backup-dir <backup-dir-name>

If a flag name differs on your install, run csdx cm:stacks:import --help and confirm with csdx --version.

3.  Retry publishing entries.

After including assets in the import process:

*   Entries publish successfully
*   Required image fields are populated
*   No publish validation errors occur

* * *

## 3\. Global Fields Import Fails: No Global Fields Found

Customer attempted to import global fields using:

csdx cm:stacks:import --stack-api-key <stack-api-key> --data-dir "<path-to-export-data>" --module global-fields

Received error indicating no global fields were found.

**Root Cause**

The specified directory did not contain any global field definitions to import.

**Resolution**

1.  Verify directory structure.
2.  Confirm global-fields folder exists in export.
3.  Validate JSON files are present in target directory.
4.  Retry import.

No logs were received after follow-up.

Directory must contain valid global field definitions for import to succeed.

* * *

## 4\. Correct Command to Export Global Fields

Customers required the correct CLI command to export global fields.

**Root Cause**

Incorrect module parameter usage.

**Resolution**

Use:

csdx cm:stacks:export --stack-api-key <stack-api-key> --data-dir "path" --module global-fields

Global fields export successfully to the specified directory.

* * *

## 5\. Bulk Content Download Before Account Termination (JSON/CSV)

Ahead of account termination, the customer requested a full export of their current content in **JSON/CSV** format for archiving and offboarding purposes.

**Root Cause**

This was not a CLI failure. The customer needed the correct, scalable method to export stack content in bulk prior to contract termination.

**Resolution**

1.  Confirm the scope of export needed (full stack content and/or specific modules like entries, assets, content types).
2.  For **full stack–style structured export**, use **csdx cm:stacks:export** (JSON/module folders as documented).
3.  For **CSV slices** (e.g. entries, taxonomies, users per command scope), use **csdx cm:export-to-csv** where it matches the need—**not** a drop-in replacement for entire-stack JSON export.
4.  Validate exported output locally to ensure completeness.

* * *

## 6\. CSV Import for Large Volume Content (CSV Not Natively Supported)

The customer explored whether they could import a large volume of entries using **CSV files**, beyond Contentstack’s standard **JSON import** capability.

**Root Cause**

Contentstack does not provide a direct “CSV → Entries” native import workflow in the CLI the way **cm:stacks:import** uses exported JSON modules. CSV ingestion requires transformation or external tooling.

**Resolution**

1.  Confirm that native stack import format for cm:stacks:import is the **exported JSON module layout** (supported workflow).
2.  Provide supported alternative approaches for CSV-based datasets:
    *   Convert CSV → JSON, then use CLI import.
    *   Use a custom script to transform CSV rows into entry payloads and push via APIs.
    *   Use third-party integration platforms to orchestrate transformation import.
3.  Recommend against manual entry for large volumes due to scalability and error risk.