Inspect website files
GET /api/v2/shared-hosting/{accountId}/diagnostics/files
Look at a website’s files on a web hosting account without changing anything. action lists a folder, reads one file or searches for text. Paths are relative to the website’s document root. domain picks the website. No code runs. Credential files, keys, backups, database dumps, binary files and symbolic links are never returned. A config file returns only the recognised settings that are not secrets. Values that look like secrets are redacted in other files. read returns up to 200 lines of a file of at most 1 MiB. For the end of a larger log, use tail=true. search finds literal text and ignores case. It stops after 40 files, 2 MiB, 1000 entries or 60 matches and then sets truncated. The account must be active and on cPanel.
Authentication: An API key with the scopes read:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredacct_…).Query parameters
domainstringactionstringrequiredlist a folder, read one file or search a folder and its subfolders for query. One of list, read, search.pathstring.. segments. Default "".querystringsearch only.startLineintegerread only. Cannot be combined with tail. Default 1. 1 to 100000.linesintegerstartLine or from the end with tail. read only. Each line is cut at 2000 characters. Default 100. 1 to 200.tailbooleanlines lines of a log file (error_log or *.log). read only. Default false.offsetintegernextOffset from the previous response. list only. Default 0. 0 to 100000.Example
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/diagnostics/files?action=list" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 A read-only snapshot. The fields depend on action.
{ "domain": "example.com", "view": "settings", "settings": { "ps_caching": "CacheMemcached", "ps_cache_enable": false }, "sizeBytes": 1005, "notice": "Only recognized non-secret static settings are returned; omitted values and the runtime state are unknown."}Response fields
domainstringviewstringread returned: settings for a config file, source for lines of a file, log_tail for the end of a log. One of settings, source, log_tail.directoryPermissionsstringlist only. Octal permissions of the listed folder, for example 0755.directoryWebServerReadablebooleanlist only. False when the web server cannot enter the listed folder.entriesarray of objectlist only. Up to 200 files and folders per page.namestringtypestringfile or directory. One of file, directory.sizeBytesintegermodifiedstring or nullpermissionsstring0644.webServerReadablebooleanviewstringread returns for this file: settings or source. One of settings, source.otherFilesNotWebServerReadableobjectlist only. Present when files left out of the listing, such as images, cannot be read by the web server.countintegernamesarray of stringsettingsobjectread of a config file. The recognised settings that are not secrets.linesarray of objectread of a file or log. The requested lines.lineinteger or nulltextstringmatchesarray of objectsearch only. Lines that contain query, at most 60.pathstringlineinteger or nulltextstringsizeBytesintegerread only. The file’s size in bytes.modifiedstring or nullread of a file or log. When the file was last changed.foreignHomePathsarray of objectread of a file or log. Present when it names home folders of other accounts, for example paths left by a previous host.homestringlinesintegerinspectedEntriesintegersearch only. Files and folders the search looked at.truncatedbooleannoticestringnextOffsetinteger or nulllist only. offset for the next page. Null on the last page.scanLimitedbooleanlist only. True when the folder holds more than 1000 entries and the rest were not read.filesReadintegersearch only. Files the search read.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Unknown or repeated query parameter. A value out of range. |
| 401 | Authentication required. |
| 403 | Missing scope. Domain not on this account (domain_not_owned). Protected path or file (protected_path, protected_file). |
| 404 | The account or the path was not found. |
| 409 | File changed during the read (file_changed). Account not on cPanel (account_not_eligible_cpanel). |
| 422 | File larger than 1 MiB (file_too_large). tail on a file that is not a log. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | The inspection could not finish. The website’s state is unknown. |