Whois API provides domain names'/IP addresses' well-parsed and accurate registration details—also known as Whois Records—such as registrant names, emails, addresses, registrar info, creation/expiration dates etc. for most of the gTLDs and ccTLDs.
Here you'll find examples of querying the API implemented in multiple languages.
You'll need a WhoisXmlApi account to authenticate.
Please, refer to the Whois API documentation for info on input parameters, request/response formats, authentication instructions and more.