Skip to content

Growth metric time series (roas etc.)

projectId
required
string
startDate
required
string format: date

Required.

endDate
required
string format: date

Required.

metric
string
default: roas

Metric series (dynamic shape). Reads the computed_metrics D1 table. metricName echoes the ?metric query param (defaults to “roas”). value column is REAL -> number. metadata is a JSON text column (text(..., {mode:"json"})) with NO schema constraint — it is whatever the metric writer stored; it is the metadata of the LAST row in the period, or null when there are no rows. trend[].date = periodStart.slice(0,10) i.e. “YYYY-MM-DD”. Missing startDate/endDate throws -> 500 {error, detail} (routes:102-110).

Media typeapplication/json
object
metricName
required

Echo of ?metric, default ‘roas’.

string
current
required

Last value in range; 0 when no rows.

number
average
required

Arithmetic mean of values; 0 when no rows.

number
trend
required
Array<object>
object
date
required

Period_start truncated to YYYY-MM-DD

string
value
required
number
metadata
required

Opaque JSON from computed_metrics.metadata of the latest row in range; null when there are no rows. No schema is enforced anywhere in the read path — intentionally permissive.

nullable

Load failed / missing date params.

Media typeapplication/json
object
error
string
detail
string
Examplegenerated
json
{
"error": "example",
"detail": "example"
}