POST Create calculated series
/api/v1/devices/{id}/derived-series
Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series.
On this page
Access and permissions
Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series.
Browser session: __Host-mb_session cookie.
Machine management credentials in Authorization: Bearer. Check the permissions (scopes) required by the operation.
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
| Field | Location | Type and limits | Required | Meaning |
|---|---|---|---|---|
| id | Path | string; {"format":"uuid"} | Yes | Resource UUID from the path. It must exist and be accessible to the acting identity. |
| X-CSRF-Token | Header | string | No | Browser CSRF cookie value. Not required when an allowed machine management credential is used. |
| Origin | Header | string; {"format":"uri"} | No | If present, must match the canonical HTTPS origin. Sec-Fetch-Site cross-site is rejected. |
| Idempotency-Key | Header | string; {"maxLength":128,"minLength":8} | No | Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series. |
Request body
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | object; {"additionalProperties":false} | Yes | — |
| $.backfill_from | string | null; {"format":"date-time"} | No | — |
| $.enabled | boolean; {"default":false} | No | — |
| $.expected_revision | integer; {"minimum":0} | No | — |
| $.expression | string; {"maxLength":1024,"minLength":1} | Yes | Bounded numeric formula: use mean(alias), min(alias), max(alias), last(alias), increase(alias) or rate(alias) with arithmetic. Bare aliases such as v*2 are invalid; use mean(v)*2. increase and rate require counters; addition and subtraction require identical units. |
| $.name | string; {"maxLength":128,"minLength":1} | Yes | — |
| $.sources | object | Yes | — |
Responses
application/json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | object | Yes | — |
| $.backfill_from | string | null; {"format":"date-time"} | No | — |
| $.effective_from | string; {"format":"date-time"} | No | — |
| $.enabled | boolean | No | — |
| $.revision | integer; {"minimum":1} | No | — |
| $.series_id | string; {"format":"uuid"} | No | — |
| $.unit | string; {"maxLength":32} | No | — |
| Stable error codes |
|---|
| invalid_session |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| forbidden |
| csrf |
| insufficient_scope |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| not_found |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| idempotency_conflict |
| revision_conflict |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| invalid_formula |
| invalid_formula_units |
| invalid_formula_source |
| invalid_backfill |
| formula_cycle_or_depth |
| invalid_idempotency_key |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| series_limit |
| creation_quota |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
| Stable error codes |
|---|
| unavailable |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
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.
curl --silent --show-error --output /dev/null --write-out "%{http_code}\n" \
--request POST \
--header @"$HOME/.config/metribeacon/headers.txt" \
--header "Content-Type: application/json" \
--data-binary '{"name":"Calculated power","expression":"mean(a)","sources":{"a":"00000000-0000-4000-8000-000000000002"},"enabled":true,"expected_revision":1}' \
"https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/derived-series"
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/derived-series", data="{\"name\":\"Calculated power\",\"expression\":\"mean(a)\",\"sources\":{\"a\":\"00000000-0000-4000-8000-000000000002\"},\"enabled\":true,\"expected_revision\":1}".encode("utf-8"), headers=headers, method="POST")
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()
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/derived-series", {
method: "POST", headers, redirect: "manual",
signal: AbortSignal.timeout(10000), body: "{\"name\":\"Calculated power\",\"expression\":\"mean(a)\",\"sources\":{\"a\":\"00000000-0000-4000-8000-000000000002\"},\"enabled\":true,\"expected_revision\":1}",
});
console.log(response.status);
await response.body?.cancel();
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("POST", "https://metribeacon.com/api/v1/devices/00000000-0000-4000-8000-000000000001/derived-series", strings.NewReader("{\"name\":\"Calculated power\",\"expression\":\"mean(a)\",\"sources\":{\"a\":\"00000000-0000-4000-8000-000000000002\"},\"enabled\":true,\"expected_revision\":1}"))
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)
}
Related guides
- HTTP API, OAuth and MCP
Find the user API endpoints, their permissions, fields, examples and response formats.
- GET List calculated series
Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series.
- PUT Update calculated-series formula
Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series.
- GET List calculated-series sources
Closed UTC minute formulas use 1–8 numeric sources from one workspace, at most 64 AST nodes and dependency depth 4. Addition and subtraction require matching units. Missing inputs and division by zero remain gaps. Each new immutable revision uses the owner data budget; replayed work is free. Defaults apply next minute; explicit backfill is at most 24 hours. Reads allow Viewer; changes need Editor, config:write and session CSRF. An optional Idempotency-Key protects retries and rejects changed payloads. Existing telemetry keys cannot write calculated series.