Domain check

Hello,
I wan’t to make an domain check tools in ruby on rails.
For example i enter test.com and click check will display if the domain
is available or not.
I think there is an API or something. Thanks