> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Manage Cognigy Projects from the command line: clone and restore resources, create Snapshots, and deploy AI Agents.

The Cognigy CLI is a command-line interface enabling users to manage Projects directly from the command line. For example, with this CLI, you can create Snapshots, manage Locales, and deploy AI Agents efficiently.

To start using the Cognigy CLI, refer to the [Cognigy repository on GitHub](https://github.com/Cognigy/Cognigy-CLI).

You can also explore the Cognigy Help Center, including its [Cognigy CLI](https://support.cognigy.com/hc/en-us/sections/360004745359-Cognigy-CLI) section.

### Examples

The following examples show common CLI commands and the resources they work with.

> [accordion] Clone a project
>
> Clone a Project or its resources of one type from Cognigy to your local machine.
>
> ```bash theme={null}
> # Clone all Project resources
> cognigy clone
> # Clone only Flows
> cognigy clone --type flows
> # Clone Flows and Endpoints
> cognigy clone --type flows endpoints
> ```
>
> Supported resource types: `agent` (all Project resources), `flows`, `endpoints`, `lexicons`, `aiAgents`.

> [accordion] Restore a project
>
> Upload a Project or its resources from your local machine to Cognigy.
>
> ```bash theme={null}
> # Restore all Project resources
> cognigy restore
> # Restore only Flows
> cognigy restore --type flows
> ```
>
> Supported resource types: `agent` (all Project resources), `flows`, `endpoints`, `lexicons`, `aiAgents`.

> [accordion] Pull and push resources
>
> Download or upload a specific resource by name.
>
> ```bash theme={null}
> # Download a specific Flow by name
> cognigy pull flows myFlow
> # Upload a specific Flow by name
> cognigy push flows myFlow
> ```
>
> Supported resource types for:
>
> * `pull` — `flows`, `lexicons`, `endpoints`, `extensions`, `locales`, `aiAgents`.
> * `push` — `flows`, `lexicons`, `endpoints`, `aiAgents`.

> [accordion] Compare local and remote resources
>
> Compare a local resource against its remote version.
>
> ```bash theme={null}
> # Compare a Flow at the resource level
> cognigy diff flows myFlow
> # Compare a Flow at the Node level
> cognigy diff flows myFlow --mode node
> ```
>
> Supported resource types: `flows`, `lexicons`, `endpoints`, `aiAgents`.

> [accordion] Train a flow
>
> Trigger NLU model training for a Flow.
>
> ```bash theme={null}
> # Train a Flow with the default timeout
> cognigy train flow myFlow
> # Train a Flow with a custom timeout in milliseconds
> cognigy train flow myFlow --timeout 30000
> ```

> [accordion] Create a snapshot or locale
>
> Creates a Snapshot or Locale in the remote Project and imports the new resource to your local Project.
>
> ```bash theme={null}
> # Create a Snapshot with an optional description
> cognigy create snapshot mySnapshot "Optional description"
> # Create a Locale
> cognigy create locale myLocale
> ```

> [accordion] Export and import multilingual flow texts
>
> Export a `content.csv` file with the text fields from Nodes in the Flow across all Locales, or import updated localized content back into a Flow.
>
> ```bash theme={null}
> # Export Flow texts to content.csv
> cognigy exportcsv flow myFlow
> # Import updated localized content back into the Flow
> cognigy importcsv flow myFlow
> ```

> [accordion] Localize a flow
>
> Add or remove localization for multiple Intents and Nodes at once.
>
> ```bash theme={null}
> # Add localization for a Flow from a source locale
> cognigy localize flow myFlow --localeName de-DE --sourceLocale en-US
> # Remove localization for a Flow
> cognigy localize flow myFlow --localeName de-DE --reverse
> ```

> [accordion] Translate a flow
>
> Translate Flow content using a [machine translation provider](https://docs.cognigy.com/ai/agents/deploy/endpoints/real-time-translation-settings.md).
>
> ```bash theme={null}
> # Translate a Flow using DeepL
> cognigy translate flow myFlow --localeName de-DE --fromLanguage en --toLanguage de --translator deepl --apiKey <key>
> ```
>
> Supported translation providers: `google`, `microsoft`, `deepl`.

> [accordion] Execute a raw API command
>
> Pass a JSON payload directly to the Cognigy REST API client.
>
> ```bash theme={null}
> # Run an API command with a JSON payload
> cognigy execute <command> -d '{"key": "value"}'
> # List all available API commands
> cognigy execute --list
> ```
>
> Use `--list` to print all available API commands.

> [accordion] Run playbooks
>
> Schedule Playbook runs on Cognigy and poll for results. The output is written to `./playbookRunResults.json`.
>
> ```bash theme={null}
> # Run all Playbooks in the project
> cognigy run playbooks
> # Run Playbooks from a specific file
> cognigy run playbooks ./myPlaybooks.json
> ```
>
> Exit codes: `0` — success, `1` — failure, `2` — timeout.

> [accordion] Manage AI agent knowledge
>
> Create a Knowledge Store, extract content from source documents, and ingest `.ctxt` files into the store.
>
> ```bash theme={null}
> # Create a Knowledge Store
> cognigy knowledge-ai create source myStore "My store" --projectId <id> --language en-US
> # Extract content from a PDF into a .ctxt file
> cognigy knowledge-ai extract pdf -i ./docs/manual.pdf -o ./output/manual.ctxt
> # Ingest .ctxt files into the Knowledge Store
> cognigy knowledge-ai ingest --knowledgeStoreId <id> --input ./output/
> ```
>
> Supported extraction types: `text`, `pdf`, `docx`, `csv`, `json`, `jsonl`, `epub`, `srt`, `md`, `cheerio`, `playwright`, `diffbot`, `other`.

## Limitations

* For Cognigy 4.100 and earlier, you can download [Snapshots](https://docs.cognigy.com/ai/agents/deploy/snapshots.md) up to 100 MB using the Cognigy CLI. In later versions, there's no maximum download size for Snapshots via the CLI.
* The `push` and `restore` commands can only update resources. To create a resource, use the [Cognigy API](https://docs.cognigy.com/api-reference/about.md).
* CLI commands don't support adding or moving Nodes in the Flow structure. For this purpose, use the [Cognigy API](https://docs.cognigy.com/api-reference/about.md).

## More information

* [Cognigy API](https://docs.cognigy.com/api-reference/about.md)
* [Cognigy CLI on GitHub](https://github.com/Cognigy/Cognigy-CLI)
