Prerequisites
- A Java 17+ project with
io.ip-api:ipapiadded - A free ip-api.io API key
Age of one domain with domainAge
Returns the registration date and the age in years and days.
IpApiClient client = IpApiClient.builder()
.apiKey(System.getenv("IP_API_IO_KEY"))
.build();
DomainAge age = client.domainAge("example.com");
System.out.println(age.isValid()); // true
System.out.println(age.registrationDate()); // "1995-08-14"
if (age.ageInDays() != null) {
System.out.println(age.ageInDays()); // 11000+
if (age.ageInDays() < 30) {
// treat brand-new domains as higher risk
}
} Many domains with domainAgeBatch
Check a list of domains in one request (throws if empty).
var batch = client.domainAgeBatch(
List.of("example.com", "brand-new-domain.xyz"));
batch.results().forEach((domain, age) -> {
if (age.ageInDays() != null) {
System.out.println(domain + " " + age.ageInDays());
}
});