SFTP Read File
Read file content from a VPS. Supports text (utf8) and binary (base64) encoding. Maximum file size is 10 MB.
Request
GET /api/v1/vps/{id}/sftp/read?path=/etc/nginx/nginx.conf
Required scope: vps:manage
Path Parameters
| Parameter |
Type |
Description |
id |
string |
The VPS ID |
Query Parameters
| Parameter |
Type |
Required |
Description |
path |
string |
Yes |
Absolute path of the file to read |
encoding |
string |
No |
utf8 (default) or base64 |
Headers
| Header |
Required |
Value |
Authorization |
Yes |
Bearer YOUR_API_KEY |
Response
{
"data": {
"path": "/etc/nginx/nginx.conf",
"content": "worker_processes auto;\nevents { ... }\n",
"encoding": "utf8",
"size": 1024
}
}
Response Fields
| Field |
Type |
Description |
path |
string |
Normalized absolute path |
content |
string |
File content in the requested encoding |
encoding |
string |
The encoding used (utf8 or base64) |
size |
number |
File size in bytes |
Errors
| Status |
Code |
Description |
| 400 |
MISSING_PATH |
The path query parameter is missing |
| 400 |
INVALID_PATH |
Path is not absolute |
| 400 |
INVALID_ENCODING |
Encoding is not utf8 or base64 |
| 400 |
READ_ERROR |
File could not be read |
| 404 |
NOT_FOUND |
VPS not found or not accessible |
| 404 |
FILE_NOT_FOUND |
File does not exist |
| 408 |
TIMEOUT |
File read timed out |
| 413 |
FILE_TOO_LARGE |
File exceeds 10 MB |
| 502 |
SSH_AUTH_ERROR |
SSH authentication failed |
| 502 |
SSH_CONNECTION_ERROR |
Could not connect to VPS |
Example
curl "https://site.quest/api/v1/vps/699cdea2ab57a244bb5273fd/sftp/read?path=/etc/hostname" \
-H "Authorization: Bearer YOUR_API_KEY"
MCP
This action is also available via the read_file MCP tool.