Skip to main content
POST
Computed values over a record selection (context.records) or named subjects: for the whole selection, per record (each_subject), by an attribute (group_by_attribute) or by period.

Authorizations

Authorization
string
header
required

An API key issued with object_model scopes: Authorization: Bearer sk_…. The scopes: object_model:records:read, object_model:records:write, object_model:facts:read, object_model:facts:write, object_model:model:read, object_model:model:configure, object_model:actions:run, object_model:changes:read. An operation's security lists the scopes it needs; several entries mean any one of them will do. A person field (ref(user), ref_list(user)) holds a user id: look people up by email or id with GET /v1/users, outside this API, with a key that also has users:read.

Scopes

object_model:facts:read

Body

application/json

What POST /figures/query takes. Not taken on this route yet, until how they combine is published: rank_by, limit, compare, subject_reduce, groups, at_fact_dates (400 unsupported_parameter). At most one of group_by_attribute, each_subject (400 conflicting_parameters).

attribute_history
object

The value history of the one record cell it names, answered alone: every other field of the read is ignored. Not with context.records (422 scope_conflict): it reads the record it names, not a selection.

attribute_sources
object

Where the current value of each named cell came from, answered alone: every other field of the read is ignored. Not with context.records (422 scope_conflict): it reads the records it names, not a selection.

bucket_limit
integer

At most this many buckets, at least 2: the largest one fewer are kept, and the rest are computed together as one other: bucket. For a read of one figure with each_subject or group_by_attribute, without by_period.

by_period
enum<string>

One figure per period: year, quarter, month or day (calendar, UTC), or fiscal_year or fiscal_quarter (following the schema's fiscal_year_end_month). Each figure's at is its period's start. The periods span the window when it has both bounds, and otherwise the dates of the facts read. Leave it out, or send "", not to split by period: each figure then covers the whole window.

Available options:
,
year,
fiscal_year,
quarter,
fiscal_quarter,
month,
day
context
object

What to compute over: which records (subject_ids, or a selection in records), the time window, and the scenario (world_id).

coverage
boolean

Compute a figure that needs every record to answer over the records that do, and say how many in coverage, instead of answering not_applicable.

date_sources
object[]
definition_ids
string[]

The figures to compute, by id from the schema's definitions.

each_subject
boolean

One figure per record for every id, each with its subject_id, instead of one over the whole selection. Combines with by_period (a figure per record per period), but not with group_by_attribute.

exclusions
object
group_by_attribute
string

One figure per value of this field of the records, each with index_key a:<value>. The field must be on the records' type, and every figure read must be about that type.

group_subjects_by
string
include_retracted
boolean

Also return retracted facts, each marked retracted.

include_superseded
boolean

Every revision of each fact, not only the current one.

newest_first
boolean

Order facts newest first, by the date they are about. Default oldest first.

offset
integer

Facts to skip, per quantity.

order
string
per_subject
boolean
quantity_axis_filters
object
quantity_ids
string[]

The quantities to read.

raw
boolean
resolve_scope
boolean
share_of_total
boolean

With group_by_attribute: also give each group's share of the whole selection's value.

subject_filter
string

A DEFINITION id, not a record predicate: subjects whose figure for that definition is not a nonzero value are dropped before anything is read. To choose subjects by their records' fields, use context.records.

units
string
what_ifs
object[]
with_as_of
boolean

Also give as_of and as_of_earliest: the dates of the values a level-kind figure used. Ignored with by_period.

with_source
boolean

Also give each figure's source. Ignored with by_period and each_subject.

Response

Answered.

attribute_sources
object[]
buckets
object[]
excluded_group_keys
string[]
exclusion_role_totals
object[]
exclusions
object[]
facts
object[]
figures
object[]
matched_records

With context.records: how many records the selection matched — the subjects read. 0 is an empty selection, answered without reading.

narrowed_to_reader
boolean
per_quantity
object[]
revisions
object[]
snapshot_id
string
total_dates
total_facts
total_figures
what_ifs
object[]