← Back to tools
View AGENTS.md for Contentful CLI
Contentful CLI
Manage Contentful headless CMS from the terminal
Description
Contentful CLI is the official command-line tool for the Contentful headless CMS platform. It lets you manage spaces, content types, entries, assets, and environments. It also handles content migrations, space imports/exports, and extension management from the terminal.
Install
npm
npm i -g contentful-cliAI Summary
Official Contentful CLI for managing spaces, content types, entries, environments, and content migrations in the Contentful headless CMS platform.
Capabilities
- + Manage Contentful spaces and environments
- + Run content migrations with versioned migration scripts
- + Export and import space content and schema
- + Manage content types and content model
- + Scaffold and manage Contentful extensions and apps
- + Generate boilerplate projects from Contentful templates
Use When
- → Managing Contentful CMS content and schemas from the terminal
- → Running content migrations across Contentful environments
- → Exporting or importing Contentful space data for backup or migration
- → Automating Contentful operations in CI/CD pipelines
Avoid When
- x Not using Contentful as your CMS
- x Prefer the Contentful web UI for content editing
- x Managing non-CMS cloud infrastructure
Usage Patterns
Export a space for backup
contentful space export --space-id SPACE_ID --export-dir ./backup Exports all content types, entries, and assets to JSON files
Run a content migration
contentful space migration --space-id SPACE_ID migrations/01-add-author.js Applies a migration script to modify the content model
Create a new environment
contentful space environment create --name staging --space-id SPACE_ID Creates a new environment for testing content changes
Input / Output
stdin: Accepts interactive input for login and confirmations
stdout: Space listings, export progress, and migration results
stderr: Error messages and API errors
Typical Pipelines
contentful space export --space-id ID | jq '.contentTypes | length' to count content types contentful space environment create --name test && contentful space migration --environment-id test migration.js to test migrations safely contentful login && contentful space list to authenticate and view available spaces