openapi: 3.2.0 info: contact: email: cs@cpanel.net name: WebPros International, LLC url: https://cpanel.net/support/ description: UAPI accesses the cPanel interface's features. Use this API to access and modify cPanel account data and settings. license: name: cPanel License url: https://cpanel.net/legal-notices/ termsOfService: https://cpanel.net/legal-notices/ title: cPanel U Session API version: 11.137.9999.106 x-api-evangelist-provenance: 'Harvested verbatim from cPanel''s developer portal on 2026-09-05 via the MCP tool get-full-api-description at https://api.docs.cpanel.net/mcp. ONE mechanical change was made before storage: example values containing PEM private-key or certificate blocks, and AWS-access-key-shaped example strings, were replaced with REDACTED_* placeholders so the file can be stored in a public git repository without tripping secret scanning. No path, operation, parameter, schema or description was altered, added or removed.' servers: - description: A server running cPanel. url: https://{host}:{port}/execute variables: host: default: cpanel-server.tld description: The hostname of a server running cPanel. port: default: '2083' description: The cPanel port. security: - BasicAuth: [] tags: - description: The Session module for UAPI. name: Session paths: /Session/create_temp_user: get: x-readonly: false x-rollback: none description: '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_session` function 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::phpmyadminlink` function. This will create a temporary user session for you.' operationId: Session-create_temp_user parameters: [] responses: '200': content: application/json: schema: properties: apiversion: description: The version of the API. example: 3 type: integer func: description: The name of the method called. example: create_temp_user type: string module: description: The name of the module called. example: Session type: string result: properties: data: properties: created: description: 'Whether the function successfully created the temporary user session. * `1` - Success. * `0` - Failure.' enum: - 0 - 1 example: 1 type: integer session_temp_user: description: The temporary user's session ID. example: cpses_reviY3ZSQK type: string type: object errors: description: List of errors if the API failed. example: null items: type: string type: - array - 'null' messages: description: List of messages generated by the API. example: null items: type: string type: - array - 'null' metadata: properties: {} status: description: '* `1` - Success. * `0` - Failed. Check the `errors` field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: description: List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API. example: null items: type: string type: - array - 'null' type: object type: object description: HTTP Request was successful. summary: Create user session with existing session tags: - Session x-codeSamples: - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Session/create_temp_user - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file Session_create_temp_user.live.pl and put this code into that file.\n# 5) In your browser login to a cPanel account.\n# 6) Manually change the url from: .../frontend//\n# to .../frontend//api_examples/Session_create_temp_user.live.pl\n#--------------------------------------------------------------------------------------\n\nuse strict;\n\nuse Cpanel::LiveAPI ();\n\nmy $cpanel = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.\n\n# Print the header\nprint \"Content-type: text/plain\\r\\n\\r\\n\";\n\n# Call the API\nmy $response = $cpanel->uapi(\n q/Session/,\n q/create_temp_user/\n);\n\n# Handle the response\nif ($response->{cpanelresult}{result}{status}) {\n my $data = $response->{cpanelresult}{result}{data};\n # Do something with the $data\n # So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n # Report errors:\n print to_json($response->{cpanelresult}{result}{errors});\n}\n\n# Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n#--------------------------------------------------------------------------------------\n# Helper function to convert a perl object to html printable json\n#--------------------------------------------------------------------------------------\nsub to_json {\n require JSON;\n my $str = JSON->new->pretty->encode($_[0]);\n return $str;\n}\n" - label: LiveAPI PHP lang: PHP source: " is the theme assigned to cPanel account.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file Session_create_temp_user.live.php and put this code into that file.\n// 5) In your browser login to a cPanel account.\n// 6) Manually change the url from: .../frontend//\n// to .../frontend//api_examples/Session_create_temp_user.live.php\n//--------------------------------------------------------------------------------------\n\n// Instantiate the CPANEL object.\nrequire_once \"/usr/local/cpanel/php/cpanel.php\";\n\n// Print the header\nheader('Content-Type: text/plain');\n\n// Connect to cPanel - only do this once.\n$cpanel = new CPANEL();\n\n// Call the API\n$response = $cpanel->uapi(\n 'Session',\n 'create_temp_user'\n);\n\n// Handle the response\nif ($response['cpanelresult']['result']['status']) {\n $data = $response['cpanelresult']['result']['data'];\n // Do something with the $data\n // So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n // Report errors:\n print to_json($response['cpanelresult']['result']['errors']);\n}\n\n// Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n//--------------------------------------------------------------------------------------\n// Helper function to convert a PHP value to html printable json\n//--------------------------------------------------------------------------------------\nfunction to_json($data) {\n return json_encode($data, JSON_PRETTY_PRINT);\n}" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 54.0.16 x-cpanel-cli-support: false /Session/create_webmail_session_for_mail_user: get: x-readonly: false x-rollback: none description: 'Create a temporary session for a cPanel user to connect to Webmail. **Note:** The cPanel user must own the Webmail account. ### How to use this API 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_AUTHTY` represents the value from the `hostname` return. * If the `hostname` return value is `null`, enter the hostname of the server that answered the API function. * `$token` represents the value from the token return. * `$session` represents 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```' operationId: Session-create_webmail_session_for_mail_user parameters: - description: The domain for the Webmail account. in: query name: domain required: true schema: example: example.com type: string - description: The Webmail account's username. in: query name: login required: true schema: example: username type: string - description: 'The [locale](https://go.cpanel.net/localedocs) that the new session will use. **Note:** * You must **only** enter lowercase characters. * This parameter defaults to the cPanel user''s locale.' in: query name: locale required: false schema: example: en type: string - description: 'The session''s client IP address. **Note:** * If you run this function from the command line, this parameter is **required**. * This parameter defaults to the API caller''s IP address.' in: query name: remote_address required: false schema: example: 192.168.0.1 format: ipv4 type: string responses: '200': content: application/json: schema: properties: apiversion: description: The version of the API. example: 3 type: integer func: description: The name of the method called. example: create_webmail_session_for_mail_user type: string module: description: The name of the module called. example: Session type: string result: properties: data: properties: hostname: description: 'The Webmail server''s hostname. **Note:** The function returns a `null` value when the Webmail server is not remote.' example: hostname.example.com type: - string - 'null' session: description: The session ID to submit via POST to begin using the new session. example: username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137 type: string token: description: A new security token. example: /cpsess2462418786 type: string type: object errors: description: List of errors if the API failed. example: null items: type: string type: - array - 'null' messages: description: List of messages generated by the API. example: null items: type: string type: - array - 'null' metadata: properties: transformed: description: Post-processing may have transformed the data. enum: - 1 example: 1 type: integer status: description: '- 1 - Success - 0 - Failed: Check the errors field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: description: List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API. example: null items: type: string type: - array - 'null' type: object type: object description: HTTP Request was successful. summary: Create Webmail session tags: - Session x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Session \\\n create_webmail_session_for_mail_user \\\n login='username' \\\n domain='example.com'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Session/create_webmail_session_for_mail_user?login=username&domain=example.com - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file Session_create_webmail_session_for_mail_user.live.pl and put this code into that file.\n# 5) In your browser login to a cPanel account.\n# 6) Manually change the url from: .../frontend//\n# to .../frontend//api_examples/Session_create_webmail_session_for_mail_user.live.pl\n#--------------------------------------------------------------------------------------\n\nuse strict;\n\nuse Cpanel::LiveAPI ();\n\nmy $cpanel = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.\n\n# Print the header\nprint \"Content-type: text/plain\\r\\n\\r\\n\";\n\n# Call the API\nmy $response = $cpanel->uapi(\n q/Session/,\n q/create_webmail_session_for_mail_user/,\n {\n 'login' => 'username',\n 'domain' => 'example.com',\n }\n);\n\n# Handle the response\nif ($response->{cpanelresult}{result}{status}) {\n my $data = $response->{cpanelresult}{result}{data};\n # Do something with the $data\n # So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n # Report errors:\n print to_json($response->{cpanelresult}{result}{errors});\n}\n\n# Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n#--------------------------------------------------------------------------------------\n# Helper function to convert a perl object to html printable json\n#--------------------------------------------------------------------------------------\nsub to_json {\n require JSON;\n my $str = JSON->new->pretty->encode($_[0]);\n return $str;\n}\n" - label: LiveAPI PHP lang: PHP source: " is the theme assigned to cPanel account.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file Session_create_webmail_session_for_mail_user.live.php and put this code into that file.\n// 5) In your browser login to a cPanel account.\n// 6) Manually change the url from: .../frontend//\n// to .../frontend//api_examples/Session_create_webmail_session_for_mail_user.live.php\n//--------------------------------------------------------------------------------------\n\n// Instantiate the CPANEL object.\nrequire_once \"/usr/local/cpanel/php/cpanel.php\";\n\n// Print the header\nheader('Content-Type: text/plain');\n\n// Connect to cPanel - only do this once.\n$cpanel = new CPANEL();\n\n// Call the API\n$response = $cpanel->uapi(\n 'Session',\n 'create_webmail_session_for_mail_user',\n array (\n 'login' => 'username',\n 'domain' => 'example.com',\n )\n);\n\n// Handle the response\nif ($response['cpanelresult']['result']['status']) {\n $data = $response['cpanelresult']['result']['data'];\n // Do something with the $data\n // So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n // Report errors:\n print to_json($response['cpanelresult']['result']['errors']);\n}\n\n// Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n//--------------------------------------------------------------------------------------\n// Helper function to convert a PHP value to html printable json\n//--------------------------------------------------------------------------------------\nfunction to_json($data) {\n return json_encode($data, JSON_PRETTY_PRINT);\n}" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 86 /Session/create_webmail_session_for_mail_user_check_password: get: x-readonly: false x-rollback: none description: '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. ### How to use this API 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_AUTHTY` represents the value from the `hostname` return. * If the `hostname` return value is `null`, enter the hostname of the server that answered the API function. * `$token` represents the value from the token return. * `$session` represents 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```' operationId: Session-create_webmail_session_for_mail_user_check_password parameters: - description: The domain for the Webmail account. in: query name: domain required: true schema: example: example.com type: string - description: The Webmail account's username. in: query name: login required: true schema: example: username type: string - description: The password for the Webmail account. in: query name: password required: true schema: example: luggage12345 type: string - description: 'The [locale](https://go.cpanel.net/localedocs) that the new session will use. **Note:** * You must **only** enter lowercase characters. * This parameter defaults to the cPanel user''s locale.' in: query name: locale required: false schema: example: en type: string - description: 'The session''s account''s client IP address. **Note:** * If you run this function from the command line, this parameter is **required**. * This parameter defaults to the API caller''s IP address.' in: query name: remote_address required: false schema: example: 192.168.0.1 format: ipv4 type: string responses: '200': content: application/json: schema: properties: apiversion: description: The version of the API. example: 3 type: integer func: description: The name of the method called. example: create_webmail_session_for_mail_user_check_password type: string module: description: The name of the module called. example: Session type: string result: properties: data: properties: hostname: description: 'The Webmail server''s hostname. **Note:** The function returns a `null` value when the Webmail server is not remote.' example: hostname.example.com type: - string - 'null' session: description: The session value to submit via POST to begin using the new session. example: username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137 type: string token: description: A new security token. example: /cpsess2462418786 type: string type: object errors: description: List of errors if the API failed. example: null items: type: string type: - array - 'null' messages: description: List of messages generated by the API. example: null items: type: string type: - array - 'null' metadata: properties: transformed: description: Post-processing may have transformed the data. enum: - 1 example: 1 type: integer status: description: '- 1 - Success - 0 - Failed: Check the errors field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: description: List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API. example: null items: type: string type: - array - 'null' type: object type: object description: HTTP Request was successful. summary: Create Webmail session with credentials tags: - Session x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Session \\\n create_webmail_session_for_mail_user_check_password \\\n login='username' \\\n domain='example.com' \\\n password='luggage12345'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Session/create_webmail_session_for_mail_user_check_password?login=username&domain=example.com&password=luggage12345 - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file Session_create_webmail_session_for_mail_user_check_password.live.pl and put this code into that file.\n# 5) In your browser login to a cPanel account.\n# 6) Manually change the url from: .../frontend//\n# to .../frontend//api_examples/Session_create_webmail_session_for_mail_user_check_password.live.pl\n#--------------------------------------------------------------------------------------\n\nuse strict;\n\nuse Cpanel::LiveAPI ();\n\nmy $cpanel = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.\n\n# Print the header\nprint \"Content-type: text/plain\\r\\n\\r\\n\";\n\n# Call the API\nmy $response = $cpanel->uapi(\n q/Session/,\n q/create_webmail_session_for_mail_user_check_password/,\n {\n 'login' => 'username',\n 'domain' => 'example.com',\n 'password' => 'luggage12345',\n }\n);\n\n# Handle the response\nif ($response->{cpanelresult}{result}{status}) {\n my $data = $response->{cpanelresult}{result}{data};\n # Do something with the $data\n # So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n # Report errors:\n print to_json($response->{cpanelresult}{result}{errors});\n}\n\n# Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n#--------------------------------------------------------------------------------------\n# Helper function to convert a perl object to html printable json\n#--------------------------------------------------------------------------------------\nsub to_json {\n require JSON;\n my $str = JSON->new->pretty->encode($_[0]);\n return $str;\n}\n" - label: LiveAPI PHP lang: PHP source: " is the theme assigned to cPanel account.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file Session_create_webmail_session_for_mail_user_check_password.live.php and put this code into that file.\n// 5) In your browser login to a cPanel account.\n// 6) Manually change the url from: .../frontend//\n// to .../frontend//api_examples/Session_create_webmail_session_for_mail_user_check_password.live.php\n//--------------------------------------------------------------------------------------\n\n// Instantiate the CPANEL object.\nrequire_once \"/usr/local/cpanel/php/cpanel.php\";\n\n// Print the header\nheader('Content-Type: text/plain');\n\n// Connect to cPanel - only do this once.\n$cpanel = new CPANEL();\n\n// Call the API\n$response = $cpanel->uapi(\n 'Session',\n 'create_webmail_session_for_mail_user_check_password',\n array (\n 'login' => 'username',\n 'domain' => 'example.com',\n 'password' => 'luggage12345',\n )\n);\n\n// Handle the response\nif ($response['cpanelresult']['result']['status']) {\n $data = $response['cpanelresult']['result']['data'];\n // Do something with the $data\n // So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n // Report errors:\n print to_json($response['cpanelresult']['result']['errors']);\n}\n\n// Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n//--------------------------------------------------------------------------------------\n// Helper function to convert a PHP value to html printable json\n//--------------------------------------------------------------------------------------\nfunction to_json($data) {\n return json_encode($data, JSON_PRETTY_PRINT);\n}" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 86 /Session/create_webmail_session_for_self: get: x-readonly: false x-rollback: none description: 'Create a temporary session to connect to Webmail for the authenticated cPanel user. ### How to use this API 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_AUTHTY` represents the value from the `hostname` return. * If the `hostname` return value is `null`, enter the hostname of the server that answered the API function. * `$token` represents the value from the token return. * `$session` represents 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```' operationId: Session-create_webmail_session_for_self parameters: - description: 'The [locale](https://go.cpanel.net/localedocs) that the new session will use. Use UAPI `Locale::list_locales` to see a list of valid locales. **Note:** * You must **only** enter lowercase characters. * This parameter defaults to the cPanel user''s locale.' in: query name: locale required: false schema: example: en type: string - description: 'The session''s client IP address. **Note:** * If you run this function from the command line, this parameter is **required**. * This parameter defaults to the API caller''s IP address.' in: query name: remote_address required: false schema: example: 192.168.0.1 format: ipv4 type: string responses: '200': content: application/json: schema: properties: apiversion: description: The version of the API. example: 3 type: integer func: description: The name of the method called. example: create_webmail_session_for_self type: string module: description: The name of the module called. example: Session type: string result: properties: data: properties: hostname: description: 'The Webmail server''s hostname. **Note:** The function returns a `null` value when the Webmail server is **not** remote.' example: hostname.example.com format: domain type: - string - 'null' session: description: The session value to submit via POST to begin using the new session. example: username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_SELF,728fb86a7df1cf20690c65f349ac3137 type: string token: description: A new security token. example: /cpsess2462418786 type: string type: object errors: description: List of errors if the API failed. example: null items: type: string type: - array - 'null' messages: description: List of messages generated by the API. example: null items: type: string type: - array - 'null' metadata: properties: transformed: description: Post-processing may have transformed the data. enum: - 1 example: 1 type: integer status: description: '- 1 - Success - 0 - Failed: Check the errors field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: description: List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API. example: null items: type: string type: - array - 'null' type: object type: object description: HTTP Request was successful. summary: Create Webmail session for current user tags: - Session x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Session \\\n create_webmail_session_for_self\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Session/create_webmail_session_for_self - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file Session_create_webmail_session_for_self.live.pl and put this code into that file.\n# 5) In your browser login to a cPanel account.\n# 6) Manually change the url from: .../frontend//\n# to .../frontend//api_examples/Session_create_webmail_session_for_self.live.pl\n#--------------------------------------------------------------------------------------\n\nuse strict;\n\nuse Cpanel::LiveAPI ();\n\nmy $cpanel = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.\n\n# Print the header\nprint \"Content-type: text/plain\\r\\n\\r\\n\";\n\n# Call the API\nmy $response = $cpanel->uapi(\n q/Session/,\n q/create_webmail_session_for_self/\n);\n\n# Handle the response\nif ($response->{cpanelresult}{result}{status}) {\n my $data = $response->{cpanelresult}{result}{data};\n # Do something with the $data\n # So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n # Report errors:\n print to_json($response->{cpanelresult}{result}{errors});\n}\n\n# Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n#--------------------------------------------------------------------------------------\n# Helper function to convert a perl object to html printable json\n#--------------------------------------------------------------------------------------\nsub to_json {\n require JSON;\n my $str = JSON->new->pretty->encode($_[0]);\n return $str;\n}\n" - label: LiveAPI PHP lang: PHP source: " is the theme assigned to cPanel account.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file Session_create_webmail_session_for_self.live.php and put this code into that file.\n// 5) In your browser login to a cPanel account.\n// 6) Manually change the url from: .../frontend//\n// to .../frontend//api_examples/Session_create_webmail_session_for_self.live.php\n//--------------------------------------------------------------------------------------\n\n// Instantiate the CPANEL object.\nrequire_once \"/usr/local/cpanel/php/cpanel.php\";\n\n// Print the header\nheader('Content-Type: text/plain');\n\n// Connect to cPanel - only do this once.\n$cpanel = new CPANEL();\n\n// Call the API\n$response = $cpanel->uapi(\n 'Session',\n 'create_webmail_session_for_self'\n);\n\n// Handle the response\nif ($response['cpanelresult']['result']['status']) {\n $data = $response['cpanelresult']['result']['data'];\n // Do something with the $data\n // So you can see the data shape we print it here.\n print to_json($data);\n}\nelse {\n // Report errors:\n print to_json($response['cpanelresult']['result']['errors']);\n}\n\n// Disconnect from cPanel - only do this once.\n$cpanel->end();\n\n//--------------------------------------------------------------------------------------\n// Helper function to convert a PHP value to html printable json\n//--------------------------------------------------------------------------------------\nfunction to_json($data) {\n return json_encode($data, JSON_PRETTY_PRINT);\n}" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 86 components: securitySchemes: BasicAuth: scheme: basic type: http externalDocs: url: https://cpanel.net/developers/ x-tagGroups: - name: API Development Tools tags: - API Token Management - Batch - SSE Task Management - URL Parsing - name: Authentication tags: - External Authentication - Two-Factor Settings - name: Backup Information tags: - BackupInfo - BackupInfo Status - name: Block Ip Addresses tags: - Block IP - name: Commerce Integration tags: - Market Integration - SSL Certificates - name: Contact Information tags: - Contact Information - name: cPanel Account tags: - Account Enhancements - Account Information - Account Management - AuditLog - Contact Information - cPanel Features - Disk Quotas - DomainRecommendations - Personalization - Resource Usage and Statistics - Subaccount Management - Team Roles - Team Users - name: cPanel Account Backups tags: - Backup - File Restoration - name: cPanel Plugin Framework tags: - Formbricks - Plugins - name: cPanel Theme Management tags: - Application Information - Brand Management - Branding Files - Browser Cache Management - Language - Theme Settings - name: Directory Management tags: - Directory Indexes - Directory Privacy - Directory Protection - name: DNS tags: - DNS - DNS Information - DNS Security - Dynamic DNS - Email DNS Settings - ZoneEdit - name: Domain tags: - Domain - name: Domain Management tags: - AddonDomain - Direct Link Protection (Hotlink) - Domain - Domain Information - Domain Redirection - DomainLookup - Park - SubDomain - Virtual Host Information - name: Domains tags: - Subdomains - name: Email tags: - Email Accounts - Email Filtering - Email Forwarding - Email Server Information - Email Suspensions - Mail Server Information - Mailbox Management - Mailing Lists - Signing and Encryption (GnuPG Keys) - Spam Filtering (Greylisting) - Spam Management - Spam Prevention (BoxTrapper) - Webmail Applications - Webmail Sessions - name: Extract Information tags: - ExtractInfo - ExtractInfo Status - name: File Manager tags: - Trash - name: Files tags: - FTP Accounts - FTP Server Settings - Image Tools - Jodit - Manage Files - Manage Files - WebDisk Settings - name: GIT Management tags: - Deployment Settings - Repository Management - name: InProductSurvey tags: - InProductSurvey - name: MySQL and MariaDB tags: - Database Information - Database Management - Remote Databases - User Management - name: Notifications tags: - Pushbullet - name: Optional Applications tags: - Antivirus Protection (ClamAV) - Calendar and Contacts (DAV) - Calendar and Contacts Server - WordPress Manager Backups - name: PostgreSQL tags: - PostgreSQL Database Management - PostgreSQL User Management - name: Retrieve bandwidth information tags: - Bandwidth - name: Security tags: - Known SSH Hosts Management - Login Information - name: Server Information tags: - cPanel Server Information - Notifications - Password Strength - SSH - WebPros MCP - WebProsMCP - name: ServiceProxy tags: - ServiceProxy - name: Site Quality Monitoring tags: - SiteQuality - name: SSL Certificates tags: - Auto-generated SSL Certificates - cPanel Account SSL Management - SNI Email Settings - SSL Certificate Management - Verify Domain Ownership - name: Statistics tags: - Domain Statistics - Weblog Settings - name: UserData tags: - UserData - name: Web Server Configuration tags: - EA4 - EasyApache Settings - PHP - name: Web Server Management tags: - Application Manager - ModSecurity - NginxCaching - PHP Settings - Web Apps - name: Website Configuration tags: - Handler Management - Logs - Mime Type Management - Nova - Site Information - Site Installation - Sitejet - WPX