pydo.domains.list_records()

Generated on 9 Jun 2026 from pydo version v0.36.0

Usage

client.domains.list_records(
    domain_name="example.com",
    name=None,
    type=None,
    per_page=20,
    page=1,
)
Returns JSONRaises HttpResponseError

Description

To get a listing of all records configured for a domain, send a GET request to /v2/domains/{domain_name}/records. The list of records returned can be filtered by using the name and type query parameters. For example, to only include A records for a domain, send a GET request to /v2/domains/$DOMAIN_NAME/records?type=A. name must be a fully qualified record name. For example, to only include records matching sub.example.com, send a GET request to /v2/domains/$DOMAIN_NAME/records?name=sub.example.com. Both name and type may be used together.

Parameters

domain_name string required

The name of the domain itself.

name string optional

A fully qualified record name. For example, to only include records matching sub.example.com, send a GET request to /v2/domains/$DOMAIN_NAME/records?name=sub.example.com.

type string optional

The type of the DNS record. For example: A, CNAME, TXT, ...

One of: A, AAAA, CAA, CNAME, MX, NS, SOA, SRV, TXT

per_page integer optional

Number of items returned per page

Min: 1

Max: 200

Default: 20

page integer optional

Which 'page' of paginated results to return.

Min: 1

Default: 1

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.domains.list_records(domain_name="example.com")

Pagination

This method returns paginated results. The response includes a links.pages object with URLs for navigating between pages. To retrieve the next page, parse the next URL and pass the page parameter:

from urllib.parse import urlparse, parse_qs

resp = client.domains.list_records(domain_name="example.com", )
pages = resp.get("links", {}).get("pages", {})

while "next" in pages:
    parsed = urlparse(pages["next"])
    page = int(parse_qs(parsed.query)["page"][0])
    resp = client.domains.list_records(domain_name="example.com", page=page)
    pages = resp.get("links", {}).get("pages", {})

Response Example

Show Response Example
{
  "domain_records": [
    {
      "id": 28448429,
      "type": "NS",
      "name": "@",
      "data": "ns1.digitalocean.com",
      "priority": null,
      "port": null,
      "ttl": 1800,
      "weight": null,
      "flags": null,
      "tag": null
    },
    {
      "id": 28448430,
      "type": "NS",
      "name": "@",
      "data": "ns2.digitalocean.com",
      "priority": null,
      "port": null,
      "ttl": 1800,
      "weight": null,
      "flags": null,
      "tag": null
    },
    {
      "id": 28448431,
      "type": "NS",
      "name": "@",
      "data": "ns3.digitalocean.com",
      "priority": null,
      "port": null,
      "ttl": 1800,
      "weight": null,
      "flags": null,
      "tag": null
    },
    {
      "id": 28448432,
      "type": "A",
      "name": "@",
      "data": "1.2.3.4",
      "priority": null,
      "port": null,
      "ttl": 1800,
      "weight": null,
      "flags": null,
      "tag": null
    }
  ],
  "links": {},
  "meta": {
    "total": 4
  }
}

More Information

See /v2/domains/{domain_name}/records in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.