v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
Fileman
Manage Files

Return file content

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.

get/Fileman/get_file_content

Query parameters

dirstring path required
Example:/home/user/public.html

The file path to the directory that contains the selected file.

filestring required
Example:example.html

The file to retrieve.

from_charsetstring
Example:_DETECT_

The file’s character encoding. This parameter defaults to _DETECT_, which indicates a request to detect the file’s character encoding.

to_charsetstring
Example:_LOCALE_

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.

update_html_document_encoding0 | 1
Example:1

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.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "get_file_content",
  "module": "Fileman",
  "result": {
    "data": {
      "content": "`hi`",
      "dir": "/home/user/public_html",
      "filename": "example.html",
      "from_char": "UTF-8",
      "path": "/home/user/public_html/example.html",
      "to_char": "UTF-8"
    },
    "status": 1
  }
}