For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get website file content

Get a single file's content, relative to a website's document root.

Get website file content

get

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.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
usernamestringRequiredExample: u123456789
domainstringRequired

Domain name

Example: mydomain.tld
Query parameters
pathstringRequired

File path, relative to the document root.

Example: index.php
from_lineinteger · nullableOptional

Line offset to start reading from.

Default: 0Example: 0
max_linesinteger · min: 1 · max: 5000 · nullableOptional

Max number of lines to return.

Default: 5000Example: 1000
Responses
200

Success response

application/json
pathstringRequired

File path, relative to the document root.

Example: index.php
contentstringRequired

File content for the requested line range.

Example: <?php echo 'Hello world';
from_lineintegerRequired

Line offset the returned content starts from.

Example: 0
total_linesintegerRequired

Total number of lines in the file.

Example: 84
size_bytesintegerRequired

Total file size in bytes.

Example: 2048
get/api/hosting/v1/accounts/{username}/domains/{domain}/files/content
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?