WWW::Namecheap::API - Perl interface to the Namecheap API


Perl interface to the Namecheap API. API details at:

Actual API calls happen in the other modules in the distribution, which can be accessed via convenience methods from an API object. Brief example:

    use WWW::Namecheap::API;

    my $api = WWW::Namecheap::API->new(
        System => 'test',
        ApiUser => 'wwwnamecheapapi',
        ApiKey => 'keyhere',
        DefaultIp => '',

    my $result = $api->domain->check(Domains => ['']);

    if ($result->{''}) {
            DomainName => '',
            Years => 1,
            Registrant => {
                OrganizationName => 'Foo Bar Inc.',
                FirstName => 'Joe',
                LastName => 'Manager',
                Address1 => '123 Fake Street',
                City => 'Univille',
                StateProvince => 'SD',
                PostalCode => '12345',
                Country => 'US',
                Phone => '+1.2125551212',
                EmailAddress => '',


There are a few parameters that can be included in any of the individual methods within the Namecheap API modules. These are listed below.


The client IP address for which this request is effective. If a DefaultIp was not provided when setting up the parent API object, this parameter is required, otherwise it is optional.


A sub-user (see WWW::Namecheap::User) under which the command should be performed. A DefaultUser may be specified at API object creation time; if one is not specified there, the default is to use the ApiUser unless a UserName is provided for the specific command being issued.



Instantiate a new API object. Example:

    my $api = WWW::Namecheap::API->new(
        System  => 'test', # or 'prod' for production, default test
        ApiUser => 'username',
        ApiKey  => 'apikey',
        DefaultIp   => '', # optional
        DefaultUser => 'otheruser', #optional, default ApiUser
        ApiUrl => '', # overrides URL chosen by System
        Agent  => 'My API Agent/1.0', # optional, overrides default UA

Only ApiUser and ApiKey are required, in which case System will default to 'test' and Agent defaults to 'WWW::Namecheap::API/$VERSION'. This API object will be passed to the constructors of the other classes in the distribution (or you can use its built-in convenience methods to get objects of those classes directly).


Send a request to the Namecheap API. Returns the XML response parsed into Perl form by XML::Simple. Intended for use by sub-classes, not outside calls. Parameters should be of the type and quantity required by the Namecheap API for the given Command. Example:

    my $xml = $api->request(
        Command => '',
        DomainList => ',',
        ClientIp => '', # required if no DefaultIp in $api


Helper method to create and return a WWW::Namecheap::Domain object utilizing this API object. Always returns the same object within a given session via internal caching.


Helper method to create and return a WWW::Namecheap::DNS object utilizing this API object. Always returns the same object within a given session via internal caching.


Returns the full XML response from the API if an error occurred during the request. Most likely key of interest is $xml->{Errors} and below.


Tim Wilde, <twilde at>


Please report any bugs or feature requests to bug-www-namecheap-api at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc WWW::Namecheap::API

You can also look for information at:



Copyright 2011 Tim Wilde.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.