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 Sub Domain 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 SubDomain module for UAPI. name: Sub Domain paths: /SubDomain/addsubdomain: get: x-readonly: false x-rollback: none description: 'This function creates a subdomain. **Important:** When you disable the Web Server role, the system **disables** this function.' operationId: SubDomain-addsubdomain parameters: - description: The subdomain name to create. in: query name: domain required: true schema: example: subdomain type: string - description: The domain on which to create the new subdomain. The domain **must** already exist on the cPanel account. in: query name: rootdomain required: true schema: example: example.com format: domain type: string - description: 'Whether to use a canonical name (CNAME) in the [Apache® configuration for self-referential URLs](https://httpd.apache.org/docs/2.4/mod/core.html#usecanonicalname). * `1` - Use the CNAME. * `0` - Do **not** use the CNAME.' in: query name: canoff required: false schema: default: 1 enum: - 0 - 1 example: 1 type: integer - description: 'The subdomain''s document `root` within the home directory, given as a valid directory path relative to the user''s home directory. This value defaults to the user''s home directory `/public_html/` path. **Note:** If the *Restrict document roots to public_html* value is set to *Off* in WHM''s [*Tweak Settings*](https://go.cpanel.net/whmdocsTweakSettings#domains) interface (*WHM >> Home >> Server Configuration >> Tweak Settings*), this parameter defaults to the `/username/` path. For example, the `username` user''s subdomain `example` would default to the `/home/username/example` path.' in: query name: dir required: false schema: example: /public_html/directory_name format: path type: string - description: 'Whether to remove the dot (`.`) characters from the `domain` value. * `1` - Remove dots from the domain. * `0` - Do **not** remove dots from the domain.' in: query name: disallowdot required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer 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: addsubdomain type: string module: description: The name of the module called. example: SubDomain type: string result: properties: data: default: null type: - object - 'null' 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 description: HTTP Request was successful. summary: Create subdomain tags: - Sub Domain x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n SubDomain \\\n addsubdomain \\\n domain='subdomain' \\\n rootdomain='example.com'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/SubDomain/addsubdomain?domain=subdomain&rootdomain=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 SubDomain_addsubdomain.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/SubDomain_addsubdomain.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/SubDomain/,\n q/addsubdomain/,\n {\n 'domain' => 'subdomain',\n 'rootdomain' => '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 SubDomain_addsubdomain.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/SubDomain_addsubdomain.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 'SubDomain',\n 'addsubdomain',\n array (\n 'domain' => 'subdomain',\n 'rootdomain' => '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 70 /SubDomain/delsubdomain: get: description: 'This function removes a subdomain from the cPanel account. **Important:** - If any addon domain is parked on the subdomain, the system refuses to remove it and names the addon domains in the `errors` field. Remove those addon domains first with the `AddonDomain::deladdondomain` function. - This function does **not** remove the subdomain''s document root or the files in it. When you disable the Web Server role, the system **disables** this function.' operationId: SubDomain-delsubdomain parameters: - description: The subdomain to remove. Give this value either as the underscore-separated `subdomain_rootdomain` form that the `SubDomain::listsubdomains` function returns in its `domainkey` field, or as a fully qualified domain name. in: query name: domain required: true schema: example: subdomain_example.com type: string - description: 'Whether to remove the dot (`.`) characters from the subdomain label in the `domain` value. * `1` - Remove dots from the subdomain label. * `0` - Do **not** remove dots from the subdomain label.' in: query name: disallowdot required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer responses: '200': content: application/json: schema: properties: data: description: This function does not return data. Check the `status` field for the outcome, and the `messages` and `errors` fields for detail. errors: items: type: string type: - array - 'null' messages: items: type: string type: - array - 'null' metadata: properties: transformed: type: integer type: object status: description: '* `1` — Success. * `0` — Failed. Check the `errors` field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: items: type: string type: - array - 'null' type: object description: HTTP Request was successful. summary: Remove a subdomain tags: - Sub Domain x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n SubDomain \\\n delsubdomain \\\n domain='subdomain_example.com'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/SubDomain/delsubdomain?domain=subdomain_example.com - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account, where theme-name represents\n# jupiter.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file SubDomain_delsubdomain.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/SubDomain_delsubdomain.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/SubDomain/,\n q/delsubdomain/,\n {\n 'domain' => 'subdomain_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, where theme-name represents\n// jupiter.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file SubDomain_delsubdomain.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/SubDomain_delsubdomain.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 'SubDomain',\n 'delsubdomain',\n array (\n 'domain' => 'subdomain_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}\n" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 138 x-readonly: false /SubDomain/getreservedsubdomains: get: description: 'This function lists the subdomain labels that the system reserves, and that an account therefore cannot use to create a subdomain. **Note:** The returned labels are **not** sorted.' operationId: SubDomain-getreservedsubdomains parameters: [] responses: '200': content: application/json: schema: properties: data: description: One entry for each reserved subdomain label. items: description: A reserved subdomain label. example: www type: string type: array errors: items: type: string type: - array - 'null' messages: items: type: string type: - array - 'null' metadata: properties: transformed: type: integer type: object status: description: '* `1` — Success. * `0` — Failed. Check the `errors` field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: items: type: string type: - array - 'null' type: object description: HTTP Request was successful. summary: List the reserved subdomain names tags: - Sub Domain x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n SubDomain \\\n getreservedsubdomains\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/SubDomain/getreservedsubdomains - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account, where theme-name represents\n# jupiter.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file SubDomain_getreservedsubdomains.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/SubDomain_getreservedsubdomains.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/SubDomain/,\n q/getreservedsubdomains/\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, where theme-name represents\n// jupiter.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file SubDomain_getreservedsubdomains.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/SubDomain_getreservedsubdomains.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 'SubDomain',\n 'getreservedsubdomains'\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}\n" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 138 x-readonly: true /SubDomain/listsubdomains: get: description: This function lists the subdomains on the cPanel account, including the subdomains that the account's addon domains are parked on. operationId: SubDomain-listsubdomains parameters: - description: 'A Perl regular expression. The system returns only the subdomains whose fully qualified name matches this pattern, case-insensitively. If this value is not a valid Perl regular expression, the function fails and reports the error in the `errors` field.' in: query name: regex required: false schema: example: ^shop type: string - description: 'Whether to include the `can_https_redirect` and `is_https_redirecting` fields in each entry. * `1` - Include the HTTPS redirect status. * `0` - Omit the HTTPS redirect status.' in: query name: return_https_redirect_status required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer responses: '200': content: application/json: schema: properties: data: description: One entry for each subdomain on the account, sorted by the `domainkey` value. items: properties: basedir: description: The subdomain's document root, relative to the account's home directory. example: public_html/shop type: string can_https_redirect: description: 'Whether the system can redirect the subdomain to `HTTPS`. The system only returns this field when you pass the `return_https_redirect_status` parameter. * `1` - The system can redirect the subdomain. * `0` - The system cannot redirect the subdomain.' enum: - 0 - 1 example: 1 type: integer dir: description: The absolute path to the subdomain's document root. example: /home/username/public_html/shop format: path type: string domain: description: The subdomain's fully qualified domain name. example: shop.example.com format: domain type: string domainkey: description: The subdomain in the underscore-separated `subdomain_rootdomain` form. Pass this value to the `SubDomain::delsubdomain` function to remove the subdomain. example: shop_example.com type: string is_https_redirecting: description: 'Whether the system currently redirects the subdomain to `HTTPS`. The system only returns this field when you pass the `return_https_redirect_status` parameter. * `1` - The system redirects the subdomain. * `0` - The system does **not** redirect the subdomain.' enum: - 0 - 1 example: 0 type: integer reldir: description: The subdomain's document root, relative to the account's home directory and prefixed with `home:`. example: home:public_html/shop type: string rootdomain: description: The domain that the subdomain belongs to. example: example.com format: domain type: string status: description: The subdomain's rewrite status, or the URL that it redirects to. example: '' type: string subdomain: description: The subdomain's label, without the root domain. example: shop type: string web_subdomain_aliases: description: The built-in service subdomain aliases, for example `www`, that the system serves for the subdomain. items: format: domain type: string type: array type: object type: array errors: items: type: string type: - array - 'null' messages: items: type: string type: - array - 'null' metadata: properties: transformed: type: integer type: object status: description: '* `1` — Success. * `0` — Failed. Check the `errors` field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: items: type: string type: - array - 'null' type: object description: HTTP Request was successful. summary: List the subdomains tags: - Sub Domain x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n SubDomain \\\n listsubdomains\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/SubDomain/listsubdomains - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account, where theme-name represents\n# jupiter.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file SubDomain_listsubdomains.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/SubDomain_listsubdomains.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/SubDomain/,\n q/listsubdomains/\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, where theme-name represents\n// jupiter.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file SubDomain_listsubdomains.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/SubDomain_listsubdomains.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 'SubDomain',\n 'listsubdomains'\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}\n" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 138 x-readonly: true /SubDomain/validregex: get: description: 'This function retrieves the regular expression that the system uses to validate a subdomain label. **Note:** Use this value to validate a subdomain label in an interface before you call the `SubDomain::addsubdomain` function. It does **not** replace the server-side validation that `SubDomain::addsubdomain` performs.' operationId: SubDomain-validregex parameters: [] responses: '200': content: application/json: schema: properties: data: description: A single-element array holding the validation pattern. items: description: The regular expression that a subdomain label must match. example: ^[A-Za-z0-9][A-Za-z0-9-]*$ type: string type: array errors: items: type: string type: - array - 'null' messages: items: type: string type: - array - 'null' metadata: properties: transformed: type: integer type: object status: description: '* `1` — Success. * `0` — Failed. Check the `errors` field for more details.' enum: - 0 - 1 example: 1 type: integer warnings: items: type: string type: - array - 'null' type: object description: HTTP Request was successful. summary: Return the subdomain validation pattern tags: - Sub Domain x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n SubDomain \\\n validregex\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/SubDomain/validregex - label: LiveAPI Perl lang: Perl source: "#--------------------------------------------------------------------------------------\n# Instructions:\n#--------------------------------------------------------------------------------------\n# is the theme assigned to cPanel account, where theme-name represents\n# jupiter.\n# 1) cd /usr/local/cpanel/base/frontend/\n# 2) mkdir api_examples\n# 3) cd api_examples\n# 4) create a file SubDomain_validregex.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/SubDomain_validregex.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/SubDomain/,\n q/validregex/\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, where theme-name represents\n// jupiter.\n// 1) cd /usr/local/cpanel/base/frontend/\n// 2) mkdir api_examples\n// 3) cd api_examples\n// 4) create a file SubDomain_validregex.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/SubDomain_validregex.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 'SubDomain',\n 'validregex'\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}\n" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 138 x-readonly: true 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