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, configure Scorecards, run 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:
- Get data out of DX (such as report results, trends, and team rollups) and into your pipeline for other operations
- 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:
Video overview
The following video walks through how to set up and use the DX CLI from start to finish.
Get started
Note: The DX CLI requires Node v20 or later.
The DX CLI can be installed via npm:
npm install -g @get-dx/cli
Run dx init to authenticate and optionally install the agent skill:
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:
npm update --g @get-dx/cli
Available commands
Each command calls a corresponding Web API method 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.
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.
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.
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 definitions between entity types.
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.
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:
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 as YAML, including listing, inspecting, creating, updating, and deleting.
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 results, including team scores, driver comments, and CSAT comments. The comment list commands paginate with --cursor and --limit (max 100).
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 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.
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 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 SQL queries with parameterized variables and table, JSON, or CSV output.
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 using SQL queries with parameterized variables to build customized metrics and visualizations you can share with your team.
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.
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 workflow definitions, optionally filtered by scope or by a specific entity.
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 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_TOKENenvironment 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 and 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:
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:
# 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:
# 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:
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.
dx doctor
dx doctor --json