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

# CLI Reference

> Complete guide to the Credible CLI for managing semantic models and packages

The Credible CLI (`cred`) is a powerful command-line interface for managing semantic data models, packages, environments, and connections in the Credible Data platform. Built for data engineers and DevOps professionals, it enables automated workflows and seamless CI/CD integration.

## Installation

<Note>
  **Prerequisites**: Node.js version 20+ and npm package manager
</Note>

Install the Credible CLI globally from the npm registry:

```bash theme={null}
npm install -g @credibledata/cred-cli
```

View package details at [npmjs.com/package/@credibledata/cred-cli](https://www.npmjs.com/package/@credibledata/cred-cli)

## Core Commands

<Tip>
  The CLI supports bash/zsh autocompletion. Type `cred ` + TAB to see available commands, or `cred ls ` + TAB to see resource types (environment, package, connection, version, group).
</Tip>

### Authentication & Session

#### Login

Authenticate with your organization via Auth0:

```bash theme={null}
cred login <organizationName>
```

#### Check Status

View your current organization and environment:

```bash theme={null}
cred status
```

#### Logout

Clear stored credentials:

```bash theme={null}
cred logout
```

### Resource Management

<Tabs>
  <Tab title="Environments">
    #### List Environments

    ```bash theme={null}
    cred ls environment
    ```

    #### Get Environment Details

    ```bash theme={null}
    cred get environment <environmentName>
    ```

    #### Create Environment

    ```bash theme={null}
    cred add environment <environmentName> [--readmeFile <path>] [-y]
    ```

    Options:

    * `--readmeFile`: Path to README file to include

    #### Delete Environment

    ```bash theme={null}
    cred rm environment <environmentName> [-y]
    ```

    #### Set Default Environment

    ```bash theme={null}
    cred set environment <environmentName>
    ```

    <Warning>
      Setting a default environment only applies to CLI sessions - it doesn't affect any web experiences
    </Warning>
  </Tab>

  <Tab title="Packages">
    #### List Packages

    ```bash theme={null}
    cred ls package
    ```

    #### Delete Package

    ```bash theme={null}
    cred rm package <packageName> [-y]
    ```

    #### Update Package

    ```bash theme={null}
    cred update package <packageName> [options]
    ```

    Options:

    * `--version <versionId>`: Set which version is latest/pinned
    * `--description <text>`: Update package description
    * `--replication <count>`: Set replication count (must be at least 1)

    <Note>
      The "latest" version may also be called "pinned" in the web UI
    </Note>

    #### Publish New Version

    ```bash theme={null}
    cred publish [--set-latest] [-y]
    ```

    #### List Package Versions

    ```bash theme={null}
    cred ls version <packageName>
    ```

    #### Archive Version

    ```bash theme={null}
    cred archive <packageName> <versionId> [-y]
    ```

    #### Unarchive Version

    ```bash theme={null}
    cred unarchive <packageName> <versionId> [-y]
    ```

    <Note>
      There is no `cred set package` command. Use `cred set environment` to set your default environment. Packages are managed through publish/archive/unarchive commands.
    </Note>
  </Tab>

  <Tab title="Connections">
    #### List Connections

    ```bash theme={null}
    cred ls connection
    ```

    #### Create Connection

    ```bash theme={null}
    cred add connection <connectionFileName> [--include-tables <tables>] [--exclude-tables <tables>] [--skip-indexing] [-y]
    ```

    Options:

    * `--include-tables <tables>`: Comma-separated list of tables to index for AI-assisted modeling, as `{dataset/schema}.{table}` (use `*` for all tables in a schema, e.g. `sales.*,finance.orders`)
    * `--exclude-tables <tables>`: Comma-separated list of tables to exclude from indexing (same format); mutually exclusive with `--include-tables`
    * `--skip-indexing`: Disable automatic indexing for this connection; cannot be combined with the table flags

    The `connectionFileName` should be a JSON file containing an array of connection objects. The connection name is a field within the JSON, not a command-line argument.

    **Command Syntax:**

    ```bash theme={null}
    cred add connection <connectionFileName>
    ```

    **JSON File Structure:**

    The file should contain an array of connection objects. Each connection has:

    * `name`: The connection name (required)
    * `type`: Connection type (`postgres`, `bigquery`, `snowflake`, `trino`, `databricks`, `mysql`)
    * Connection-specific configuration based on type

    **BigQuery Example:**

    ```json theme={null}
    [
      {
        "name": "my-bigquery-connection",
        "type": "bigquery",
        "bigqueryConnection": {
          "defaultProjectId": "my-project",
          "billingProjectId": "billing-project",
          "location": "us-central1",
          "serviceAccountKeyJson": "{\"type\":\"service_account\",\"project_id\":\"...\"}",
          "maximumBytesBilled": "1000000",
          "queryTimeoutMilliseconds": "30000"
        }
      }
    ]
    ```

    Note: For BigQuery, the `serviceAccountKeyJson` field contains the entire JSON content as a string (not a file path).

    **PostgreSQL Example:**

    ```json theme={null}
    [
      {
        "name": "my-postgres-connection",
        "type": "postgres",
        "postgresConnection": {
          "host": "localhost",
          "port": 5432,
          "databaseName": "mydb",
          "userName": "myuser",
          "password": "mypassword"
        }
      }
    ]
    ```

    Alternatively, you can use a connection string:

    ```json theme={null}
    [
      {
        "name": "my-postgres-connection",
        "type": "postgres",
        "postgresConnection": {
          "connectionString": "postgresql://user:password@localhost:5432/mydb"
        }
      }
    ]
    ```

    **Snowflake Example:**

    ```json theme={null}
    [
      {
        "name": "my-snowflake-connection",
        "type": "snowflake",
        "snowflakeConnection": {
          "account": "myaccount.us-east-1",
          "username": "myuser",
          "password": "mypassword",
          "warehouse": "COMPUTE_WH",
          "database": "MYDB",
          "schema": "PUBLIC",
          "responseTimeoutMilliseconds": 60000
        }
      }
    ]
    ```

    **Databricks Example (Personal Access Token):**

    ```json theme={null}
    [
      {
        "name": "my-databricks-connection",
        "type": "databricks",
        "databricksConnection": {
          "host": "dbc-xxxxxxxx-xxxx.cloud.databricks.com",
          "path": "/sql/1.0/warehouses/abcdef1234567890",
          "token": "dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
          "defaultCatalog": "main",
          "defaultSchema": "default"
        }
      }
    ]
    ```

    Alternatively, authenticate with an OAuth M2M service principal:

    ```json theme={null}
    [
      {
        "name": "my-databricks-connection",
        "type": "databricks",
        "databricksConnection": {
          "host": "dbc-xxxxxxxx-xxxx.cloud.databricks.com",
          "path": "/sql/1.0/warehouses/abcdef1234567890",
          "oauthClientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "oauthClientSecret": "doseXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
          "defaultCatalog": "main",
          "defaultSchema": "default"
        }
      }
    ]
    ```

    See the [Databricks connection reference](/reference/connections/databricks) for details on creating a SQL warehouse and credentials.

    <Note>
      The connection name is defined in the JSON file itself, not as a command argument. You can include multiple connections in a single JSON file array.
    </Note>

    #### Delete Connection

    ```bash theme={null}
    cred rm connection <connectionName> [-y]
    ```
  </Tab>

  <Tab title="Groups">
    #### List Groups

    ```bash theme={null}
    cred ls group
    ```

    #### Get Group Details

    ```bash theme={null}
    cred get group <groupName>
    ```

    #### Create Group

    ```bash theme={null}
    cred add group <groupName> [-d <description>] [-y]
    ```

    Options:

    * `-d, --description`: Description for the group
    * `-y, --yes`: Skip confirmation

    #### Delete Group

    ```bash theme={null}
    cred rm group <groupName> [-y]
    ```

    #### Create Group Access Token

    ```bash theme={null}
    cred add group-access-token <groupName> <tokenName>
    ```

    Arguments:

    * `<groupName>`: The name of the group
    * `<tokenName>`: Name for the API key/token

    **Example:**

    ```bash theme={null}
    cred add group-access-token ai-agents-group production-token
    ```

    This command generates an API key that can be used to authenticate applications or services with the permissions of the specified group. The token is displayed once and should be stored securely.

    #### Add Member to Group

    ```bash theme={null}
    cred add member <groupName> <memberType> <memberName> <role>
    ```

    Arguments:

    * `<groupName>`: The name of the group
    * `<memberType>`: Type of member (`user` or `group`)
    * `<memberName>`: Name of the user or group to add
    * `<role>`: Member role (`admin` or `member`)

    **Examples:**

    ```bash theme={null}
    # Add a user as admin
    cred add member engineering-team user john.doe@example.com admin

    # Add a nested group as member
    cred add member engineering-team group data-analysts member
    ```

    #### Remove Member from Group

    ```bash theme={null}
    cred rm member <groupName> <memberType> <memberName>
    ```

    Arguments:

    * `<groupName>`: The name of the group
    * `<memberType>`: Type of member (`user` or `group`)
    * `<memberName>`: Name of the user or group to remove

    **Example:**

    ```bash theme={null}
    cred rm member engineering-team user john.doe@example.com
    ```

    <Note>
      Groups enable role-based access control (RBAC) for organizing users and managing permissions across environments and packages. Groups can contain both individual users and other groups (nested groups).
    </Note>
  </Tab>
</Tabs>

## Command Options

### Global Options

| Option          | Description                                                                    |
| --------------- | ------------------------------------------------------------------------------ |
| `-V, --version` | Display version number                                                         |
| `-h, --help`    | Display help (use alone for general help or after a command for specific help) |
| `--debug`       | Enable debug output (most commands)                                            |
| `-y, --yes`     | Skip confirmation prompts                                                      |
| `--set-latest`  | Set published version as the latest (publish command)                          |
