# CLI

The `thinkbench` CLI exposes every [API operation](/api) as a subcommand:
commands, flags, and help text are derived from the same contract as the
REST API, so the CLI is never missing an operation.

```bash
npx thinkbench drives list
```

## Configuration

| Variable                           | Description                                         |
| ---------------------------------- | --------------------------------------------------- |
| `THINKBENCH_API_KEY`               | Required. An API key from **Settings → API keys**.  |
| `THINKBENCH_AGENT` _(optional)_    | Names the software making requests for attribution. |
| `THINKBENCH_BASE_URL` _(optional)_ | Defaults to `https://app.thinkbench.com/api/v1`.                     |

## Output shaping

Every command accepts `--pick <field>` to print a single top-level field of
the response, raw:

```bash
npx thinkbench documents read --document-id "<documentId>" --pick markdown
```

Piping to `jq` works too — `--pick` just keeps the CLI self-sufficient.

## Commands

Flags for each command are the operation's input fields, kebab-cased
(`documentId` becomes `--document-id`); see each operation page for the full
list. `npx thinkbench --help` prints the same catalog.

| Command | Summary |
| --- | --- |
| [`thinkbench documents read`](/api/documents/read) | Read a ThinkBench document and return its current content as Markdown. |
| [`thinkbench drive-items shared-with-me`](/api/drive-items/shared-with-me) | List items shared directly with the user via share grants. |
| [`thinkbench drive-items get`](/api/drive-items/get) | Read a drive item with its drive, children, visible ancestors, and shares. |
| [`thinkbench drive-items rename`](/api/drive-items/rename) | Rename a drive item. |
| [`thinkbench drive-items move`](/api/drive-items/move) | Move an item to another folder or drive. |
| [`thinkbench drive-items create-child`](/api/drive-items/create-child) | Create a folder or document inside a folder. |
| [`thinkbench drive-items share-suggestions`](/api/drive-items/share-suggestions) | Organization members who could be given access to this item. |
| [`thinkbench drive-items share`](/api/drive-items/share) | Grant a person access to an item by email. |
| [`thinkbench drive-items update-share`](/api/drive-items/update-share) | Change an existing share grant's permission. |
| [`thinkbench drive-items remove-share`](/api/drive-items/remove-share) | Revoke a share grant. |
| [`thinkbench drive-items set-publication`](/api/drive-items/set-publication) | Publish or unpublish a document to the web. |
| [`thinkbench drives list`](/api/drives/list) | List every drive the user can access, each with its items and members. |
| [`thinkbench drives create`](/api/drives/create) | Create a shared drive in the active organization. |
| [`thinkbench drives rename`](/api/drives/rename) | Rename a drive. |
| [`thinkbench drives create-item`](/api/drives/create-item) | Create a folder or document at the drive's root. |
| [`thinkbench drives upsert-member`](/api/drives/upsert-member) | Add an organization member to a shared drive or change their role. |
| [`thinkbench drives remove-member`](/api/drives/remove-member) | Remove a member from a shared drive. |
