---
title: Archbee Public API CLI
slug: test-archbee/archbee-public-api-cli
docTags: 
createdAt: 2026-02-26T14:46:12.000Z
---

A command-line interface for the Archbee Public API. Manage documents, spaces, OpenAPI references, and more directly from your terminal.

## Installation

Download the pre-built binary for your operating system and architecture:

### macOS

**Apple Silicon (M1/M2/M3/M4):**

```bash
curl -L -o archbee-api-cli https://downloads.archbee.com/cli/latest/archbee-api-cli-macos-arm64
chmod +x archbee-api-cli
sudo mv archbee-api-cli /usr/local/bin/
```

**Intel:**

```bash
curl -L -o archbee-api-cli https://downloads.archbee.com/cli/latest/archbee-api-cli-macos-x64
chmod +x archbee-api-cli
sudo mv archbee-api-cli /usr/local/bin/
```

### Linux

**x64:**

```bash
curl -L -o archbee-api-cli https://downloads.archbee.com/cli/latest/archbee-api-cli-linux-x64
chmod +x archbee-api-cli
sudo mv archbee-api-cli /usr/local/bin/
```

**ARM64:**

```bash
curl -L -o archbee-api-cli https://downloads.archbee.com/cli/latest/archbee-api-cli-linux-arm64
chmod +x archbee-api-cli
sudo mv archbee-api-cli /usr/local/bin/
```

### Windows

**x64:**

Download [archbee-api-cli-windows-x64.exe](https://downloads.archbee.com/cli/latest/archbee-api-cli-windows-x64.exe) and add it to your `PATH`.

Or via PowerShell:

```powershell
Invoke-WebRequest -Uri "https://downloads.archbee.com/cli/latest/archbee-api-cli-windows-x64.exe" -OutFile "archbee-api-cli.exe"
```

### Verify installation

```bash
archbee-api-cli --help
```

## Authentication

Every command requires `--doc-space-id` and `--api-key`. These can be found in your Archbee workspace under **Settings > API Keys**.

The CLI builds a bearer token automatically using `base64(docSpaceId~apiKey)`.

```bash
archbee-api-cli <command> --doc-space-id <YOUR_SPACE_ID> --api-key <YOUR_API_KEY> [options]
```

## Commands

### Documents

### get-doc

Retrieve a document in markdown, html, json, or source format.

```bash
archbee-api-cli get-doc \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id <id> \
  --format markdown
```

| Option           | Required | Description                                                              |
| ---------------- | -------- | ------------------------------------------------------------------------ |
| `--doc-id <id>`  | Yes      | Document ID                                                              |
| `--format <fmt>` | No       | Output format: `markdown`, `html`, `json`, `source`. Default: `markdown` |

### create-doc

Create a new document or update an existing one. If `--doc-id` is provided, the document is updated.

```bash
# Create a new document from inline content
archbee-api-cli create-doc \
  --doc-space-id <id> \
  --api-key <key> \
  --title "Getting Started" \
  --content "# Welcome\nThis is a new document."

# Update an existing document from a file
archbee-api-cli create-doc \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id <existing_id> \
  --file ./readme.md
```

| Option                       | Required | Description                                             |
| ---------------------------- | -------- | ------------------------------------------------------- |
| `--content <text>`           | Yes\*    | Markdown or JSON content                                |
| `--file <path>`              | Yes\*    | Read content from a file instead of `--content`         |
| `--format <fmt>`             | No       | Content format: `markdown`, `json`. Default: `markdown` |
| `--doc-id <id>`              | No       | Existing document ID to update                          |
| `--parent-doc-id <id>`       | No       | Parent document ID. Empty string moves to root          |
| `--title <text>`             | No       | Document title                                          |
| `--description <text>`       | No       | Document description                                    |
| `--slug <text>`              | No       | URL slug                                                |
| `--alias <text>`             | No       | URL alias                                               |
| `--preview-img-url <url>`    | No       | Preview image URL                                       |
| `--conditional-rule-id <id>` | No       | Conditional rule ID                                     |
| `--sorting <type>`           | No       | Insertion order: `alphabetical`, `chronological`        |
| `--hidden`                   | No       | Mark document as hidden                                 |

\* Either `--content` or `--file` is required.

### delete-doc

Permanently delete a document.

```bash
archbee-api-cli delete-doc \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id <id>
```

| Option          | Required | Description           |
| --------------- | -------- | --------------------- |
| `--doc-id <id>` | Yes      | Document ID to delete |

### search-docs

Search documents in a space. Supports word-based search, AI chat, and AI retrieval.

```bash
# Word-based search
archbee-api-cli search-docs \
  --doc-space-id <id> \
  --api-key <key> \
  --query "authentication"

# AI-powered search
archbee-api-cli search-docs \
  --doc-space-id <id> \
  --api-key <key> \
  --query "How do I set up SSO?" \
  --type ai-chat

# List all documents (empty query)
archbee-api-cli search-docs \
  --doc-space-id <id> \
  --api-key <key> \
  --query ""
```

| Option                     | Required | Description                                                       |
| -------------------------- | -------- | ----------------------------------------------------------------- |
| `--query <text>`           | Yes      | Search query. Empty string returns all documents                  |
| `--type <type>`            | No       | Search type: `words`, `ai-chat`, `ai-retrieval`. Default: `words` |
| `--doc-id <id>`            | No       | Return only this document                                         |
| `--parent-doc-id <id>`     | No       | Return only children of this doc. Use `"null"` for root           |
| `--search-only-title`      | No       | Search only by title                                              |
| `--data-text-format <fmt>` | No       | Return dataText as: `markdown`, `html`                            |
| `--persist-search`         | No       | Keep a SearchSession in the database                              |
| `--search-session-id <id>` | No       | Existing SearchSession ID to continue                             |

### import-content

Import a markdown file or a zip archive of markdown files as new documents.

```bash
# Single markdown file
archbee-api-cli import-content \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./guide.md

# Zip archive (preserves folder structure)
archbee-api-cli import-content \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./docs.zip
```

| Option          | Required | Description                          |
| --------------- | -------- | ------------------------------------ |
| `--file <path>` | Yes      | Path to `.md` file or `.zip` archive |

***

### Spaces

### create-space

Create a new space. The new space inherits the API key.

```bash
archbee-api-cli create-space \
  --doc-space-id <id> \
  --api-key <key> \
  --name "API Documentation" \
  --enable-llm
```

| Option                      | Required | Description                         |
| --------------------------- | -------- | ----------------------------------- |
| `--name <text>`             | No       | Space name                          |
| `--enable-llm`              | No       | Enable AI features                  |
| `--enable-review-system`    | No       | Enable review system                |
| `--doc-space-group-id <id>` | No       | Space group ID to add this space to |

### update-space

Update space settings including access control, custom hostname, and space links.

```bash
# Set password protection
archbee-api-cli update-space \
  --doc-space-id <id> \
  --api-key <key> \
  --protection-type Password \
  --password "s3cret"

# Set custom hostname
archbee-api-cli update-space \
  --doc-space-id <id> \
  --api-key <key> \
  --hostname docs.example.com

# Configure JWT authentication
archbee-api-cli update-space \
  --doc-space-id <id> \
  --api-key <key> \
  --protection-type JWT \
  --jwt-validation-type JWT-Secret \
  --jwt-secret "my-secret" \
  --jwt-redirect-url "https://example.com/auth"
```

| Option                         | Required | Description                                                                                                        |
| ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `--protection-type <type>`     | No       | Access type: `None`, `Password`, `Guest accounts`, `Private Accounts`, `Private Link`, `Magic Link`, `JWT`, `SAML` |
| `--password <text>`            | No       | Password (when protection-type is `Password`)                                                                      |
| `--hostname <domain>`          | No       | Custom hostname                                                                                                    |
| `--hostname-path <path>`       | No       | Path component for hostname                                                                                        |
| `--jwt-validation-type <type>` | No       | JWT validation: `JWT-Secret`, `JWT-KeySet`                                                                         |
| `--jwt-secret <text>`          | No       | JWT secret                                                                                                         |
| `--jwt-key-url <url>`          | No       | JWT key URL                                                                                                        |
| `--jwt-redirect-url <url>`     | No       | JWT redirect URL                                                                                                   |
| `--saml-metadata <xml>`        | No       | SAML metadata XML                                                                                                  |
| `--conditional-rule-id <id>`   | No       | Conditional rule ID                                                                                                |
| `--space-links <json>`         | No       | JSON array of space links                                                                                          |

### publish-space

Publish documents from a space.

```bash
# Publish to production
archbee-api-cli publish-space \
  --doc-space-id <id> \
  --api-key <key> \
  --environment PUBLISHED

# Publish to preview
archbee-api-cli publish-space \
  --doc-space-id <id> \
  --api-key <key> \
  --environment PREVIEW
```

| Option                | Required | Description              |
| --------------------- | -------- | ------------------------ |
| `--environment <env>` | Yes      | `PREVIEW` or `PUBLISHED` |

### clone-space

Clone a space into a target space group.

```bash
archbee-api-cli clone-space \
  --doc-space-id <id> \
  --api-key <key> \
  --target-space-group-id <id>
```

| Option                         | Required | Description           |
| ------------------------------ | -------- | --------------------- |
| `--target-space-group-id <id>` | No       | Target space group ID |

***

### OpenAPI

### sync-openapi

Sync an OpenAPI or Postman document with a new or existing API reference tree.

```bash
# Import a new OpenAPI spec
archbee-api-cli sync-openapi \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./openapi.json

# Update an existing API reference tree
archbee-api-cli sync-openapi \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./openapi.yml \
  --doc-tree-id <existing_tree_id>

# Import with code examples
archbee-api-cli sync-openapi \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./openapi.json \
  --language-examples "python,javascript,curl" \
  --create-schema-category \
  --create-intro
```

| Option                        | Required | Description                                           |
| ----------------------------- | -------- | ----------------------------------------------------- |
| `--file <path>`               | Yes      | Path to `.json`, `.yml`, `.yaml`, or `.zip` file      |
| `--doc-tree-id <id>`          | No       | Existing docTree ID to update                         |
| `--type <type>`               | No       | Import type: `openapi`, `postman`. Default: `openapi` |
| `--try-it`                    | No       | Enable API Try It feature. Default: `true`            |
| `--show-download`             | No       | Show download link for the OpenAPI file               |
| `--create-schema-category`    | No       | Create a models category                              |
| `--create-intro`              | No       | Create an intro document                              |
| `--language-examples <langs>` | No       | Comma-separated language examples (max 5)             |

### info-openapi

Get info of an existing OpenAPI tree.

```bash
archbee-api-cli info-openapi \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-tree-id <id>
```

| Option               | Required | Description                |
| -------------------- | -------- | -------------------------- |
| `--doc-tree-id <id>` | Yes      | DocTree ID to get info for |

***

### Upload

### upload

Upload a single file to the File Manager.

```bash
archbee-api-cli upload \
  --doc-space-id <id> \
  --api-key <key> \
  --file ./diagram.png
```

| Option          | Required | Description                                        |
| --------------- | -------- | -------------------------------------------------- |
| `--file <path>` | Yes      | Path to file to upload                             |
| `--public`      | No       | Make the file publicly accessible. Default: `true` |
| `--no-public`   | No       | Make the file private                              |

***

### Suggestions

### merge-suggestion

Merge a suggestion document into the base document.

```bash
archbee-api-cli merge-suggestion \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id SUGGEST-abc123def456
```

| Option          | Required | Description                                        |
| --------------- | -------- | -------------------------------------------------- |
| `--doc-id <id>` | Yes      | Suggestion document ID. Must start with `SUGGEST-` |

### discard-suggestion

Discard and delete a suggestion document without merging.

```bash
archbee-api-cli discard-suggestion \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id SUGGEST-abc123def456
```

| Option          | Required | Description                                        |
| --------------- | -------- | -------------------------------------------------- |
| `--doc-id <id>` | Yes      | Suggestion document ID. Must start with `SUGGEST-` |

***

### Organization

### export

Export team documentation as a signed S3 URL.

```bash
# Export entire team
archbee-api-cli export \
  --doc-space-id <id> \
  --api-key <key> \
  --team-id <id>

# Export only the current space
archbee-api-cli export \
  --doc-space-id <id> \
  --api-key <key> \
  --team-id <id> \
  --export-this-space-only
```

| Option                     | Required | Description                              |
| -------------------------- | -------- | ---------------------------------------- |
| `--team-id <id>`           | Yes      | Team ID                                  |
| `--export-this-space-only` | No       | Export only this space. Default: `false` |
| `--no-export-as-link`      | No       | Return raw data instead of a link        |

### display-rules

List display rules for an organization.

```bash
archbee-api-cli display-rules \
  --doc-space-id <id> \
  --api-key <key> \
  --team-id <id>
```

| Option           | Required | Description |
| ---------------- | -------- | ----------- |
| `--team-id <id>` | Yes      | Team ID     |

***

## CI/CD Usage

The CLI works great in CI pipelines. Here are some common workflows:

### Sync OpenAPI docs on deploy

```yaml
# GitHub Actions
- name: Update API docs
  run: |
    archbee-api-cli sync-openapi \
      --doc-space-id ${{ secrets.ARCHBEE_SPACE_ID }} \
      --api-key ${{ secrets.ARCHBEE_API_KEY }} \
      --file ./openapi.json \
      --doc-tree-id ${{ secrets.ARCHBEE_DOC_TREE_ID }}
```

### Publish docs after content update

```yaml
- name: Publish docs
  run: |
    archbee-api-cli publish-space \
      --doc-space-id ${{ secrets.ARCHBEE_SPACE_ID }} \
      --api-key ${{ secrets.ARCHBEE_API_KEY }} \
      --environment PUBLISHED
```

### Import markdown docs from repo

```yaml
- name: Import docs
  run: |
    archbee-api-cli import-content \
      --doc-space-id ${{ secrets.ARCHBEE_SPACE_ID }} \
      --api-key ${{ secrets.ARCHBEE_API_KEY }} \
      --file ./docs.zip
```

## Output

All commands output JSON to stdout on success. Errors are printed to stderr. This makes it easy to pipe output to other tools:

```bash
# Get a document and pipe to jq
archbee-api-cli get-doc \
  --doc-space-id <id> \
  --api-key <key> \
  --doc-id <id> | jq '.content'

# Search and save results to a file
archbee-api-cli search-docs \
  --doc-space-id <id> \
  --api-key <key> \
  --query "api" > results.json
```

## Getting help

Run any command with `--help` to see available options:

```bash
archbee-api-cli --help
archbee-api-cli create-doc --help
archbee-api-cli sync-openapi --help
```
