API Reference
Metrics

Metrics

Live CPU and memory figures for an environment's containers, or CPU, memory, disk and network figures for one of your servers, read on demand from the server's monitoring agent. An environment's disk sizes come from the last measurement, not live. The same figures appear on the Monitoring pages of the dashboard.

Base URL: https://api.oec.sh/api/public/v1

Works with read-only and full-access keys.

Every call reads from the server. On top of your key's rate limit, each environment and each server accepts at most 6 metrics calls a minute, whichever keys make them, and your organization can make at most 20 environment metrics and runtime-log calls a minute to the environments on one server. A 429 with error: "target_rate_limit" carries retry_after (seconds to wait, also sent as the Retry-After header).


Get Environment Metrics

GET /environments/{env_id}/metrics

Figures for the environment's own containers only, also on a shared server.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Response: 200 OK

{
  "environment_id": "5a296461-9222-40da-91f5-9e912890dc1b",
  "status": "running",
  "odoo": {
    "status": "running",
    "cpu_percent": 12.5,
    "memory_used_bytes": 536870912,
    "memory_limit_bytes": 2147483648,
    "memory_percent": 25.0
  },
  "postgres": {
    "status": "running",
    "cpu_percent": 1.2,
    "memory_used_bytes": 201326592,
    "memory_limit_bytes": 1073741824,
    "memory_percent": 18.75
  },
  "disk": {
    "allocated_gb": 10,
    "database_bytes": 432198144,
    "filestore_bytes": 211345920,
    "addons_bytes": 18350080,
    "measured_at": "2026-10-05T03:00:12Z"
  },
  "queried_at": "2026-10-05T09:12:03.512Z"
}
FieldTypeDescription
statusstringThe environment's status (see Environments).
odoo, postgresobject|nullThe Odoo and database containers. null when the server does not report the container: through the monitoring agent only running containers are reported, while over SSH a stopped container is reported with status stopped.
*.statusstringContainer state, for example running, stopped, restarting.
*.cpu_percentnumber|nullCPU use. 100 means one full core.
*.memory_used_bytes, *.memory_limit_bytes, *.memory_percentnumber|nullMemory in use, the container's limit, and the share of the limit in use.
disk.allocated_gbintegerDisk allocated to the environment.
disk.database_bytes, disk.filestore_bytes, disk.addons_bytesinteger|nullSizes from the last measurement, null if never measured.
disk.measured_atstring|nullWhen the sizes were measured. They are not live.

Some servers are monitored over SSH instead of through the monitoring agent's web endpoint. For those, the container status is known but the CPU and memory figures are null.

Errors

StatuserrorReason
404not_foundEnvironment not found, or outside your key's organization or project.
409no_serverThe environment has no server assigned yet.
409environment_not_readyThe environment is pending, cloning or deploying. Try again when the task has finished.
429target_rate_limitMore than 6 calls in a minute for this environment, or more than 20 calls in a minute from your organization to environments on the same server.
502metrics_unavailableThe server did not return metrics. Try again in a minute.

Example

curl "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID/metrics" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Server Metrics

GET /servers/{server_id}/metrics

Whole-server figures for a server your organization owns. Shared servers return 404, because their figures cover other customers too; use the environment metrics above for your environments on a shared server.

A project-scoped key can read a server only while it hosts an environment of that project.

Path Parameters

ParameterTypeDescription
server_idUUIDThe server ID.

Response: 200 OK

{
  "server_id": "0f6b1d2e-5c1a-4a8e-9d55-4f3f1f3a2b10",
  "status": "healthy",
  "cpu_percent": 31.0,
  "memory_percent": 62.4,
  "memory_used_bytes": 10716446720,
  "memory_total_bytes": 17179869184,
  "disk_percent": 55.0,
  "disk_used_bytes": 88046829568,
  "disk_total_bytes": 160083787776,
  "network_rx_bytes_per_second": 15360.0,
  "network_tx_bytes_per_second": 40960.0,
  "container_count": 9,
  "containers_running": 9,
  "queried_at": "2026-10-05T09:12:03.512Z"
}

Network rates are bytes per second, summed over the server's physical network interfaces.

status is healthy, warning (CPU or memory at 80% or more, or disk at 80% or more) or critical (CPU or memory at 95% or more, or disk at 90% or more).

Errors

StatuserrorReason
404not_foundServer not found, a shared server, owned by another organization, or (project-scoped key) hosting none of the project's environments.
429target_rate_limitMore than 6 calls in a minute for this server.
502metrics_unavailableThe server or its monitoring agent did not respond. Try again in a minute.

Example

curl "https://api.oec.sh/api/public/v1/servers/YOUR_SERVER_ID/metrics" \
  -H "Authorization: Bearer YOUR_API_KEY"