@kontent-ai/cli
v0.11.0
Published
Kontent.ai command-line interface
Readme
Kontent.ai CLI
Command-line interface for Kontent.ai.
[!WARNING] Under active development. The command surface is incomplete and may change between releases. More commands are added incrementally. Breaking changes may occur.
[!IMPORTANT] Looking for the previous CLI? The content-migration and environment backup/restore commands from earlier
@kontent-ai/cliversions are deprecated. That functionality now lives in@kontent-ai/data-ops.
Prerequisites
- Node.js LTS or newer
- A Kontent.ai account
Installation
Run without installing:
npx @kontent-ai/cli@latest <command>Or install globally to get the kontent command:
npm install -g @kontent-ai/cli
kontent <command>Using @latest ensures you run the newest version.
Authentication
Most commands require you to be signed in.
kontent login
kontent logoutCommands
Run kontent --help for the full, always-current list.
Each command supports --help for its own options.
| Command | Description |
| --- | --- |
| kontent dapi <endpoint> | Send a request to the Delivery API |
| kontent docs search <query> | Search Kontent.ai Learn docs and API reference, ranked by relevance |
| kontent docs endpoint <query> | Show matching API endpoints: method, URL, parameters, responses, code samples |
| kontent docs object <query> | Show matching API reference objects and their properties |
| kontent environment use <envId> | Set the default environment used when --envId is omitted |
| kontent environment current | Print the default environment ID |
| kontent environment clear | Remove the default environment, making --envId required again |
| kontent login | Authenticate with Kontent.ai via Auth0 device flow |
| kontent logout | Clear stored authentication tokens |
| kontent mapi <endpoint> | Send an authenticated request to the Management API |
| kontent project sample bootstrap | Clone a sample app for an environment and wire its .env |
Global options
--logLevel,-ll— detail level:none,standard(default),verbose--verbose— shortcut for--logLevel verbose--configFile— path to a JSON file with CLI parameters--help,-h/--version,-v
Everything the log level governs goes to stderr, and none silences errors along
with progress — a failed command is then visible only through its exit code. What
a command was asked to produce goes to stdout and is never gated by the log
level.
Environment variables
Environment variables are read individually where they apply — they are not
mapped onto option names, so an unrelated KONTENT_* variable in your shell
never reaches the parser.
KONTENT_MAPI_KEY— Management API key forkontent mapi, used when--mapiKeyis absentDO_NOT_TRACK,KONTENT_DO_NOT_TRACK,KONTENT_TELEMETRY_DEBUG— see TELEMETRY.md
Telemetry
The CLI collects anonymous usage data. See TELEMETRY.md for details and opt-out.
Contributing
Contributions are welcome. See CONTRIBUTING.md for details.
License
Distributed under the MIT License. See LICENSE.md.
