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 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 } }
Request
This function returns a sorted list of files and directories.
Important:
When you disable the FileStorage role, the system disables this function. For more information, read our How to Use Server Profiles documentation.
Whether to return directories that contain subdirectories.
1— Return subdirectories.0— Do not retain subdirectories.
Whether to return the file's MIME type.
1— Include MIME type.0— Do not include MIME type.
Note:
If you set this value to 0 but also include the mime_types or raw_mime_types parameters, the function overrides your specified value and sets this parameter to 1.
Whether to parse the file owner's read and write permissions.
1— Parse file permissions.0— Do not parse file permissions.
Whether to return only entries that begin with the filepath- prefix.
1— Return only files that begin with thefilepath-prefix.0— Return all files.
If you do not use this parameter, the function returns all filenames.
The MIME types to return.
- If you use this parameter, the function returns the specified MIME types and sets the
include_mimeparameter's value to1. - If you do not use this parameter, the function returns all MIME types.
A comma-separated list of files to return.
If you do not use this parameter, the function returns all files.
The raw MIME types to return.
- If you use this parameter, the function returns the specified MIME types and sets the
include_mimeparameter's value to1. - If you do not use this parameter, the function returns all MIME types.
Whether to include hidden files in the output.
1— Include hidden files.0— Do not include hidden files.
A pipe-separated list of file types to return.
file— A file.dir— A directory.char— A character special device.block— A block special device.fifo— A named pipe (FIFO).link— A symbolic link.socket— A Unix domain socket.
If you do not use this parameter, the function returns all file types.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Fileman/list_files
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Fileman/list_files
- 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/list_files?dir=public_html&check_for_leaf_directories=1&include_mime=1&include_permissions=0&limit_to_list=0&mime_types=text-plain&only_these_files=cpbackup-exclude.conf&raw_mime_types=text%2Fplain&show_hidden=1'{ "apiversion": 3, "func": "list_files", "module": "Fileman", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }