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 Fileman 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 Fileman module for UAPI. name: Fileman paths: /Fileman/autocompletedir: get: x-readonly: true description: '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.' operationId: Fileman-autocompletedir parameters: - description: The prefix of the paths to complete. in: query name: path required: true schema: example: public type: string - description: 'Whether to include only directories in the output. * `1` — **Only** include directories. * `0` — Include directories **and** files.' in: query name: dirsonly required: false schema: default: 0 enum: - 1 - 0 type: integer - description: 'Whether to return HTML-encoded results. * `1` — Return HTML-encoded output. * `0` — Return plaintext output.' in: query name: html required: false schema: default: 1 enum: - 0 - 1 example: 1 type: integer - description: '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.' in: query name: list_all required: false schema: default: 1 enum: - 1 - 0 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: autocompletedir type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: description: An array of objects containing the files and directories that match the specified path. items: properties: file: description: A file or directory that matches the specified path. example: public_ftp type: string type: object type: array 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: Return autocomplete file and directory names tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n autocompletedir \\\n path='public'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/autocompletedir?path=public - 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 Fileman_autocompletedir.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/Fileman_autocompletedir.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/Fileman/,\n q/autocompletedir/,\n {\n 'path' => 'public',\n }\n);\n\n# Handle the response\nif ($response->{cpanelresult}{result}{status}) {\n my $data = $response->{cpanelresult}{result}{data};\n foreach my $item (@{$data}) {\n # Do something with the $item\n }\n\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 Fileman_autocompletedir.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/Fileman_autocompletedir.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 'Fileman',\n 'autocompletedir',\n array (\n 'path' => 'public',\n )\n);\n\n// Handle the response\nif ($response['cpanelresult']['result']['status']) {\n $data = $response['cpanelresult']['result']['data'];\n foreach ($data as $item) {\n // Do something with the $item\n }\n\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 /Fileman/copy_file: get: x-readonly: false x-rollback: none description: 'This function copies a file or directory to a new location and preserves the source permissions and modification time. If the destination is an existing directory, the source is copied into it. The function returns an error if the destination already exists. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-copy_file parameters: - description: The path to copy the source to. in: query name: destination required: true schema: example: public_html/backup/file.txt format: path type: string - description: The path to the file or directory to copy. in: query name: source required: true schema: example: public_html/file.txt format: path 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: copy_file type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: src: description: The resolved source path. format: path type: string dest: description: The resolved destination path. format: path 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: Copy a file tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n copy_file \\\n source='public_html/file.txt' \\\n destination='public_html/backup/file.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/copy_file?source=public_html/file.txt&destination=public_html/backup/file.txt - 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 Fileman_copy_file.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/Fileman_copy_file.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/Fileman/,\n q/copy_file/,\n {\n 'source' => 'public_html/file.txt',\n 'destination' => 'public_html/backup/file.txt',\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 Fileman_copy_file.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/Fileman_copy_file.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 'Fileman',\n 'copy_file',\n array (\n 'source' => 'public_html/file.txt',\n 'destination' => 'public_html/backup/file.txt',\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 136 /Fileman/delete_file: get: x-readonly: false x-rollback: none description: 'This function permanently removes a file or directory. The function removes directories recursively. This action cannot be undone; to remove a file reversibly, use the trash_file function instead. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-delete_file parameters: - description: The path to the file or directory to delete. in: query name: path required: true schema: example: public_html/unwanted.txt format: path 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: delete_file type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: path: description: The resolved path that the function deleted. example: /home/user/public_html/unwanted.txt format: path 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: Delete a file permanently tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n delete_file \\\n path='public_html/unwanted.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/delete_file?path=public_html/unwanted.txt - 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 Fileman_delete_file.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/Fileman_delete_file.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/Fileman/,\n q/delete_file/,\n {\n 'path' => 'public_html/unwanted.txt',\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 Fileman_delete_file.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/Fileman_delete_file.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 'Fileman',\n 'delete_file',\n array (\n 'path' => 'public_html/unwanted.txt',\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 136 /Fileman/empty_trash: get: x-readonly: false x-rollback: none description: '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.' operationId: Fileman-empty_trash parameters: - description: 'The maximum age in days of content that the function will not purge. **Note:** A value of `0` will purge everything from the user''s `.trash` folder.' in: query name: older_than required: false schema: default: 0 example: 31 minimum: 0 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: empty_trash type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: example: null properties: {} 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 type: object description: HTTP Request was successful. summary: Delete .trash folder content tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n empty_trash\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/empty_trash - 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 Fileman_empty_trash.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/Fileman_empty_trash.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/Fileman/,\n q/empty_trash/\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 Fileman_empty_trash.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/Fileman_empty_trash.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 'Fileman',\n 'empty_trash'\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 60 /Fileman/get_file_content: get: x-readonly: true description: '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.' operationId: Fileman-get_file_content parameters: - description: The file path to the directory that contains the selected file. in: query name: dir required: true schema: example: /home/user/public.html format: path type: string - description: The file to retrieve. in: query name: file required: true schema: example: example.html type: string - description: The file’s character encoding. This parameter defaults to `_DETECT_`, which indicates a request to detect the file’s character encoding. in: query name: from_charset required: false schema: default: _DETECT_ example: _DETECT_ type: string - description: '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.' in: query name: to_charset required: false schema: default: _LOCALE_ example: _LOCALE_ type: string - description: 'Whether to update the file''s HTML document encoding. * `1` — Update the file''s HTML document encoding. * `0` — Don''t update the file''s HTML encoding.' in: query name: update_html_document_encoding required: false schema: default: 1 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: get_file_content type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: content: description: 'The file''s contents. A string value. **Note:** Behavior is **undefined** if the calling context requires an encoding that conflicts with the file contents. For example, if the file contents are ISO-8859-1 but the context requires UTF-8 (as is the case with JSON), the system may apply an extra layer of UTF-8 encoding in order to satisfy the request.' example: '`hi`' format: binary type: string dir: description: The absolute path to the directory that contains the selected file. example: /home/user/public_html format: path type: string filename: description: The file's name. example: example.html type: string from_char: description: The file's previous character encoding. If the request’s `from_charset` was `_DETECT_`, this will contain the detected encoding. Otherwise, it will contain the request’s `from_charset` value. example: UTF-8 type: string from_charset: {} path: description: The absolute path to the file. example: /home/user/public_html/example.html format: path type: string to_char: description: The file's new character encoding. If the request’s `from_charset` was `_LOCALE_`, this will contain the locale’s encoding. Otherwise, it will contain the request’s `to_charset` value. example: UTF-8 type: string to_charset: {} 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: Return file content tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n get_file_content \\\n dir='/home/user/public_html' \\\n file='example.html'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/get_file_content?dir=%2fhome%2fuser%2fpublic.html&file=example.html - 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 Fileman_get_file_content.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/Fileman_get_file_content.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/Fileman/,\n q/get_file_content/,\n {\n 'dir' => '/home/user/public.html',\n 'file' => 'example.html',\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 Fileman_get_file_content.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/Fileman_get_file_content.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 'Fileman',\n 'get_file_content',\n array (\n 'dir' => '/home/user/public.html',\n 'file' => 'example.html',\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 11.44 /Fileman/get_file_information: get: x-readonly: true description: 'This function returns the information for a specified file or directory. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-get_file_information parameters: - description: The directory from which to list files. in: query name: path required: true schema: example: public_html format: path type: string - description: 'Whether to flag directories that contain subdirectories. * `1` - Flag directories that contain subdirectories. * `0` - Do **not** flag directories that contain subdirectories.' in: query name: check_for_leaf_directories required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: 'Whether to return the file''s MIME type. * `1` - Return the file''s MIME type. * `0` - Do **not** return the file''s MIME type.' in: query name: include_mime required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: '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.' in: query name: include_permissions required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: 'Whether to include hidden files in the output. * `1` - Include hidden files. * `0` - Do **not** include hidden files.' in: query name: show_hidden 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: get_file_information type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: absdir: description: The path to the user's home directory. example: /home/user format: path type: string ctime: description: The file's creation time, Unix time format. example: 1400573272 format: unix_timestamp type: integer exists: description: 'Whether the file exists in the directory. * `1` - Exists. * `0` - Does **not** exist.' enum: - 0 - 1 example: 1 type: integer file: description: The filename. example: cgi-bin type: string fullpath: description: The file's full filepath. example: /home/user/public_html/cgi-bin format: path type: string gid: description: The file owner's system group ID. example: 503 minimum: 1 type: integer humansize: description: 'The file''s formatted size, followed by one of the following symbols: * `KB` - kilobytes * `MB` - megabytes * `GB` - gigabytes' example: 5 KB type: string isleaf: description: 'Whether the directory contains subdirectories. * `1` - Contains subdirectories. * `0` - Does **not** contain subdirectories.' enum: - 0 - 1 example: 1 type: integer mimename: description: The file's MIME name. example: publichtml type: string mimetype: description: The file's MIME type. example: text/plain format: MIME type: string mode: description: The file's textual permissions in [Unix format](https://en.wikipedia.org/wiki/File-system_permissions#Notation_of_traditional_Unix_permissions). example: '16872' type: string mtime: description: The file's last modification time, in Unix time format. example: 1400573272 format: unix_timestamp type: integer nicemode: description: The file's numerical permissions in [octal notation](https://en.wikipedia.org/wiki/File-system_permissions#Notation_of_traditional_Unix_permissions). example: 755 type: integer path: description: The file's path. example: /home/user/public.html format: path type: string rawmimename: description: The file's raw MIME name. example: text/plain format: MIME type: string rawmimetype: description: The file's raw MIME type. example: text/plain format: MIME type: string read: description: 'Whether the file is readable. The function only returns this value if you set the `include_permissions` value to 1. * `1` - Readable. * `0` - **Not** readable.' enum: - 0 - 1 example: 1 type: integer size: description: The file's size, in bytes. example: 4096 minimum: 1 type: integer type: description: 'The item''s type. * `file` - File. * `dir` - Directory. * `char` - Character special device. * `block` - Block special device. * `fifo` - Named pipe. * `link` - Symbolic link. * `socket` - Unix domain socket.' enum: - file - dir - char - block - fifo - link - socket example: file type: string uid: description: The file owner's system user ID. example: 502 minimum: 1 type: integer write: description: 'Whether the file is writable. The function only returns this value if you set the `include_permissions` value to 1 . * `1` - Writable. * `0` - Not writable.' enum: - 0 - 1 example: 1 type: integer 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: Return file or directory information tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n get_file_information \\\n path='public_html'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/get_file_information?path=public_html - 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 Fileman_get_file_information.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/Fileman_get_file_information.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/Fileman/,\n q/get_file_information/,\n {\n 'path' => 'public_html',\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 Fileman_get_file_information.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/Fileman_get_file_information.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 'Fileman',\n 'get_file_information',\n array (\n 'path' => 'public_html',\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 11.44 /Fileman/list_files: get: x-readonly: true description: '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.' operationId: Fileman-list_files parameters: - description: The directory from which to list files. in: query name: dir required: true schema: example: public_html type: string - description: 'Whether to return directories that contain subdirectories. * `1` — Return subdirectories. * `0` — Do **not** retain subdirectories.' in: query name: check_for_leaf_directories required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: "Whether to return the file's MIME type.\n\n* `1` — Include MIME type.\n* `0` — Do **not** include MIME type.\n\n**Note:**\n\n 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`." in: query name: include_mime required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: 'Whether to parse the file owner''s read and write permissions. * `1` — Parse file permissions. * `0` — Do **not** parse file permissions.' in: query name: include_permissions required: false schema: default: 0 enum: - 0 - 1 example: 0 type: integer - description: 'Whether to return only entries that begin with the `filepath-` prefix. * `1` — Return only files that begin with the `filepath-` prefix. * `0` — Return **all** files. If you do not use this parameter, the function returns all filenames.' in: query name: limit_to_list required: false schema: enum: - 0 - 1 example: 0 type: integer - description: 'The MIME types to return. * If you use this parameter, the function returns the specified MIME types and sets the `include_mime` parameter''s value to `1`. * If you do **not** use this parameter, the function returns all MIME types.' in: query name: mime_types required: false schema: example: text-plain type: string - description: 'A comma-separated list of files to return. If you do not use this parameter, the function returns all files.' in: query name: only_these_files required: false schema: example: cpbackup-exclude.conf type: string - description: 'The raw MIME types to return. * If you use this parameter, the function returns the specified MIME types and sets the `include_mime` parameter''s value to `1`. * If you do **not** use this parameter, the function returns all MIME types.' in: query name: raw_mime_types required: false schema: example: text/plain type: string - description: 'Whether to include hidden files in the output. * `1` — Include hidden files. * `0` — Do **not** include hidden files.' in: query name: show_hidden required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: '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.' explode: false in: query name: types required: false schema: items: example: file|dir type: string type: array style: pipeDelimited 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: list_files type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: dirs: description: An array of objects containing information about each directory. items: properties: absdir: description: The file path to the user's home directory. example: /home/user format: path type: string ctime: description: The directory's creation date. example: 1400573272 format: unix_timestamp type: integer exists: description: 'Whether the directory exists in the directory. * `1` — Exists. * `0` — Does **not** exist.' enum: - 0 - 1 example: 1 type: integer file: description: The directory name. example: cgi-bin type: string fullpath: description: The directory's full directory path. example: /home/user/public_html/cgi-bin format: path type: string gid: description: The directory owner's system group ID. example: 503 minimum: 1 type: integer humansize: description: 'The formatted size of the directory. The function returns the size with one of the following symbols: * `KB` — Kilobytes. * `MB` — Megabytes. * `GB` — Gigabytes.' example: 5 KB type: string isleaf: description: 'Whether the directory contains subdirectories. * `1` — Contains subdirectories. * `0` — Does **not** contain subdirectories.' enum: - 0 - 1 example: 1 type: integer isparent: description: 'Whether the directory is a parent record. * `1` — A parent record. * `0` — **Not** a parent record.' enum: - 0 - 1 example: 1 type: integer mimename: description: The MIME type's name. example: text-plain type: string mimetype: description: The directory's MIME's type. example: text/plain type: string mode: description: The directory's textual permissions in [Unix format](http://en.wikipedia.org/wiki/File_system_permissions#Notation_of_traditional_Unix_permissions). example: '16877' format: unix-file-permission type: string mtime: description: The directory's last modification time. example: 1400573272 format: unix_timestamp type: integer nicemode: description: The directory's numerical permissions. example: 755 format: unix-file-permission type: integer path: description: The path to the directory. example: /home/user/public.html format: path type: string rawmimename: description: The directory's raw MIME type's name. example: text-plain type: string rawmimetype: description: The directory's raw MIME type. example: text/plain type: string read: description: 'Whether the directory is readable. * `1` — Readable. * `0` — **Not** readable. **Note:** The function only returns this value if the `include_permissions` value is `1`.' enum: - 0 - 1 example: 1 type: integer size: description: The directory's size, in bytes. example: 4096 minimum: 1 type: integer type: description: 'The item''s type. * `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.' enum: - file - dir - char - block - fifo - link - socket example: file type: string uid: description: The directory owner's system user ID. example: 502 minimum: 1 type: integer write: description: 'Whether the directory is writable. * `1` — Writable. * `0` — **Not** writable. **Note:** The function only returns this value if the `include_permissions` value is `1`.' enum: - 0 - 1 example: 1 type: integer type: object type: array files: description: An array of objects containing information about each file. items: properties: absdir: description: The file path to the user's home directory. example: /home/user format: path type: string ctime: description: The file's creation time. example: 1400573272 format: unix_timestamp type: integer exists: description: 'Whether the file exists in the directory. * `1` — Exists. * `0` — Does **not** exist.' enum: - 0 - 1 example: 1 type: integer file: description: The filename. example: cgi-bin type: string fullpath: description: The file's full file path. example: /home/user/public_html/cgi-bin format: path type: string gid: description: The file owner's system group ID. example: 503 minimum: 1 type: integer humansize: description: 'The formatted size of the file. The function returns the size with one of the following symbols: * `KB` — Kilobytes. * `MB` — Megabytes. * `GB` — Gigabytes.' example: 5 KB type: string isleaf: description: 'Whether the directory contains subdirectories. * `1` — Contains subdirectories. * `0` — Does **not** contain subdirectories.' enum: - 0 - 1 example: 1 type: integer isparent: description: 'Whether the file is a parent record. * `1` — A parent record. * `0` — **Not** a parent record.' enum: - 0 - 1 example: 1 type: integer mimename: description: The file's MIME type name. example: text-plain type: string mimetype: description: The file's MIME type. example: text/plain type: string mode: description: The file's textual permissions. example: '16877' format: unix-file-permission type: string mtime: description: The file's last modification time. example: 1400573272 format: unix_timestamp type: integer nicemode: description: The file's numerical permissions. example: 755 format: unix-file-permission type: integer path: description: The absolute path to the file. example: /home/user/public.html format: path type: string rawmimename: description: The file's raw MIME type's name. example: text-plain type: string rawmimetype: description: The file's raw MIME type. example: text/plain type: string read: description: 'Whether the file is readable. * `1` — Readable. * `0` — **Not** readable. **Note:** The function only returns this value if the `include_permissions` value is `1`.' enum: - 0 - 1 example: 1 type: integer size: description: The file's size, in bytes. example: 4096 minimum: 1 type: integer type: description: 'The item''s type. * `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.' enum: - file - dir - char - block - fifo - link - socket example: file type: string uid: description: The file owner's system user ID. example: 502 minimum: 1 type: integer write: description: 'Whether the file is writable. * `1` — Writable. * `0` — **Not** writable. **Note:** The function only returns this value if the `include_permissions` value is `1`.' enum: - 0 - 1 example: 1 type: integer type: object type: array 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: Return directory content tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n list_files \\\n dir='public_html'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/list_files?dir=public_html - 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 Fileman_list_files.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/Fileman_list_files.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/Fileman/,\n q/list_files/,\n {\n 'dir' => 'public_html',\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 Fileman_list_files.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/Fileman_list_files.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 'Fileman',\n 'list_files',\n array (\n 'dir' => 'public_html',\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 11.44 /Fileman/move_file: get: x-readonly: false x-rollback: none description: 'This function moves a file or directory to a new location. If the destination is an existing directory, the source is moved into it. The function returns an error if the destination already exists. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-move_file parameters: - description: The path to move the source to. in: query name: destination required: true schema: example: public_html/subdir/new.txt format: path type: string - description: The path to the file or directory to move. in: query name: source required: true schema: example: public_html/old.txt format: path 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: move_file type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: src: description: The resolved source path. example: /home/user/public_html/old.txt format: path type: string dest: description: The resolved destination path. example: /home/user/public_html/subdir/new.txt format: path 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: Move a file tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n move_file \\\n source='public_html/old.txt' \\\n destination='public_html/subdir/new.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/move_file?source=public_html/old.txt&destination=public_html/subdir/new.txt - 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 Fileman_move_file.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/Fileman_move_file.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/Fileman/,\n q/move_file/,\n {\n 'source' => 'public_html/old.txt',\n 'destination' => 'public_html/subdir/new.txt',\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 Fileman_move_file.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/Fileman_move_file.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 'Fileman',\n 'move_file',\n array (\n 'source' => 'public_html/old.txt',\n 'destination' => 'public_html/subdir/new.txt',\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 136 /Fileman/rename_file: get: x-readonly: false x-rollback: clean description: 'This function changes the name of a file or directory within the same directory. To move a file to a different directory, use the move_file function. The function returns an error if the destination already exists. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-rename_file parameters: - description: The new path, in the same directory as the source. in: query name: destination required: true schema: example: public_html/new.txt format: path type: string - description: The path to the file or directory to rename. in: query name: source required: true schema: example: public_html/old.txt format: path 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: rename_file type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: src: description: The resolved source path. format: path type: string dest: description: The resolved destination path. format: path 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: Rename a file tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n rename_file \\\n source='public_html/old.txt' \\\n destination='public_html/new.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/rename_file?source=public_html/old.txt&destination=public_html/new.txt - 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 Fileman_rename_file.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/Fileman_rename_file.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/Fileman/,\n q/rename_file/,\n {\n 'source' => 'public_html/old.txt',\n 'destination' => 'public_html/new.txt',\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 Fileman_rename_file.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/Fileman_rename_file.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 'Fileman',\n 'rename_file',\n array (\n 'source' => 'public_html/old.txt',\n 'destination' => 'public_html/new.txt',\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 136 /Fileman/restore_from_trash: get: x-readonly: false x-rollback: none description: 'This function restores a previously trashed file or directory to its original location. Pass the item''s original path. If the path was trashed more than once, the function restores the most recent copy. The function returns an error if the original path already exists. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-restore_from_trash parameters: - description: The original path of the trashed file or directory. in: query name: path required: true schema: example: public_html/unwanted.txt format: path 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: restore_from_trash type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: path: description: The restored path. format: path type: string trash_leaf: description: The trash directory name that the function restored from. example: unwanted.txt 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: Restore a file from the trash tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n restore_from_trash \\\n path='public_html/unwanted.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/restore_from_trash?path=public_html/unwanted.txt - 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 Fileman_restore_from_trash.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/Fileman_restore_from_trash.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/Fileman/,\n q/restore_from_trash/,\n {\n 'path' => 'public_html/unwanted.txt',\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 Fileman_restore_from_trash.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/Fileman_restore_from_trash.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 'Fileman',\n 'restore_from_trash',\n array (\n 'path' => 'public_html/unwanted.txt',\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 136 /Fileman/save_file_content: get: x-readonly: false x-rollback: none description: 'This function saves a file in a directory and encodes it in a character set. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-save_file_content parameters: - description: The files to retrieve. in: query name: file required: true schema: example: example.html type: string - description: The new file's contents. If you do **not** use this parameter, the function creates a blank file. in: query name: content required: false schema: example: hi type: string - description: 'The directory that contains the selected file. **Note:** This parameter defaults to the currently-authenticated user''s `/home` directory.' in: query name: dir required: false schema: example: /home/username/public_html format: path type: string - description: 'Whether the function will return an error or save in the default character set if it cannot save in the specified character set. * `1` — Save in the default character set. * `0` — Return an error.' in: query name: fallback required: false schema: default: 1 enum: - 0 - 1 example: 0 type: integer - description: The [character set encoding](https://en.wikipedia.org/wiki/Character_encoding) of the `content` parameter's value. in: query name: from_charset required: false schema: default: UTF-8 example: UTF-8 type: string - description: The [character set encoding](https://en.wikipedia.org/wiki/Character_encoding) in which to encode the file. in: query name: to_charset required: false schema: default: UTF-8 example: ASCII 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: save_file_content type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: from_charset: description: The file's character set. example: UTF-8 type: string path: description: The path to the file. example: /home/user/public_html/example.html format: path type: string to_charset: description: The file's new character set. example: ASCII 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: Save file tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n save_file_content \\\n file='example.html'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/save_file_content?file=example.html - 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 Fileman_save_file_content.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/Fileman_save_file_content.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/Fileman/,\n q/save_file_content/,\n {\n 'file' => 'example.html',\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 Fileman_save_file_content.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/Fileman_save_file_content.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 'Fileman',\n 'save_file_content',\n array (\n 'file' => 'example.html',\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 11.44 /Fileman/transcode: get: x-readonly: false x-rollback: none description: 'This function converts a buffer from one encoding language to another. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-transcode parameters: - description: The file's contents. in: query name: content required: true schema: example: hi type: string - description: "Whether to discard any characters that do not transcode correctly.\n * `1` - Discard invalid characters.\n * `0` - Transcode invalid characters in the default [character set encoding](https://en.wikipedia.org/wiki/Character_encoding)." in: query name: discard_illegal required: false schema: enum: - 0 - 1 example: 1 type: integer - description: The file's current [character set encoding](https://en.wikipedia.org/wiki/Character_encoding). in: query name: from_charset required: false schema: example: UTF-8 type: string - description: The [character set encoding](https://en.wikipedia.org/wiki/Character_encoding) in which to encode the file. in: query name: to_charset required: false schema: example: ASCII type: string - description: "Whether to transcode invalid characters to valid characters in the new character set encoding.\n * `1` - Transcode invalid characters in the new [character set encoding](https://en.wikipedia.org/wiki/Character_encoding).\n * `0` - Return an error message." in: query name: transliterate required: false schema: enum: - 0 - 1 example: 0 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: transcode type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: charset: description: The file's new character set. example: ASCII type: string content: description: The file's content. example: hi 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: Update buffer encoding tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n transcode \\\n content='hi'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/transcode?content=hi - 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 Fileman_transcode.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/Fileman_transcode.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/Fileman/,\n q/transcode/,\n {\n 'content' => 'hi',\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 Fileman_transcode.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/Fileman_transcode.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 'Fileman',\n 'transcode',\n array (\n 'content' => 'hi',\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 11.44 /Fileman/trash_file: get: x-readonly: false x-rollback: none description: 'This function moves a file or directory to the account trash directory and records its original path so that you can restore it later with the restore_from_trash function. **Important:** When you disable the File Storage role, the system **disables** this function.' operationId: Fileman-trash_file parameters: - description: The path to the file or directory to move to the trash. in: query name: path required: true schema: example: public_html/unwanted.txt format: path 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: trash_file type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: path: description: The resolved original path. format: path type: string trash_leaf: description: The name of the item inside the trash directory. example: unwanted.txt 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: Move a file to the trash tags: - Fileman x-codeSamples: - label: CLI lang: Shell source: "uapi --output=jsonpretty \\\n --user=username \\\n Fileman \\\n trash_file \\\n path='public_html/unwanted.txt'\n" - label: URL lang: HTTP source: https://hostname.example.com:2083/cpsess##########/execute/Fileman/trash_file?path=public_html/unwanted.txt - 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 Fileman_trash_file.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/Fileman_trash_file.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/Fileman/,\n q/trash_file/,\n {\n 'path' => 'public_html/unwanted.txt',\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 Fileman_trash_file.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/Fileman_trash_file.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 'Fileman',\n 'trash_file',\n array (\n 'path' => 'public_html/unwanted.txt',\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 136 /Fileman/upload_files: post: x-readonly: false x-rollback: none description: 'This function uploads one or more files to a directory. **Important:** * You **must** send the files as parts of a `multipart/form-data` request body. Query parameters cannot carry a file. For security reasons, the system discards any query parameter whose name begins with `file-`. * You can''t pass the file parts on the command line, and LiveAPI can''t call this function at all, because neither can send a `multipart/form-data` body. * When you disable the File Storage role, the system **disables** this function. * You cannot call this function through WHM API 1''s uapi_cpanel function. **Note:** * The system names each stored file after that part''s `filename` attribute, **not** after the form field''s name. By convention, name the fields `file-0`, `file-1`, and so on, as the cPanel interface does. * The system scans every uploaded file for viruses and rejects an infected file. * The system rejects a filename of `.` or `..`, or a filename that contains control characters or any of the ``, `;`, and `/` characters. * If one request contains two files with the same name, the system renames the second file. For example, `example-2.png`. * For more information about how to use this function in your custom code, read our Use UAPI''s `Fileman::upload_files` Function in Custom Code tutorial.' operationId: Fileman-upload_files summary: Upload files tags: - Fileman parameters: - description: 'The directory in which to store the uploaded files. **Note:** * A relative path resolves against the account''s home directory. * This parameter defaults to the account''s home directory. * The system creates the directory if it does not exist.' in: query name: dir required: false schema: example: /home/username/public_html format: path type: string - description: 'Whether to include the account''s disk usage in the response. * `1` - Return the `diskinfo` object. * `0` - Do not return the `diskinfo` object.' in: query name: get_disk_info required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: 'Whether to replace a file that already exists in the target directory. * `1` - Overwrite the existing file. * `0` - Fail that file with an "already exists" reason.' in: query name: overwrite required: false schema: default: 0 enum: - 0 - 1 example: 1 type: integer - description: "The permissions to apply to every file in the request, in octal\nnotation.\n\n**Note:**\n\n* The system reads both `0644` and `644` as octal.\n* This parameter defaults to `0644`.\n* If the system cannot apply the permissions, the upload still succeeds\n and the function returns a warning for that file." in: query name: permissions required: false schema: default: '0644' example: '0600' format: unix-file-permission pattern: ^[0]?[0-7]{3}$ type: string requestBody: content: multipart/form-data: schema: properties: file-0: description: A file to upload. format: binary type: string required: - file-0 type: object description: "The files to upload. For more information about this structure, read\nMozilla's [POST\nMethod](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)\ndocumentation.\n\n**Important:**\n\n* You **must** use this request body. You can't pass the files as query\n parameters or on the command line.\n* The system names the stored file after the part's `filename`\n attribute, not after the field name.\n\n**Note:**\n\nTo upload multiple files in one request, increment the field name. For\nexample: `file-0`, `file-1`, and `file-2`." required: true 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: upload_files type: string module: description: The name of the module called. example: Fileman type: string result: properties: data: properties: diskinfo: additionalProperties: description: 'The `_humansize` variant of the value of the same name, formatted for display. For example, `4.5 GB`.' type: string description: "The account's disk usage and upload limits. The\nsystem **only** returns this object when you pass\nthe `get_disk_info` parameter.\n\n**Note:**\n\n* The object also contains a `_humansize` variant\n of every value below, formatted for display. For\n example, `spaceused_humansize`.\n* The system returns each byte count as a decimal\n string with two decimal places, and each inode\n count as a number.\n* A value that the account's quota does not limit\n appears as an infinity symbol (∞)." properties: file_upload_max_bytes: description: The largest size, in bytes, that a single uploaded file may reach. example: '104857600.00' type: string file_upload_must_leave_bytes: description: The amount of free space, in bytes, that must remain after an upload. example: '5242880.00' type: string file_upload_remain: description: The total size, in bytes, that the account may upload now. example: '4718592.00' type: string fileslimit: anyOf: - type: integer - type: string description: The number of inodes that the account may use. example: 16896 filesremain: anyOf: - type: integer - type: string description: The number of inodes that the account may still use. example: 15872 filesused: anyOf: - type: integer - type: string description: The number of inodes that the account uses. example: 1024 spacelimit: description: The disk space, in bytes, that the account may use. example: '4718592.00' type: string spaceremain: description: The disk space, in bytes, that the account may still use. example: '2359296.00' type: string spaceused: description: The disk space, in bytes, that the account uses. example: '2359296.00' type: string type: object failed: description: The number of files that the system did not store. example: 0 type: integer succeeded: description: The number of files that the system stored. example: 1 type: integer uploads: description: One entry for each file in the request. items: properties: file: description: The file's name. example: example.png type: string reason: description: A description of the outcome for this file. example: Upload of “example.png” succeeded. type: string size: description: The stored file's size, in bytes. The system returns `null` when the upload failed. example: 268 type: - integer - 'null' status: description: '* `1` - The system stored the file. * `0` - The upload failed. Check the `reason` value.' enum: - 0 - 1 example: 1 type: integer warnings: description: Non-critical problems, such as a failure to apply the file's ownership or permissions. items: type: string type: array type: object type: array warned: description: The number of files that produced warnings. example: 0 type: integer type: object errors: description: "List of errors if the API failed. This function returns\none of the following errors:\n\n* `You must specify at least one file to upload.` - The\n request contained no file. The system also returns\n this error when it discarded the request's only file\n for exceeding the `file_upload_max_bytes` limit or for\n leaving less than `file_upload_must_leave_bytes` of\n free space.\n* `Failed to upload any of the requested files with\n various failures.` - Every file failed. Check each\n entry's `reason` value in the `uploads` array." 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. x-codeSamples: - label: URL lang: HTTP source: "curl -F \"file-0=@/path/to/local.bin;filename=example.bin\" \\\n -F \"dir=public_html\" \\\n -F \"overwrite=1\" \\\n -H \"Authorization: cpanel username:APITOKEN\" \\\n https://hostname.example.com:2083/execute/Fileman/upload_files\n" x-cpanel-api-version: UAPI x-cpanel-available-version: cPanel 11.44 x-cpanel-cli-support: false 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