MetriBeacon
Menu

PUT Save confirmed retention settings (device)

/api/v1/devices/{id}/retention

Whole rolling 24-hour days, at least one. The effective lifetime is the minimum of system limits, the owning account and monitor overrides. Null inherits. Shortening immediately hides expired data and schedules physical cleanup; a paused cleanup shows its reason. Expired data does not return after lengthening or reset. Incidents, delivery history, reports and security logs have separate lifetimes; external copies are unaffected. Changes require an owning browser account, CSRF and a current revision. Account settings always belong to the authenticated person, including when a shared workspace is selected. Monitor readers may inspect the policy; only its workspace owner may change it. If this feature is unavailable, changes respond with HTTP 503; the read response reports whether you may change the setting.

On this page

Access and permissions

Whole rolling 24-hour days, at least one. The effective lifetime is the minimum of system limits, the owning account and monitor overrides. Null inherits. Shortening immediately hides expired data and schedules physical cleanup; a paused cleanup shows its reason. Expired data does not return after lengthening or reset. Incidents, delivery history, reports and security logs have separate lifetimes; external copies are unaffected. Changes require an owning browser account, CSRF and a current revision. Account settings always belong to the authenticated person, including when a shared workspace is selected. Monitor readers may inspect the policy; only its workspace owner may change it. If this feature is unavailable, changes respond with HTTP 503; the read response reports whether you may change the setting.

Browser session: __Host-mb_session cookie.

When using a browser session for a mutation, send the current CSRF token in X-CSRF-Token with the same-site cookie. OAuth consent uses its documented form field.

Parameters and headers

FieldLocationType and limitsRequiredMeaning
idPathstring; {"format":"uuid"}YesResource UUID from the path. It must exist and be accessible to the acting identity.
OriginHeaderstring; {"format":"uri"}NoIf present, must match the canonical HTTPS origin. Sec-Fetch-Site cross-site is rejected.
X-CSRF-TokenHeaderstringNoBrowser CSRF cookie value. Not required when an allowed machine management credential is used.

Request body

FieldType and limitsRequiredMeaning
$RetentionDraftYes—
$.daysRetentionDaysNo—
$.days.rawinteger | null; {"minimum":1,"maximum":7}NoOriginal numeric values and states.
$.days.minuteinteger | null; {"minimum":1,"maximum":30}NoMinute aggregates.
$.days.quarter_hourinteger | null; {"minimum":1,"maximum":365}NoFifteen-minute aggregates.
$.days.hourinteger | null; {"minimum":1,"maximum":1095}NoHourly aggregates.
$.days.textinteger | null; {"minimum":1,"maximum":7}NoOriginal events and associated run details.
$.revisionstring; {"pattern":"^[0-9]+:[0-9]+$"}YesAccount and monitor revisions from the latest GET; a stale revision returns HTTP 409.
$.preview_idstring; {"format":"uuid"}NoThe unused preview for this exact actor, scope, revision and normalized draft; valid for ten minutes. Required for PUT.
$.confirm_deletionbooleanNoExplicitly acknowledge the displayed deletion when the preview shortens a lifetime.

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
$RetentionPolicyYes—
$.accountRetentionDaysYes—
$.account.rawinteger | null; {"minimum":1,"maximum":7}NoOriginal numeric values and states.
$.account.minuteinteger | null; {"minimum":1,"maximum":30}NoMinute aggregates.
$.account.quarter_hourinteger | null; {"minimum":1,"maximum":365}NoFifteen-minute aggregates.
$.account.hourinteger | null; {"minimum":1,"maximum":1095}NoHourly aggregates.
$.account.textinteger | null; {"minimum":1,"maximum":7}NoOriginal events and associated run details.
$.configuredRetentionDaysYes—
$.configured.rawinteger | null; {"minimum":1,"maximum":7}NoOriginal numeric values and states.
$.configured.minuteinteger | null; {"minimum":1,"maximum":30}NoMinute aggregates.
$.configured.quarter_hourinteger | null; {"minimum":1,"maximum":365}NoFifteen-minute aggregates.
$.configured.hourinteger | null; {"minimum":1,"maximum":1095}NoHourly aggregates.
$.configured.textinteger | null; {"minimum":1,"maximum":7}NoOriginal events and associated run details.
$.effectiveobject; {"additionalProperties":false}Yes—
$.effective.rawobject; {"additionalProperties":false}Yes—
$.effective.raw.daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.raw.maximuminteger; {"minimum":1,"maximum":1095}Yes—
$.effective.raw.account_daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.raw.sourcestring; {"enum":["system","account","monitor"]}Yes—
$.effective.raw.clampedbooleanYes—
$.effective.minuteobject; {"additionalProperties":false}Yes—
$.effective.minute.daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.minute.maximuminteger; {"minimum":1,"maximum":1095}Yes—
$.effective.minute.account_daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.minute.sourcestring; {"enum":["system","account","monitor"]}Yes—
$.effective.minute.clampedbooleanYes—
$.effective.quarter_hourobject; {"additionalProperties":false}Yes—
$.effective.quarter_hour.daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.quarter_hour.maximuminteger; {"minimum":1,"maximum":1095}Yes—
$.effective.quarter_hour.account_daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.quarter_hour.sourcestring; {"enum":["system","account","monitor"]}Yes—
$.effective.quarter_hour.clampedbooleanYes—
$.effective.hourobject; {"additionalProperties":false}Yes—
$.effective.hour.daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.hour.maximuminteger; {"minimum":1,"maximum":1095}Yes—
$.effective.hour.account_daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.hour.sourcestring; {"enum":["system","account","monitor"]}Yes—
$.effective.hour.clampedbooleanYes—
$.effective.textobject; {"additionalProperties":false}Yes—
$.effective.text.daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.text.maximuminteger; {"minimum":1,"maximum":1095}Yes—
$.effective.text.account_daysinteger; {"minimum":1,"maximum":1095}Yes—
$.effective.text.sourcestring; {"enum":["system","account","monitor"]}Yes—
$.effective.text.clampedbooleanYes—
$.expired_beforeobject; {"additionalProperties":false}Yes—
$.expired_before.rawstring; {"format":"date-time"}Yes—
$.expired_before.minutestring; {"format":"date-time"}Yes—
$.expired_before.quarter_hourstring; {"format":"date-time"}Yes—
$.expired_before.hourstring; {"format":"date-time"}Yes—
$.expired_before.textstring; {"format":"date-time"}Yes—
$.revisionstring; {"pattern":"^[0-9]+:[0-9]+$"}Yes—
$.can_writebooleanYes—
$.cleanupobject; {"additionalProperties":false}Yes—
$.cleanup.statusstring; {"enum":["running","paused","complete"]}Yes—
$.cleanup.reasonstring; {"enum":["","storage_unavailable","waiting_for_readers","waiting_for_aggregation","cleanup_failed","waiting_for_database"]}Yes—
$.cleanup.phasestring | nullNo—
$.cleanup.last_attempt_atstring | null; {"format":"date-time"}No—
$.cleanup.last_progress_atstring | null; {"format":"date-time"}No—
$.cleanup.completed_atstring | null; {"format":"date-time"}No—
json
{
  "account": {
    "raw": null,
    "minute": null,
    "quarter_hour": null,
    "hour": null,
    "text": null
  },
  "configured": {
    "raw": null,
    "minute": null,
    "quarter_hour": null,
    "hour": null,
    "text": null
  },
  "effective": {
    "raw": {
      "days": 7,
      "maximum": 7,
      "account_days": 7,
      "source": "system",
      "clamped": false
    },
    "minute": {
      "days": 30,
      "maximum": 30,
      "account_days": 30,
      "source": "system",
      "clamped": false
    },
    "quarter_hour": {
      "days": 365,
      "maximum": 365,
      "account_days": 365,
      "source": "system",
      "clamped": false
    },
    "hour": {
      "days": 1095,
      "maximum": 1095,
      "account_days": 1095,
      "source": "system",
      "clamped": false
    },
    "text": {
      "days": 7,
      "maximum": 7,
      "account_days": 7,
      "source": "system",
      "clamped": false
    }
  },
  "expired_before": {
    "raw": "2026-10-01T12:00:00Z",
    "minute": "2026-10-01T12:00:00Z",
    "quarter_hour": "2026-10-01T12:00:00Z",
    "hour": "2026-10-01T12:00:00Z",
    "text": "2026-10-01T12:00:00Z"
  },
  "revision": "0:0",
  "can_write": true,
  "cleanup": {
    "status": "complete",
    "reason": ""
  }
}
Stable error codes
invalid_credential
unauthorized
authentication_required
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
owner_required
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
not_found
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": 404,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
revision_conflict
preview_required
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": 409,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
invalid_retention
deletion_confirmation_required
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": 422,
  "title": "Demo error",
  "type": "about:blank"
}
Stable error codes
feature_unavailable
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 change does not have a general retry guarantee. If the response is unclear, read the affected resource before trying again. Follow Retry-After waiting times and request new sign-in or action codes when they expire.

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 PUT \
  --header @"$HOME/.config/metribeacon/headers.txt" \
  --header "Content-Type: application/json" \
  --data-binary '{"days":{"raw":3,"minute":null,"quarter_hour":null,"hour":null,"text":3},"revision":"0:0","preview_id":"00000000-0000-4000-8000-000000000001","confirm_deletion":true}' \
  "https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/retention"
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())
headers["Content-Type"] = "application/json"
request = Request("https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/retention", data="{\"days\":{\"raw\":3,\"minute\":null,\"quarter_hour\":null,\"hour\":null,\"text\":3},\"revision\":\"0:0\",\"preview_id\":\"00000000-0000-4000-8000-000000000001\",\"confirm_deletion\":true}".encode("utf-8"), headers=headers, method="PUT")
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"));
headers["Content-Type"] = "application/json";
const response = await fetch("https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/retention", {
  method: "PUT", headers, redirect: "manual",
  signal: AbortSignal.timeout(10000), body: "{\"days\":{\"raw\":3,\"minute\":null,\"quarter_hour\":null,\"hour\":null,\"text\":3},\"revision\":\"0:0\",\"preview_id\":\"00000000-0000-4000-8000-000000000001\",\"confirm_deletion\":true}",
});
console.log(response.status);
await response.body?.cancel();
go
package main

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

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("PUT", "https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/retention", strings.NewReader("{\"days\":{\"raw\":3,\"minute\":null,\"quarter_hour\":null,\"hour\":null,\"text\":3},\"revision\":\"0:0\",\"preview_id\":\"00000000-0000-4000-8000-000000000001\",\"confirm_deletion\":true}"))
  if err != nil { panic("request failed; credentials and response omitted") }
  for name, value := range headers { request.Header.Set(name, value) }
  request.Header.Set("Content-Type", "application/json")
  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)
}
  • HTTP API, OAuth and MCP

    Find the user API endpoints, their permissions, fields, examples and response formats.

  • GET Read retention settings (device)

    Whole rolling 24-hour days, at least one. The effective lifetime is the minimum of system limits, the owning account and monitor overrides. Null inherits. Shortening immediately hides expired data and schedules physical cleanup; a paused cleanup shows its reason. Expired data does not return after lengthening or reset. Incidents, delivery history, reports and security logs have separate lifetimes; external copies are unaffected. Changes require an owning browser account, CSRF and a current revision. Account settings always belong to the authenticated person, including when a shared workspace is selected. Monitor readers may inspect the policy; only its workspace owner may change it. If this feature is unavailable, changes respond with HTTP 503; the read response reports whether you may change the setting.

  • DELETE Restore inherited retention settings (device)

    Whole rolling 24-hour days, at least one. The effective lifetime is the minimum of system limits, the owning account and monitor overrides. Null inherits. Shortening immediately hides expired data and schedules physical cleanup; a paused cleanup shows its reason. Expired data does not return after lengthening or reset. Incidents, delivery history, reports and security logs have separate lifetimes; external copies are unaffected. Changes require an owning browser account, CSRF and a current revision. Account settings always belong to the authenticated person, including when a shared workspace is selected. Monitor readers may inspect the policy; only its workspace owner may change it. If this feature is unavailable, changes respond with HTTP 503; the read response reports whether you may change the setting.

  • POST Preview retention changes (device)

    Whole rolling 24-hour days, at least one. The effective lifetime is the minimum of system limits, the owning account and monitor overrides. Null inherits. Shortening immediately hides expired data and schedules physical cleanup; a paused cleanup shows its reason. Expired data does not return after lengthening or reset. Incidents, delivery history, reports and security logs have separate lifetimes; external copies are unaffected. Changes require an owning browser account, CSRF and a current revision. Account settings always belong to the authenticated person, including when a shared workspace is selected. Monitor readers may inspect the policy; only its workspace owner may change it. If this feature is unavailable, changes respond with HTTP 503; the read response reports whether you may change the setting.