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 returns any files and directories that begin with a specified string.
Important:
When you disable the File Storage role, the system disables this function.
Whether to include only directories in the output.
1— Only include directories.0— Include directories and files.
Whether to return HTML-encoded results.
1— Return HTML-encoded output.0— Return plaintext output.
Whether to return all files and directories inside the specified directory. If you set this parameter's value to 1, you must set the path parameter's value to a full directory path.
1— Return all files and directories inside the specified directory.0— Return partial file and directory name matches.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Fileman/autocompletedir
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Fileman/autocompletedir
- 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/Fileman/autocompletedir?path=public&dirsonly=1&html=1&list_all=1'{ "apiversion": 3, "func": "autocompletedir", "module": "Fileman", "result": { "data": [ … ], "errors": null, "messages": null, "metadata": { … }, "status": 1, "warnings": null } }
Request
This function purges content from the .trash folder in the user's home directory.
Important:
When you disable the FileStorage role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Fileman/empty_trash
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Fileman/empty_trash
- 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/Fileman/empty_trash?older_than=31'{ "apiversion": 3, "func": "empty_trash", "module": "Fileman", "result": { "data": null, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
This function retrieves a file's content.
Important:
When you disable the File Storage role, the system disables this function.
Note:
JSON strings must be valid UTF-8. To retrieve a non-UTF-8 file via JSON, we recommend that you give ISO-8859-1 as from_charset and UTF-8 as to_charset, then decode the return payload’s content as UTF-8.
The file path to the directory that contains the selected file.
The file’s character encoding. This parameter defaults to _DETECT_, which indicates a request to detect the file’s character encoding.
The output character encoding. This parameter defaults to _LOCALE_, which indicates a request to use the session locale’s character encoding.
Important:
Contexts that serialize the API response as JSON require this value to be utf-8 or US-ASCII. Behavior is undefined if the request indicates any other encoding.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Fileman/get_file_content
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Fileman/get_file_content
- 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/Fileman/get_file_content?dir=%2Fhome%2Fuser%2Fpublic.html&file=example.html&from_charset=_DETECT_&to_charset=_LOCALE_&update_html_document_encoding=1'{ "apiversion": 3, "func": "get_file_content", "module": "Fileman", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }