Skip to main content

ICANN Centralized Zone Data Service API

The ICANN Centralized Zone Data Service (CZDS) allows approved users to request and download DNS zone files in bulk, provided they represent a legitimate company or academic institution and their intended use is legal and ethical. Once ICANN approves the request, this tool streamlines the retrieval of extensive domain name system data, facilitating research and security analysis in the realm of internet infrastructure.

Features

  • Asynchronous downloads with configurable concurrency
  • Support for both CSV and JSON report formats
  • Automatic gzip decompression of zone files (optional)
  • Skips zones that have not changed since the last download
  • Automatic re-authentication when the access token expires
  • Zone access requests, extensions & cancellations
  • Environment variable support for credentials
  • Comprehensive error handling and logging

Zone Information

Zone files are updated once every 24 hours, specifically from 00:00 UTC to 06:00 UTC. Access to these zones is granted in increments, and the total time for approval across all zones may extend to a month or longer. It is typical for more than 90% of requested zones to receive approval. Access to certain zone files may require additional application forms with the TLD organization. Please be aware that access to certain zones is time-bound, expiring at the beginning of the following year, or up to a decade after the initial approval has been confirmed.

At the time of writing this repository, the CZDS offers access to 1,150 zones in total.

1,066 have been approved, 51 are still pending, 12 have been revoked because the TLDs are no longer active, and 6 have been denied. Zones that have expired automatically had the expiration extended for me without doing anything, aside from 15 zones that remained expired. I have included a recent stats file directly from my ICANN account.

Installation

pip install czds-api

Usage

Command Line Interface

czds [-h] [-u USERNAME] [-p PASSWORD] [-o OUTPUT] [--zones] [-z TLD [TLD ...]] [-c CONCURRENCY] [--no-decompress] [--force] [-r] [-s] [-f {csv,json}] [--request TLD [TLD ...]] [--reason REASON] [--extend TLD [TLD ...]] [--cancel TLD [TLD ...]]

Arguments

Basic Options
Argument Description Default
-h, --help Show help message and exit
-u, --username ICANN Username $CZDS_USER
-p, --password ICANN Password $CZDS_PASS
-o, --output Output directory Current directory
Zone Options
Argument Description Default
--zones Download all zone files
-z, --zone Download specific zone files by TLD
-c, --concurrency Number of concurrent downloads 3
--no-decompress Keep the zone files gzip compressed
--force Download zone files even if the local copy is current

Zone files are saved to <output>/zones/. Each file is stamped with the zone's Last-Modified time, and zones that have not changed since the last run are skipped.

Report Options
Argument Description Default
-r, --report Download the zone stats report
-s, --scrub Scrub username from the report
-f, --format Report output format (csv/json) csv

The report is saved to <output>/report.<format>.

Zone Request Options
Argument Description
--request Request access to zones (all for every requestable zone)
--reason Reason for the zone request (required with --request)
--extend Request an extension for approved zones (all for every zone expiring within 120 days)
--cancel Cancel pending zone requests

Extensions and cancellations only go through when CZDS marks the request as extensible or cancellable (a freshly submitted request cannot be cancelled until it is pending).

Environment Variables

export CZDS_USER='your_username'
export CZDS_PASS='your_password'

Python Module

import asyncio
import os

from czds import CZDS


async def main():
	async with CZDS(os.environ['CZDS_USER'], os.environ['CZDS_PASS']) as client:
		# Download zone stats report
		await client.get_report('report.json', scrub=True, format='json')

		# Download zone files (returns the TLDs that failed)
		failed = await client.download_zones('zones', concurrency=3)

		# Request extensions for every zone expiring soon
		await client.extend_all()


asyncio.run(main())

Respects & extras

While ICANN does have an official czds-api-client-python repository, I rewrote it from scratch to be more streamline & included a POSIX version for portability. There is some official documentation that was referenced in the creation of the POSIX version. Either way, big props to ICANN for allowing me to use the CZDS for research purposes!


Mirrors for this repository: acid.vegas • SuperNETs • GitHub • GitLab • Codeberg

Mirrors: SuperNETs • GitHub • GitLab • Codeberg

Metadata

Release files for czds-api 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for czds-api 1.4.0
File Size Uploaded Provenance Actions
czds_api-1.4.0.tar.gz 14.6 kB Without provenance Details for czds_api-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for czds-api 1.4.0
File Interpreter ABI Platform Actions
czds_api-1.4.0-py3-none-any.whl Python 3 none any Details for czds_api-1.4.0-py3-none-any.whl

Total release size: 28.3 kB

Release files / czds_api-1.4.0.tar.gz

Download URL czds_api-1.4.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9c35f402ebe8b0927df8e08ece5553c0f9e88c4dc69255643dbe263e64960da8
BLAKE2b-256 checksum
How to use checksums
6f5a8ffa03ec08a8840a9dc2bb4e097abeb0f8679332a23a03acaa15867d430c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / czds_api-1.4.0-py3-none-any.whl

Download URL czds_api-1.4.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
861332257e6bd3df5574042877ad0166419b6b683e84161c1052f30165c49f48
BLAKE2b-256 checksum
How to use checksums
ae2e658fdcb2c9383e1ec3e227e060b51107e537cd18333f8e207315858f8aa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for czds-api 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page