Official command-line interface
Your registrar, in your terminal.
Domains, DNS, SSL, email and hosting, from a shell prompt, a cron job, or a coding agent that would rather run a command than click a page.
npm install --global @porkbunllc/cliporkbun login # approve it in your browser, no keys to copy
porkbun dns create example.com --type A --name www --content 192.0.2.1
Every command in the Porkbun API, generated from the same spec that produces the documentation and the MCP server, so the three cannot drift apart. MIT licensed. API v3.117.
Finding the command
Nobody memorises a registrar's API. Describe the task instead:
$ porkbun search "add an A record"
[{"command":"porkbun dns create","summary":"Create DNS record"}]
$ porkbun dns # every command in a group
$ porkbun dns create --help # arguments, flags, which are required
$ porkbun schema "dns create" # method, path and body fields, as JSON
Made for scripts, not just people
- Results on stdout, everything else on stderr. A pipe gets nothing but JSON, so
porkbun dns retrieve example.com | jqworks without flags or cleanup. - Failures exit non-zero and print the API's error code, message and its
next_actionhint, so a script can stop and a person can tell why. - Dry runs that really check.
--dry-runasks the API to validate the write for real and returnswouldSucceed, without changing anything. - Nothing bought or deleted by surprise. Commands that spend money or destroy something prompt, defaulting to no, and refuse outright when there is no terminal to answer.
--forcewhen you mean it. - Keys never go in arguments. Environment variables or
~/.config/porkbun/config.jsonat mode 0600, because arguments show up inpsand shell history.
Keys without the copying
porkbun login asks the API for a key pair and prints a link to approve while you are signed in to Porkbun. Approve it and the pair is saved to ~/.config/porkbun/config.json at mode 0600.
$ porkbun login
Approve this request while signed in to Porkbun:
https://porkbun.com/account/apiKeyApproval/<token>
Waiting for approval...
Approved. Key pair saved to ~/.config/porkbun/config.json (mode 0600).
The approval is bound to that one run with PKCE (RFC 7636), so an intercepted link is useless to anyone else, and the pair is never printed: a key in scrollback is a key in every log that captured it. For CI and unattended agents set PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY instead, which always win over the stored file.
Dynamic DNS, in four lines
The reason a lot of people want a registrar CLI at all:
ip=$(porkbun util ping | jq -r .yourIp)
id=$(porkbun dns retrieve-by-name-type example.com A home | jq -r '.records[0].id')
porkbun dns edit example.com "$id" --content "$ip"
porkbun util ping reports the address our servers actually see, which is the one worth publishing.
Try it without an account
A sandbox key pair is free and instant, needs no signup, and touches nothing real: no registrations, no DNS changes, no charges.
curl -s -X POST https://api.porkbun.com/api/json/v3/apikey/request \
-H 'Content-Type: application/json' -d '{"sandbox": true}'
Export the pair it returns and every command works, against an isolated copy of everything.
For coding agents
Add one line to AGENTS.md, CLAUDE.md or your agent's instructions:
When working with Porkbun domains or DNS, use the `porkbun` CLI.
Run `porkbun search "<task>"` to find the command and
`porkbun <command> --help` for its flags. Use --dry-run before writes.
An agent that would rather call tools than run commands can use the MCP server instead. Same API underneath, same guardrails, and Porkbun for AI agents explains when each one fits.
Official, and first-party
Porkbun writes and maintains this CLI. It is on npm as @porkbunllc/cli and on GitHub at oborseth/Porkbun-CLI.
A package named porkbun-cli on PyPI is published by someone else and is not ours. It is not reviewed or supported by Porkbun, and it handles API keys, so treat it the way you would any third-party tool asking for credentials.