How to Use the DomainsDB API

If you need to query a large database of domain names, the DomainsDB API is a powerful tool that can provide you with all the information you need. Here's how you can use it in JavaScript:

Getting an API Key

The first thing you need to do is sign up for an API key. You can do that by visiting https://domainsdb.info/register. Once you've signed up, you'll receive an email with instructions on how to access your API key.

Making a Request

Once you have your API key, you can start making requests to the DomainsDB API. The simplest request you can make is to search for a domain by name. Here's an example using the Fetch API:

const apiKey = "yourapikey";
const domainName = "google.com";

fetch(`https://api.domainsdb.info/v1/domains/search?domain=${domainName}&zone=com`, {
  headers: {
    "X-Api-Key": apiKey,
  },
})
  .then((response) => response.json())
  .then((data) => console.log(data));

This will search for the domain google.com in the .com zone and log the results to the console.

Advanced Queries

The DomainsDB API allows for more advanced queries as well. For example, you can search for all domains that were registered on a specific date:

const apiKey = "yourapikey";
const registrationDate = "2021-04-27";

fetch(`https://api.domainsdb.info/v1/domains/search?registration_date=${registrationDate}`, {
  headers: {
    "X-Api-Key": apiKey,
  },
})
  .then((response) => response.json())
  .then((data) => console.log(data));

This will search the entire DomainsDB database for all domains that were registered on April 27th, 2021.

Conclusion

The DomainsDB API is a powerful tool that can provide you with a wealth of information about domain names. By following the examples above, you should be able to get started querying the API in no time.

Related APIs