Create DNS Record
create_dns_recordAdd an A, AAAA, CNAME, MX, TXT or other DNS record to a domain in your Porkbun account. Returns the new record ID so it can be updated or deleted later.
Instructions
Create a DNS record on a domain in the authenticated account. Returns the new record's id so it can be referenced by update_dns_record and delete_dns_record. For the name field: omit or pass empty string for the apex/root, otherwise pass the subdomain prefix only (e.g. www, not www.example.com). For MX and SRV records, set prio (priority). Free, doesn't spend account credit. If a record with this exact name, type and content already exists the call fails with DUPLICATE_RECORD and returns that record's id in existingId — use it rather than retrying or creating a variant. If a CNAME would share a name with another record type (forbidden by RFC 1034) the call fails with RECORD_CONFLICT and lists the blocking rows in conflictingRecords; delete those or pick another name.
Check warnings in the response and pass it on. Porkbun keeps a DNS zone for every domain in the account whether or not the domain is delegated to Porkbun's nameservers, so this write succeeds either way. If the domain points somewhere else, the response is still SUCCESS but carries a warnings string naming the nameservers that actually answer — the record exists and nothing resolves differently. Do not report plain success in that case: either make the change at the provider that runs those nameservers, or offer update_nameservers to point the domain at Porkbun.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ttl | No | Time-to-live in seconds. Minimum 60. Defaults to 600 if omitted. | |
| name | No | Subdomain prefix (no domain). Empty string or omitted = apex. Examples: `www`, `mail`, `api.staging`. | |
| prio | No | Priority — required for MX and SRV records, ignored otherwise. | |
| type | Yes | Record type. Common: A, AAAA, CNAME, MX, TXT. | |
| domain | Yes | Domain to add the record to, e.g. `example.com` | |
| content | Yes | Record value (e.g. an IP for A, a hostname for CNAME, the text body for TXT). | |
| dry_run | No | If true, validate only — returns wouldSucceed without creating the record. |