---
title: "CLI"
canonical_url: "https://docs.getdx.com/cli/"
md_url: "https://docs.getdx.com/cli.md"
last_updated: "2026-11-20"
---

# CLI
The DX CLI is an AI-native command-line tool for interacting with DX from the terminal. With it you can manage your [Software Catalog](https://docs.getdx.com/catalog/overview/), configure [Scorecards](https://docs.getdx.com/scorecards/overview/), run [Data Studio](https://docs.getdx.com/data-studio/) queries, and more. It is designed to be accessed either through your AI agent, or from a terminal or CI pipeline. The DX CLI is a command tool that sends requests to DX APIs and returns results. It is not an AI agent and does not interpret, reason about, or generate data on its own.

## About the CLI

The DX CLI provides a headless way to query DX data and perform operations in DX directly from your terminal, CI/CD pipelines, or agentic workflows -- all without going into the DX UI.

- **For engineers**: Run straightforward commands to interact with DX APIs, query metrics, and make updates directly from your terminal or automation scripts.
- **For agents**: The CLI includes built-in skills and context that teach agents when, why, and how to use DX APIs. This allows agents to translate high-level natural language prompts into exact DX actions. For example, instead of running `dx scorecards create --from-file ./my-scorecard.yaml`, you can simply ask your agent: "Build a scorecard that checks for README.md existence."

## Advantages of the CLI

The DX CLI provides you with the ability to interact with DX seamlessly through your agent, and gives your agent the exact context and tool definitions it needs to take actions in DX on your behalf. That way, you can bring DX data and actions directly into the tools and environments where your team already works.

The DX CLI allows you to:

1. Get data _out_ of DX (such as report results, trends, and team rollups) and into your pipeline for other operations
2. Make changes _in_ DX (create new reports, create new scorecards, add/edit catalog entities) in a quick, automated way without going into the DX UI.

## Ways to use the CLI

You can do the following with the DX CLI:


Query data from Data Studio, export it to use elsewhere/in another application

Take your DX data wherever it's needed. Your agent can query data from Data Studio and make it available in a format that works for you (i.e. a JSON file), or pipe it directly into another step in your development workflow. For example, you can turn the latest DX Snapshot into a CSV to provide high-level updates to execs all without writing any code.



Build reports in DX from a simple prompt

Instead of manually constructing a report in DX, writing multiple SQL queries, and fixing formatting, you can ask your agent to build a report in DX based on any available data in Data Studio. If you're not sure what data is available, your agent can answer that as well.



Add catalog entities to DX or edit existing catalog entities in an automated manner

Manage entities for your catalog in an automated way - that can include adding many entities at once asynchronously, or making mass-edits across all entities without any of the work. Either of these can be accomplished by simply prompting your agent to do so. Your agent can also define relations between entity types and connect entities in bulk, such as mapping which services depend on each other.



Build scorecards based on friction that occurs in your development workflow

Instead of writing SQL for scorecard checks, describe what you want to measure and let your agent build it for you. This keeps you in your flow—if you identify a new check during development, like an updated production readiness requirement, you can prompt your agent to update the scorecard immediately without context switching.


## Video overview

The following video walks through how to set up and use the DX CLI from start to finish.

<div style="padding:64.67065868263472% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/1236685343?h=faa7f11f4e&amp;badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479" frameborder="0" allow="autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share" referrerpolicy="strict-origin-when-cross-origin" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="DX CLI beta walkthrough"></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>

## Get started

> Note: The DX CLI requires Node v20 or later.

The DX CLI can be installed via npm:

```shell
npm install -g @get-dx/cli
```

Run `dx init` to authenticate and optionally install the agent skill:

```shell
dx init
```

The DX CLI automatically checks for the latest version every 24 hours before running a command. If a new version is available, you will be prompted to upgrade, be reminded later, or skip that version.

To manually update to the latest version of the CLI:

```shell
npm update --g @get-dx/cli
```

## Available commands

Each command calls a corresponding [Web API method](https://docs.getdx.com/webapi/overview/) and inherits its scope requirements. Run `dx --help` for the full command tree, and `dx <command> --help` for usage and examples on any specific command.

### auth

Manage CLI authentication and inspect the active session.

```shell
dx auth login
dx auth login --token [TOKEN]
dx auth status
dx auth logout
```

**Required scope**: none.

### catalog entities

List, inspect, create, update, upsert, and delete entities in the [Software Catalog](https://docs.getdx.com/catalog/overview/).

```shell
dx catalog entities list
dx catalog entities info [identifier]
dx catalog entities create --type service --identifier [identifier]
dx catalog entities upsert --type service --identifier [identifier]
dx catalog entities update [identifier] --property tier=Tier-1
dx catalog entities update [identifier] --alias github_repo=12345
dx catalog entities delete [identifier]
dx catalog entities tasks [identifier]
dx catalog entities scorecards [identifier]
```

`--property` and `--alias` accept `key=value` pairs and can be repeated to set multiple values. On `update` and `upsert`, pass `--alias key=null` to remove an alias.

**Required scopes**: `catalog:read` for `list`, `info`, `tasks`, `scorecards`; `catalog:write:entities` for `create`, `update`, `upsert`, `delete`.

### catalog entityTypes

List, inspect, create, update, and delete entity type definitions, or initialize a YAML template for editing.

```shell
dx catalog entityTypes list
dx catalog entityTypes info [identifier]
dx catalog entityTypes init ./my-entity-type.yaml
dx catalog entityTypes create --from-file ./my-entity-type.yaml
dx catalog entityTypes update [identifier] --from-file ./my-entity-type.yaml
dx catalog entityTypes delete [identifier]
```

**Required scopes**: `catalog:read` for `list`, `info`, and `init` with `--identifier`; `catalog:write:entities` for `create`, `update`, `delete`.

### catalog relations

List, inspect, create, update, and delete [relation](https://docs.getdx.com/catalog/overview/#relation-properties) definitions between entity types.

```shell
dx catalog relations list
dx catalog relations info [identifier]
dx catalog relations create --identifier [identifier] --source-type service --target-type service --type "depends on" --cardinality many_to_many
dx catalog relations update [identifier] --description "Runtime dependencies between services"
dx catalog relations delete [identifier]
```

`--type` accepts one of `consumes`, `depends on`, `parent of`, `part of`, `provides`, or `manages`. `--cardinality` accepts one of `one_to_one`, `one_to_many`, `many_to_one`, or `many_to_many`.

`update` can change only `--type` and `--description`. The identifier, source and target entity types, and cardinality cannot be changed. `list` paginates with `--cursor` and `--limit`.

**Required scopes**: `catalog:read` for `list` and `info`; `catalog:write:entities` for `create`, `update`, `delete`.

### catalog relationEdges

List, add, remove, and bulk upsert relation edges between individual entities.

```shell
dx catalog relationEdges list --entity [identifier] --relation [relation]
dx catalog relationEdges list --entity [identifier] --relation [relation] --direction incoming
dx catalog relationEdges add --relation [relation] --source [identifier] --target [identifier]
dx catalog relationEdges remove --relation [relation] --source [identifier] --target [identifier]
dx catalog relationEdges initBulkUpsert ./edges.yaml
dx catalog relationEdges bulkUpsert --relation [relation] --from-file ./edges.yaml
```

`list` treats the entity as the source of the relation by default (`--direction outgoing`). Pass `--direction incoming` to treat it as the target. `list` paginates with `--cursor` and `--limit` (max 50).

`bulkUpsert` reads edges from a YAML or JSON file with `--from-file`, or from stdin with `--from-stdin`. The input maps each source entity identifier to a list of target entity identifiers:

```yaml
login-frontend:
  - authn-backend
  - feature-flag-backend
```

`bulkUpsert` only adds edges. Existing edges that are not listed in the input are kept; use `remove` to delete an edge. Run `initBulkUpsert` to write a blank template.

**Required scopes**: `catalog:read` for `list`; `catalog:write:entities` for `add`, `remove`, `bulkUpsert`. `initBulkUpsert` writes a local file and requires no scope.

### scorecards

Manage [Scorecards](https://docs.getdx.com/scorecards/overview/) as YAML, including listing, inspecting, creating, updating, and deleting.

```shell
dx scorecards list
dx scorecards info [id]
dx scorecards init ./my-scorecard.yaml
dx scorecards create --from-file ./my-scorecard.yaml
dx scorecards update [id] --from-file ./my-scorecard.yaml
dx scorecards delete [id]
```

**Required scopes**: `scorecards:read` for `list`, `info`, and `init` with `--id`; `scorecards:write` for `create`, `update`, `delete`.

### snapshots

Inspect [Snapshot](https://docs.getdx.com/snapshots/overview/) results, including team scores, driver comments, and CSAT comments. The comment list commands paginate with `--cursor` and `--limit` (max 100).

```shell
dx snapshots list
dx snapshots info --id [snapshot_id]
dx snapshots snapshotTeams list --id [snapshot_id]
dx snapshots driverScores list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots csatScores list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots impactScores list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots workflowScores list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots dxiScores list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots allocationPercentages list --id [snapshot_id] --team-ids [id1],[id2] --snapshot-team-ids [id1] --group-ids [id1] --attribute-ids [id1] --branch-ids [id1]
dx snapshots driverComments list --id [snapshot_id] --limit 100
dx snapshots csatComments list --id [snapshot_id] --limit 100
```

The score commands wrap the matching [`snapshots.*` Web API methods](https://docs.getdx.com/scopes/#snapshotsread) and accept comma-separated `--team-ids`, `--snapshot-team-ids`, `--group-ids`, `--branch-ids`, and `--attribute-ids`. `--snapshot-team-ids` takes the snapshot-scoped `id` from `snapshotTeams list`, not the stable `team_id`. `dxiScores` requires `--branch-ids` to include the main branch. Results marked `hidden` have too few responses to meet the reporting threshold. Hidden score results return a `null` score. Hidden `allocationPercentages` results return a `null` `percentage` on every item.

**Required scope**: `snapshots:read`.

### snapshots settings

Read and manage Snapshot survey settings.

```shell
dx snapshots settings branches list
dx snapshots settings configuration get
dx snapshots settings library get
dx snapshots settings drivers create --from-file ./my-driver.yaml
dx snapshots settings drivers update --from-file ./my-driver.yaml
dx snapshots settings driverSelection set --from-file ./driver-selection.yaml
dx snapshots settings workflowSelection set --from-file ./workflow-selection.yaml
dx snapshots settings csatItems create --from-file ./my-csat-item.yaml
dx snapshots settings csatItems update --from-file ./my-csat-item.yaml
dx snapshots settings csatSelection set --from-file ./csat-selection.yaml
dx snapshots settings csatOrder set --from-file ./csat-order.yaml
```

Write commands take one YAML or JSON object with `--from-file` or `--from-stdin`. See the matching [`snapshots.settings.*` Web API method](https://docs.getdx.com/scopes/#snapshotsadmin) for each payload. `update` preserves omitted fields, except that rewording a translated field clears its existing translations unless you resend them. The selection `set` commands replace the whole selected set, so run `library get` first and include every ID you want to keep. Writes fail while a snapshot is live.

**Required scope**: `snapshots:admin`.

### studio query

Run [Data Studio](https://docs.getdx.com/data-studio/) SQL queries with parameterized variables and table, JSON, or CSV output.

```shell
dx studio query 'SELECT id, name FROM github_repositories LIMIT 10'
dx studio query 'SELECT * FROM github_pulls' --output pulls.csv
dx studio query 'SELECT * FROM github_repositories WHERE id IN ($repo_ids)' --variable repo_ids=1,2,3
```

**Required scope**: `datacloud:query`.

### studio reports

Create and manage [Data Studio reports](https://docs.getdx.com/data-studio/#custom-reports) using SQL queries with parameterized variables to build customized metrics and visualizations you can share with your team.

```shell
dx studio reports create
dx studio reports info [id]
dx studio reports init [path]
dx studio reports list
dx studio reports update [id]
```

**Required scopes**: `studio:reports:write` for `create`, `update`, and `delete`; `studio:reports:read` for `info` and `list`.

### teams

Look up DX teams by ID, by reference ID, or by member emails.

```shell
dx teams list
dx teams info --team-id [id]
dx teams info --reference-id [id]
dx teams findByMembers --team-emails person@example.com,another@example.com
```

**Required scope**: `snapshots:read`.

### workflows

List [Self-service](https://docs.getdx.com/self-service/overview/) workflow definitions, optionally filtered by scope or by a specific entity.

```shell
dx workflows list
dx workflows list --scope GLOBAL
dx workflows list --scope ENTITY --entity-identifier [identifier]
```

**Required scope**: `workflows:read`.

## For agents

The DX CLI is designed for headless use from the ground up, ready for integration into your agentic workflows.

### Agent skill

`dx init` offers to install the bundled `dx-cli` agent skill, which teaches [skills-compatible](https://vercel.com/changelog/introducing-skills-the-open-agent-skills-ecosystem) agents how and when to invoke the CLI, including the available commands, argument shapes, and DX glossary.

The skill bundles workflow guides for managing the Software Catalog, managing Scorecards, and analyzing Snapshot results.

### Non-interactive authentication

Agents can authenticate the CLI in one of two ways:

- Set the `DX_API_TOKEN` environment variable for the session or job. The CLI uses this token for all commands without saving it to the OS keyring.
- Alternatively, run `dx auth login --token <token>` once at the start of the session to store the token in the OS keyring. Subsequent commands use this stored token.

The CLI accepts both [organization tokens](https://docs.getdx.com/webapi/overview/#authentication) and [personal access tokens](https://docs.getdx.com/personal-access-tokens/). DX recommends personal access tokens for individuals and agents because they attribute calls to the issuing user in audit logs. Use organization tokens for machine-to-machine workflows that are not tied to a user.

### Machine-readable output

Pass `--json` to any command to receive the raw API response as machine-readable JSON instead of the formatted human view:

```shell
dx --json catalog entities list
```




## Dedicated and managed deployments

The CLI relies on an API base URL for making requests and a web base URL for displaying links on resources. The default values are used for DX **cloud** deployments. Users of **dedicated** and **managed** deployments will need to specify these values explicitly when authenticating.

| Value            | How it is used                               | Env var           | Default value           |
| ---------------- | -------------------------------------------- | ----------------- | ----------------------- |
| **Web base URL** | Browser-based login and displaying web links | `DX_WEB_BASE_URL` | `https://app.getdx.com` |
| **API base URL** | Making each API request to DX                | `DX_API_BASE_URL` | `https://api.getdx.com` |

### For dedicated deployments

Set the env vars once when initializing:

```shell
# Interactive login
DX_WEB_BASE_URL="https://mycompany.getdx.io" DX_API_BASE_URL="https://api.mycompany.getdx.io" dx init

# Non-interactive use for CI, containers, or remote agents
DX_WEB_BASE_URL="https://mycompany.getdx.io" DX_API_BASE_URL="https://api.mycompany.getdx.io" DX_API_TOKEN="$DX_TOKEN" dx auth login
```

### For managed deployments

Set the env vars once when initializing:

```shell
# Interactive login
DX_WEB_BASE_URL="https://dx.some-example-subdomain.example.com" DX_API_BASE_URL="https://api.dx.some-example-subdomain.example.com" dx init

# Non-interactive use for CI, containers, or remote agents
DX_WEB_BASE_URL="https://dx.some-example-subdomain.example.com" DX_API_BASE_URL="https://api.dx.some-example-subdomain.example.com" DX_API_TOKEN="$DX_TOKEN" dx auth login
```

## Logging

Logs are off by default. Set `DX_LOG_LEVEL` to one of `debug`, `info`, `warn`, or `error` to enable them:

```shell
DX_LOG_LEVEL=debug dx catalog entities list
```

Logs are human-readable on a TTY and switch to JSON when `--json` is passed or when `stderr` is redirected.

## Troubleshooting

Run `dx doctor` to diagnose problems with your CLI installation, configuration, networking, and authentication. The output masks tokens and other secrets, so it is safe to share with DX support.

```shell
dx doctor
dx doctor --json
```
---

## Sitemap

[Overview of all docs pages](/llms.txt)
