Skip to content
Start here

List DNS Records

dns.records.list(RecordListParams**kwargs) -> SyncV4PagePaginationArray[RecordResponse]
GET/zones/{zone_id}/dns_records

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

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
DNS ReadDNS Write
ParametersExpand Collapse
zone_id: str

Identifier.

maxLength32
comment: Optional[Comment]
absent: Optional[str]

If this parameter is present, only records without a comment are returned.

contains: Optional[str]

Substring of the DNS record comment. Comment filters are case-insensitive.

endswith: Optional[str]

Suffix of the DNS record comment. Comment filters are case-insensitive.

exact: Optional[str]

Exact value of the DNS record comment. Comment filters are case-insensitive.

present: Optional[str]

If this parameter is present, only records with a comment are returned.

startswith: Optional[str]

Prefix of the DNS record comment. Comment filters are case-insensitive.

content: Optional[Content]
contains: Optional[str]

Substring of the DNS record content. Content filters are case-insensitive.

endswith: Optional[str]

Suffix of the DNS record content. Content filters are case-insensitive.

exact: Optional[str]

Exact value of the DNS record content. Content filters are case-insensitive.

startswith: Optional[str]

Prefix of the DNS record content. Content filters are case-insensitive.

direction: Optional[SortDirection]

Direction to order DNS records in.

One of the following:
"asc"
"desc"
match: Optional[Literal["any", "all"]]

Whether to match all search requirements or at least one (any). If set to all, acts like a logical AND between filters. If set to any, acts like a logical OR instead. Note that the interaction between tag filters is controlled by the tag-match parameter instead.

One of the following:
"any"
"all"
name: Optional[Name]
contains: Optional[str]

Substring of the DNS record name. Name filters are case-insensitive.

endswith: Optional[str]

Suffix of the DNS record name. Name filters are case-insensitive.

exact: Optional[str]

Exact value of the DNS record name. Name filters are case-insensitive.

startswith: Optional[str]

Prefix of the DNS record name. Name filters are case-insensitive.

order: Optional[Literal["type", "name", "content", 2 more]]

Field to order DNS records by.

One of the following:
"type"
"name"
"content"
"ttl"
"proxied"
page: Optional[float]

Page number of paginated results.

minimum1
per_page: Optional[float]

Number of DNS records per page.

maximum5000000
minimum1
proxied: Optional[bool]

Whether the record is receiving the performance and security benefits of Cloudflare.

tag: Optional[Tag]
absent: Optional[str]

Name of a tag which must not be present on the DNS record. Tag filters are case-insensitive.

contains: Optional[str]

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value contains <tag-value>. Tag filters are case-insensitive.

endswith: Optional[str]

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value ends with <tag-value>. Tag filters are case-insensitive.

exact: Optional[str]

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value is <tag-value>. Tag filters are case-insensitive.

present: Optional[str]

Name of a tag which must be present on the DNS record. Tag filters are case-insensitive.

startswith: Optional[str]

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value starts with <tag-value>. Tag filters are case-insensitive.

tag_match: Optional[Literal["any", "all"]]

Whether to match all tag search requirements or at least one (any). If set to all, acts like a logical AND between tag filters. If set to any, acts like a logical OR instead. Note that the regular match parameter is still used to combine the resulting condition with other filters that aren't related to tags.

One of the following:
"any"
"all"
type: Optional[Literal["A", "AAAA", "CAA", 18 more]]

Record type.

One of the following:
"A"
"AAAA"
"CAA"
"CERT"
"CNAME"
"DNSKEY"
"DS"
"HTTPS"
"LOC"
"MX"
"NAPTR"
"NS"
"OPENPGPKEY"
"PTR"
"SMIMEA"
"SRV"
"SSHFP"
"SVCB"
"TLSA"
"TXT"
"URI"
ReturnsExpand Collapse
One of the following:
class A:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class AAAA:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class CNAME:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class MX:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class NS:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class Openpgpkey:
id: str

Identifier.

maxLength32
comment: str

Comments or notes about the DNS record. This field has no effect on DNS responses.

content: str

A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1)

created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
name: str

Complete DNS record name, including the zone name, in Punycode.

maxLength255
minLength1
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

proxied: bool

Whether the record is receiving the performance and security benefits of Cloudflare.

settings: OpenpgpkeySettings

Settings for the DNS record.

ipv4_only: Optional[bool]

When enabled, only A records will be generated, and AAAA records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

ipv6_only: Optional[bool]

When enabled, only AAAA records will be generated, and A records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

tags: List[RecordTags]

Custom tags for the DNS record. This field has no effect on DNS responses.

ttl: TTL

Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones.

One of the following:
float
Literal[1]

Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones.

type: Literal["OPENPGPKEY"]

Record type.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class PTR:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class TXT:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class CAA:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class CERT:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class DNSKEY:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class DS:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class HTTPS:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class LOC:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class NAPTR:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class SMIMEA:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class SRV:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class SSHFP:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class SVCB:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class TLSA:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
class URI:
id: str

Identifier.

maxLength32
created_on: datetime

When the record was created.

formatdate-time
meta: object

Extra Cloudflare-specific information about the record.

modified_on: datetime

When the record was last modified.

formatdate-time
proxiable: bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Optional[datetime]

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
tags_modified_on: Optional[datetime]

When the record tags were last modified. Omitted if there are no tags.

formatdate-time

List DNS Records

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.dns.records.list(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "name": "example.com",
      "ttl": 3600,
      "type": "A",
      "comment": "Domain verification record",
      "content": "198.51.100.4",
      "private_routing": true,
      "proxied": true,
      "settings": {
        "ipv4_only": true,
        "ipv6_only": true
      },
      "tags": [
        "owner:dns-team"
      ],
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "created_on": "2014-01-01T05:20:00.12345Z",
      "meta": {},
      "modified_on": "2014-01-01T05:20:00.12345Z",
      "proxiable": true,
      "comment_modified_on": "2024-01-01T05:20:00.12345Z",
      "tags_modified_on": "2025-01-01T05:20:00.12345Z"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "name": "example.com",
      "ttl": 3600,
      "type": "A",
      "comment": "Domain verification record",
      "content": "198.51.100.4",
      "private_routing": true,
      "proxied": true,
      "settings": {
        "ipv4_only": true,
        "ipv6_only": true
      },
      "tags": [
        "owner:dns-team"
      ],
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "created_on": "2014-01-01T05:20:00.12345Z",
      "meta": {},
      "modified_on": "2014-01-01T05:20:00.12345Z",
      "proxiable": true,
      "comment_modified_on": "2024-01-01T05:20:00.12345Z",
      "tags_modified_on": "2025-01-01T05:20:00.12345Z"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}