CLI
The `papermark` command — scripted workflows, CI, and local exploration.
papermark is the official command-line client. It wraps the same
REST API the dashboard uses, with first-class support for piping,
machine-readable output, and CI environments.
npm install -g papermark
papermark login
papermark documents listWhen to use it (and when not to)
| Use the CLI | Use the API directly |
|---|---|
| One-off scripts, cron jobs, CI tasks | A backend service in your stack |
| Scripted dataroom population for customers | A web UI you control |
| Per-customer link minting in a CRM workflow | A worker fleet running thousands of QPS |
| Local exploration ("what's in this dataroom?") | Anything performance-sensitive |
Ad-hoc analytics pulls (--json then jq) |
The CLI shells out to your local Node, so per-call overhead is on the order of 50–150 ms. Fine for scripts, not great for hot paths.
Command tree
| Group | Purpose |
|---|---|
papermark login / logout / whoami | Auth lifecycle |
papermark auth export / auth set | Move credentials between machines |
papermark documents | List, get, search, upload, delete documents |
papermark datarooms | Create, list, configure datarooms; read viewers and aggregate analytics |
papermark links | Create, list, get, delete share links (document- or dataroom-bound) |
papermark views | Read view analytics for a link |
papermark config | Per-machine settings (e.g. API URL override) |
papermark doctor | Health checks: config, token, API reachability |
Run any command with --help for the full flag list. The
Commands page has per-command pages with
examples.
Global flags
These work on every command:
| Flag | Effect |
|---|---|
--json | Force machine-readable JSON output. Auto-enabled when stdout is not a TTY (i.e., when piped). |
--dry-run | Print the HTTP request that would be sent (with the token redacted) and exit 0. Useful for debugging permissions and request shapes. |
--no-color | Disable ANSI color. Equivalent to NO_COLOR=1. |
Output is a contract
When you pass --json (or pipe to anything), the CLI emits a stable
envelope:
{ "ok": true, "data": { … }, "meta": { "next_cursor": "…" } }On failure:
{
"ok": false,
"error": {
"code": "AUTH_INVALID",
"message": "Token rejected.",
"status": 401,
"retryable": false,
"doc_url": "https://papermark.com/docs/cli/output-contract#auth-invalid"
}
}Exit codes are tied to the error class — 2 for auth, 3 for
validation, 4 for network, 1 for everything else, 5 for an
internal CLI bug. See the output contract
for the full table.
Next
- Install — Node 24 requirements, alternative install paths
- Getting started — log in, run your first three commands
- Authentication — env vars, credentials files, CI patterns
- Output contract — every error code, every exit code