Go SDK · Feature

Domain Age Checker in Go

Newly registered domains are a strong fraud and spam signal. DomainAge returns how long ago a domain was registered, derived from WHOIS data, so you can flag or block domains created days ago.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Catch throwaway domains early

Abuse rings register domains in bulk and burn them fast, so a domain's age is one of the cheapest, highest-signal fraud checks you can run. DomainAge turns a raw WHOIS record into a simple registration date and age in days, and DomainAgeBatch lets you screen a whole slice — sign-up email domains, referral links, or outbound targets — in a single request.

Prerequisites

1

Age of one domain with DomainAge

Returns the registration date and the age in years and days.

client := ipapi.NewClient(ipapi.WithAPIKey(os.Getenv("IP_API_IO_KEY")))
ctx := context.Background()

age, err := client.DomainAge(ctx, "example.com")
if err != nil {
	log.Fatal(err)
}

fmt.Println(age.IsValid)               // true
if age.RegistrationDate != nil {
	fmt.Println(*age.RegistrationDate) // "1995-08-14"
}
if age.AgeInDays != nil {
	fmt.Println(*age.AgeInDays)        // 11000+
	if *age.AgeInDays < 30 {
		// treat brand-new domains as higher risk
	}
}
2

Many domains with DomainAgeBatch

Check a slice of domains in one request (returns an error if empty).

batch, _ := client.DomainAgeBatch(ctx, []string{
	"example.com",
	"brand-new-domain.xyz",
})

for domain, age := range batch.Results {
	if age.AgeInDays != nil {
		fmt.Println(domain, *age.AgeInDays)
	}
}
Reference

Response reference

DomainAge (from DomainAge)

FieldTypeDescription
DomainstringThe domain checked
IsValidboolWhether age could be determined
RegistrationDate*stringFirst registration date
AgeInYears*intAge in whole years
AgeInDays*int64Age in days
Error*stringReason when IsValid is false

DomainAgeBatch(ctx, domains) returns a *BatchDomainAgeResponse — a Results map (map[string]DomainAge) of domain to age.

FAQ

Frequently asked questions

How do I check a domain's age in Go?

Call client.DomainAge(ctx, domain). It returns IsValid, the RegistrationDate, and the age as both AgeInYears and AgeInDays, derived from WHOIS data. Nullable fields are pointers.

Why is domain age a fraud signal?

Freshly registered domains are disproportionately used for phishing, spam, and throwaway accounts. Flagging domains created in the last few days — e.g. *age.AgeInDays < 30 — catches a lot of abuse before it reaches your users.

Can I check many domains at once?

Yes. client.DomainAgeBatch(ctx, domains) checks a slice of domains in one request and returns a Results map of domain to age. It returns an error if the slice is empty.

Start building with the ip-api.io Go SDK

Run go get github.com/ip-api-io/ipapi-go, drop in your free API key, and ship in minutes — one typed, context-aware client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ipapi-go module is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub