UAPI accesses the cPanel interface's features. Use this API to access and modify cPanel account data and settings.
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/
https://{host}:{port}/execute/
Request
This function creates a temporary user session.
Important:
- Because this function requires a valid cPanel session ID, you must call it via a cPanel or Webmail session URL. If you call this function via the command line or Template Toolkit, it will not create a temporary user session. You must use the WHM API 1
create_user_sessionfunction to create a temporary user session. - Third-party plugins that require access to temporary MySQL users must call this function via the URL. It will create the temporary users before they are available. You can find these users in the
$ENV{'REMOTE_DBOWNER'}environment variable. - If you cannot update your system, update your scripts to call the
Cgi::phpmyadminlinkfunction. This will create a temporary user session for you.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_temp_user
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Session/create_temp_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_temp_user{ "apiversion": 3, "func": "create_temp_user", "module": "Session", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
Create a temporary session for a cPanel user to connect to Webmail.
Note:
The cPanel user must own the Webmail account.
After you successfully call this API, you will need to log in to Webmail. To do this, send an HTTP POST to https://$URL_AUTHTY:2096$token/login with a message body of session=$session where:
$URL_AUTHTYrepresents the value from thehostnamereturn.- If the
hostnamereturn value isnull, enter the hostname of the server that answered the API function. $tokenrepresents the value from the token return.
- If the
$sessionrepresents the value of the session return.
For example, an HTTP POST may resemble the following:
https://hostname.example.com:2096/cpsess2462418786/login
With a message body of:
session=username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137
The locale that the new session will use.
Note:
- You must only enter lowercase characters.
- This parameter defaults to the cPanel user's locale.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_webmail_session_for_mail_user
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Session/create_webmail_session_for_mail_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_webmail_session_for_mail_user?domain=example.com&login=username&locale=en&remote_address=192.168.0.1'{ "apiversion": 3, "func": "create_webmail_session_for_mail_user", "module": "Session", "result": { "data": { … }, "errors": null, "messages": null, "metadata": { … }, "status": 1, "warnings": null } }
Request
This function creates a temporary session with a password for the calling cPanel user to connect to Webmail.
Note:
- The cPanel user must own the Webmail account.
- This function works like the UAPI Session::create_webmail_session_for_mail_user function with one exception. This function requires a correct password to create the Webmail session. If you use an incorrect password or attempt to connect to a suspended account, the login will fail.
After you successfully call this API, you will need to log in to Webmail. To do this, send an HTTP POST to https://$URL_AUTHTY:2096$token/login with a message body of session=$session where:
$URL_AUTHTYrepresents the value from thehostnamereturn.- If the
hostnamereturn value isnull, enter the hostname of the server that answered the API function. $tokenrepresents the value from the token return.
- If the
$sessionrepresents the value of the session return.
For example, an HTTP POST may resemble the following:
https://hostname.example.com:2096/cpsess2462418786/login
With a message body of:
session=username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137
The locale that the new session will use.
Note:
- You must only enter lowercase characters.
- This parameter defaults to the cPanel user's locale.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_webmail_session_for_mail_user_check_password
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Session/create_webmail_session_for_mail_user_check_password
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Session/create_webmail_session_for_mail_user_check_password?domain=example.com&login=username&password=luggage12345&locale=en&remote_address=192.168.0.1'{ "apiversion": 3, "func": "create_webmail_session_for_mail_user_check_password", "module": "Session", "result": { "data": { … }, "errors": null, "messages": null, "metadata": { … }, "status": 1, "warnings": null } }