Docs

CLI

Use the relaypdf CLI for local scripts, CI, and agents. Same operations as REST, plus the MCP server. Run relaypdf setup so credentials are written to disk instead of pasted into chat.

Install with npx @relaypdf/cli. Credentials live in ~/.config/relaypdf/credentials.json with mode 0600 and are never printed. Do not ask users to paste API keys — run relaypdf login or setup. The npm README (@relaypdf/cli) is the full command and MCP tool reference.

Auth

Device-code flow opens /cli/authorize in the browser. RELAYPDF_API_KEY overrides the stored key. whoami --json never includes the secret.

Auth
npx @relaypdf/cli login
npx @relaypdf/cli setup --env .env
npx @relaypdf/cli whoami
npx @relaypdf/cli logout

Document commands

Each command maps to one public endpoint. --html / --markdown may be markup, a file path, or - (stdin). --async returns a job id. --response url returns a 24-hour download.

CommandHTTP
pdf --html|--url|--markdown|--templatePOST /v1/pdf
image --url|--htmlPOST /v1/images
convert <file> --to pdf|docx|xlsx|html|pngPOST /v1/convert
merge / extract / protect / unlock / raster / from-imagesPOST /v1/pdf/*
stamp / rotate / delete-pages / compress / info / textPOST /v1/pdf/*
form-fields / form-fillPOST /v1/pdf/form/*
barcode --type qr --data …POST /v1/barcodes
zip a.pdf b.pdfPOST /v1/zip
templates list|gallery|create|publish/v1/templates
webhooks list|create|deleteGET/POST/DELETE /v1/webhooks
jobs get|waitGET /v1/jobs/:id
healthGET /health
Examples
relaypdf pdf --html invoice.html --out invoice.pdf
relaypdf pdf --url https://example.com --out page.pdf
relaypdf pdf --markdown notes.md --out notes.pdf
relaypdf pdf --template invoice --data sample.json --out invoice.pdf
relaypdf image --url https://example.com --full-page --out page.png
relaypdf convert letter.docx --to pdf --out letter.pdf
relaypdf merge a.pdf b.pdf --out pack.pdf
relaypdf extract report.pdf --pages 1-3 --out slice.pdf
relaypdf protect file.pdf --password secret --out locked.pdf
relaypdf stamp in.pdf --text DRAFT --out stamped.pdf
relaypdf raster in.pdf --pages 1 --out page.png
relaypdf barcode --type qr --data 'https://relaypdf.com' --out qr.png
relaypdf webhooks create --url https://example.com/hooks --events job.completed,job.failed
relaypdf jobs wait <id> --out done.pdf

MCP

Hosted: POST https://api.relaypdf.com/mcp (Bearer, Streamable HTTP). Local: relaypdf mcp starts a stdio server using the same credentials. Same tools: pdf, image, convert, merge, extract, protect, unlock, raster, from_images, stamp, rotate, delete_pages, compress, info, text, form_fields, form_fill, barcode, zip, templates_list, templates_gallery, templates_create, templates_publish, webhooks_list, webhooks_create, webhooks_delete, jobs_get, jobs_wait, health. Hosted generating tools return a 24h URL. Stdio binary tools take out.

mcp.json
{
  "mcpServers": {
    "relaypdf": {
      "command": "npx",
      "args": ["-y", "@relaypdf/cli", "mcp"]
    }
  }
}