npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rdapapi

v0.5.0

Published

Official Node.js SDK for the RDAP API — look up domains, IPs, ASNs, nameservers, and entities via RDAP.

Downloads

49

Readme

RDAP API Node.js SDK

npm version Node.js License: MIT

Official Node.js SDK for the RDAP API — look up domains, IP addresses, ASNs, nameservers, and entities via the RDAP protocol.

Installation

npm install rdapapi

Quick start

import { RdapClient } from "rdapapi";

const client = new RdapClient("your-api-key");

// Domain lookup
const domain = await client.domain("google.com");
console.log(domain.registrar.name); // "MarkMonitor Inc."
console.log(domain.dates.expires); // "2028-09-14T04:00:00Z"
console.log(domain.nameservers); // ["ns1.google.com", ...]

// IP address lookup
const ip = await client.ip("8.8.8.8");
console.log(ip.name); // "GOGL"
console.log(ip.cidr); // ["8.8.8.0/24"]

// ASN lookup
const asn = await client.asn(15169);
console.log(asn.name); // "GOOGLE"

// Nameserver lookup
const ns = await client.nameserver("ns1.google.com");
console.log(ns.ipAddresses.v4); // ["216.239.32.10"]

// Entity lookup
const entity = await client.entity("GOGL");
console.log(entity.name); // "Google LLC"
console.log(entity.autnums[0].handle); // "AS15169"

client.close();

Bulk domain lookups

Look up multiple domains in a single request (Pro and Business plans). Up to 10 domains per call, with concurrent upstream fetches:

const result = await client.bulkDomains(["google.com", "github.com", "invalid..com"], {
  follow: true,
});

console.log(result.summary); // { total: 3, successful: 2, failed: 1 }

for (const r of result.results) {
  if (r.status === "success" && r.data) {
    console.log(`${r.data.domain}: ${r.data.registrar.name}`);
  } else {
    console.log(`${r.domain}: ${r.error}`);
  }
}

Each domain counts as one request toward your monthly quota. Starter plans receive a SubscriptionRequiredError (403).

Registrar follow-through

For thin registries like .com and .net, the registry only returns basic registrar info. Use follow: true to follow the registrar's RDAP link and get richer contact data:

const domain = await client.domain("google.com", { follow: true });
console.log(domain.entities.registrant?.organization); // "Google LLC"
console.log(domain.entities.registrant?.email); // "[email protected]"

Error handling

import {
  RdapClient,
  NotFoundError,
  NotSupportedError,
  RateLimitError,
  AuthenticationError,
} from "rdapapi";

const client = new RdapClient("your-api-key");

try {
  const domain = await client.domain("example.nope");
} catch (err) {
  // Check NotSupportedError before NotFoundError: it's a subclass.
  if (err instanceof NotSupportedError) {
    console.log("The TLD is not covered by RDAP");
  } else if (err instanceof NotFoundError) {
    console.log("The domain is not registered");
  } else if (err instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${err.retryAfter}s`);
  } else if (err instanceof AuthenticationError) {
    console.log("Invalid API key");
  }
}

NotSupportedError extends NotFoundError, so catching NotFoundError still handles both cases. All exceptions inherit from RdapApiError and include statusCode, error, and message properties.

| Exception | HTTP Status | When | | ----------------------------- | ----------- | ----------------------------------------------------------- | | ValidationError | 400 | Invalid input format | | AuthenticationError | 401 | Missing or invalid API key | | SubscriptionRequiredError | 403 | No active subscription | | NotFoundError | 404 | Namespace is covered but no record exists | | NotSupportedError | 404 | Namespace (TLD, IP range, ASN range) is not covered by RDAP | | RateLimitError | 429 | Rate limit or quota exceeded | | UpstreamError | 502 | Upstream RDAP server error | | TemporarilyUnavailableError | 503 | Domain data temporarily unavailable |

Supported TLDs catalog

List every TLD the API can resolve, with the date support was added and a qualitative summary of which fields the registry's RDAP server populates. Does not count against your monthly quota.

const tlds = await client.tlds();
if (tlds !== null) {
  console.log(`${tlds.meta.count} TLDs, coverage ${(tlds.meta.coverage * 100).toFixed(0)}%`);

  for (const tld of tlds.data) {
    const availability = tld.fieldAvailability;
    if (availability !== null) {
      console.log(`${tld.tld}: expires_at=${availability.expiresAt}`);
    }
  }
}

Filter to recent additions or to a single registry:

const recent = await client.tlds({ since: "2026-04-01T00:00:00Z" });
const verisign = await client.tlds({ server: "rdap.verisign.com" });

Pass back the previous etag to skip the transfer when nothing has changed:

const first = await client.tlds();
const later = await client.tlds({ ifNoneMatch: first?.etag ?? undefined });
if (later === null) {
  console.log("No change since last poll");
}

Look up a single TLD:

const com = await client.tld("com");
console.log(com?.data.rdapServerHost); // "rdap.verisign.com"

Configuration

const client = new RdapClient("your-api-key", {
  baseUrl: "https://rdapapi.io/api/v1", // default
  timeout: 30_000, // milliseconds, default
});

TypeScript

The SDK is written in TypeScript with full type definitions. All response types are exported:

import type { DomainResponse, IpResponse, AsnResponse } from "rdapapi";

Requirements

Links

Development

Set up pre-commit hooks (runs lint + tests before each commit):

git config core.hooksPath .githooks

License

MIT