External Authentication - Automatically Creating Accounts


Dec 3, 2019
cPanel Access Level
DataCenter Provider
Hello, all!

This is my first post and I hope this is the correct place to put it. I'm hoping by posing this question, someone, somewhere has done it and may be able to point me in the right direction.

I work for a University and we set up our cPanel instance with ADFS. We have the authentication working and I know with the API, I can link the external account with the account locally created. I was reading the documentation that is located here about automatically creating the account with the API. I believe what I want to do is possible, but I want the experts opinion.

I have an AD group that connects to allow authentication to our cPanel instance, through ADFS. I don't want to have to manually create accounts and then manually link them once someone logs in. With the above referenced documentation, I know I can create it automatically, but I want it to create it automatically when the student or faculty log into the system. So, for instance, if I am a student AND in that AD group, I hit our cPanel login interface and I type in my credentials that authenticate with AD, and if my account doesn't yet exist, I want it to create automatically. However, if they are not in the group, it should NOT create an account because they are not authorized.

Hope this makes sense.


Product Owner II
Staff member
Nov 14, 2017
I think really what you'd need to happen in order for this to work is when the account is added to that specific AD group it sends a request to the cPanel server to create an account for that user. I don't know how this works on the AD side of things unfortunately but I do know that in order to create an account you'd need to run that WHMAPI1 function that you provided.

WE do have the following which may be helpful:

As well as the standardized hooks which will allow for automation based on specific triggers: Guide to Standardized Hooks - Developer Documentation - cPanel Documentation