porkbun-cli
Setup
If porkbun-cli is not found, install and build it:
bun --version || curl -fsSL https://bun.sh/install | bash
npx api2cli bundle porkbun
npx api2cli link porkbun
api2cli link adds ~/.local/bin to PATH automatically. The CLI is available in the next command.
Always use --json flag when calling commands programmatically.
Authentication
porkbun-cli auth set "your-token"
porkbun-cli auth test
Resources
general
| Command | Description |
|---|---|
porkbun-cli general ping --json |
Test API connection and get your IP |
porkbun-cli general pricing --json |
Get domain pricing for all TLDs |
domains
| Command | Description |
|---|---|
porkbun-cli domains list --json |
List all domains in account |
porkbun-cli domains list --fields domain,status --json |
List domains with specific fields |
porkbun-cli domains check example.com --json |
Check domain availability |
porkbun-cli domains nameservers example.com --json |
Get nameservers for a domain |
porkbun-cli domains update-ns example.com --ns ns1.porkbun.com,ns2.porkbun.com --json |
Update nameservers |
porkbun-cli domains auto-renew example.com --status on --json |
Enable auto-renew |
porkbun-cli domains auto-renew example.com --status off --json |
Disable auto-renew |
dns
| Command | Description |
|---|---|
porkbun-cli dns list example.com --json |
List all DNS records |
porkbun-cli dns list example.com --fields name,type,content --json |
List DNS records with specific fields |
porkbun-cli dns get example.com 12345 --json |
Get specific DNS record by ID |
porkbun-cli dns create example.com --type A --content 1.1.1.1 --json |
Create A record |
porkbun-cli dns create example.com --type A --name www --content 1.1.1.1 --ttl 300 --json |
Create A record with subdomain and TTL |
porkbun-cli dns create example.com --type MX --content mail.example.com --prio 10 --json |
Create MX record with priority |
porkbun-cli dns edit example.com 12345 --type A --content 2.2.2.2 --json |
Edit DNS record |
porkbun-cli dns edit example.com 12345 --type MX --content mail2.example.com --prio 20 --json |
Edit MX record with priority |
porkbun-cli dns delete example.com 12345 --json |
Delete DNS record |
porkbun-cli dns get-by-type example.com A --json |
Get all A records |
porkbun-cli dns get-by-type example.com A www --json |
Get A records for subdomain |
porkbun-cli dns edit-by-type example.com A www --content 2.2.2.2 --json |
Edit DNS record by type/subdomain |
porkbun-cli dns delete-by-type example.com A --json |
Delete all A records |
porkbun-cli dns delete-by-type example.com A www --json |
Delete A records for subdomain |
forwards
| Command | Description |
|---|---|
porkbun-cli forwards list example.com --json |
List all URL forwards |
porkbun-cli forwards list example.com --fields subdomain,location --json |
List forwards with specific fields |
porkbun-cli forwards add example.com --subdomain www --location "https://example.com" --type permanent --json |
Add permanent URL forward |
porkbun-cli forwards add example.com --subdomain blog --location "https://blog.example.com" --include-path --json |
Add forward with path inclusion |
porkbun-cli forwards add example.com --subdomain "*" --location "https://example.com" --wildcard --json |
Add wildcard forward |
porkbun-cli forwards delete example.com 12345 --json |
Delete URL forward |
ssl
| Command | Description |
|---|---|
porkbun-cli ssl retrieve example.com --json |
Get SSL certificate bundle |
Global Flags
All commands support: --json, --format <text|json|csv|yaml>, --verbose, --no-color, --no-header