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 site hosting, 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

What you can do

Everything in the Porkbun dashboard, over the API.

Domains

Check availability & pricing, register, renew, transfer-in, and list/manage every domain in the account.

DNS & DNSSEC

Full CRUD over records (A, AAAA, CNAME, MX, TXT, SRV, CAA, ALIAS, …) and DNSSEC DS records.

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 forwarding

Route mail on your domains to existing inboxes.

Marketplace

Browse the Porkbun aftermarket with server-side filters.

Secure Static Hosting

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

Outbound webhooks

Get signed, real-time events (registrations, renewals, transfers, DNS changes) instead of polling.

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

Per-account monthly limits, low-balance alerts, and auto top-up on API spend.

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.15). 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.

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) and/or specific domains — 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.

npx -y @porkbunllc/mcp-server  ·  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.