REST API
Times and windows
Times in answers
Section titled “Times in answers”Instants are epoch milliseconds (UTC), as integers: 1793000000000. Dates without a time
of day are YYYY-MM-DD. A few fields are exact stored text instead, and say so: a domain’s
changed values (old, new) are strings. A log line’s time is RFC 3339 text with nine fraction digits, beside its logged_at in milliseconds (investigating logs).
Choosing a window
Section titled “Choosing a window”An operation that reads over time takes a window, in one of two forms:
| Form | Example | Meaning |
|---|---|---|
period |
period=3h, period=2w |
The last 1 to 9,999 minutes (m), hours (h), days (d) or weeks (w), ending now. |
from and to |
from=1792990000000&to=1793000000000 |
Epoch milliseconds, or RFC 3339 with an offset (2026-10-30T09:00:00+01:00). |
Send one form or the other. The answer repeats the window it used as window{from, to}.
Each operation has a default window (used when you send none) and a longest window; a
longer one is 422 invalid_request on period, to or end.
| Operation | Default | Longest |
|---|---|---|
| Server metrics, database metrics | 1 day | 31 days |
| Custom metric series, a metric source’s series | 1 day | 1,095 days, the metric’s retention; shorter for a dense metric (below) |
| Custom metric samples | 1 hour | 1 day |
| Custom metric summary | 1 day | None: back to the metric’s retention, 1,095 days; an earlier start is served from it. Over 31 days it reads daily summaries (below) |
| A metric source’s summary (25 metrics a page) | 1 day | None, as the single summary’s |
| Database coverage | 30 days | 31 days |
| Log search, log facets, log groups | 1 hour | None: back to retention (30 days); an earlier start is served from it |
| Log histogram | 1 day | None: back to retention (30 days); an earlier start is served from it |
| Database queries | 1 day | 7 days |
| Incidents, a server’s incidents, database schema changes, a database’s collector history, a database’s failovers, audit actions | every row | none |
A window that starts before the oldest data kept is served from the oldest data (the answer’s
window.from shows where). A window that ends before the data begins, or in the future, is
refused, except on the four log operations (search, facets, groups and histogram): there a window that
ends in the future ends now, and one wholly in the future keeps its length and ends now. The
answer’s window says the window read.
The custom metrics store reads at most 30,000,000 samples of one metric in one query. A metric
pushed at the default 100,000 points a day holds that many in about 300 days, so its longest
series window is about 300 days, not 1,095. A window the store refuses for this limit, on any
custom metric read, is 422 invalid_request on period (on from when you sent from and
to): “This window holds more samples than the store reads in one query; ask for a shorter
window.” A shorter window then answers.
Series
Section titled “Series”Server metrics, custom metric series and database metrics answer points as [t, value]: t in
epoch milliseconds and value a number or null. What a point is of its step (a peak, an
average) is named per series. A series a server does not report is absent, never zero.
A custom metric’s series takes two more parameters. aggregation chooses what a point holds:
avg, min, max or last for a level metric, sum for a count metric (the metric’s
supported_aggregations); omitted, a level reads its value at each step and a count its sum.
step chooses the width of a point: 30s, 1m, 5m, 30m, 2h, 6h, 1d or 1w; omitted, it
follows the window’s length. A step that cuts the window into more than 720 points is
422 invalid_request on step, naming the smallest step allowed. Each point summarises the step
that ends at its time: with step=1d the point at 00:00 UTC on a day holds the day before. The
window is widened to whole steps, so the first point can sit one step before window.from.
tz (an IANA time zone name such as Europe/London) moves the 1d and 1w points to the zone’s local
midnights, and a 1w point to a Monday’s. A day that holds a clock change is 23 or 25 hours long, so
across a change two neighbouring points are not step_seconds apart: read each point’s own time. A
zone whose clock skips midnight (America/Santiago in September) has no 00:00 that day, so its point
sits at the day’s first local instant, 01:00. tz=UTC is not the same as no tz: with tz=UTC a 1w
point sits on Monday 00:00 UTC, without tz on Thursday 00:00 UTC (the epoch grid). With any other
step tz is accepted and changes nothing, and the answer gives the tz you sent (or null).
A summary over more than 31 days reads the daily summaries WatchTower15 keeps, for whole UTC days up to
the start of yesterday, and the samples for the rest; its answer says rolled_up: true, and p50 and p95
are approximations. See
charting custom metrics.
Database metrics differ in two ways. Every series of the database’s engine is always present,
with empty points when the window holds none, never absent. And at a step where another
series has a sample but this one has none, the point is [t, null]; at a step where no series
has a sample there is no point at all. unit is null on every database series.