API

API quickstart

Make a read-only request before automating changes.

1. Prepare a key

Create a read-only API key in Integration & API. Store it in an environment variable or secret manager. The examples use UPTIVA_API_KEY; they do not contain a real key. Keep the value out of browser JavaScript, screenshots and repositories.

2. List monitors with curl

Example
curl --fail-with-body --max-time 20 "https://uptiva.linuxmaster.cloud/api/monitors" \
  -H "Authorization: Bearer $UPTIVA_API_KEY"

A successful response is an array of monitor objects, not a pagination envelope. Fields may include the monitor ID, name, type, target, status and recent summary values. Summary values can be null when no suitable check data is available. Do not interpret missing data as zero uptime or zero latency.

JavaScript / Node.js

Example
const key = process.env.UPTIVA_API_KEY;
if (!key) throw new Error("Set UPTIVA_API_KEY");
const response = await fetch("https://uptiva.linuxmaster.cloud/api/monitors", {
  headers: { Authorization: `Bearer ${key}` },
  signal: AbortSignal.timeout(20000),
});
if (!response.ok) {
  throw new Error(`Uptiva ${response.status}: ${await response.text()}`);
}
const monitors = await response.json();
for (const monitor of monitors) {
  console.log(monitor.id, monitor.name, monitor.status);
}

Python

Example
import json, os, urllib.request, urllib.error

request = urllib.request.Request(
    "https://uptiva.linuxmaster.cloud/api/monitors",
    headers={"Authorization": "Bearer " + os.environ["UPTIVA_API_KEY"]},
)
try:
    with urllib.request.urlopen(request, timeout=20) as response:
        monitors = json.load(response)
    for monitor in monitors:
        print(monitor["id"], monitor["name"])
except urllib.error.HTTPError as error:
    raise RuntimeError(f"Uptiva {error.code}: {error.read().decode()}") from error

3. Read one monitor

Use an ID returned by the list. Replace MONITOR_ID below before running the command.

Example
curl --fail-with-body "https://uptiva.linuxmaster.cloud/api/monitors/MONITOR_ID/stats?range=7d" \
  -H "Authorization: Bearer $UPTIVA_API_KEY"

Supported statistics ranges are 24h, 7d, 30d and 90d. For creation or other writes, use the monitor workflows guide and an appropriate write key.