Hosting: NodeJS

Get Node.js runtime logs

Changed on

Returns the Node.js application's runtime console log entries, oldest first, each with timestamp, level and message. On the first call send period (1h, 1d, 1w or 1m) and optionally levels and limit (1-5000, default 1000); when more entries match than limit, the newest are kept.

To poll for new entries send total_lines + 1 from the previous response as from_line and omit period; period and from_line cannot be combined. Lines that are not JSON with a timestamp, level and message are skipped, so logs may hold fewer than limit entries while total_lines counts every raw line. Entries with a timestamp before last_deployed_at belong to the previous deployment. Returns an empty logs list when the application has not written a log file yet.

get/api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/runtime-logs

Request

  • Base URL: https://developers.hostinger.com
  • URL: https://developers.hostinger.com/api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/runtime-logs
  • Auth: HTTP bearer

Path parameters

usernamestring required
Example:u123456789
domainstring required
Example:mydomain.tld

Domain name

Query parameters

period'1h' | '1d' | '1w' | '1m'
Example:1h

Time window for the first fetch. Required when from_line is not sent.

from_lineinteger
Example:5042

1-based line of the log file to start from. For polling send total_lines + 1 from the previous response. Cannot be combined with period.

limitinteger
Example:200

Maximum number of log entries to return. When more entries match, the newest are kept.

levelsstring[]

Return only entries with these log levels, sent as a comma-separated list, e.g. ERROR,WARN. Matching runs on the raw log line, so entries written with numeric levels (for example by pino) are excluded while this filter is set.

[
  "ERROR",
  "WARN"
]

Response

Success response

started_atstring date-time nullable required

Timestamp of the first line of the log file; null when the file is empty or its first line has no timestamp field

total_linesinteger required

Total number of lines in the raw log file. Send total_lines + 1 as from_line in the next poll to receive only new entries.

last_deployed_atstring date-time nullable required

Time of the last completed build; entries before it belong to the previous deployment. null when no build has completed yet.

Example response

{
  "logs": [
    {
      "timestamp": "2026-03-03T09:11:02.001Z",
      "level": "INFO",
      "message": "Server started on port 3000"
    }
  ],
  "started_at": "2026-03-03T09:11:02Z",
  "total_lines": 5042,
  "last_deployed_at": "2026-03-03T08:58:41Z"
}

Changes