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 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 } }
Request
This function returns the information for a specified file or directory.
Important:
When you disable the File Storage role, the system disables this function.
Whether to flag directories that contain subdirectories.
1- Flag directories that contain subdirectories.0- Do not flag directories that contain subdirectories.
Whether to return the file's MIME type.
1- Return the file's MIME type.0- Do not return the file's MIME type.
Whether to parse the file owner's read and write permissions.
1- Parse the file owner's read and write permissions.0- Do not parse the file owner's read and write permissions.
Whether to include hidden files in the output.
1- Include hidden files.0- Do not include hidden files.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Fileman/get_file_information
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Fileman/get_file_information
- 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_information?path=public_html&check_for_leaf_directories=1&include_mime=1&include_permissions=1&show_hidden=1'{ "apiversion": 3, "func": "get_file_information", "module": "Fileman", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }