WhoisXmlApi.com has been gathering domain Whois records for almost all gTLDs and ccTLDs for over a decade. This data is unified, consistent, well parsed, and accurate and provided through real-time APIs.
Here you'll find examples of using Hosted Whois Web API 2.0 implemented in multiple languages.
Please, refer to Whois API 2.0 docs for authentication instructions.