API Shell for cPanel

Valid for versions 82 through the latest version

Version:

82


Last modified: July 6, 2022

Overview

This interface allows you to run cPanel API functions interactively.

Important:
  • This interface is only available to reseller accounts.
  • Only cPanel API 2 and UAPI functions are available in the API Shell interface.
Warning:

This feature uses live data from your server. API function calls may change or delete data on your server, which can cause your server to fail.

  • Read the documentation for a function thoroughly before you use it in the API Shell interface.
  • To see an example of the function’s output, read the function’s Response samples section in our cPanel Developer Documentation.

Enable the API Shell interface

To use this feature, your hosting provider must enable it for you. Ask them to perform the following steps in WHM:

  1. Select On for the cPanel & WHM API shell (for developers) setting in the System tab of WHM’s Tweak Settings interface (WHM » Home » Server Configuration » Tweak Settings).
  2. Grant the API Shell feature to your account’s feature list in WHM’s Feature Manager interface (WHM » Home » Packages » Feature Manager).

Call an API function

To call an API function, perform the following steps:

  1. Select either the UAPI (API 3) or API 2 option in the cPanel API version section.
  2. Select the API function from the selected API version’s menu.
  3. In the Variables section, enter the API function’s keys and values in the text boxes. If the API function has any required key and value pairs, you must enter them.
    • To add a new variable entry, click Add.
    • To remove a variable entry, click the X icon.
  4. To filter, sort, or paginate the results, click Show Sort/Filter/Paginate Options:
    • To select the first record to show from the results, enter a number in the Index of first results to show, zero-based text box or use the menu to select a number.
      • A 0 value displays unlimited results.
    • To limit the number of results to display, enter a number in the Maximum # of results to show text box or use the menu to select a number.
      • A 0 value displays unlimited results.
    • To filter the results, click Add in the Filters section of the interface. You can specify the field to use to filter the results, the conditions (Contains, Begins With, Equals, Greater Than (numeric), or Less Than (numeric)), and the term to apply to the conditions.
      • To add a new filter, click Add.
      • To remove a filter, click the X icon.
    • To sort the results, click Add in the Sorts section of the interface. You can specify a field by which you wish to sort the results, the conditions (lexicographic, numeric, numeric_zero_as_max, or ipv4), and whether to reverse the sort order.
      • To add a new sort method, click Add.
      • To remove a sort order, click the X icon.
    • To limit the columns to display, click Add in the Columns section of the interface. Then, enter the column number in the Column text box.
      • To add more columns to display, click Add.
      • To remove a column, click the X icon.
  5. Click Submit.

As you modify the API function’s values, the interface updates the URL and API call data structure sections’ entries.

API call response

After you click Submit, the API function’s returns appear in the API call response section of the interface. You can view the results in the Tree view, Table view, and Raw view tabs.

Note:
  • The Raw view tab separates the API call’s response from the HTTP headers.
  • The Table view may be unavailable for certain function data.

Additional Documentation