---
title: "Search the project's stored logs: app output (runtime), build logs (build) or requests (http), newest first"
method: GET
path: "/projects/{projectId}/logs/search"
tags: ["Logs"]
---

# Search the project's stored logs: app output (runtime), build logs (build) or requests (http), newest first

`GET /projects/{projectId}/logs/search`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/projects/{projectId}/logs/search`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

Lines are kept as long as the plan says (Free 1 day, Pro 7 days, Business 30 days). One call reads a bounded part of the range; pass nextCursor to go on with older lines. Secret environment values are redacted in app and build lines; request lines hold no client address or query string. Needs logs:read.

## Path parameters

- `projectId` string, uuid, required

## Query parameters

- `source` 'runtime' | 'build' | 'http': runtime: the app's own output; build: build logs of deployments; http: requests the platform proxy served for the project's hostnames
- `from` string, date-time: oldest line to include; default: 24 hours ago, never before the plan keeps lines
- `to` string, date-time: newest line to include; default: now
- `q` string: text to find (case does not matter); several words must all appear
- `level` 'all' | 'errors': errors: error lines only (stderr/error words; 5xx for requests)
- `status` 'all' | '2xx' | '3xx' | '4xx' | '5xx': requests only: the status class
- `deploymentId` string, uuid: build logs of one deployment
- `cursor` string: nextCursor of the previous page: continue with older lines
- `limit` integer

## Response `200`

Lines

- object
  - `items` object[], required: newest first
    - `ts` string, required: ISO-8601 timestamp
    - `source` 'runtime' | 'build' | 'http', required: runtime: the app's own output; build: build logs of deployments; http: requests the platform proxy served for the project's hostnames
    - `level` 'error' | 'warning' | 'info', required
    - `stream` 'stdout' | 'stderr' | 'system' | 'null', nullable, required
    - `message` string, required: the line (requests: "GET /path 500")
    - `request` object, nullable, required: requests only
      - `method` string, required
      - `host` string, required
      - `path` string, required
      - `status` integer, required
      - `durationMs` integer, nullable, required
    - `deploymentId` string, uuid, nullable, required: build lines only
  - `nextCursor` string, nullable, required: pass as cursor for older lines; null when the whole range was searched
  - `from` string, required: ISO-8601 timestamp
  - `to` string, required: ISO-8601 timestamp
  - `retentionDays` integer, required: how long the project's plan keeps lines
  - `scannedLines` integer, required
  - `complete` boolean, required: false: the search stopped early (page full or time budget); nextCursor continues it

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `429`: Too many requests (code rate_limited); see Retry-After
- `501`: Not available on this server yet (code not_configured): migration 190 is not applied

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
