Porkbun Sandbox API

Isolated sandbox/test environment (sandbox API keys, pk1_sb_…).

GitHub OpenAPI

Operations 3

POST /sandbox/topup Sandbox: add fake credit #
POST /sandbox/reset Sandbox: reset to a clean slate #
POST /sandbox/triggerWebhook Sandbox: fire a sample webhook event #

Specifications

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/porkbun-com:porkbun-com-sandbox-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

porkbun-com-sandbox-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Porkbun API v3 Sandbox API
  version: '3.109'
  description: 'The Porkbun API enables programmatic domain registration, DNS management, SSL certificate retrieval, and related operations. It is fully usable by AI agents, automation scripts, and developer tools. ## Sandbox / test mode


    Build and test an integration end-to-end with **no real registry actions, no DNS changes, no certificates, and no charges** by using a **sandbox API key** — a public key prefixed `pk1_sb_` (secret `sk1_sb_`), created at https://porkbun.com/account/api. Same base URL; just swap the key. In sandbox:

    - **A sandbox key sees only sandbox data.** Domains, DNS records, contacts and everything else in your live Porkbun account are invisible to it, including on a key you created on your own API Access page. Calling a live domain in the sandbox returns `INVALID_DOMAIN` for that reason, not because the name is wrong. - **Everything in the sandbox is created through the API.** The website only creates the keys. Register a test domain with `POST /domain/create/{domain}` first; that also creates its DNS zone, so there is no separate zone step. - **First steps:** `POST /domain/checkDomain/{name}` on a name nobody has registered, then `POST /domain/create/{domain}`, then `POST /dns/create/{domain}`, then `GET /dns/retrieve/{domain}`. - Every response includes `"sandbox": true` and an `X-Porkbun-Sandbox: true` header. - Registrations, renewals, transfers, DNS, contacts, nameservers, glue, and DNSSEC are simulated against an isolated datastore; your account starts with fake credit (top up/reset via `/sandbox/topup` and `/sandbox/reset`). Availability and pricing reflect the real catalog so quotes match production. - Endpoints that can''t be simulated — **hosting**, **email**, **closeouts** and **agent naming (ANS)** — return `SANDBOX_UNSUPPORTED`. Closeouts are excluded because the inventory and the purchase both live with a third party that has no test environment, so a simulated buy would claim a real domain. - **Webhooks are delivered in the sandbox.** Register an endpoint with `POST /webhook/create`, then either perform an operation (the matching signed event is delivered just like production) or fire any event on demand with `POST /sandbox/triggerWebhook` to test your handler and signature verification. ## Mock server (no credentials)


    Learn any endpoint''s exact response shape with **zero setup** — no key, no account. Every real path is mirrored under `/mock`:

    - `GET /mock` lists every mockable endpoint. - `GET|POST /mock/` returns a schema-accurate example response for that operation (e.g. `/mock/domain/listAll`). Append `?status=error` for the error shape. Mock responses touch no datastore, are identical in shape to the live API, and are signalled by an `X-Porkbun-Mock: true` header. Use it to build client code before you have credentials; switch to a sandbox key when you want real behavior with fake money. ## Quickstart


    **1. Get your API keys** — visit https://porkbun.com/account/api


    **2. Test connectivity**

    ```bash

    curl https://api.porkbun.com/api/json/v3/ip

    ```

    Returns your public IP. No credentials required. **3. Check domain availability** (also verifies your credentials)

    ```bash

    curl -X POST https://api.porkbun.com/api/json/v3/domain/checkDomain/example.com \

    -H "Content-Type: application/json" \

    -d ''{"apikey":"your_api_key","secretapikey":"your_secret_key"}''

    ```

    Returns `avail: "yes"/"no"` and `price` in USD. Returns an error if credentials are invalid. **4. Register the domain** — convert `price` to pennies (e.g. $9.73 → 973) for `cost`

    ```bash

    curl -X POST https://api.porkbun.com/api/json/v3/domain/create/example.com \

    -H "Content-Type: application/json" \

    -d ''{"apikey":"your_api_key","secretapikey":"your_secret_key","cost":973,"agreeToTerms":"yes"}''

    ```


    **5.'
  contact:
    name: Porkbun Support
    url: https://porkbun.com/support
  x-logo:
    url: https://porkbun.com/img/logo.png
servers:
- url: https://api.porkbun.com/api/json/v3
  description: Production
- url: https://api-ipv4.porkbun.com/api/json/v3
  description: Production (IPv4 only — use this if your client is on an IPv6 network and needs to reach the API over IPv4)
security:
- ApiKeyHeader: []
  SecretApiKeyHeader: []
tags:
- name: Sandbox
  description: Isolated sandbox/test environment (sandbox API keys, pk1_sb_…).
paths:
  /sandbox/topup:
    post:
      tags:
      - Sandbox
      summary: 'Sandbox: add fake credit'
      operationId: sandboxTopup
      description: Sandbox only (requires a `pk1_sb_` key). Grants fake account credit so paid operations can keep being exercised after funds run out. Optional `amount` in US cents (default 100000 = $1000, capped 1,000,000).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                properties:
                  amount:
                    type: integer
                    description: Fake credit to add in US cents (default 100000; max 1000000).
      responses:
        '200':
          description: Credit granted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  granted:
                    type: integer
                  balance:
                    type: integer
                  display:
                    type: string
                  sandbox:
                    type: boolean
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
            X-RateLimit-Window:
              $ref: '#/components/headers/XRateLimitWindow'
            X-RateLimit-Mode:
              $ref: '#/components/headers/XRateLimitMode'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-porkbun-agent:
        safe: false
        cost: false
        destructive: false
        reversible: true
        requiresConfirmation: false
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      x-porkbun-scope: account
  /sandbox/reset:
    post:
      tags:
      - Sandbox
      summary: 'Sandbox: reset to a clean slate'
      operationId: sandboxReset
      description: Sandbox only (requires a `pk1_sb_` key). Wipes the sandbox account's simulated state (domains, DNS, orders, credit) and re-grants $1000 fake credit.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
      responses:
        '200':
          description: Sandbox reset.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  message:
                    type: string
                  domainsCleared:
                    type: integer
                  balance:
                    type: integer
                  sandbox:
                    type: boolean
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
            X-RateLimit-Window:
              $ref: '#/components/headers/XRateLimitWindow'
            X-RateLimit-Mode:
              $ref: '#/components/headers/XRateLimitMode'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-porkbun-agent:
        safe: false
        cost: false
        destructive: true
        reversible: false
        requiresConfirmation: true
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      x-porkbun-scope: account
  /sandbox/triggerWebhook:
    post:
      tags:
      - Sandbox
      summary: 'Sandbox: fire a sample webhook event'
      operationId: sandboxTriggerWebhook
      description: Sandbox only (requires a `pk1_sb_` key). Enqueues a signed sample webhook event to your registered endpoints so you can test your handler and signature verification for any event type on demand — including cron-driven events like `domain.expiring` that don't result from a single API call. Register an endpoint first with `POST /webhook/create`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - eventType
                properties:
                  eventType:
                    type: string
                    enum:
                    - domain.registered
                    - domain.renewed
                    - domain.transfer.completed
                    - domain.transfer.failed
                    - domain.expiring
                    - dns.record.created
                    - dns.record.updated
                    - dns.record.deleted
                    description: Event type to emit.
                  domain:
                    type: string
                    description: Domain used in the sample payload (default example.com).
      responses:
        '200':
          description: Event enqueued for delivery.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  event:
                    type: string
                  data:
                    type: object
                  endpointsRegistered:
                    type: integer
                  message:
                    type: string
                  sandbox:
                    type: boolean
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
            X-RateLimit-Window:
              $ref: '#/components/headers/XRateLimitWindow'
            X-RateLimit-Mode:
              $ref: '#/components/headers/XRateLimitMode'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-porkbun-agent:
        safe: false
        cost: false
        destructive: false
        reversible: true
        requiresConfirmation: false
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      x-porkbun-scope: account
components:
  responses:
    RateLimited:
      description: Rate limit exceeded (code RATE_LIMIT_EXCEEDED). Wait Retry-After seconds, then retry the same request.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        X-RateLimit-Window:
          $ref: '#/components/headers/XRateLimitWindow'
        X-RateLimit-Mode:
          $ref: '#/components/headers/XRateLimitMode'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitExceeded'
  headers:
    RetryAfter:
      description: 'On 429: whole seconds to wait before retrying.'
      schema:
        type: integer
    XRateLimitLimit:
      description: Requests allowed per window for this API key (the general per-key limiter).
      schema:
        type: integer
    XRateLimitReset:
      description: Seconds until the current window resets.
      schema:
        type: integer
    XRateLimitRemaining:
      description: Requests left in the current window for this API key.
      schema:
        type: integer
    XRateLimitWindow:
      description: Window length in seconds.
      schema:
        type: integer
    XRateLimitMode:
      description: '`observe` while the general per-key limiter only measures and refuses nothing. Endpoint-specific limits (availability checks, registrations, renewals and others) are enforced regardless, with 429 and Retry-After.'
      schema:
        type: string
        enum:
        - observe
  schemas:
    AuthRequest:
      type: object
      description: API credentials. Provide `apikey`/`secretapikey` in the request body, OR supply them as `X-API-Key`/`X-Secret-API-Key` request headers. One of the two methods is required.
      properties:
        apikey:
          type: string
          description: Your API key. Required in body when not using header auth.
          example: pk1_...
        secretapikey:
          type: string
          description: Your secret API key. Required in body when providing apikey.
          example: sk1_...
    RateLimitExceeded:
      type: object
      required:
      - status
      - message
      properties:
        status:
          type: string
          enum:
          - ERROR
          example: ERROR
        message:
          type: string
          example: Rate limit exceeded. Please try again later.
        code:
          type: string
          example: RATE_LIMIT_EXCEEDED
        ttlRemaining:
          type: integer
          description: Seconds until the rate limit window resets. Present on some endpoints.
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: Optional, recommended on every purchase and write. Send a unique value (a UUID) per intended operation. Repeating the request with the same key and an identical body within 24 hours returns the original response instead of doing it again, so a retry after a timeout cannot double-charge or double-apply. The same key with a different body returns 409 IDEMPOTENCY_KEY_MISMATCH; while the first request is still running, 409 IDEMPOTENCY_KEY_IN_USE.
      example: 3f0c9a52-6d1e-4c8e-9b7a-2f5d1e0c4a11
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your API key. Use together with X-Secret-API-Key.
    SecretApiKeyHeader:
      type: apiKey
      in: header
      name: X-Secret-API-Key
      description: Your secret API key. Use together with X-API-Key.