Skip to content

Search Metric definition

POST
/v1/object-types/hospitality.metric_definition/search
curl --request POST \
--url https://api.aerandil.com/v1/object-types/hospitality.metric_definition/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "branch": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "cursor": "example", "filters": [ { "property": "id", "type": "eq", "value": "example" } ], "limit": 1, "order": "asc", "property_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "scope": { "level": "tenant" }, "sort_by": "created_at" }'

Search for instances. Filters eq, contains, gte and lte AND-compose; or / not are additive follow-ups. Pages with an opaque cursor; the +1 fetch returns has_more without a second round-trip. Ordered by sort_by (default created_at) in order (default ascending), id breaking ties; rows with no value for a property key sort last.

A governed, versioned business-metric definition: the disambiguating prose (description / formula_expression) plus a structured reference list over registered object types and fields, so the definition cannot silently reference a field that doesn’t exist. Versioned per name and superseded in place (prior versions live in the event history); certify_metric records operator sign-off, and a deprecated version only returns via revise_metric at a strictly greater version. The executable complement for kernel-conformed metrics lives in the MetricDef registry (/v1/metrics/{name}); this object is the certification layer NL-analytics and agents ground against.

Media typeapplication/json
object
branch

Optional open-branch id. Search composes that branch’s copy-on-first-write overlay instead of main, so a preview reads its own hypothetical writes. Omit to read main.

string format: uuid
cursor

Opaque cursor from a prior response’s next_cursor. Pass back verbatim; do not introspect.

string
filters

Conjunctive list of predicates. Empty or omitted matches every row in scope, capped by limit.

Array
One of:
object
property
required
Allowed value: id
type
required
Allowed value: eq
value
required
string
limit

Page size. Server defaults to 50, silently clamps at 500 (AIP-158 §3).

integer
>= 1 <= 500
order

Direction of sort_by: asc (oldest / smallest first) or desc. A cursor is bound to the sort_by and order it was minted under; another pair is refused (422).

string
default: asc
Allowed values: asc desc
property_id

The house a desk stands in: keeps this property’s rows (property- or venue-scoped there) and every row scoped to no property (tenant, brand, portfolio), and drops a sibling house’s — the meaning property_id has on the event tail.

string format: uuid
scope
One of: discriminator: level
object
level
required
string
Allowed value: tenant
Allowed values: tenant
sort_by

What the page is ordered by: the row’s created_at or updated_at, or a property whose type orders — strings, enums and dates as text, ints, decimals and durations as numbers, datetimes as instants. Rows with no value sort last in either direction. A property the caller is not cleared to read is refused (403).

string
default: created_at
Allowed values: created_at updated_at id name display_name description version status grain unit formula_expression owner authored_by certified_at certified_by

Search results, ordered by (sort_by, id) in the requested order (ascending by default).

Media typeapplication/json
object
data
required
Array<object>
object
created_at
required
string format: date-time
id
required
string format: uuid
object_type
required
Allowed value: hospitality.metric_definition
properties
required
object
authored_by
required
Principal::stable_id() of the defining / revising principal
string
certified_at
When this version was certified (set by certify_metric)
string format: date-time
certified_by
Principal::stable_id() of the certifying sign-off
string
description
required
Disambiguating prose — the definition operators sign off on
string
display_name
required
Display name
string
formula_expression
required
Canonical formula expression (governed prose, not executed)
string
grain
required
Organisational-unit × period grain the metric is defined over
string
Allowed values: property_day property_month venue_day venue_month outlet_day brand_month portfolio_month tenant_month
id
required
Definition id
string
name
required
Metric name (snake_case; matches a registry metric when one exists)
string
owner
required
Accountable team / principal for the definition
string
referenced_fields
required
Registered `type.property` fields the formula reads
Array<string>
referenced_object_types
required
Registered object-type names the formula reads
Array<string>
status
required
Certification lifecycle status
string
Allowed values: draft certified deprecated
unit
required
Unit the metric's value carries
string
Allowed values: money ratio percent count hours native_unit
version
required
Monotonic version per name (revise_metric bumps it)
integer
provenance

Per-property source attribution and pins. An entry under properties means the property’s current value came from that source (on the source’s own clock, source_updated_at); an entry under pins is a human override protecting the property from sourced writes.

object
pins
object
key
additional properties
object
pinned_at
string format: date-time
pinned_by
object
reason
required
string
properties
object
key
additional properties
object
external_id
string
recorded_at
required
string format: date-time
source
required
string
source_updated_at
string format: date-time
stream
string
scope
required
One of: discriminator: level
object
level
required
string
Allowed value: tenant
Allowed values: tenant
tenant_id
required
string format: uuid
updated_at
required
string format: date-time
version
required
integer
>= 1
has_more
required
boolean
next_cursor

Cursor for the next page; omitted when the result set is exhausted.

string
Example
{
"data": [
{
"object_type": "hospitality.metric_definition",
"properties": {
"grain": "property_day",
"status": "draft",
"unit": "money"
},
"scope": {
"level": "tenant"
}
}
]
}

Validation error — unknown property or filter type mismatch.