CloudPDF
DocsPricing
Start building

CLI reference

The server is one binary, cloudpdf-server, with a handful of subcommands. It’s the entrypoint of the Docker image too, so every command below works the same whether you run it from npm or a container.

# npm
cloudpdf-server <command> [args]
 
# Docker (the binary is the entrypoint)
docker run --rm ghcr.io/embedpdf/cloudpdf-server:latest <command> [args]

Run cloudpdf-server --help to print the commands and the full CLOUDPDF_* environment surface.

serve#

Starts the HTTP server. This is the defaultcloudpdf-server with no arguments runs serve.

cloudpdf-server serve

Reads its entire configuration from the environment — see the configuration reference. Listens on PORT (default 3000) and exposes /healthz, /readyz, /v1/docs/*, and /v1/admin/*.

migrate#

Manage the database schema. See Migrations for the recommended flow per deployment.

CommandWhat it does
migrate statusShow applied, pending, and drift state.
migrate upApply all pending migrations.
migrate up --dry-runList what would be applied, without changing the database.
migrate validateExit non-zero if drift is detected.
migrate validate --strictTreat pending migrations as drift too.
migrate downRoll back migrations (manual break-glass; destructive).
cloudpdf-server migrate status
cloudpdf-server migrate up

Rolling back#

migrate down is a deliberate, destructive break-glass tool. It requires --yes because containers are non-interactive:

FlagEffect
--to NNNRoll back everything newer than version NNN.
--steps NRoll back the N highest applied (default 1).
--allRoll back every applied migration.
--dry-runPreview the plan without touching the database.
--yesRequired to actually run.
--forceRoll back even if the up-checksum drifted from the code.
# Preview first
cloudpdf-server migrate down --steps 1 --dry-run
 
# Then commit to it
cloudpdf-server migrate down --steps 1 --yes

migrate down can drop data. Take a database backup first, and prefer rolling forward with a corrective migration over rolling back in production.

db doctor#

Connects to the database, runs validate, and prints version information. A fast way to confirm credentials, connectivity, and schema health:

cloudpdf-server db doctor

audit export#

Exports a closed day’s audit_log rows to JSONL in the object store — useful for shipping audit records to long-term storage or a SIEM:

cloudpdf-server audit export --day yesterday

quarantine#

Host-isolation deployments journal engine crashes and refuse documents that repeatedly crash the engine (422 DocumentQuarantined). Inspect and release them:

# What is quarantined right now, and why
cloudpdf-server quarantine list
 
# Release one document (audited, with a reason)
cloudpdf-server quarantine clear <base-sha> --reason "vendor fixed the file"

A quarantine expires on its own after its TTL; clear is for releasing one early after you’ve verified the document (or upgraded the engine).

Exit codes#

The commands use conventional exit codes (0 success, non-zero on failure), which makes them safe to wire into CI, init containers, and Helm hooks. For example, migrate validate failing non-zero is exactly what lets a deploy refuse to proceed on a stale schema.

Next steps#