The domain API built for developers & AI agents

A clean REST/JSON API to register, renew, transfer and fully manage domains — plus DNS & DNSSEC, SSL certificates, email forwarding, the aftermarket, static and WordPress hosting, Cloudflare connect, and signed webhooks. Machine-readable errors, idempotency keys, an OpenAPI spec, a first-party MCP server, and a free sandbox make it a great fit for automation and autonomous agents.

Base URLhttps://api.porkbun.com/api/json/v3
Open the interactive reference →

What you can do

Everything in the Porkbun dashboard, over the API.

Domains

Check availability & pricing one at a time or 25 per call, register, renew, transfer-in, and list/manage every domain in the account.

Porkbun DNS & DNSSEC

Full CRUD over records (A, AAAA, CNAME, MX, TXT, SRV, CAA, ALIAS, …) and DNSSEC DS records on Porkbun's nameservers — plus dated restore points, so a zone broken by a bad edit can be diffed against a previous version and put back.

SSL certificates

Retrieve the free Porkbun-issued SSL bundle for any domain in the account.

Nameservers & glue

Read/replace nameservers and manage glue (host) records at the registry.

Domain contacts

Read and edit registrant/admin/tech/billing contacts, with per-TLD validation.

URL forwarding

Create and manage 301/302/masked URL forwards for a domain.

Email

Forward mail on your domains to existing inboxes, or set up real mailboxes. Guides: forwarding, mailboxes.

Aftermarket

Find taken names that are for sale: Afternic, Sedo, Atom, NameBright and DAX listings, plus Porkbun Marketplace, in one search, with price and a link to buy.

Expired closeouts

Search expired-domain closeouts and buy one outright. Filter by age, price, TLD and name length, and sort by registration date to find aged names in a single call.

Secure Static Hosting

Provision hosting and deploy a static site end-to-end — no dashboard.

WordPress hosting

Provision a managed Cloud for WordPress site, then edit its pages, posts and images through Porkbun (no WordPress password needed), or mint REST API credentials for your own code. Change PHP and WordPress versions, take and restore backups, and try changes on a staging copy before publishing them.

Link in Bio

Turn on a free Link in Bio page on a domain or buy a paid plan, then set the profile, links, social icons and look. Guide.

Agent Naming (ANS) experimental

Give an AI agent a verifiable name, identity certificate and public transparency-log entry, check its trust tier, and search the agent directory. Free. Guide.

Site sharing

Let someone else, and their AI agent, run one domain's website without your account: you approve, they get a one-time link, QR code and handoff prompt. Guide.

Official MCP server

npx @porkbunllc/mcp-server — the whole API as tools for Claude, Cursor and any MCP client. Or connect ChatGPT and Claude to the hosted server with a sign-in, no install. See porkbun.com/mcp.

Terraform & DNS as code

Manage domains and DNS from Terraform or OpenTofu with the community providers built on this API, or from DNSControl, octoDNS, external-dns and cert-manager. Setup, sandbox testing and the differences between providers: porkbun.com/terraform.

Cloudflare connect

Move domains into the customer's own Cloudflare account — create the zone, copy the DNS across, repoint nameservers — then manage those Cloudflare records, the orange cloud, and zone settings from the same API.

Outbound webhooks

Get signed, real-time events (registrations, renewals, transfers, expiring domains, DNS changes, Cloudflare moves, account verification) instead of polling. What each event sends.

Sandbox / test mode

A pk1_sb_ key runs the whole API in an isolated environment with fake credit — no real actions or charges, and signed webhooks are delivered too.

Mock server

Schema-accurate example responses for any endpoint at /mock/<path> — no credentials, nothing to install.

Spend controls & funding

One monthly limit on what keys and agents buy and on the credit they add ($100 a month until the account holder sets their own), low-balance alerts, plus account credit funding from the API: read and set auto top-up, or charge the saved payment method now so an agent that runs out of credit does not have to stop and wait for a human. With no card saved, an agent can pay with the user's card from its Stripe Link wallet over MPP, or with USDC over x402. An agent with a USDC wallet can also pay for a single purchase directly ("payWith": "usdc", HTTP 402), with no credit at all; if the purchase fails, the payment stays on the account as credit. Or pay for it by card ("payWith": "card") with a real hold, charged only if the purchase succeeds.

How it works

Simple, predictable, and safe to automate.

AuthenticationPass X-API-Key/X-Secret-API-Key headers, or apikey/secretapikey in the JSON body. Keys work whether or not account 2FA is enabled.
REST / JSONHTTPS only. Reads accept GET; writes are POST with a JSON body. Every response has a stable status.
IdempotencySend Idempotency-Key on any write; retries within 24h replay the original response — no double-charging.
Dry runPass dryRun: true to rehearse a billable or destructive write (price, funds, eligibility) without performing it.
VersioningEvery response carries X-API-Version (currently 3.84). The path stays /v3; minor bumps are backward-compatible.
Request IDsAn X-Request-Id header + requestId body field (UUIDv7) on every response for retries, logs, and support.

Built for AI agents

Agent-safety features so autonomous callers can act confidently. For the whole picture, from connecting a chat app to the guardrails, see Porkbun for AI agents.

Machine-readable errorsEvery error has a stable code plus a next_action object telling an agent how to recover (re-quote, add funds, enable a setting, …).
Registration requirements as JSON SchemaGET /domain/getRegistrationRequirements/{tld} returns the create payload and registry eligibility fields upfront.
Per-key scopingRestrict a key to specific source IPs (CIDR), specific domains and permissions (read-only, manage but no purchases, or custom scopes) — hand an agent a least-privilege key.
Rate-limit signallingX-RateLimit-* headers on rate-limited endpoints.
Spec self-discoveryEvery response carries a Link: rel="describedby" pointer to the OpenAPI spec.
Free sandboxA pk1_sb_ key runs the full lifecycle against an isolated sandbox with fake credit — responses include "sandbox": true.

Official MCP server

The fastest way to give an AI agent Porkbun superpowers.

Porkbun ships a first-party Model Context Protocol server exposing the whole API as native tools for Claude Desktop, Cursor, Cline, and other MCP clients. Write tools auto-attach an idempotency key, and the same server also grounds an agent in these docs (search_docs, read_doc, list_doc_topics) — no separate docs server needed.

Hosted, no install: add https://mcp.porkbun.com/mcp as a connector in ChatGPT, Claude, Claude Code or any remote-MCP client, then sign in to Porkbun and approve. No API key to copy; each connection is its own key, listed under API access, bounded by your per-domain API access and spend limit. Connect guide.

npx -y @porkbunllc/mcp-server  ·  Setup guide & tool list  ·  GitHub  ·  paste-to-install agent setup prompt

Reference & formats

Pick the format that fits your client — all kept in sync from one spec.

Open the interactive reference →

Get started

Create keys, then make your first call.