PHP Client for Cloudflare API
Client Reference

DNS

DNS endpoint reference.

Scan

Scan DNS Records.

Scan for common DNS records on your domain and automatically add them to your zone. Useful if you haven't updated your nameservers yet.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
php
$response = $client->dns()->scan('ZONE_ID');
View this operation on the Cloudflare API Reference

List

List, search, sort, and filter a zones' DNS records.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
paramsarrayNo[]Query Parameters
php
$response = $client->dns()->list('ZONE_ID', []);
View this operation on the Cloudflare API Reference

Create

Create a new DNS record for a zone.

Notes:

  • A/AAAA records cannot exist on the same name as CNAME records.
  • NS records cannot exist on the same name as any other record type.
  • Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
valuesarrayYesValues to set on DNS.
php
$response = $client->dns()->create('ZONE_ID', []);
View this operation on the Cloudflare API Reference

Export

Export BIND config.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
php
$response = $client->dns()->export('ZONE_ID');
View this operation on the Cloudflare API Reference

Import

Import BIND config.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
contentstringYesContent of BIND config to import.
proxiedboolNotrueShould DNS records be proxied.
php
$response = $client->dns()->import('ZONE_ID', 'CONTENT', true);
View this operation on the Cloudflare API Reference

Get

DNS Record Details

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
dnsRecordIdstringYesDNS ID to fetch details.
php
$response = $client->dns()->get('ZONE_ID', 'DNS_RECORD_ID');
View this operation on the Cloudflare API Reference

Edit

Apply changes to an existing DNS record, overwriting only the supplied properties.

Notes:

  • A/AAAA records cannot exist on the same name as CNAME records.
  • NS records cannot exist on the same name as any other record type.
  • Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
dnsRecordIdstringYesDNS ID to update.
valuesarrayYes
php
$response = $client->dns()->edit('ZONE_ID', 'DNS_RECORD_ID', []);
View this operation on the Cloudflare API Reference

Update

Update an existing DNS record, overwriting the full configuration.

Notes:

  • A/AAAA records cannot exist on the same name as CNAME records.
  • NS records cannot exist on the same name as any other record type.
  • Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
dnsRecordIdstringYesDNS ID to overwrite.
valuesarrayYes
php
$response = $client->dns()->update('ZONE_ID', 'DNS_RECORD_ID', []);
View this operation on the Cloudflare API Reference

Delete

Delete DNS Record

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
dnsRecordIdstringYesDNS ID to delete.
php
$response = $client->dns()->delete('ZONE_ID', 'DNS_RECORD_ID');
View this operation on the Cloudflare API Reference
Copyright © 2026