> For the complete documentation index, see [llms.txt](https://docs.dnscontrol.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dnscontrol.org/provider/porkbun.md). Agents can also search and read this documentation through its [MCP server](https://docs.dnscontrol.org/~gitbook/mcp).

# Porkbun

### Configuration

To use this provider, add an entry to `creds.json` with `TYPE` set to `PORKBUN` along with your `api_key` and `secret_key`. More info about authentication can be found in [Getting started with the Porkbun API](https://kb.porkbun.com/article/190-getting-started-with-the-porkbun-api).

Example:

{% code title="creds.json" %}

```json
{
  "porkbun": {
    "TYPE": "PORKBUN",
    "api_key": "your-porkbun-api-key",
    "secret_key": "your-porkbun-secret-key"
  }
}
```

{% endcode %}

Porkbun has quite strict API limits. If you experience errors with this provider (common when you have many domains), you can set one or both of `max_attempts` and `max_duration` in the credentials configuration.

Example:

{% code title="creds.json" %}

```json
{
  "porkbun": {
    "TYPE": "PORKBUN",
    "api_key": "your-porkbun-api-key",
    "secret_key": "your-porkbun-secret-key",
    "max_attempts": "10",
    "max_duration": "5m"
  }
}
```

{% endcode %}

The default for `max_attempts` is 5. There is no maximum duration by default, instead the provider will perform exponential backoff between 1 and 10 seconds, until `max_attempts` is reached. To retry indefinitely until `max_duration` is reached, set `max_attempts` to any value below 1.

### Metadata

This provider does not recognize any special metadata fields unique to Porkbun.

### Usage

An example configuration: (DNS hosted with Porkbun):

{% code title="dnsconfig.js" %}

```javascript
D("example.com", REGISTRAR("porkbun"), SERVICE("porkbun"),
    A("test", "1.2.3.4"),
);
```

{% endcode %}

An example configuration: (Registrar only. DNS hosted elsewhere)

{% code title="dnsconfig.js" %}

```javascript
D("example.com", REGISTRAR("porkbun"), SERVICE("r53"),
    A("test", "1.2.3.4"),
);
```

{% endcode %}

### URL Forwarding

Porkbun supports URL forwarding (redirects) using the `URL` and `URL301` record types:

{% code title="dnsconfig.js" %}

```javascript
D("example.com", REGISTRAR("porkbun"), SERVICE("porkbun"),
    // Temporary redirect (HTTP 302)
    URL("redirect", "https://example.org"),
    // Permanent redirect (HTTP 301)
    URL301("www", "https://example.com"),
);
```

{% endcode %}

By default, URL forwarding includes wildcard subdomains but does not include the URI path in redirection. You can customize this behavior using metadata:

{% code title="dnsconfig.js" %}

```javascript
D("example.com", REGISTRAR("porkbun"), SERVICE("porkbun"),
    // Include path and disable wildcard
    URL("redirect", "https://example.org", {includePath: "yes", wildcard: "no"}),
);
```

{% endcode %}

{% hint style="info" %}
**NOTE**: The legacy `PORKBUN_URLFWD` record type is deprecated. Please use `URL` or `URL301` instead.
{% endhint %}

### Feature Summary

* Support Level and Type
  * [Official Support](https://docs.dnscontrol.org/provider/index.md#providers-with-official-support): ❌
  * DNS Provider: ✅
  * Registrar: ✅
* API-level Features
  * [Concurrent fetching](https://docs.dnscontrol.org/advanced-features/concurrency-verified.md): ✅
  * [dual host](https://docs.dnscontrol.org/advanced-features/dual-host.md): ❌
  * create-domains: ❌
  * [get-zones](https://docs.dnscontrol.org/commands/get-zones.md): ✅
  * [AUTODNSSEC](https://docs.dnscontrol.org/language-reference/domain-modifiers/autodnssec_on.md): ❌
* Supported Record Types
  * [A](https://docs.dnscontrol.org/language-reference/domain-modifiers/a.md) [AAAA](https://docs.dnscontrol.org/language-reference/domain-modifiers/aaaa.md) [ALIAS](https://docs.dnscontrol.org/language-reference/domain-modifiers/alias.md) [CAA](https://docs.dnscontrol.org/language-reference/domain-modifiers/caa.md) [CNAME](https://docs.dnscontrol.org/language-reference/domain-modifiers/cname.md) [HTTPS](https://docs.dnscontrol.org/language-reference/domain-modifiers/https.md) [MX](https://docs.dnscontrol.org/language-reference/domain-modifiers/mx.md) [NS](https://docs.dnscontrol.org/language-reference/domain-modifiers/ns.md) [PORKBUN\_URLFWD](https://github.com/DNSControl/dnscontrol/tree/main/documentation/language-reference/domain-modifiers/PORKBUN_URLFWD.md) [SRV](https://docs.dnscontrol.org/language-reference/domain-modifiers/srv.md) [SSHFP](https://docs.dnscontrol.org/language-reference/domain-modifiers/sshfp.md) [SVCB](https://docs.dnscontrol.org/language-reference/domain-modifiers/svcb.md) [TLSA](https://docs.dnscontrol.org/language-reference/domain-modifiers/tlsa.md) [TXT](https://docs.dnscontrol.org/language-reference/domain-modifiers/txt.md) [URL](https://docs.dnscontrol.org/language-reference/domain-modifiers/url.md) [URL301](https://docs.dnscontrol.org/language-reference/domain-modifiers/url301.md)
