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

# Command Reference

> Review global options, command groups, contact identifier lookups, and the full ChatbotX CLI command catalog.

ChatbotX CLI commands follow the same resources you manage in the Workspace: Contacts, Tags, Custom Fields, Bot Fields, Conversations, Broadcasts, Flows, Sequences, and system tools.

## Global Options

| Option                  | When to Use It                                                                    |
| :---------------------- | :-------------------------------------------------------------------------------- |
| `--apiKey`              | Use a different API key for one command                                           |
| `--apiUrl`              | Use a different API URL for one command                                           |
| `--allowSelfSignedCert` | Connect to a server with a self-signed certificate                                |
| `--refresh-spec`        | Re-fetch the OpenAPI spec after new APIs are added                                |
| `--json`                | Return raw JSON output instead of formatted text (useful for scripting with `jq`) |

## Contact Identifiers

For any command in the `contacts` group, the `<identifier>` parameter supports three look-up formats. Use an explicit prefix format so the CLI finds the correct Contact:

| Format          | Example                  | Lookup By     |
| :-------------- | :----------------------- | :------------ |
| `id:<value>`    | `id:123456789`           | Contact ID    |
| `email:<value>` | `email:user@example.com` | Email address |
| `phone:<value>` | `phone:+84708123123`     | Phone number  |

### Examples

```bash theme={null}
# Get contact by email
chatbotx contacts get email:user@example.com

# Get contact by phone
chatbotx contacts get phone:+84708123123

# Get contact by internal ID
chatbotx contacts get id:123456789
```

## Command Groups

| Group                    | Common Commands                                                   | Use It For                                       |
| :----------------------- | :---------------------------------------------------------------- | :----------------------------------------------- |
| Workspace                | `workspaces get`                                                  | Check Workspace connection and metadata          |
| Members, Channels, Teams | `members list`, `channels list`, `teams list`                     | Inspect users, channels, and inbox teams         |
| Tags                     | `tags list`, `tags create`, `tags update`                         | Manage Contact labels                            |
| Custom Fields            | `custom-fields list`, `custom-fields create`                      | Manage Contact data fields                       |
| Bot Fields               | `bot-fields list`, `bot-fields bulk-update`                       | Manage bot-level variables                       |
| Contacts                 | `contacts list`, `contacts get`, `contacts upsert`                | Find, create, update, import, and block Contacts |
| Contact Actions          | `contacts tag add`, `contacts message send`, `contacts flow add`  | Run actions on a specific Contact                |
| Conversations            | `conversations list`                                              | Inspect Inbox activity                           |
| Broadcasts               | `broadcasts list`, `broadcasts get`                               | Check campaigns and audiences                    |
| Automation               | `flows list`, `sequences list`, `keywords list`, `triggers list`  | Inspect automation assets                        |
| System Tools             | `saved-replies list`, `template-messages list`, `error-logs list` | Review reusable content and logs                 |

## Workspace, Members, Channels, and Teams

```bash theme={null}
chatbotx workspaces get
chatbotx members list                      # [--page --perPage --sort --keyword]
chatbotx members get <memberId>
chatbotx channels list                     # [--includes --page --perPage]
chatbotx teams list
```

## Tags

```bash theme={null}
chatbotx tags list
chatbotx tags create --name <name>
chatbotx tags get <idOrName>
chatbotx tags update <id> --name <name>
chatbotx tags delete <id>
```

## Custom Fields

```bash theme={null}
chatbotx custom-fields list
chatbotx custom-fields create --name <name> --type <type>
chatbotx custom-fields get <idOrName>
chatbotx custom-fields update <id> --name <name>     # [--description --folderId]
chatbotx custom-fields delete <id>
```

## Bot Fields

```bash theme={null}
chatbotx bot-fields list
chatbotx bot-fields create --name <name> --type <type> --value <value> --description <description>
chatbotx bot-fields update --fields <fields>
chatbotx bot-fields bulk-update --fields <fields>
chatbotx bot-fields get <idOrName>
chatbotx bot-fields update <idOrName> --value <value>
chatbotx bot-fields delete <idOrName>
```

## Contacts

```bash theme={null}
chatbotx contacts list                     # [--page --perPage --sort --keyword ...]
chatbotx contacts create --phoneNumber <phoneNumber> --email <email> --gender <gender>
chatbotx contacts get <identifier>
chatbotx contacts upsert <identifier>      # [--firstName --lastName --email --phoneNumber --avatar --gender]
chatbotx contacts update <identifier>
chatbotx contacts delete <identifier>
chatbotx contacts find-by-custom-field     # [--customFieldId --value]
chatbotx contacts import --fileId <fileId> --channel <channel> --inboxId <inboxId>
```

## Contact Tags

```bash theme={null}
chatbotx contacts tags list <identifier>
chatbotx contacts tag add <identifier> --tagIds <tagIds>
chatbotx contacts tag delete <identifier> --tagIds <tagIds>
```

## Contact Custom Fields

```bash theme={null}
chatbotx contacts custom-fields list <identifier>
chatbotx contacts custom-fields update <identifier> --fields <fields>
chatbotx contacts custom-field get <identifier> <customFieldId>
chatbotx contacts custom-field add <identifier> <customFieldId> --value <value>
chatbotx contacts custom-field delete <identifier> <idOrName>
```

## Contact Actions

```bash theme={null}
chatbotx contacts block <identifier>
chatbotx contacts unblock <identifier>
chatbotx contacts messages list <identifier>         # [--perPage --cursor]
chatbotx contacts message get <identifier> <messageId>
chatbotx contacts message send <identifier>          # [--text --files --flowId --nodeId --inboxId]
chatbotx contacts flow add <identifier> --flowId <flowId>  # [--inboxId]
chatbotx contacts auto-replies add <identifier> --keyword <keyword>  # [--inboxId]
```

## Conversations, Broadcasts, Flows, Sequences, and System Tools

```bash theme={null}
chatbotx conversations list                # [--botCategory --assignedId --channel --status --keyword ...]
chatbotx broadcasts list
chatbotx broadcasts get <idOrName>
chatbotx broadcasts audience get <idOrName>           # [--page --perPage]
chatbotx flows list
chatbotx sequences list                    # [--page --perPage --sort]
chatbotx sequences get <id>
chatbotx saved-replies list
chatbotx template-messages list            # [--inboxId --integrationWhatsappId --status]
chatbotx ai-agents list
chatbotx integrations list
chatbotx keywords list
chatbotx triggers list
chatbotx webhooks list
chatbotx error-logs list                   # [--page --perPage --sort --keyword]
```
