htmlbin cli · v0.2.0
GET /cli HTTP/1.1
host: htmlbin.dev
to: anyone curious about @htmlbin/cli
from: htmlbin <htmlbin.dev>
re: a command-line client for the htmlbin API
date: May 23, 2026
accept: text/agent-friendly, text/markdown, application/json
200 OK content-type: text/html; charset=utf-8

Drop HTML from your shell.

The thinnest possible client for the htmlbin API. One verb. Humans, CI, agents.

01Install

One npm install, one human auth step. After that, the agent owns it.

# requires node 20+
$ npm i -g @htmlbin/cli
$ htmlbin login
$ htmlbin publish ./out.html
 https://htmlbin.dev/p/aB3xK7g

htmlbin login mints an API token via the GitHub device-code flow, ~30 seconds. The token lives at ./.htmlbin/token or ~/.config/htmlbin/token, in that order.

02Built for agents

htmlbin is an API for agents to share HTML; the CLI is the thin layer that lets them call it. Set CLAUDE_CODE, CURSOR_AGENT, CODEX, AIDER, CLINE, AMP_CODE, or DEVIN in the environment and the CLI auto-switches to single-line JSON. No flag needed.

$ CLAUDE_CODE=1 htmlbin publish ./out.html
{"url":"https://htmlbin.dev/p/aB3xK7g","slug":"aB3xK7g","version":1}

The full agent skill is served at htmlbin.dev/.well-known/agent-skills/htmlbin/SKILL.md — agents can fetch it before publishing to learn the rules.

03The PR-preview trick

Idempotent publishes, keyed by metadata. The pattern that makes pull-request previews click.

$ htmlbin publish ./out.html \
    --upsert \
    --metadata repo=u/r \
    --metadata pr=42

First push creates the drop. Every push after updates it. The URL stays stable for the entire life of the PR. Tag with anything you want; --upsert finds the match and re-publishes in place.

04Three backends, one verb

The same publish command, three places it can land. Select with --to <name>, $HTMLBIN_BACKEND, or backend = "..." in ./.htmlbin/config.

cloud
Public previews on htmlbin.dev. The default. Authenticates with an hb_* token.
gh-pages
Org-internal previews behind GitHub SSO. Commits to a gh-pages branch via the Git Data API.
cloudflare
SSO-gated previews via Cloudflare Access. The free tier covers up to 50 users.

05Commands

publish <file>
publish a file, print the URL
update <slug>
mutate an existing drop (PUT new HTML or PATCH metadata)
list
list your drops; filter with --metadata k=v
url <slug>
print the URL for a slug
delete <slug>
remove a drop
login
cloud sign-in via GitHub device code
setup
one-time backend preparation
patterns
install reusable drop templates