MetriBeacon
Menu

GET Read your active rules and persistent alarm state

/api/v1/alarms/rules

Read accessible active rules in pages of 50 (at most 100). Search rule and monitor names and filter type, severity or state before pagination. Follow next_cursor with the same filters, sort and limit; an empty cursor marks the end. Cursors expire after 15 minutes. Paused and muted rules remain available.

On this page

Access and permissions

Read accessible active rules in pages of 50 (at most 100). Search rule and monitor names and filter type, severity or state before pagination. Follow next_cursor with the same filters, sort and limit; an empty cursor marks the end. Cursors expire after 15 minutes. Paused and muted rules remain available.

Browser session: __Host-mb_session cookie.

Machine management credentials in Authorization: Bearer. Check the permissions (scopes) required by the operation.

Parameters and headers

FieldLocationType and limitsRequiredMeaning
qURL querystring; {"maxLength":128}NoCase-insensitive literal search in the documented text fields, applied before the page limit.
limitURL queryinteger; {"default":50,"maximum":100,"minimum":1}NoPage size, 1–100; default 50. A following page exists only when another matching row is available.
cursorURL querystring; {"maxLength":4096}NoOpaque next_cursor from the preceding page. Keep resource, account, filters, sort and limit unchanged; collection cursors expire after 15 minutes.
sortURL querystring; {"enum":["newest","oldest","name_asc","name_desc"]}NoStable order with the record ID as a tie breaker: newest, oldest, name_asc or name_desc.
severityURL querystringNoExact field filter; omit the parameter to include all values.
workspace_idURL querystring; {"format":"uuid"}NoLimit the list to an accessible workspace.
kindURL querystring; {"enum":["numeric","state","text","heartbeat","no_data","run","slo"]}NoExact field filter; omit the parameter to include all values.
stateURL querystring; {"enum":["OK","PENDING","FIRING","NO_DATA","RESOLVED","paused","muted","maintenance","collection_paused"]}NoExact field filter; omit the parameter to include all values.
device_idURL querystring; {"format":"uuid"}NoReturn rules belonging to this monitor.
counts_onlyURL querystring; {"enum":["1"]}NoReturn counts for the requested filter instead of table rows. Counts include search and other filters, excluding this filter selection, sorting and pagination.
count_filterURL querystring; {"enum":["state","kind","severity"]}NoDeclared table filter to count. Requires counts_only=1.
snapshotURL querystring; {"format":"date-time"}NoOptional snapshot from the corresponding table page.

Request body

No request body.

Responses

HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/json

FieldType and limitsRequiredMeaning
$object | objectYes—
$ (anyOf 1)objectNo—
$ (anyOf 1).rulesarray<object>Yes—
$ (anyOf 1).rules[]objectYes—
$ (anyOf 1).rules[].clearobjectYes—
$ (anyOf 1).rules[].clear.operatorstring | nullYes—
$ (anyOf 1).rules[].clear.operator (anyOf 1)stringNo—
$ (anyOf 1).rules[].clear.operator (anyOf 2)nullNo—
$ (anyOf 1).rules[].clear.valuenumber | nullYes—
$ (anyOf 1).rules[].clear.value (anyOf 1)numberNo—
$ (anyOf 1).rules[].clear.value (anyOf 2)nullNo—
$ (anyOf 1).rules[].clear.value_highnumber | nullYes—
$ (anyOf 1).rules[].clear.value_high (anyOf 1)numberNo—
$ (anyOf 1).rules[].clear.value_high (anyOf 2)nullNo—
$ (anyOf 1).rules[].clear_duration_secondsintegerYes—
$ (anyOf 1).rules[].created_atstring; {"format":"date-time"}YesCreation timestamp in RFC 3339 UTC.
$ (anyOf 1).rules[].device_idstringYesUUID of the target device or monitor. The ingestion key must allow this device.
$ (anyOf 1).rules[].equality_tolerancenumberYes—
$ (anyOf 1).rules[].event_case_sensitivebooleanYes—
$ (anyOf 1).rules[].event_containsstring | nullYes—
$ (anyOf 1).rules[].event_contains (anyOf 1)stringNo—
$ (anyOf 1).rules[].event_contains (anyOf 2)nullNo—
$ (anyOf 1).rules[].event_min_severitystring | nullYes—
$ (anyOf 1).rules[].event_min_severity (anyOf 1)stringNo—
$ (anyOf 1).rules[].event_min_severity (anyOf 2)nullNo—
$ (anyOf 1).rules[].event_operatorstringYes—
$ (anyOf 1).rules[].event_whole_wordbooleanYes—
$ (anyOf 1).rules[].idstringYesUUID of this resource. Keep the returned identifier for subsequent operations.
$ (anyOf 1).rules[].kindstringYesResource kind or measurement type selected from the listed values.
$ (anyOf 1).rules[].maintenance_untilstring; {"format":"date-time"} | nullYes—
$ (anyOf 1).rules[].maintenance_until (anyOf 1)string; {"format":"date-time"}No—
$ (anyOf 1).rules[].maintenance_until (anyOf 2)nullNo—
$ (anyOf 1).rules[].muted_untilstring; {"format":"date-time"} | nullYes—
$ (anyOf 1).rules[].muted_until (anyOf 1)string; {"format":"date-time"}No—
$ (anyOf 1).rules[].muted_until (anyOf 2)nullNo—
$ (anyOf 1).rules[].namestringYesHuman-readable resource name. Follow the listed length limit.
$ (anyOf 1).rules[].no_data_secondsinteger | nullYes—
$ (anyOf 1).rules[].no_data_seconds (anyOf 1)integerNo—
$ (anyOf 1).rules[].no_data_seconds (anyOf 2)nullNo—
$ (anyOf 1).rules[].paused_untilstring; {"format":"date-time"} | nullYes—
$ (anyOf 1).rules[].paused_until (anyOf 1)string; {"format":"date-time"}No—
$ (anyOf 1).rules[].paused_until (anyOf 2)nullNo—
$ (anyOf 1).rules[].quiet_secondsinteger | nullYes—
$ (anyOf 1).rules[].quiet_seconds (anyOf 1)integerNo—
$ (anyOf 1).rules[].quiet_seconds (anyOf 2)nullNo—
$ (anyOf 1).rules[].repeat_secondsintegerYesMinimum interval before repeating an unresolved alarm notification.
$ (anyOf 1).rules[].series_idstring | nullYesUUID of the measurement series belonging to the authorized device.
$ (anyOf 1).rules[].series_id (anyOf 1)stringNo—
$ (anyOf 1).rules[].series_id (anyOf 2)nullNo—
$ (anyOf 1).rules[].server_profile_pausedbooleanYes—
$ (anyOf 1).rules[].severitystringYesSeverity value from the listed vocabulary.
$ (anyOf 1).rules[].state_clear_samplesintegerYes—
$ (anyOf 1).rules[].state_trigger_samplesintegerYes—
$ (anyOf 1).rules[].statusstringYes—
$ (anyOf 1).rules[].target_statestring | nullYes—
$ (anyOf 1).rules[].target_state (anyOf 1)stringNo—
$ (anyOf 1).rules[].target_state (anyOf 2)nullNo—
$ (anyOf 1).rules[].triggerobjectYes—
$ (anyOf 1).rules[].trigger.operatorstring | nullYes—
$ (anyOf 1).rules[].trigger.operator (anyOf 1)stringNo—
$ (anyOf 1).rules[].trigger.operator (anyOf 2)nullNo—
$ (anyOf 1).rules[].trigger.valuenumber | nullYes—
$ (anyOf 1).rules[].trigger.value (anyOf 1)numberNo—
$ (anyOf 1).rules[].trigger.value (anyOf 2)nullNo—
$ (anyOf 1).rules[].trigger.value_highnumber | nullYes—
$ (anyOf 1).rules[].trigger.value_high (anyOf 1)numberNo—
$ (anyOf 1).rules[].trigger.value_high (anyOf 2)nullNo—
$ (anyOf 1).rules[].trigger_duration_secondsintegerYes—
$ (anyOf 1).rules[].versionintegerYes—
$ (anyOf 1).rules[].window_functionstringYes—
$ (anyOf 1).rules[].window_secondsintegerYes—
$ (anyOf 1).rules[].deployment_maintenanceobject | nullNo—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1)objectNo—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).expires_atstring; {"format":"date-time"}Yes—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).idstring; {"format":"uuid"}Yes—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).manual_muted_untilstring; {"format":"date-time"} | nullYes—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).manual_muted_until (anyOf 1)string; {"format":"date-time"}No—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).manual_muted_until (anyOf 2)nullNo—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).servicestringYes—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 1).starts_atstring; {"format":"date-time"}Yes—
$ (anyOf 1).rules[].deployment_maintenance (anyOf 2)nullNo—
$ (anyOf 1).rules[].evaluation_statusstring; {"enum":["not_evaluated","current","stale"]}Yes—
$ (anyOf 1).rules[].last_evaluated_atstring; {"format":"date-time"} | nullYes—
$ (anyOf 1).rules[].last_evaluated_at (anyOf 1)string; {"format":"date-time"}No—
$ (anyOf 1).rules[].last_evaluated_at (anyOf 2)nullNo—
$ (anyOf 1).rules[].device_iconAlarmMonitorIconNoOptional monitor identity for lists. Includes the list area, server platform and the same authenticated favicon address used in monitor lists. Target URLs, credentials and measurements are not included.
$ (anyOf 1).rules[].device_icon.monitor_typestringYes—
$ (anyOf 1).rules[].device_icon.list_groupstring; {"enum":["monitors","servers"]}Yes—
$ (anyOf 1).rules[].device_icon.summaryobject; {"additionalProperties":false}Yes—
$ (anyOf 1).rules[].device_icon.summary.platformstring; {"enum":["linux","darwin","windows"]}No—
$ (anyOf 1).rules[].device_icon.summary.favicon_urlstringNo—
$ (anyOf 1).rules[].device_namestringNo—
$ (anyOf 1).limitinteger; {"maximum":100,"minimum":1}Yes—
$ (anyOf 1).next_cursorstringYesCursor for the next matching page; empty when no following page exists.
$ (anyOf 1).snapshotstring; {"format":"date-time"}YesUTC snapshot bound to the cursor; later-created rows do not enter that page sequence.
$ (anyOf 2)objectNo—
$ (anyOf 2).filter_countsTableFilterCountsYes—
$ (anyOf 2).filter_counts.fieldstringYes—
$ (anyOf 2).filter_counts.totalinteger; {"minimum":0}Yes—
$ (anyOf 2).filter_counts.valuesobjectYes—
$ (anyOf 2).filter_counts.completebooleanYes—
$ (anyOf 2).filter_counts.snapshotstring; {"format":"date-time"}Yes—
$ (anyOf 2).filter_counts.counted_atstring; {"format":"date-time"}Yes—
json
{
  "rules": [],
  "next_cursor": "",
  "snapshot": "2026-10-17T00:00:00Z",
  "limit": 50
}
Stable error codes
invalid_credential
unauthorized
HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/problem+json

FieldType and limitsRequiredMeaning
$ProblemYes—
$.codestringYesStable machine-readable error code
$.detailstringYesShort localized explanation without internal error details
$.instancestringYesUnique relative identifier /api/v1/requests/{request_id}; not a retrievable resource
$.messagestringYesTemporarily identical to detail for existing clients
$.message_keystringYesStable translation key for changing the displayed language without another request
$.message_paramsobject; {"additionalProperties":true}YesNamed, safely rendered message parameters; never arbitrary HTML
$.request_idstring; {"pattern":"^[0-9a-f]{32}$"}YesServer-generated diagnostic identifier. It contains no login token or credential.
$.statusinteger; {"maximum":599,"minimum":400}Yes—
$.titlestringYesLocalized HTTP status title
$.typestring; {"const":"about:blank"}Yes—
json
{
  "code": "demo",
  "detail": "Demo error detail; inspect the documented code.",
  "instance": "demo",
  "message": "Demo error detail; inspect the documented code.",
  "message_key": "errors.requestFailed",
  "message_params": {},
  "request_id": "00000000000000000000000000000000",
  "status": 401,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
csrf
insufficient_scope
invalid_origin
HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/problem+json

FieldType and limitsRequiredMeaning
$ProblemYes—
$.codestringYesStable machine-readable error code
$.detailstringYesShort localized explanation without internal error details
$.instancestringYesUnique relative identifier /api/v1/requests/{request_id}; not a retrievable resource
$.messagestringYesTemporarily identical to detail for existing clients
$.message_keystringYesStable translation key for changing the displayed language without another request
$.message_paramsobject; {"additionalProperties":true}YesNamed, safely rendered message parameters; never arbitrary HTML
$.request_idstring; {"pattern":"^[0-9a-f]{32}$"}YesServer-generated diagnostic identifier. It contains no login token or credential.
$.statusinteger; {"maximum":599,"minimum":400}Yes—
$.titlestringYesLocalized HTTP status title
$.typestring; {"const":"about:blank"}Yes—
json
{
  "code": "demo",
  "detail": "Demo error detail; inspect the documented code.",
  "instance": "demo",
  "message": "Demo error detail; inspect the documented code.",
  "message_key": "errors.requestFailed",
  "message_params": {},
  "request_id": "00000000000000000000000000000000",
  "status": 403,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
unavailable
HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
Retry-Afterstring; {"pattern":"^[0-9]+$"}Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/problem+json

FieldType and limitsRequiredMeaning
$ProblemYes—
$.codestringYesStable machine-readable error code
$.detailstringYesShort localized explanation without internal error details
$.instancestringYesUnique relative identifier /api/v1/requests/{request_id}; not a retrievable resource
$.messagestringYesTemporarily identical to detail for existing clients
$.message_keystringYesStable translation key for changing the displayed language without another request
$.message_paramsobject; {"additionalProperties":true}YesNamed, safely rendered message parameters; never arbitrary HTML
$.request_idstring; {"pattern":"^[0-9a-f]{32}$"}YesServer-generated diagnostic identifier. It contains no login token or credential.
$.statusinteger; {"maximum":599,"minimum":400}Yes—
$.titlestringYesLocalized HTTP status title
$.typestring; {"const":"about:blank"}Yes—
json
{
  "code": "demo",
  "detail": "Demo error detail; inspect the documented code.",
  "instance": "demo",
  "message": "Demo error detail; inspect the documented code.",
  "message_key": "errors.requestFailed",
  "message_params": {},
  "request_id": "00000000000000000000000000000000",
  "status": 503,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
not_found
unavailable
HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
Retry-Afterstring; {"pattern":"^[0-9]+$"}Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/problem+json

FieldType and limitsRequiredMeaning
$ProblemYes—
$.codestringYesStable machine-readable error code
$.detailstringYesShort localized explanation without internal error details
$.instancestringYesUnique relative identifier /api/v1/requests/{request_id}; not a retrievable resource
$.messagestringYesTemporarily identical to detail for existing clients
$.message_keystringYesStable translation key for changing the displayed language without another request
$.message_paramsobject; {"additionalProperties":true}YesNamed, safely rendered message parameters; never arbitrary HTML
$.request_idstring; {"pattern":"^[0-9a-f]{32}$"}YesServer-generated diagnostic identifier. It contains no login token or credential.
$.statusinteger; {"maximum":599,"minimum":400}Yes—
$.titlestringYesLocalized HTTP status title
$.typestring; {"const":"about:blank"}Yes—
json
{
  "code": "demo",
  "detail": "Demo error detail; inspect the documented code.",
  "instance": "demo",
  "message": "Demo error detail; inspect the documented code.",
  "message_key": "errors.requestFailed",
  "message_params": {},
  "request_id": "00000000000000000000000000000000",
  "status": 503,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
invalid_reference
unavailable
HeaderType and limitsMeaning
Cache-Controlstring; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"}Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation.
Content-Languagestring; {"enum":["en","de"]}Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable.
Referrer-PolicyJSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]}The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters.
Retry-Afterstring; {"pattern":"^[0-9]+$"}Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics.
VarystringResponses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie.
X-Content-Type-OptionsJSON; {"const":"nosniff"}The browser must use the declared content type.
X-Frame-OptionsJSON; {"const":"DENY"}The response must not be embedded in a frame.
X-Request-IDstringServer-generated request identifier. Include this when reporting an error; inbound values are not trusted.

application/problem+json

FieldType and limitsRequiredMeaning
$ProblemYes—
$.codestringYesStable machine-readable error code
$.detailstringYesShort localized explanation without internal error details
$.instancestringYesUnique relative identifier /api/v1/requests/{request_id}; not a retrievable resource
$.messagestringYesTemporarily identical to detail for existing clients
$.message_keystringYesStable translation key for changing the displayed language without another request
$.message_paramsobject; {"additionalProperties":true}YesNamed, safely rendered message parameters; never arbitrary HTML
$.request_idstring; {"pattern":"^[0-9a-f]{32}$"}YesServer-generated diagnostic identifier. It contains no login token or credential.
$.statusinteger; {"maximum":599,"minimum":400}Yes—
$.titlestringYesLocalized HTTP status title
$.typestring; {"const":"about:blank"}Yes—
json
{
  "code": "demo",
  "detail": "Demo error detail; inspect the documented code.",
  "instance": "demo",
  "message": "Demo error detail; inspect the documented code.",
  "message_key": "errors.requestFailed",
  "message_params": {},
  "request_id": "00000000000000000000000000000000",
  "status": 503,
  "title": "Demo error",
  "type": "about:blank"
}

Retries and asynchronous work

This operation reads or validates without applying a resource mutation. Respect rate limits and credential lifetime.

Request examples

Replace demo IDs, timestamps and placeholders with your own values. For a retry, keep the same IDs, time and content. These examples do not run requests on this page.

Keep login links, codes, cookies and keys private. Do not print them in logs or share them in support requests.

shell
curl --silent --show-error --output /dev/null --write-out "%{http_code}\n" \
  --request GET \
  --header @"$HOME/.config/metribeacon/headers.txt" \
  "https://metribeacon.com/api/v1/alarms/rules"
python
import json
from pathlib import Path
from urllib.request import Request, HTTPRedirectHandler, build_opener
from urllib.error import HTTPError

headers = json.loads((Path.home() / ".config/metribeacon/headers.json").read_text())
request = Request("https://metribeacon.com/api/v1/alarms/rules", data=None, headers=headers, method="GET")
class NoRedirect(HTTPRedirectHandler):
    def redirect_request(self, request, fp, code, message, headers, target):
        return None

opener = build_opener(NoRedirect())
try:
    with opener.open(request, timeout=10) as response:
        print(response.status)
except HTTPError as error:
    print(error.code)
    error.close()
javascript
import { readFile } from "node:fs/promises";
import { homedir } from "node:os";
import { join } from "node:path";

const headers = JSON.parse(await readFile(join(homedir(), ".config/metribeacon/headers.json"), "utf8"));
const response = await fetch("https://metribeacon.com/api/v1/alarms/rules", {
  method: "GET", headers, redirect: "manual",
  signal: AbortSignal.timeout(10000),
});
console.log(response.status);
await response.body?.cancel();
go
package main

import (
  "fmt"
  "net/http"
  "time"
  "encoding/json"
  "os"
  "path/filepath"
)

func main() {
  home, err := os.UserHomeDir(); if err != nil { panic("request failed; credentials and response omitted") }
  raw, err := os.ReadFile(filepath.Join(home, ".config/metribeacon/headers.json")); if err != nil { panic("request failed; credentials and response omitted") }
  var headers map[string]string
  if json.Unmarshal(raw, &headers) != nil { panic("invalid local headers") }
  request, err := http.NewRequest("GET", "https://metribeacon.com/api/v1/alarms/rules", nil)
  if err != nil { panic("request failed; credentials and response omitted") }
  for name, value := range headers { request.Header.Set(name, value) }
  client := &http.Client{Timeout: 10*time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
  response, err := client.Do(request)
  if err != nil { panic("request failed; credentials and response omitted") }
  defer response.Body.Close()
  fmt.Println(response.StatusCode)
}