Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Cpanel/WHM API Getting Started Help PHP

Discussion in 'cPanel Developers' started by MikeMartinOSM, Apr 8, 2016.

  1. MikeMartinOSM

    MikeMartinOSM Registered

    Apr 8, 2016
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello! I'm looking to integrate some cpanel features in our in house CMS, specifically managing email forwarders and http redirects. Ideal usage to be within our own CMS (real time api)...idea is so our clients don't have to fuss with going into cpanel and recalling their login info just to do a email forwarder or something.

    I've been digging around in the documentation and I'm beyond confused on how to get started. It would appear I need the UAPI based on the functionality but I'm not sure how to use it and go about getting authenticated...and actually I'm starting to doubt if I even know what the UAPI is intended for? Maybe I need a different API?

    Could someone please give me some real world PHP examples on how to do this? I think I would need the "User and Password" option on that "Guide to API Authentication" but there appears to be no examples on how to authenticate that way AND use an API call? On each "Guide to ... API" it just specifically mentions only providing a security token but doesn't say how to generate one? Also with the "user and password" method, the example only shows for root access...what about calling some api functionality as a cpanel user?

    For example, if I had valid cpanel user and password, how would I go about say simply running the list email pop accounts function?

    Hopefully someone can help, as I've been spinning my wheels on this for hours!

    Many thanks!
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    UAPI is the way to go for this type of script. The following thread offers some examples for PHP that you may find helpful:

    How to make new email accounts for cPanel user, from PHP script

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice