---
title: "CPU and memory of a project over time (per resource: the project, its previews, its databases) against the allocated resources and the plan, with restarts and out-of-memory kills. 1h: every minute, 24h: 5-minute points, 7d/30d: from 15-minute rollups"
method: GET
path: "/projects/{projectId}/metrics"
tags: ["Metrics"]
---

# CPU and memory of a project over time (per resource: the project, its previews, its databases) against the allocated resources and the plan, with restarts and out-of-memory kills. 1h: every minute, 24h: 5-minute points, 7d/30d: from 15-minute rollups

`GET /projects/{projectId}/metrics`

## Request

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

## Path parameters

- `projectId` string, uuid, required

## Query parameters

- `range` '1h' | '24h' | '7d' | '30d'

## Response `200`

Metrics

- object
  - `projectId` string, uuid, required
  - `range` '1h' | '24h' | '7d' | '30d', required
  - `resolutionSeconds` integer, required
  - `from` string, required: ISO-8601 timestamp
  - `to` string, required: ISO-8601 timestamp
  - `collecting` boolean, required: the host collector reported within the last 5 minutes (false: graphs are not collected on this server yet)
  - `lastReportAt` string, nullable, required: when the collector last reported (platform-wide)
  - `oomKillsCounted` boolean, required: false: the collector cannot read the kernel log, so oomKills stay 0
  - `plan` object, nullable, required: the most CPU and memory one resource may get on the team's plan
    - `cpus` number, required
    - `memoryMb` integer, required
  - `series` object[], required: the project first, then its previews, then its databases
    - `kind` 'project' | 'preview' | 'database', required
    - `id` string, uuid, required: the project, preview or database id
    - `name` string, required: project name, preview branch or database name
    - `allocation` object, nullable, required: CPU and memory allocated to this resource; the graphs' limit line
      - `cpus` number, required
      - `memoryMb` integer, required
    - `containerLimits` object, nullable, required: limits the running containers actually have (null fields: none); new limits apply at the next start or restart
      - `cpus` number, nullable, required
      - `memoryBytes` number, nullable, required
    - `latest` object, nullable, required: the newest sample of the last 10 minutes (null: not running or not measured)
      - `at` string, required: ISO-8601 timestamp
      - `containers` integer, required
      - `cpuCores` number, nullable, required
      - `memoryBytes` number, nullable, required
    - `summary` object, required
      - `cpuCoresAvg` number, nullable, required
      - `cpuCoresPeak` number, nullable, required
      - `memoryBytesAvg` number, nullable, required
      - `memoryBytesPeak` number, nullable, required
      - `restarts` integer, required
      - `oomKills` integer, required
      - `lastRestartAt` string, nullable, required: start of the latest interval with a restart
      - `lastOomKillAt` string, nullable, required: ISO-8601 timestamp
    - `points` object[], required
      - `at` string, required: start of the point's interval (resolutionSeconds long)
      - `cpuCores` number, nullable, required: average CPU use in cores (1 = one full CPU); null before a container's second sample
      - `cpuCoresMax` number, nullable, required: highest one-minute average within the interval
      - `memoryBytes` number, nullable, required: average memory in use (without reclaimable file cache)
      - `memoryBytesMax` number, nullable, required
      - `restarts` integer, required: times a container was restarted after it exited (a crash; a redeploy is not a restart)
      - `oomKills` integer, required: processes the kernel killed because the resource reached its memory limit

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden; needs projects:read)
- `404`: Not found or not visible to the caller (code not_found)
- `429`: Too many requests (code rate_limited); see Retry-After

---

[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)
