
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@datocms/cli
Advanced tools
DatoCMS CLI tool for managing DatoCMS projects, environments and schemas.
$ npm install -g @datocms/cli
$ datocms COMMAND
running command...
$ datocms (--version)
@datocms/cli/0.1.6 darwin-x64 node-v16.20.0
$ datocms --help [COMMAND]
USAGE
$ datocms COMMAND
...
datocms autocomplete [SHELL]datocms environments:destroy ENVIRONMENT_IDdatocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_IDdatocms environments:indexdatocms environments:listdatocms environments:primarydatocms environments:promote ENVIRONMENT_IDdatocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_IDdatocms help [COMMAND]datocms maintenance:offdatocms maintenance:ondatocms migrations:new NAMEdatocms migrations:rundatocms pluginsdatocms plugins:add PLUGINdatocms plugins:availabledatocms plugins:inspect PLUGIN...datocms plugins:install PLUGINdatocms plugins:link PATHdatocms plugins:remove [PLUGIN]datocms plugins:resetdatocms plugins:uninstall [PLUGIN]datocms plugins:unlink [PLUGIN]datocms plugins:updatedatocms profile:remove PROFILE_IDdatocms profile:set PROFILE_IDdatocms schema:generate FILENAMEdatocms autocomplete [SHELL]Display autocomplete installation instructions.
USAGE
$ datocms autocomplete [SHELL] [-r]
ARGUMENTS
SHELL (zsh|bash|powershell) Shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
Display autocomplete installation instructions.
EXAMPLES
$ datocms autocomplete
$ datocms autocomplete bash
$ datocms autocomplete zsh
$ datocms autocomplete powershell
$ datocms autocomplete --refresh-cache
See code: @oclif/plugin-autocomplete
datocms environments:destroy ENVIRONMENT_IDDestroys a sandbox environment
USAGE
$ datocms environments:destroy ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to destroy
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Destroys a sandbox environment
See code: src/commands/environments/destroy.ts
datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_IDCreates a new sandbox environment by forking an existing one
USAGE
$ datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_ID [--json] [--config-file <value>] [--profile
<value>] [--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
[--force --fast]
ARGUMENTS
SOURCE_ENVIRONMENT_ID The environment to copy
NEW_ENVIRONMENT_ID The name of the new sandbox environment to generate
FLAGS
--fast Run a fast fork. A fast fork reduces processing time, but it also prevents writing to the source environment
during the process
--force Forces the start of a fast fork, even there are users currently editing records in the environment to copy
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Creates a new sandbox environment by forking an existing one
See code: src/commands/environments/fork.ts
datocms environments:indexLists primary/sandbox environments of a project
USAGE
$ datocms environments:index [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
datocms environments:listLists primary/sandbox environments of a project
USAGE
$ datocms environments:list [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
See code: src/commands/environments/list.ts
datocms environments:primaryReturns the name the primary environment of a project
USAGE
$ datocms environments:primary [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Returns the name the primary environment of a project
See code: src/commands/environments/primary.ts
datocms environments:promote ENVIRONMENT_IDPromotes a sandbox environment to primary
USAGE
$ datocms environments:promote ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to promote
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Promotes a sandbox environment to primary
See code: src/commands/environments/promote.ts
datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_IDRenames an environment
USAGE
$ datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>]
[--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to rename
NEW_ENVIRONMENT_ID The new environment ID
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Renames an environment
See code: src/commands/environments/rename.ts
datocms help [COMMAND]Display help for datocms.
USAGE
$ datocms help [COMMAND...] [-n]
ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for datocms.
See code: @oclif/plugin-help
datocms maintenance:offTake a project out of maintenance mode
USAGE
$ datocms maintenance:off [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Take a project out of maintenance mode
See code: src/commands/maintenance/off.ts
datocms maintenance:onPut a project in maintenance mode
USAGE
$ datocms maintenance:on [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--force]
FLAGS
--force Forces the activation of maintenance mode even there are users currently editing records
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Put a project in maintenance mode
See code: src/commands/maintenance/on.ts
datocms migrations:new NAMECreate a new migration script
USAGE
$ datocms migrations:new NAME [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--ts | --js] [--template <value>
| --autogenerate <value>] [--schema <value>]
ARGUMENTS
NAME The name to give to the script
FLAGS
--autogenerate=<value>
Auto-generates script by diffing the schema of two environments
Examples:
* --autogenerate=foo finds changes made to sandbox environment 'foo' and applies them to primary environment
* --autogenerate=foo:bar finds changes made to environment 'foo' and applies them to environment 'bar'
--js
Forces the creation of a JavaScript migration file
--schema=<value>
Include schema definitions for models and blocks (TypeScript only). Use "all" for all item types, or specify
comma-separated API keys for specific ones
--template=<value>
Start the migration script from a custom template
--ts
Forces the creation of a TypeScript migration file
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Create a new migration script
See code: src/commands/migrations/new.ts
datocms migrations:runRun migration scripts that have not run yet
USAGE
$ datocms migrations:run [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--source <value>] [--dry-run] [--force
[--fast-fork [--destination <value> | --in-place]]] [--migrations-dir <value>] [--migrations-model <value>]
[--migrations-tsconfig <value>]
FLAGS
--destination=<value> Specify the name of the new forked environment
--dry-run Simulate the execution of the migrations, without making any actual change
--fast-fork Run a fast fork. A fast fork reduces processing time, but it also prevents writing to
the source environment during the process
--force Forces the start of a fast fork, even there are users currently editing records in the
environment to copy
--in-place Run the migrations in the --source environment, without forking
--migrations-dir=<value> Directory where script migrations are stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migrations scripts
--source=<value> Specify the environment to fork
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Run migration scripts that have not run yet
See code: src/commands/migrations/run.ts
datocms pluginsList installed plugins.
USAGE
$ datocms plugins [--json] [--core]
FLAGS
--core Show core plugins.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List installed plugins.
EXAMPLES
$ datocms plugins
See code: @oclif/plugin-plugins
datocms plugins:add PLUGINInstalls a plugin into datocms.
USAGE
$ datocms plugins:add PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into datocms.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the DATOCMS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the DATOCMS_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ datocms plugins:add
EXAMPLES
Install a plugin from npm registry.
$ datocms plugins:add myplugin
Install a plugin from a github url.
$ datocms plugins:add https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ datocms plugins:add someuser/someplugin
datocms plugins:availableLists official DatoCMS CLI plugins
USAGE
$ datocms plugins:available [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists official DatoCMS CLI plugins
See code: src/commands/plugins/available.ts
datocms plugins:inspect PLUGIN...Displays installation properties of a plugin.
USAGE
$ datocms plugins:inspect PLUGIN...
ARGUMENTS
PLUGIN... [default: .] Plugin to inspect.
FLAGS
-h, --help Show CLI help.
-v, --verbose
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Displays installation properties of a plugin.
EXAMPLES
$ datocms plugins:inspect myplugin
See code: @oclif/plugin-plugins
datocms plugins:install PLUGINInstalls a plugin into datocms.
USAGE
$ datocms plugins:install PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into datocms.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the DATOCMS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the DATOCMS_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ datocms plugins:add
EXAMPLES
Install a plugin from npm registry.
$ datocms plugins:install myplugin
Install a plugin from a github url.
$ datocms plugins:install https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ datocms plugins:install someuser/someplugin
See code: @oclif/plugin-plugins
datocms plugins:link PATHLinks a plugin into the CLI for development.
USAGE
$ datocms plugins:link PATH [-h] [--install] [-v]
ARGUMENTS
PATH [default: .] path to plugin
FLAGS
-h, --help Show CLI help.
-v, --verbose
--[no-]install Install dependencies after linking the plugin.
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
command will override the user-installed or core plugin implementation. This is useful for development work.
EXAMPLES
$ datocms plugins:link myplugin
See code: @oclif/plugin-plugins
datocms plugins:remove [PLUGIN]Removes a plugin from the CLI.
USAGE
$ datocms plugins:remove [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:remove myplugin
datocms plugins:resetRemove all user-installed and linked plugins.
USAGE
$ datocms plugins:reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
See code: @oclif/plugin-plugins
datocms plugins:uninstall [PLUGIN]Removes a plugin from the CLI.
USAGE
$ datocms plugins:uninstall [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:uninstall myplugin
See code: @oclif/plugin-plugins
datocms plugins:unlink [PLUGIN]Removes a plugin from the CLI.
USAGE
$ datocms plugins:unlink [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:unlink myplugin
datocms plugins:updateUpdate installed plugins.
USAGE
$ datocms plugins:update [-h] [-v]
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Update installed plugins.
See code: @oclif/plugin-plugins
datocms profile:remove PROFILE_IDRemove a profile from DatoCMS config file
USAGE
$ datocms profile:remove PROFILE_ID [--json] [--config-file <value>]
ARGUMENTS
PROFILE_ID The name of the profile
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Remove a profile from DatoCMS config file
See code: src/commands/profile/remove.ts
datocms profile:set PROFILE_IDAdd/update profile configuration in DatoCMS config file
USAGE
$ datocms profile:set PROFILE_ID [--json] [--config-file <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--migrations-dir <value>] [--migrations-model <value>] [--migrations-template
<value>] [--migrations-tsconfig <value>]
ARGUMENTS
PROFILE_ID [default: default] Name of the profile to create/update
FLAGS
--log-level=<option> Level of logging to use for the profile
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--migrations-dir=<value> Directory where script migrations will be stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-template=<value> Path of the file to use as migration script template
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migration scripts
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Add/update profile configuration in DatoCMS config file
See code: src/commands/profile/set.ts
datocms schema:generate FILENAMEGenerate TypeScript definitions for the schema
USAGE
$ datocms schema:generate FILENAME [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [-e <value>] [-t <value>]
ARGUMENTS
FILENAME Output filename for the generated TypeScript definitions
FLAGS
-e, --environment=<value> Environment to generate schema from
-t, --item-types=<value> Comma-separated list of item type API keys to include (includes dependencies)
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Generate TypeScript definitions for the schema
See code: src/commands/schema/generate.ts
FAQs
CLI to interact with DatoCMS APIs
The npm package @datocms/cli receives a total of 6,502 weekly downloads. As such, @datocms/cli popularity was classified as popular.
We found that @datocms/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.