---
title: "Return file content"
method: GET
path: "/Fileman/get_file_content"
tags: ["Fileman", "Manage Files"]
---

# Return file content

`GET /Fileman/get_file_content`

This function retrieves a file's content.

**Important:**

When you disable the [File Storage](https://go.cpanel.net/serverroles) 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.

## Query parameters

- `dir` string, path, required
- `file` string, required
- `from_charset` string
- `to_charset` string
- `update_html_document_encoding` 0 | 1

## Response `200`

HTTP Request was successful.

- object
  - `apiversion` integer — The version of the API.
  - `func` string — The name of the method called.
  - `module` string — The name of the module called.
  - `result` object
    - `data` object
      - `content` string, binary — 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.
      - `dir` string, path — The absolute path to the directory that contains the selected file.
      - `filename` string — The file's name.
      - `from_char` string — 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.
      - `from_charset` unknown
      - `path` string, path — The absolute path to the file.
      - `to_char` string — 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.
      - `to_charset` unknown
    - `errors` string[], nullable — List of errors if the API failed.
    - `messages` string[], nullable — List of messages generated by the API.
    - `metadata` object
    - `status` 0 | 1 — - 1 - Success - 0 - Failed: Check the errors field for more details.
    - `warnings` string[], nullable — List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.

---

[API](https://skmtc.net/cpanel/apis/cpanel-uapi.md) · [All operations](https://skmtc.net/cpanel/apis/cpanel-uapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/cpanel-uapi/revisions/632e2f8e6d04/schema)
