Skip to main content

Top-Level Domains API

REAL DATA

The current IANA delegated TLD ASCII list — search all labels, filter punycode IDNs, or look up one TLD with an honest 404.

Authoritative reference data or standards computation

Base URL
/api/tlds
Capabilities
2 routes
Last updated
July 29, 2026
Data source

GET /api/tlds

With no filters, returns the complete pinned delegated list. Search matches the ASCII/punycode label and ignores an optional leading dot; zero matches return an empty list plus a warning.

Live requestRuns against the public API
No key required
GET/api/tlds?search=dk

Request parameters

Case-insensitive substring search against the ASCII/punycode label; an optional leading dot is ignored.

Keep only IDN A-labels (true) or non-IDN ASCII labels (false).

Advanced response options6 options

Limit the number of returned records (1–100). Defaults to all matches.

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Response format: json envelope, ndjson (one record per line) or csv.

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/tlds?search=dk"
const res = await fetch("https://randomapi.dev/api/tlds?search=dk");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/tlds?search=dk").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/tlds?search=dk"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 2
search string

Case-insensitive substring search against the ASCII/punycode label; an optional leading dot is ignored.

allowed: ≤ 64
example: search=museum
isIdn boolean

Keep only IDN A-labels (true) or non-IDN ASCII labels (false).

example: isIdn=true
Universal parameters Shared response and formatting options 6
count int

Limit the number of returned records (1–100). Defaults to all matches.

default: all matches
allowed: 1 – 100
example: count=3
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=tld,ascii
exclude list

Return all fields except these (comma-separated).

example: exclude=isIdn
format enum

Response format: json envelope, ndjson (one record per line) or csv.

default: json
allowed: json | ndjson | csv
example: format=csv
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 3
tld string

Canonical lower-case delegated ASCII label with a leading dot.

example: .com

ascii string

Canonical lower-case ASCII label without the leading dot; IDNs remain punycode A-labels.

example: com

isIdn boolean

True when the delegated ASCII label starts with the IDNA A-label prefix xn--.

example: false

Documented examples

Build-generated requests and complete responses
3
Find Denmark's TLD
GET /api/tlds?search=dk
{
  "data": [
    {
      "tld": ".dk",
      "ascii": "dk",
      "isIdn": false
    },
    {
      "tld": ".tdk",
      "ascii": "tdk",
      "isIdn": false
    },
    {
      "tld": ".vodka",
      "ascii": "vodka",
      "isIdn": false
    }
  ],
  "meta": {
    "endpoint": "tlds",
    "count": 3,
    "params": {
      "search": "dk"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
First punycode IDN labels
GET /api/tlds?isIdn=true&count=10
{
  "data": [
    {
      "tld": ".xn--11b4c3d",
      "ascii": "xn--11b4c3d",
      "isIdn": true
    },
    {
      "tld": ".xn--1ck2e1b",
      "ascii": "xn--1ck2e1b",
      "isIdn": true
    },
    {
      "tld": ".xn--1qqw23a",
      "ascii": "xn--1qqw23a",
      "isIdn": true
    },
    {
      "tld": ".xn--2scrj9c",
      "ascii": "xn--2scrj9c",
      "isIdn": true
    },
    {
      "tld": ".xn--30rr7y",
      "ascii": "xn--30rr7y",
      "isIdn": true
    },
    {
      "tld": ".xn--3bst00m",
      "ascii": "xn--3bst00m",
      "isIdn": true
    },
    {
      "tld": ".xn--3ds443g",
      "ascii": "xn--3ds443g",
      "isIdn": true
    },
    {
      "tld": ".xn--3e0b707e",
      "ascii": "xn--3e0b707e",
    …
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Search with the leading dot
GET /api/tlds?search=.museum
{
  "data": [
    {
      "tld": ".museum",
      "ascii": "museum",
      "isIdn": false
    }
  ],
  "meta": {
    "endpoint": "tlds",
    "count": 1,
    "params": {
      "search": ".museum"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

GET /api/tlds/lookup

Accepts one ASCII or punycode label, case-insensitively, with or without a leading dot. Unicode display labels are deliberately not accepted or guessed.

Live requestRuns against the public API
No key required
GET/api/tlds/lookup?tld=.com

Request parameters

Delegated ASCII/punycode TLD label, with or without a leading dot (for example .com, dk or xn--p1ai).

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/tlds/lookup?tld=.com"
const res = await fetch("https://randomapi.dev/api/tlds/lookup?tld=.com");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/tlds/lookup?tld=.com").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/tlds/lookup?tld=.com"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
tld string required

Delegated ASCII/punycode TLD label, with or without a leading dot (for example .com, dk or xn--p1ai).

allowed: 1 – 64
example: tld=.com
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=tld,ascii
exclude list

Return all fields except these (comma-separated).

example: exclude=isIdn
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 3
tld string

Canonical lower-case delegated ASCII label with a leading dot.

example: .com

ascii string

Canonical lower-case ASCII label without the leading dot; IDNs remain punycode A-labels.

example: com

isIdn boolean

True when the delegated ASCII label starts with the IDNA A-label prefix xn--.

example: false

Documented examples

Build-generated requests and complete responses
2
The COM top-level domain
GET /api/tlds/lookup?tld=.com
{
  "data": {
    "tld": ".com",
    "ascii": "com",
    "isIdn": false
  },
  "meta": {
    "endpoint": "tlds",
    "route": "/lookup",
    "params": {
      "tld": ".com"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Punycode IDN lookup
GET /api/tlds/lookup?tld=XN--P1AI&fields=tld,ascii,isIdn
{
  "data": {
    "tld": ".xn--p1ai",
    "ascii": "xn--p1ai",
    "isIdn": true
  },
  "meta": {
    "endpoint": "tlds",
    "route": "/lookup",
    "params": {
      "tld": ".xn--p1ai"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

About this API

Coverage & behavior

All 1437 delegated top-level-domain labels in IANA's tlds-alpha-by-domain.txt snapshot, version 2026062302. Results are canonical lower-case ASCII: .com, .dk, and IDN A-labels such as .xn--p1ai.

The scope is intentionally narrow and verifiable: this is the delegated-name list, not a domain availability service. It does not infer country-code versus generic type from label length, does not bundle manager metadata from another source, and does not invent Unicode display forms. The isIdn flag only reports IANA labels carrying the standards-defined xn-- A-label prefix; the authoritative punycode is preserved unchanged.

  • /api/tlds supports case-insensitive ASCII/punycode search and an isIdn filter (151 snapshot rows are IDN A-labels).
  • /api/tlds/lookup?tld=.com accepts a leading dot optionally and is case-insensitive. It echoes the canonical dotted form; a syntactically valid but undelegated label returns 404.

The data is bundled, so requests never depend on DNS or an upstream IANA fetch.

Use it for

  • Validate that a domain suffix appears in the current delegated root list
  • Populate a searchable TLD picker without shipping your own registry snapshot
  • Separate delegated punycode IDN labels from ordinary ASCII labels

Frequently asked questions

Does this list every delegated top-level domain?

Yes — it contains all 1437 ASCII labels in the pinned IANA delegated-TLD snapshot, including country-code, generic and punycode IDN labels. It does not claim that every listed domain accepts public registrations.

Can I look up a TLD with or without the dot?

Yes. .com, COM and com all resolve to the canonical .com record; an undelegated but well-formed label returns 404.

Does the API decode internationalized TLDs to Unicode?

No. It preserves IANA's authoritative xn-- A-label and exposes isIdn=true, avoiding an unverified or display-context-dependent Unicode conversion.

Standards & references