# Core Rudder CLI Commands Reference


This guide covers the **core workflow commands** available in the [Rudder CLI tool]({{< ref "dev-tools/rudder-cli/" >}}) for managing resources like Tracking Plans, Data Catalog, SQL Models, destinations, connections, and Transformations.

For resource-specific commands (for example SQL model preview or transformation tests), see the sections below and the linked how-to guides.

## Authentication

Before running any commands, you must authenticate the CLI tool with your RudderStack workspace.

```bash
rudder-cli auth login
```

You will be prompted to enter your [workspace-level Service Access Token]({{< ref "access-management/service-access-tokens.md#workspace-sat" >}}) or [Personal Access Token]({{< ref "access-management/personal-access-tokens.md" >}}) (for **Free** and **self-hosted** plans).

## Commands

Use the following commands to manage various RudderStack resources.

### `import workspace`

Import existing resources from your RudderStack workspace into your local project directory. This is useful when you want to start managing existing dashboard configurations as code.

```bash
rudder-cli import workspace -l <project-directory>
```

**Supported resources for import**

- Data Catalog (Events, Properties, Categories, Custom Types)
- Tracking Plans
- Event Stream sources (SDK-based)
- Destinations
- Event Stream connections
- Transformations and Transformation Libraries
- SQL Models

See [Import Workspace Resources]({{< ref "dev-tools/rudder-cli/import-resources/" >}}) for prerequisites, metadata, and troubleshooting.

### `validate`

Validate your local YAML configurations for syntax errors, structural integrity, and resource-specific constraints.

```bash
rudder-cli validate -l <project-directory>
```

**What it checks**

- YAML syntax and schema compliance
- Resource referencing (for example, ensuring an event references a valid property, or a connection references a source and destination in the same project)
- Transformation code syntax
- SQL syntax and warehouse connectivity
- Destination `config` for the selected destination type
- Event Stream connection eligibility and topology rules

### `apply`

Sync your local configurations to your RudderStack workspace.

```bash
rudder-cli apply -l <project-directory>
```

If your YAML uses `{{ .VAR }}` references, enable variable substitution and pass `--var-file`. See [How to Use Variable Substitution in Rudder CLI]({{< ref "dev-tools/rudder-cli/variable-substitution.md" >}}).

```bash
rudder-cli apply -l <project-directory> --var-file ./credentials.vars.yaml
```

#### Dry run

RudderStack recommends running the `apply` command with the `--dry-run` flag first to preview the changes that will be made to your workspace.

```bash
rudder-cli apply -l <project-directory> --dry-run
```

If your specs use variable substitution, include `--var-file` on dry run as well.

### `destroy`

Use this command to **permanently remove** resources that Rudder CLI manages from your workspace, based on your local project state.

{{< danger >}}
This is a destructive operation.
{{< /danger >}}

```bash
rudder-cli destroy
```

Rudder CLI lists what it plans to remove and asks you to confirm before anything is deleted.

{{< tip >}}
Flags and behavior can change between CLI releases — run `rudder-cli destroy --help` for the options your build supports, and prefer dry runs (`validate`, `apply --dry-run`) in CI before you use destroy in production.
{{< /tip >}}

## Additional command groups

The CLI also exposes subcommands for specific workflows. See the linked docs for syntax, flags, and examples:

| Resource | Example commands | Documentation |
|------|---------------------|----------------|
| SQL Models (Reverse ETL) | <ul><li>`rudder-cli workspace accounts list`</li><li>`rudder-cli workspace retl-sources list`</li><li>`rudder-cli import retl-sources ...`</li><li>`rudder-cli retl-sources preview ...`</li><li>`rudder-cli retl-sources validate ...`</li></ul> | <ul><li>[Create SQL Models]({{< ref "dev-tools/rudder-cli/sql-models/create.md" >}})</li><li>[Import SQL Models]({{< ref "dev-tools/rudder-cli/sql-models/import.md" >}})</li><li>[Validate and Preview SQL Models]({{< ref "dev-tools/rudder-cli/sql-models/validate.md" >}})</li></ul> |
| Transformations | <ul><li>`rudder-cli transformations test ...`</li><li>`rudder-cli transformations show-default-events`</li></ul> | <ul><li>[Transformations Quickstart]({{< ref "dev-tools/rudder-cli/transformations-walkthrough.md" >}})</li><li>[Transformation YAML Reference]({{< ref "dev-tools/rudder-cli/yaml-transformations.md" >}})</li></ul> |
| Code Generation | <ul><li>`rudder-cli typer generate ...`</li><li>`rudder-cli typer options kotlin`</li><li>`rudder-cli typer options swift`</li><li>`rudder-cli typer options typescript`</li></ul> | [RudderTyper v2 Command Reference]({{< ref "dev-tools/rudder-cli/ruddertyper-v2-command-reference.md" >}}) |

Run `rudder-cli --help` and `rudder-cli <command> --help` locally for the full list of subcommands and flags for your CLI version.
