Get website file content
Get a single file's content, relative to a website's document root.
Get a single file's content, relative to a website's document root.
Read-only; refuses symlinks, oversized files, non-text file types, and files identified as containing secrets (e.g. credential files) — none of these are returned by this endpoint.
API Token authentication
u123456789Domain name
mydomain.tldFile path, relative to the document root.
index.phpLine offset to start reading from.
0Example: 0Max number of lines to return.
5000Example: 1000Success response
File path, relative to the document root.
index.phpFile content for the requested line range.
<?php echo 'Hello world';Line offset the returned content starts from.
0Total number of lines in the file.
84Total file size in bytes.
2048Unauthenticated response
Validation error response
Error response
GET /api/hosting/v1/accounts/{username}/domains/{domain}/files/content?path=index.php HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"path": "index.php",
"content": "<?php\necho 'Hello world';\n",
"from_line": 0,
"total_lines": 84,
"size_bytes": 2048
}Last updated
Was this helpful?