Skip to content

Pdns

API Methods

Method Action Description
add_dns add DNS record Adds a new DNS record to the specified zone.
add_domain add domain Adds a new domain to the DNS system for the specified client.
delete_dns delete DNS record Deletes the specified DNS record.
delete_domain delete domain Deletes the domain and all associated records.
get_cb_url get callback URL Returns the URL for callback notifications.
list_domains get domain list Returns the list of client domains.
list_zones get zone list Returns the list of DNS zones.
view_zone view zone Returns details of the specified DNS zone.

pdns/add_dns

Adds a new DNS record to the specified zone.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: add_dns
token string Authorization token
params[zone] string Zone name (domain) to which the record is added
params[name] string Host name for the record (e.g., www or @)
params[type] string Record type (A, AAAA, CNAME, MX, TXT, SRV, SOA, DKIM, SPF, NS)
params[content] array<mixed> Record content. For A, AAAA, NS, MX types — array of strings. For all other types — string.
params[ttl] int Record time-to-live in seconds (default 3600)
params[priority] int Priority for MX and SRV records
params[weight] int Weight for SRV records
params[port] int Port for SRV records
params[proto] string Protocol for SRV records (tcp, udp)
params[target] string Target domain for SRV records
params[mname] string Primary server for SOA records
params[rname] string Administrator email for SOA records
params[serial] int Serial number for SOA records
params[refresh] int Refresh interval for SOA records
params[retry] int Retry interval for SOA records
params[expire] int Expiration time for SOA records
params[minimum] int Minimum TTL for SOA records
params[increase_soa_serial] int Increment SOA serial number (1 or 0)
params[changetype] string Change type: create or update
params[pdns_loc] string PowerDNS server location
params[update] string Value for updating an MX record

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=add_dns" \
--data "token=HOSTKEY_TOKEN" \
--data "params[zone]=example.com" \
--data "params[name]=www" \
--data "params[type]=A" \
--data "params[content][]=192.168.1.1" \
--data "params[content][]=192.168.1.2"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "add_dns",
"data": {
  "rrsets": [
    {
      "name": "www.example.com.",
      "type": "A",
      "ttl": 3600,
      "changetype": "REPLACE",
      "records": [
        {
          "content": "192.168.1.1",
          "disabled": false
        }
      ]
    }
  ]
}
}
Failure response
{
"code": -1,
"message": "invalid argument zone 'example.com'",
"description": "Invalid zone format or zone not allowed"
}

pdns/add_domain

Adds a new domain to the DNS system for the specified client.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: add_domain
token string Authorization token for access verification
params[name] string Domain name (FQDN) to add
params[pdns_loc] string PDNS server location (pdns_loc)
params[server_id] int ID of the server where the domain will be hosted
params[nameservers] array<string> List of nameserver (NS) names for the domain
params[dns][mname] string Name of the server that created the zone (SOA MNAME)
params[dns][rname] string Zone administrator email (SOA RNAME)
params[dns][serial] int Initial zone serial number (SOA SERIAL)
params[dns][refresh] int Zone refresh interval in seconds (SOA REFRESH)
params[dns][retry] int Retry interval on error (SOA RETRY)
params[dns][expire] int Zone expiration time in seconds (SOA EXPIRE)
params[dns][minimum] int Minimum TTL for negative responses (SOA MINIMUM)
params[dns][ttl] int Default TTL value for records

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=add_domain" \
--data "token=HOSTKEY_TOKEN" \
--data "params[name]=example.com" \
--data "params[nameservers]=ns1.example.com" \
--data "params[nameservers]=ns2.example.com" \
--data "params[dns][mname]=ns1.example.com" \
--data "params[dns][rname]=admin.example.com" \
--data "params[dns][serial]=2023102701" \
--data "params[dns][refresh]=7200" \
--data "params[dns][retry]=3600" \
--data "params[dns][expire]=1209600" \
--data "params[dns][minimum]=3600" \
--data "params[dns][ttl]=3600"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "add_domain",
"data": {
  "id": 1024
}
}
Failure response
{
"code": -1,
"message": "invalid argument DNS zone name"
}

pdns/delete_dns

Deletes the specified DNS record.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_dns
token string Authorization token
params[zone] string Zone domain (FQDN)
params[name] string Record name (relative or @)
params[type] string Record type (A, AA4, CNAME, MX, TXT, etc.)
params[priority] int Priority (required only for MX type)
params[records][0][content] string Record content (required only for MX type)
params[pdns_loc] string PowerDNS server location

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=delete_dns" \
--data "token=HOSTKEY_TOKEN" \
--data "params[zone]=example.com" \
--data "params[name]=www" \
--data "params[type]=A"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "delete_dns",
"data": {
  "status": "success",
  "message": "Record deleted"
}
}
Failure response
{
"code": -1,
"message": "invalid argument zone 'example.com'",
"description": "Invalid zone format"
}

pdns/delete_domain

Deletes the domain and all associated records.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: delete_domain
token string Authorization token
params[id] int ID of the domain to delete
params[zone] string Domain zone name (FQDN)
params[customer_id] int Client ID (required for staff, optional for clients)
params[pdns_loc] string PDNS server location

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=delete_domain" \
--data "token=HOSTKEY_TOKEN" \
--data "params[id]=VALUE" \
--data "params[zone]=VALUE"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "delete_domain",
"data": {
  "id": 67890
}
}
Failure response
{
"code": -1,
"message": "invalid argument DNS zone id",
"description": "Invalid domain ID (less than 1)"
}

pdns/get_cb_url

Returns the URL for callback notifications.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: get_cb_url
token string Authorization token

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=get_cb_url" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "get_cb_url",
"data": {
  "cb_url": "https://api.example.com/callback/pdns"
}
}
Failure response
{
"code": -1,
"message": "Action required"
}

pdns/list_domains

Returns the list of client domains.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: list_domains
token string Authorization token

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=list_domains" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "list_domains",
"data": [
  {
    "id": 1,
    "name": "example.com"
  },
  {
    "id": 2,
    "name": "test.org"
  }
]
}
Failure response
{
"code": -1,
"message": "Action required"
}

pdns/list_zones

Returns the list of DNS zones.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: list_zones
token string Authorization token
params[customer_id] int Filter by client ID (optional, used in controller for other actions, but passed in params)
params[pdns_loc] string PDNS server location

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=list_zones" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "list_zones",
"data": [
  {
    "id": 101,
    "name": "example.com",
    "type": "MASTER",
    "notified_serial": 2024011501
  }
]
}
Failure response
{
"code": -1,
"message": "Action required",
"description": "Missing action parameter"
}

pdns/view_zone

Returns details of the specified DNS zone.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: view_zone
token string Authorization token
params[zone] string DNS zone name (domain name)
params[pdns_loc] string PDNS server location (optional)

Example Request

curl -s "https://api.hostkey.com/pdns.php" -X POST \
--data "action=view_zone" \
--data "token=HOSTKEY_TOKEN" \
--data "params[zone]=example.com"
Example of a successful response
{
"result": "OK",
"module": "pdns",
"action": "view_zone",
"data": {
  "id": 101,
  "name": "example.com",
  "type": "MASTER",
  "records": [
    {
      "id": 1,
      "name": "@",
      "type": "A",
      "content": "192.168.1.1",
      "ttl": 3600
    },
    {
      "id": 2,
      "name": "www",
      "type": "CNAME",
      "content": "@",
      "ttl": 3600
    }
  ]
}
}
Failure response
{
"code": -1,
"message": "invalid argument zone 'example.com'",
"description": "Invalid zone argument (invalid FQDN or not allowed)"
}

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×