datocms
v4.0.24
Published
CLI to interact with DatoCMS APIs
Downloads
3,117
Readme
DatoCMS CLI
DatoCMS CLI tool for managing DatoCMS projects, environments and schemas.
Usage
$ npm install -g datocms
$ datocms COMMAND
running command...
$ datocms (--version)
datocms/0.1.6 darwin-x64 node-v16.20.0
$ datocms --help [COMMAND]
USAGE
$ datocms COMMAND
...Commands
datocms autocomplete [SHELL]datocms cma:call RESOURCE METHODdatocms cma:docs [RESOURCE] [ACTION]datocms cma:script [FILE]datocms environments:destroy ENVIRONMENT_IDdatocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_IDdatocms environments:listdatocms environments:primarydatocms environments:promote ENVIRONMENT_IDdatocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_IDdatocms help [COMMAND]datocms linkdatocms logindatocms logoutdatocms 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 projects:list [QUERY]datocms schema:generate FILENAMEdatocms schema:inspect [FILTER]datocms unlinkdatocms whoami
datocms 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-cacheSee code: @oclif/plugin-autocomplete
datocms cma:call RESOURCE METHOD
Call any DatoCMS Content Management API method
USAGE
$ datocms cma:call RESOURCE... METHOD... [--json] [--config-file <value>] [--profile <value>] [--api-token
<value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [-e <value>] [--data
<value>] [--params <value>]
ARGUMENTS
RESOURCE... The resource to call (e.g., items, itemTypes, etc.)
METHOD... The method to execute (e.g., list, find, create, etc.)
FLAGS
-e, --environment=<value> Environment to execute the command in
--data=<value> JSON/JSON5 string containing the request body data (for create/update operations)
--params=<value> JSON/JSON5 string containing query parameters
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Call any DatoCMS Content Management API method
EXAMPLES
List all roles
$ datocms cma:call roles list
Find a specific role
$ datocms cma:call roles find 123
Create a new role
$ datocms cma:call roles create --data '{name: "Editor", can_edit_site: true}'
Update a role
$ datocms cma:call roles update 123 --data '{name: "Updated Name"}'
Delete a role
$ datocms cma:call roles destroy 123
List items with query parameters
$ datocms cma:call items list --params '{filter: {type: "blog_post"}}'
Execute command in a specific environment
$ datocms cma:call items list --environment my-environmentSee code: src/commands/cma/call.ts
datocms cma:docs [RESOURCE] [ACTION]
Browse the DatoCMS Content Management API reference documentation
USAGE
$ datocms cma:docs [RESOURCE] [ACTION] [--expand <value>...] [--expand-types <value>...] [--types-depth
<value>]
ARGUMENTS
[RESOURCE] The resource to describe (e.g., items, uploads)
[ACTION] The action to describe (e.g., create, instances)
FLAGS
--expand=<value>... Expand a collapsed <details> section by its summary text (can be repeated)
--expand-types=<value>... Inline TypeScript definitions for types referenced by the action. Pass `*` to expand every
reachable type, or specific type names (repeatable) to expand just those
--types-depth=<value> Maximum depth when walking referenced types at default expansion (default: 2). Useful only
when --expand-types is omitted but you still want types output — set the flag to surface a
deeper "Not expanded" list
DESCRIPTION
Browse the DatoCMS Content Management API reference documentation
EXAMPLES
List all available resources
$ datocms cma:docs
Describe a specific resource and its actions
$ datocms cma:docs items
Describe a specific action with examples
$ datocms cma:docs items create
Expand a collapsed details section
$ datocms cma:docs items create --expand "Example: Basic example"
Inline definitions for every reachable referenced type
$ datocms cma:docs items create --expand-types "*"
Inline only specific referenced types
$ datocms cma:docs items create --expand-types ItemCreateSchemaSee code: src/commands/cma/docs.ts
datocms cma:script [FILE]
Run a one-off TypeScript script against the Content Management API.
USAGE
$ datocms cma:script [FILE] [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [-e <value>] [-f <value>]
[--timeout <value>] [--rebuild-workspace] [--skip-validation]
ARGUMENTS
[FILE] Path to a TypeScript file to run (file-mode). Alternative to --file. If omitted and --file is not set, the
script is read from stdin (stdin-mode).
FLAGS
-e, --environment=<value> Environment to execute the script against
-f, --file=<value> Path to a TypeScript file to run (file-mode). If omitted, the script is read from stdin
(stdin-mode).
--rebuild-workspace Wipe and rebuild the internal workspace used by stdin-mode (node_modules, tsconfig), then
exit without running any script. Use after a CLI upgrade if stdin scripts fail with module
resolution errors.
--skip-validation Skip source validation and (stdin-mode only) TypeScript type-checking before execution
--timeout=<value> Kill the script if it runs longer than this many seconds. Default: no timeout.
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Run a one-off TypeScript script against the Content Management API.
Two modes of invocation, different ergonomics:
File-mode — Pass a .ts file path. The script must export a default
async function `(client: Client) => Promise<void>`.
It is loaded from its original location (via tsx), which
means imports resolve against your project's node_modules
and your editor LSP gives you full type feedback. No
typecheck is performed before execution — same behavior as
`migrations:run`. Use it for scripts that are long enough
that a shell heredoc becomes awkward, use local helper
modules, or need to be rerunnable by filename.
Stdin-mode — Pipe plain top-level-await code via stdin. `client` (a
pre-authenticated CMA client) and, on-demand, `Schema`
(project-specific ItemTypeDefinition types) are available
as ambient globals. `export default` is not supported here.
Ideal for throwaway one-liners and pipes.
These are *both* for one-off, throwaway work. If you need to commit and
replay a script across environments, use `migrations:new` /
`migrations:run` instead.
Source validation (both modes):
- Explicit `any` / `unknown` types are rejected. Use specific types.
- Casts to `never` (e.g. `x as never`, `<never>x`) are rejected.
- `@ts-ignore`, `@ts-expect-error`, and `@ts-nocheck` directives are
rejected — fix the underlying type error instead.
- File-mode: script must have a default export; top-level is rejected.
- Stdin-mode: script must be top-level; default export is rejected.
Stdin-mode — pre-installed packages (importable only here):
- @datocms/cma-client-node
- datocms-structured-text-utils
- datocms-structured-text-dastdown
In file-mode you have your own `node_modules` — install whatever you
need there.
Stdin-mode — ambient globals (no import needed):
- `client` (pre-authenticated CMA client)
- `Schema.*` (project-specific ItemTypeDefinition types, on demand)
- All named exports of `@datocms/cma-client-node`,
`datocms-structured-text-utils`, and
`datocms-structured-text-dastdown` are exposed as globals — e.g.
`buildBlockRecord(...)`, `mapNodes(...)`, `parse(...)`,
`ApiTypes.Item`, `SchemaRepository`.
Use `console.log()` for output. stdout is piped through cleanly so the
command composes with `| jq` and similar.
EXAMPLES
File-mode — run a script from a file
$ datocms cma:script ./my-script.ts
Same as above, using the --file flag
$ datocms cma:script --file ./my-script.ts
File-mode — typical script shape (requires `datocms` installed in the script's project)
$ datocms cma:script <<'EOF' > ./my-script.ts && datocms cma:script ./my-script.ts \
import type { Client } from 'datocms/lib/cma-client-node'; \
export default async function(client: Client) { \
const itemTypes = await client.itemTypes.list(); \
console.log(itemTypes.map((t) => t.api_key)); \
} \
EOF
Stdin-mode — one-liner via pipe
echo 'console.log((await client.itemTypes.list()).map(t => t.api_key))' | datocms cma:script
Stdin-mode — type-safe record creation using the ambient Schema
$ datocms cma:script <<'EOF' \
await client.items.create<Schema.Article>({ \
item_type: { id: 'ABC123', type: 'item_type' }, \
title: 'Hello world', \
}); \
EOF
Stdin-mode — pipe output into jq
echo 'console.log(JSON.stringify(await client.itemTypes.list()))' | datocms cma:script 2>/dev/null | jq \
'.[].api_key'See code: src/commands/cma/script.ts
datocms environments:destroy ENVIRONMENT_ID
Destroys 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Destroys a sandbox environmentSee code: src/commands/environments/destroy.ts
datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Creates 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Creates a new sandbox environment by forking an existing oneSee code: src/commands/environments/fork.ts
datocms environments:list
Lists 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Lists primary/sandbox environments of a projectSee code: src/commands/environments/list.ts
datocms environments:primary
Returns 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Returns the name the primary environment of a projectSee code: src/commands/environments/primary.ts
datocms environments:promote ENVIRONMENT_ID
Promotes 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Promotes a sandbox environment to primarySee code: src/commands/environments/promote.ts
datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Renames 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Renames an environmentSee 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 link
Link the current directory to a DatoCMS project and configure it
USAGE
$ datocms link [--json] [--config-file <value>] [--profile <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--migrations-dir <value>] [--migrations-model <value>] [--migrations-template
<value>] [--migrations-tsconfig <value>] [--organization-id <value>] [--site-id <value>]
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
--organization-id=<value> Organization ID to use
--profile=<value> [default: default] Name of the profile to create/update
--site-id=<value> Site ID to link to
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json, env: DATOCMS_CONFIG_FILE] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Link the current directory to a DatoCMS project and configure itSee code: src/commands/link.ts
datocms login
Authenticate with DatoCMS via OAuth
USAGE
$ datocms login [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Authenticate with DatoCMS via OAuth
EXAMPLES
$ datocms loginSee code: src/commands/login.ts
datocms logout
Log out of DatoCMS by removing stored credentials
USAGE
$ datocms logout [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Log out of DatoCMS by removing stored credentials
EXAMPLES
$ datocms logoutSee code: src/commands/logout.ts
datocms maintenance:off
Take 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Take a project out of maintenance modeSee code: src/commands/maintenance/off.ts
datocms maintenance:on
Put 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Put a project in maintenance modeSee code: src/commands/maintenance/on.ts
datocms migrations:new NAME
Create 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Create a new migration scriptSee code: src/commands/migrations/new.ts
datocms migrations:run
Run 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>] [--allow-primary ]
[--dry-run] [--force [--fast-fork [--destination <value> | --in-place]]] [--migrations-dir <value>]
[--migrations-model <value>] [--migrations-tsconfig <value>]
FLAGS
--allow-primary Allow running migrations in-place on the primary environment. Only use for strictly
additive migrations (no data/schema destruction): there is no rollback if the run fails
partway through
--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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Run migration scripts that have not run yetSee code: src/commands/migrations/run.ts
datocms plugins
List 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 pluginsSee code: @oclif/plugin-plugins
datocms plugins:add PLUGIN
Installs 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/someplugindatocms plugins:available
Lists official DatoCMS CLI plugins
USAGE
$ datocms plugins:available [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists official DatoCMS CLI pluginsSee 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 mypluginSee code: @oclif/plugin-plugins
datocms plugins:install PLUGIN
Installs 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/somepluginSee code: @oclif/plugin-plugins
datocms plugins:link PATH
Links 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 mypluginSee 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 myplugindatocms plugins:reset
Remove 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 mypluginSee 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 myplugindatocms plugins:update
Update 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 projects:list [QUERY]
List DatoCMS projects accessible to the authenticated account
USAGE
$ datocms projects:list [QUERY] [--json] [--limit <value>] [--workspace <value>]
ARGUMENTS
[QUERY] Fuzzy-match string. When omitted, returns up to --limit projects across all workspaces.
FLAGS
--limit=<value> [default: 20] Maximum number of results returned. Exact-match shortcut is not capped.
--workspace=<value> Restrict results to one workspace. Accepts "personal", an organization id, or an organization
name (case-insensitive exact match).
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List DatoCMS projects accessible to the authenticated account
EXAMPLES
$ datocms projects:list
$ datocms projects:list blog
$ datocms projects:list --workspace="Acme Corp"
$ datocms projects:list --jsonSee code: src/commands/projects/list.ts
datocms schema:generate FILENAME
Generate 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, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Generate TypeScript definitions for the schemaSee code: src/commands/schema/generate.ts
datocms schema:inspect [FILTER]
Inspect DatoCMS models and modular blocks — emits JSON with models, fields, fieldsets, nested blocks, and relationships.
USAGE
$ datocms schema:inspect [FILTER] [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [-e <value>] [--type
all|models_only|blocks_only] [--fields-details basic|complete] [--include-validators] [--include-appearance]
[--include-default-values] [--include-fieldsets] [--include-nested-blocks] [--include-referenced-models]
[--include-embedding-models]
ARGUMENTS
[FILTER] Filter by API key, ID, or display name. Falls back to fuzzy search if no exact match is found. If omitted,
all models/blocks are returned.
FLAGS
-e, --environment=<value> Environment to inspect
--fields-details=<option> [default: basic] Level of detail returned for each field. `basic` drops validators,
appearance, and default values; `complete` includes everything (very verbose). For
selective inclusion use the `--include-*` flags instead.
<options: basic|complete>
--include-appearance Include field appearance configuration
--include-default-values Include field default values
--include-embedding-models For blocks only: include every model that embeds the selected blocks (direct or
transitive)
--include-fieldsets Include UI fieldset organization
--include-nested-blocks Recursively include every block nested in the selected item types
--include-referenced-models Include models referenced by link, links, or structured_text fields
--include-validators Include field validators
--type=<option> [default: all] Restrict to models, blocks, or both
<options: all|models_only|blocks_only>
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json, env: DATOCMS_CONFIG_FILE] 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> [env: DATOCMS_PROFILE] Use settings of profile in datocms.config.js
DESCRIPTION
Inspect DatoCMS models and modular blocks — emits JSON with models, fields, fieldsets, nested blocks, and
relationships.
Without arguments, lists every model and block in the project. Pass a
filter to narrow down by API key (e.g. "blog_post"), ID, or display
name; if no exact match is found a fuzzy search is used.
By default, fields are returned without validators, appearance, or
default values. Use `--include-validators`, `--include-appearance`,
`--include-default-values`, or `--fields-details=complete` to opt in.
Output is TOON on stdout (compact, agent-friendly). Pass `--json` for
JSON output that composes with `| jq` and similar.
EXAMPLES
List every model and block in the project
$ datocms schema:inspect
Inspect a single model by API key
$ datocms schema:inspect blog_post
Only modular blocks, with fieldsets
$ datocms schema:inspect --type=blocks_only --include-fieldsets
Include validators and appearance for the given model
$ datocms schema:inspect blog_post --include-validators --include-appearance
Full detail (verbose), piped through jq
$ datocms schema:inspect blog_post --fields-details=complete --json | jq '.[].fields[].api_key'
Inspect a block plus every model that embeds it (directly or indirectly)
$ datocms schema:inspect my_block --type=blocks_only --include-embedding-modelsSee code: src/commands/schema/inspect.ts
datocms unlink
Unlink the current directory from a DatoCMS project
USAGE
$ datocms unlink [--json] [--config-file <value>] [--profile <value>]
FLAGS
--profile=<value> [default: default] Name of the profile to remove
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json, env: DATOCMS_CONFIG_FILE] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Unlink the current directory from a DatoCMS projectSee code: src/commands/unlink.ts
datocms whoami
Show the currently authenticated DatoCMS account
USAGE
$ datocms whoami [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show the currently authenticated DatoCMS account
EXAMPLES
$ datocms whoamiSee code: src/commands/whoami.ts
