GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing www.contentstack.com — Contentstack CLI Bulk | V2.x.x | Contentstack Bulk Operations in CLIupdateLast updated November 6, 2026 OverviewThe CLI Bulk Operations plugin streamlines content management workflows by providing robust commands for bulk publishing and unpublishing operations. It intelligently handles API rate limits, retries failed operations, and processes large volumes of content efficiently. What Problem Does It Solve?When managing content at scale in Contentstack, you often need to:
This plugin handles all of these challenges automatically. Prerequisites
Install Plugin12345 # Install Contentstack CLI npm install -g @contentstack/cli # Verify installation csdx cm:stacks:bulk-entries --help InstallationCommandsBulk EntriesPerform bulk operations on entries with advanced filtering and publishing options. Syntax 1 csdx cm:stacks:bulk-entries [OPTIONS] Required Options
Entry-Specific Options
Filter values:
General Options
Examples 1. Publish all content types to production 12345 csdx cm:stacks:bulk-entries \ --operation publish \ --environments production \ --locales en-us \ -k blt******* 2. Publish specific content types to multiple environments 123456 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post,article,page \ --environments dev,staging,production \ --locales en-us,es-es \ -k blt******* 3. Publish entries with non-localized field changes 123456 csdx cm:stacks:bulk-entries \ --operation publish \ --filter non-localized \ --content-types blog_post \ --environments production \ -k blt******* 3. Publish only draft entries 1234567 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --filter draft \ --environments production \ --locales en-us \ -k blt******* 4. Cross-publish from production to staging First, add the delivery token for the source environment (one-time setup): 1234567 # Add delivery token for production environment csdx auth:tokens:add \ -a prod-delivery \ --delivery \ --token prod-delivery-token \ --stack-api-key blt******* \ --environment production Then use it for cross-publish: 12345678 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --source-env production \ --source-alias prod-delivery \ --environments staging \ --locales en-us \ -k blt******* 5. Publish using single mode for fine control 1234567 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --publish-mode single \ --environments production \ --locales en-us \ -k blt******* 6. Unpublish entries 123456 csdx cm:stacks:bulk-entries \ --operation unpublish \ --content-types blog_post \ --environments staging \ --locales en-us \ -k blt******* 7. Retry failed operations 123 # Retry failed entries from a previous operation csdx cm:stacks:bulk-entries \ --retry-failed ./bulk-operation 8. Revert a publish operation 123 # Revert (unpublish) previously published entries csdx cm:stacks:bulk-entries \ --revert ./bulk-operation 9. Publish with entry variants 12345678 # Publish entries including their variants csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --include-variants \ --environments production \ --locales en-us \ -k blt******* Bulk AssetsPerform bulk operations on assets with folder and file type filtering. Syntax 1 csdx cm:stacks:bulk-assets [OPTIONS] Required Options Same as bulk entries (see above). Asset-Specific Options
Examples 1. Publish all assets 12345 csdx cm:stacks:bulk-assets \ --operation publish \ --environments production \ --locales en-us \ -k blt******* 2. Publish assets from specific folder 123456 csdx cm:stacks:bulk-assets \ --operation publish \ --folder-uid cs_product_images \ --environments production \ --locales en-us \ -k blt******* 3. Cross-publish assets from production to staging 1234567 csdx cm:stacks:bulk-assets \ --operation publish \ --source-env production \ --source-alias prod-delivery \ --environments staging \ --locales en-us \ -k blt******* Note: See Example 4 in Bulk Entries section for how to set up the delivery token alias. 4. Unpublish assets 12345 csdx cm:stacks:bulk-assets \ --operation unpublish \ --environments staging \ --locales en-us \ -k blt******* 5. Retry failed asset operations 123 # Retry failed assets from a previous operation csdx cm:stacks:bulk-assets \ --retry-failed ./bulk-operation 6. Revert an asset publish operation 123 # Revert (unpublish) previously published assets csdx cm:stacks:bulk-assets \ --revert ./bulk-operation Bulk CS Assets operationsPerform bulk delete or move operations on assets stored in cs-assets spaces. This command uses the cs-assets REST API and is separate from the CMA-based Bulk Publish API used by bulk-entries and bulk-assets. Prerequisite: Your region must have CS Assets enabled. See Configure Regions. Warning Do not combine CMS flags (--stack-api-key, --alias, --environments, --locales, --branch) with the CS Assets flags in the table below. The delete and move operations target the CS Assets API, not the CMS publish pipeline. Syntax 1 csdx cm:stacks:bulk-assets [OPTIONS] Options
Examples Bulk delete assets in a space: 123456 csdx cm:stacks:bulk-assets \ --operation delete \ --space-uid blt1234567890abcdef \ --org-uid bltorg1234567890 \ --locale en-us \ --asset-uids-file ./assets.json Bulk move assets to a different folder: 12345678 csdx cm:stacks:bulk-assets \ --operation move \ --space-uid blt1234567890abcdef \ --org-uid bltorg1234567890 \ --folder-uid cs_source_folder \ --target-folder-uid cs_destination_folder \ --asset-uids-file ./assets.json \ --yes Bulk TaxonomiesBulk publish or unpublish taxonomy terms. This command has no equivalent in CLI V1. Syntax 1 csdx cm:stacks:bulk-taxonomies [OPTIONS] Options
Examples Publish taxonomy terms to an environment: 123456 csdx cm:stacks:bulk-taxonomies \ --operation publish \ --taxonomies product_category \ --environments production \ --locales en-us \ --stack-api-key bltxxxxxx Unpublish taxonomy terms: 123456 csdx cm:stacks:bulk-taxonomies \ --operation unpublish \ --taxonomies product_category,region \ --environments production \ --locales en-us \ --alias myalias Operation ModesIn both modes, every publish and unpublish request that the bulk commands send uses API version 3.2 (Nested Reference Publishing). The --api-version flag from CLI 1.x is removed, and the commands do not accept it. For details, see All Publish Operations Now Use NRP. Bulk Mode (Default)Uses Contentstack's native Bulk Publish APIs. Best For:
Example: 123456 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --environments production \ --locales en-us \ -k blt******* Single ModeMakes individual API calls for each item with intelligent rate limiting. Best For:
Example: 1234567 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --environments production \ --locales en-us \ --publish-mode single \ -k blt******* Cross-Publish SetupCross-publish allows you to promote content from one environment to another (e.g., staging → production). To use cross-publish, you need to set up a delivery token for the source environment. Why Delivery Tokens?Cross-publish uses the Delivery API to fetch only published content from the source environment. This ensures you're promoting exactly what's live, not draft content. Setting Up Delivery TokensStep 1: Create a Delivery Token in Contentstack
Step 2: Add Token to CLI 123456 csdx auth:tokens:add \ -a <alias-name> \ --delivery \ --token <your-delivery-token> \ --stack-api-key <your-stack-api-key> \ --environment <source-environment> Example: 123456789101112131415 # Add production delivery token csdx auth:tokens:add \ -a prod-delivery \ --delivery \ --token prod-delivery-token \ --stack-api-key blt******** \ --environment production # Add staging delivery token csdx auth:tokens:add \ -a staging-delivery \ --delivery \ --token stag-delivery-token \ --stack-api-key blt******** \ --environment staging Step 3: Use in Cross-Publish Operations 123456789 # Promote from staging to production csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --source-env staging \ --source-alias staging-delivery \ --environments production \ --locales en-us \ -k blt******** Managing Delivery Tokens12345 # List all stored tokens (including delivery tokens) csdx auth:tokens:list # Remove a delivery token csdx auth:tokens:remove -a staging-delivery Use CasesUse Case 1: Content UnpublishScenario: A critical bug is discovered in 500 blog posts that need immediate unpublishing from production. Solution: 1234567 csdx cm:stacks:bulk-entries \ --operation unpublish \ --content-types blog_post \ --environments production \ --locales en-us,es-es,fr-fr \ --yes \ -k blt******** Result: All 500 blog posts unpublished across 3 locales in ~2 minutes (bulk mode). Use Case 2: Scheduled Content ReleaseScenario: Publish 200 product entries to production every Monday at 9 AM. Solution: Create a cron job with a config file 123456789101112 # config.json
{
"operation": "publish",
"contentTypes": ["product"],
"environments": ["production"],
"locales": ["en-us"],
"filter": "modified",
"publishMode": "bulk"
}
# Cron command
0 9 * * 1 csdx cm:stacks:bulk-entries -c /path/to/config.json -k $STACK_API_KEY --yesUse Case 3: Cross-Environment PromotionScenario: Promote all content published in staging to production. Setup (one-time): 1234567 # Add delivery token for staging environment csdx auth:tokens:add \ -a staging-delivery \ --delivery \ --token blt_staging_token \ --stack-api-key blt******** \ --environment staging Solution: 1234567891011121314151617 # Promote entries csdx cm:stacks:bulk-entries \ --operation publish \ --source-env staging \ --source-alias staging-delivery \ --environments production \ --locales en-us \ -k blt******** # Promote assets csdx cm:stacks:bulk-assets \ --operation publish \ --source-env staging \ --source-alias staging-delivery \ --environments production \ --locales en-us \ -k blt******** Result: All staging content promoted to production with verification. How it works: The --source-alias uses a stored delivery token to fetch only published content from the source environment. This ensures you're promoting exactly what's live in staging. Use Case 4: Selective Publishing with FiltersScenario: Publish only draft entries that have never been published. Solution: 1234567 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types article,blog_post \ --filter draft \ --environments production \ --locales en-us \ -k blt******** Result: Only unpublished entries are sent to production, saving API calls. Use Case 5: Multi-Locale Product LaunchScenario: Launch 50 new product entries across 10 locales and 3 environments simultaneously. Solution: 1234567 csdx cm:stacks:bulk-entries \ --operation publish \ --content-types product \ --environments dev,staging,production \ --locales en-us,es-es,fr-fr,de-de,it-it,pt-br,ja-jp,zh-cn,ko-kr,ar-ae \ --publish-mode bulk \ -k blt******** Result: 50 products × 10 locales × 3 envs = 1,500 publish operations completed in ~5 minutes via batching. Use Case 6: Retry Failed OperationsScenario: A network issue caused 20 out of 200 entries to fail publishing. Solution: 1234 # Retry only failed entries csdx cm:stacks:bulk-entries \ --retry-failed bulk-operation/failed-20250112-143022.json \ -k blt******** Result: Only the 20 failed entries are retried, successful ones are skipped. Use Case 7: Asset Organization by FolderScenario: Publish only marketing assets in a specific folder. Solution: 123456 csdx cm:stacks:bulk-assets \ --operation publish \ --folder-uid cs_marketing_2026 \ --environments production \ --locales en-us \ -k blt******** Result: Only assets in the cs_marketing_2026 folder are published. Use Case 8: Rollback Published ContentScenario: After publishing 300 blog entries to production, you discover that some entries contain incorrect information and need to be unpublished immediately. Solution: 123 # Step 1: Revert the publish operation using the operation log csdx cm:stacks:bulk-entries \ --revert ./bulk-operation How it works:
Result: All 300 blog entries are unpublished and reverted to their previous version, effectively rolling back the entire operation. Important Notes:
Use Case 9: Retry Failed Operations After Network IssuesScenario: While publishing 500 product entries to production, a temporary network issue caused 75 entries to fail. You want to retry only the failed entries without re-processing the successful ones. Solution: 123456 # Step 1: Check the operation summary to identify failures # The CLI automatically logs failed operations # Step 2: Retry only the failed entries csdx cm:stacks:bulk-entries \ --retry-failed ./bulk-operation How it works:
Result: The 75 failed entries are retried and successfully published, while the 425 successful entries are untouched. Best Practices:
Common Retry Scenarios:
Non-retryable Scenarios (require manual intervention):
Use Case 10: Automated Retry in a CI/CD PipelineScenario: You have a CI/CD pipeline that publishes content, and you want to retry failures automatically. Note The CLI does not read the --config file in this release, so you cannot change the retry count or rate limit. The CLI retries each failed request up to 3 times, then logs it for --retry-failed. Solution: 12345678910111213 # Initial publish attempt csdx cm:stacks:bulk-entries \ --operation publish \ --content-types product,article \ --environments production \ --locales en-us,es-es \ --publish-mode bulk \ -k blt******** \ --yes # If failures occur, retry only the failed items after 30 seconds sleep 30 csdx cm:stacks:bulk-entries --retry-failed ./bulk-operation --yes Result: The second command retries only the items that failed in the first run. In bulk mode, the CLI does not log failures inside an accepted bulk job, so check the bulk publish status link for those items. Use --publish-mode single to log every failed item. Use Case 11: Safe Multi-Stage Deployment with RollbackScenario: Deploy content to staging for testing, and if approved, promote to production. If issues are found in production, quickly rollback. Solution: 12345678910111213141516171819202122232425 # Step 1: Publish to staging csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post,article \ --environments staging \ --locales en-us \ -k blt******** # Backup the operation logs cp -r bulk-operation bulk-operation-staging-$(date +%Y%m%d-%H%M%S) # Step 2: After testing, promote to production csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post,article \ --environments production \ --locales en-us \ -k blt******** # Backup production operation logs cp -r bulk-operation bulk-operation-production-$(date +%Y%m%d-%H%M%S) # Step 3: If issues found, rollback production csdx cm:stacks:bulk-entries \ --revert ./bulk-operation-production-YYYYMMDD-HHMMSS Result: Content is safely deployed with the ability to quickly rollback production while preserving staging state. Content FiltersThe CLI supports various filters to target specific entries based on their status and content state: Non-Localized FilterThe non-localized filter identifies entries where non-localized fields have been updated in the master locale, requiring localized entries to be republished to maintain consistency. How it works:
Use Case: When you update a non-localized field (like a status, category, or global setting) in the master locale, all localized versions of that entry should be republished to reflect the change. Example: 1234567 # Publish entries where non-localized fields have been updated csdx cm:stacks:bulk-entries \ --operation publish \ --filter non-localized \ --content-types product \ --environments production \ -k blt******* Note This filter automatically discovers all locales in your stack and doesn't require specifying the --locales flag. ConfigurationUsing Config FilesWarning The --config flag accepts a JSON file path, but the CLI does not read the file in this release. Rate limits, retry counts and other options in the file have no effect. Pass each option as a flag. The CLI always sends up to 10 requests per second, 5 at a time, and retries a failed request up to 3 times. The CLI ignores the example file below: 1 csdx cm:stacks:bulk-entries -c my-config.json -k blt******** Example Config File: 1234567891011121314 {
"operation": "publish",
"contentTypes": ["blog_post", "article"],
"environments": ["production", "staging"],
"locales": ["en-us", "es-es"],
"filter": "draft",
"publishMode": "bulk",
"branch": "main",
"rateLimit": {
"requestsPerSecond": 15,
"maxConcurrent": 5
},
"maxRetries": 3
}ExamplesBasic Publish Operation1234567891011121314 # Publish all entries of a content type csdx cm:stacks:bulk-entries \ --operation publish \ --content-types blog_post \ --environments production \ --locales en-us \ --stack-api-key blt******* # Publish assets csdx cm:stacks:bulk-assets \ --operation publish \ --environments production \ --locales en-us \ --stack-api-key blt******* Basic Unpublish Operation1234567 # Unpublish entries csdx cm:stacks:bulk-entries \ --operation unpublish \ --content-types blog_post \ --environments staging \ --locales en-us \ --stack-api-key blt******* Best Practices1. Test in Lower Environments FirstAlways test bulk operations in dev/staging before production: 12345678 # Test in dev first csdx cm:stacks:bulk-entries --operation publish --environments dev ... # Then staging csdx cm:stacks:bulk-entries --operation publish --environments staging ... # Finally production csdx cm:stacks:bulk-entries --operation publish --environments production ... 2. Use Config Files for Complex OperationsFor operations with many flags, use config files for repeatability and version control. 3. Monitor Rate Limiter LogsPay attention to rate limiter messages to understand system behavior. 4. Start with Bulk ModeUse bulk mode by default for efficiency, switch to single mode only when needed. 5. Keep Log FilesSave log files for auditing and potential rollback: 1 cp -r bulk-operation bulk-operation-backup-$(date +%Y%m%d) 6. Use Filters to Reduce LoadApply filters to publish only necessary content: 12 --filter draft # Only unpublished entries --filter modified # Only entries modified since last publish 7. Batch Similar OperationsGroup operations by content type, environment, or locale for better performance. Limitations
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |