Manage2 Authentication Methods


Last modified: March 9, 2021

Overview

The Manage2 API supports HTTP or key-based authentication. Manage2’s client libraries use basic authentication over SSL by default. This method encodes the Manage2 username and password inside the HTTP request headers.

Authentication methods

The Manage2 API supports the following authentication methods:

Basic authentication

Basic authentication encodes the Manage2 username and password inside the HTTP request headers. You can authenticate with the following methods:

HTTP

When you call a Manage2 API script in a web browser, a dialog box will appear below the URL:

The Manage2 Sign in dialog box.

Enter the Manage2 username and password in the appropriate text boxes.

cURL

Use the curl -u command to authenticate user accounts when you call the function via the command line. For example:

curl -u username@example.com:123456luggage https://manage2.cpanel.net/XMLgroupInfo.cgi

Perl

Use the cPanelLicensing Perl module to authenticate to the user account. For example:

1
2
3
use cPanelLicensing;
my $cpl = cPanelLicensing->new(user => "username\@example.com", pass => "123456luggage");
$cpl->fetchGroups();

PHP

Use the require PHP class with the cPanelLicensing PHP Class to authenticate to the user account. For example:

1
2
3
require "cpl.inc.php";
$cpl = new cPanelLicensing("username\@example.com", "123456luggage");
$cpl->fetchGroups();

Key-based authentication

Key-based authentication grants access to a limited subset of the account’s abilities without the account’s username and password. For security, the system limits keys to one IP address. You must register keys on the computer that runs the scripts.

Register a key

To register a key, perform the following steps:

  1. Use the Manage2 API Add a Pickup Phrase function to add a pickup passphrase.
  2. Call the Manage2 API Register Key-Based Authentication function. This function returns a 20 character key to use for subsequent API calls.

On subsequent API calls, pass this key as the apikey parameter’s value. For example:

curl 'https://manage2.cpanel.net/XMLlicenseInfo.cgi?output=json&apikey=aFj1fKnYzW5lbD5KXFeVtLsM'
Note:

If you use key-based authentication, the Manage2 API provides a Cross-Origin Resource Sharing (CORS) header.

Additional Documentation