confluencedc-cli
v1.0.31
Published
Command-line interface for [Confluence Data Center](https://developer.atlassian.com/server/confluence/confluence-rest-api-summary/). 26 commands across 7 domains — pages, comments, attachments, labels, search, users, and access tokens.
Readme
confluencedc-cli
Command-line interface for Confluence Data Center. 26 commands across 7 domains — pages, comments, attachments, labels, search, users, and access tokens.
Install
npm install -g confluencedc-cliSetup
export CONFLUENCE_URL="https://confluence.example.com" # Base URL of your Confluence instance
export CONFLUENCE_TOKEN="your-personal-access-token" # HTTP Access Token from ConfluenceThe token commands are the exception: token management uses basic auth, not the PAT (--basic-username / --basic-password).
Argument conventions
- One positional, and it is the group's subject — the page id for
page, the comment id forcomment, the CQL query forsearch. - Scope is a flag —
--space <key>,--page-id <id>. - Prose is
--body, and every prose flag has a--<name>-file <path|->companion that reads a file or stdin. - Pagination is
--limit(default 25) +--start.
Commands
All commands output JSON. Add --pretty to pretty-print.
page
| Command | Description |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| confluencedc page get [pageId] | One page. Pass the id, or omit it and look the page up with --title + --space. --page-version reads an older version, --expand widens the response |
| confluencedc page children <pageId> | The page's direct children |
| confluencedc page history <pageId> | Its version history — who changed what, when |
| confluencedc page create | Creates a page in --space with --title and --body. --format storage\|wiki, --parent <pageId> to nest it |
| confluencedc page update <pageId> | Replaces the body and --title. The current version is fetched automatically; --comment records a change note, --minor-edit suppresses notifications |
| confluencedc page delete <pageId> | Deletes the page |
comment
| Command | Description |
| ----------------------------------------- | ---------------------------------------------------------------------------- |
| confluencedc comment list <pageId> | Comments on the page. --depth includes replies, --expand widens each one |
| confluencedc comment get <commentId> | One comment |
| confluencedc comment create <pageId> | Adds a comment from --body/--body-file (wiki markup) |
| confluencedc comment update <commentId> | Rewrites the comment; the version is fetched automatically |
| confluencedc comment reply <commentId> | Replies in-thread. Requires --page-id <id> alongside the parent comment |
| confluencedc comment delete <commentId> | Deletes the comment |
attachment
| Command | Description |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| confluencedc attachment list <pageId> | Attachments on the page, with their ids and download urls. --filename filters |
| confluencedc attachment download | Writes one attachment to --output, from the --url reported by attachment list |
| confluencedc attachment download-all <pageId> | Writes every attachment on the page into the --output directory |
| confluencedc attachment upload <pageId> | Uploads the files in --files (comma-separated paths). --comment annotates the version, --minor-edit suppresses notifications |
| confluencedc attachment delete <attachmentId> | Deletes one attachment |
label
| Command | Description |
| ---------------------------------- | ---------------------------------------- |
| confluencedc label list <pageId> | Labels on the page |
| confluencedc label add <pageId> | Adds the label named by --label <name> |
search
| Command | Description |
| --------------------------- | --------------------------------------------------------------------------------------- |
| confluencedc search <cql> | Content matching a CQL query. --expand pulls in body or version data with each result |
user
| Command | Description |
| ---------------------------------- | ---------------------------------------------------------------------------------- |
| confluencedc user me | The profile behind CONFLUENCE_TOKEN |
| confluencedc user get <username> | One user by exact username, or by user key with --by-key |
| confluencedc user search <query> | Users matching part of a display name. --cql takes a raw user CQL clause instead |
token
| Command | Description |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| confluencedc token list | Your tokens' names, ids and expiry — never the secrets |
| confluencedc token create | Mints a token named --name, optionally --expiration-duration <days>. The secret is returned exactly once |
| confluencedc token revoke <tokenId> | Revokes one token |
Pagination
List commands take --limit <n> (default 25) and --start. Responses carry a nextPage cursor — pass it back as --start for the next page. When nextPage is null, there are no more results.
Examples
# Read a page by id, or find it by title
confluencedc page get 12345
confluencedc page get --title "Architecture Overview" --space DOCS
# Walk the tree
confluencedc page children 12345
confluencedc page history 12345
# Create, including under a parent
confluencedc page create --space DOCS --title "New Page" --body "<p>Hello</p>" --format storage
confluencedc page create --space DOCS --title "Sub Page" --body "h1. Hello" --format wiki --parent 12345
# Update from a file, or from stdin
confluencedc page update 12345 --title "New Page" --body-file ./page.html --comment "Rewrote the intro"
cat page.html | confluencedc page update 12345 --title "New Page" --body-file -
# Comment, and reply in-thread
confluencedc comment create 12345 --body "Looks good, ship it"
confluencedc comment reply 67890 --page-id 12345 --body "Agreed"
# Search with CQL
confluencedc search 'space = "DOCS" AND type = "page" AND text ~ "deployment"'
# Attachments: list to get a download url, then fetch it
confluencedc attachment list 12345
confluencedc attachment download --url "https://confluence.example.com/download/attachments/12345/diagram.png" --output ./diagram.png
confluencedc attachment download-all 12345 --output ./downloads
confluencedc attachment upload 12345 --files ./diagram.png,./notes.txt
# Label a page
confluencedc label add 12345 --label runbook
# Who am I, and who is Jane
confluencedc user me
confluencedc user search "Jane Smith"Content formats
Confluence supports two body formats:
storage— Confluence storage format (XHTML-like). Use for precise control.wiki— Wiki markup. Simpler syntax, auto-converted to storage on save.
Comments always use wiki markup.
Error reporting
Confluence answers HTTP 404 both for content that does not exist and for content you are not allowed to see, and does not distinguish the two — so every 404 is reported as not_found (exit 3) with a recovery naming both causes, never as an auth failure.
An invalid or expired CONFLUENCE_TOKEN does not produce a 401 either: Confluence serves the request anonymously, and the status you get back depends on the endpoint (404, 403, or even 200). The CLI detects the anonymous case from the response headers and reports auth (exit 6) consistently.
Renamed in 2.0.0
The argument surface was unified across the whole CLI suite. There are no deprecation shims:
| Before | Now |
| ------------------------------------------- | ---------------------------------------------------------------------------------------- |
| comment reply <commentId> --page <pageId> | comment reply <commentId> --page-id <pageId> |
| page update --message <text> | page update --comment <text> |
| attachment upload --no-minor-edit | attachment upload --minor-edit (default is now a regular edit, matching page update) |
| token revoke --id <tokenId> | token revoke <tokenId> |
