Skip to main content
Every organization’s ontology is its own: its record types, fields, relations, quantities, figures, actions and scenarios are whatever it declares. Nothing about them is fixed, so a client, or an AI agent working through this API, starts by reading GET /schema and works from what it says. This page explains what the schema answer tells you and the rules that follow from it. For how to write a value of each field type, see Field types.

The API’s names

The API predates the name “ontology”, and some of its members still use older names:

Read the schema first

  • Use ids, never display names. Paths, bodies and filters take type_id, a field’s name, relation_id, quantity_id, definition_id, action_id and world_id. display_name is only what people see in the app.
  • The answer is filtered to you. It describes what the key’s person can see. A group of fields marked hidden (under facets) is absent from every record you read.
  • Cache it. Send the previous answer’s declarations_fingerprint as known_declarations_fingerprint. If nothing changed, the answer says reuse_declarations: true and leaves the declarations out.
  • Ignore what only the app reads. In the endpoint reference, members described as “Read by the VectorShift app’s own screens” are for the app’s pages and permission screens. A client never needs them.

Record types and fields

A record type’s attributes are its fields. Each field’s name is its key in a record’s values. Its storage decides how a value is written; see Field types. A record’s label is the value of the type’s primary_label_attribute. The flags on a field are rules every write must pass. A write that breaks one is refused with 422, and nothing is written:

Fields that apply to some records only

  • Conditional fields. A type’s facets group fields that apply only while a condition on the record holds. when is the condition, as written in the ontology. While it does not hold, a value for those fields is refused; clearing one always works.
  • Fields you cannot read. A facet marked hidden is absent from every record you read, and a facet marked restricted is present on some records only. Don’t write or report a hidden field.
  • Fields scoped to a parent. A field with scope_attribute and scope_record_id applies only to records whose scope_attribute holds that record. A field with choice_overrides takes different options on such records.

Reference fields and relations

Records point at other records in two ways, and they are independent: setting one never sets the other. A reference field is a field whose storage is ref(<type_id>) (one record id) or ref_list(<type_id>) (several). It is a value, written under values and filtered with eq or in on the id:
A relation is a link, declared under relations. It is written on the record of from_type_id, under links, keyed by relation_id:
On an update, use links_add and links_remove in the same shape. Read links on a record’s links, list linked records with GET /records/{type_id}/{record_id}/related/{relation_id} (inverse=true walks the relation from the other end), and filter on them with has_links. cardinality says how many records one record links to: zero_or_one, exactly_one, zero_or_many or one_or_many. When a type has both a reference field and a relation to the same type, write each one your integration needs. The schema can’t tell you which one a person means by “the owner”, so ask when it matters.

People

A field whose storage is ref(user) or ref_list(user) holds people’s VectorShift user ids, not emails or names. People belong to the platform, not the ontology, so you look them up outside this API, with GET /v1/users: by email to find the id to write, or by id to see who a value names. See Field types.

Stages and decisions

A type with a lifecycle keeps its stage in one field (attribute). milestones lists its main stages in order; the field’s options can add stages between them. Some changes need a person’s decision, such as moving a deal into a stage. decisions lists them: the type, the field, the value whose entry is decided (enters), and who decides (decided_by). For these changes:
  1. A record update that makes the change is refused with 422.
  2. Make it by running the action that makes it: one whose source sets that field. If the key’s person is not one of its deciders, the run answers 202 with a decision_id, and nothing is written yet. If no action sets the field, this API can’t make the change: ask a person to make it in the app.
  3. Follow the decision with GET /decisions/{decision_id}. Its status is pending, approved, denied, expired or withdrawn. Only approved makes the change, and the record then changes as the change feed and a read show.
Several people can propose a value for the same field while it waits. They share one decision, each run’s 202 names it, and approving it applies one value. The decision’s proposal says what became of yours: leading or alternative while it waits, then applied (your value was applied) or not_applied (another value was, or the decision was denied, expired or withdrawn). Read proposal, not status alone, to know whether your change was made. Keep the decision_id a 202 gives you: it is the only way to find that decision again. The decision_id in the schema’s decisions is a different id, the rule’s, and GET /decisions/{decision_id} doesn’t take it. Approving, denying and assigning decisions, and listing the ones waiting for someone, happen in the VectorShift app: this API has no route for them.

Actions

actions lists the ontology’s named writes. Each one checks its rules and then changes records, sometimes several at once. Run one with POST /actions/{action_id}/run:
  • subject_id is a record of the action’s subject_type_id.
  • params are written like fields of the same type: each param’s param_type uses the same words as a field’s storage. A list param takes an array of objects with the param’s fields, and ref(quantity) and ref(definition) take an id.
  • A creatable param takes an existing record’s id, or {"new": {<field>: <value>, …}} to create the record as the action runs.
  • requires lists each rule’s message. A run that fails one is refused with 422 and writes nothing. source shows the whole action as written in the ontology.
  • An optional param you leave out changes nothing. A field the action sets from it keeps its value.
  • caller_allowed: false means the key’s person may not run it at all.
  • Preview first. dry_run: true checks everything and writes nothing.
The answer’s status says what happened: A 422 carries the run’s answer under result.

Walls

Some types keep records behind walls: once a record enters, only the people inside see it. GET /schema doesn’t answer walls, so you meet one in a run’s answer. A run that would put a record behind a wall your key’s person is outside of depends on the wall:
  • A wall that lets you push records in refuses the live run: 422 with code would_lose_access. result.lockout names the wall and counts what you would lose sight of (records, and of those own). To go ahead, send the run again with "confirm_lockout": true under a new Idempotency-Key: the refusal is kept under the first. A dry run passes.
  • A wall that refuses writers from outside refuses the run, dry run included: 422 with code walled.
  • A wall that asks the people inside passes a dry run. The live run writes nothing and asks them to take the record: 202 with status proposed and a decision_id to follow, as for a decided change. For a record the run would create, it is refused with walled.

Facts and figures

Quantities are what facts are recorded about: numbers about a record over time, such as rent collected or an appraised value. Each has a subject_type_id (a fact’s subject_id is a record of that type), a unit, and:
  • time: what a fact’s dates mean. interval is a value over valid_from to valid_to, instant is a value at valid_from, and timeless has no history.
  • measure_kind: how values combine. A flow (rent collected in a quarter) adds up over a period. A level (an appraised value) is read at its latest, never summed.
  • axis_ids: further dimensions each fact carries in axis_values, from the schema’s axes.
Record a fact with its value tagged by type, such as {"double": …} for a number. A fact you send in assertions is recorded as sent. A quantity’s capture applies only to values VectorShift finds in documents and conversations, which wait as captures until they are applied.
Units work as they do for fields: an amount is in the quantity’s unit, and a quantity whose unit is 1 holds a ratio as a fraction (0.25 for 25%).
  • valid_from is the date a fact is about. For an interval quantity, valid_to ends the interval and is not included. Figures place a fact by valid_from alone: a fact over an interval counts whole in the period it starts in, and is never spread across periods.
  • Revise a fact under its fact_id. Read it with GET /facts and send its fact_id with the new value. An assertion without one records a new fact beside the old, and a flow figure counts both.
Figures (definitions) are computed from facts and fields. Query them by definition_ids (or raw quantities by quantity_ids). Choose subjects with context.subject_ids or a record filter in context.records, and a time span with context.window. To get one figure per record, set each_subject: true. To get one per period, set by_period to year, quarter, month or day (calendar periods, in UTC), or fiscal_year or fiscal_quarter. The two combine: each_subject with by_period gives one figure per record per period.
  • A window includes both ends, and tests each fact’s valid_from. To end with December, send "to": "2026-12-31T23:59:59Z", not the first of January.
  • A period is named by its start. Each figure’s at is the first instant of its period, at midnight UTC. A fiscal year starts the month after fiscal_year_end_month, and its quarters are its four three-month periods: with a June year end, the year that ends in June 2027 starts 2026-07-01T00:00:00Z, and its quarters start July, October, January and April. No answer names a year or quarter, so label them yourself.
  • Only add up flow figures. A figure’s measure_kind says how it combines. Summing level, ratio, rate or state figures yourself gives a meaningless number: ask for the figure over the whole selection instead.
  • A figure may have no value. not_computable means there were no facts to compute it from: show a blank, not zero. not_applicable means it has no single answer here, such as a ratio over many records: read it per record.

Scenarios

worlds are scenarios: what-ifs built on the recorded facts. A scenario reads every fact from its parent (parent_world_id, or the recorded facts when it is empty), except the facts it overrides. Read under one with context.world_id, and manage them with the scenario routes. A scenario overrides a fact only under that fact’s fact_id. To change a recorded value in a scenario, read the fact with GET /facts, then record it again with its fact_id and the scenario’s world_id:
Without the fact_id, the assertion adds a second fact beside the parent’s, and a flow figure counts both: January would read as the recorded rent plus 2,800. To show the parent’s value again, withdraw the override. A fact recorded in a scenario that no parent holds is simply added there.

Writing many records

For thousands of records, use a record write job rather than one request per record:
  1. Start it with POST /record-write-jobs: the type_id, a mode (create, update or upsert), a namespace for your system’s ids, and an Idempotency-Key.
  2. Upload the items in parts of up to 5,000, each request within the 8 MiB body limit, with POST /record-write-jobs/{job_id}/parts, each with its own part_id. A job holds up to 100,000 items.
  3. Seal it with POST /record-write-jobs/{job_id}/seal, and writing starts.
  4. Follow it with GET /record-write-jobs/{job_id} until state is completed, failed or cancelled, then read each item’s outcome from .../results.
A job differs from a single write in four ways:
  • Values are tagged by type, not plain JSON: {"string": …} for text, an option or a record id; {"double": …} for a number; {"vec": {"items": [{"string": "<record id>"}]}} for a list. A personal_name is {"map": {"items": {"first_name": {"string": "Ada"}, "last_name": {"string": "Lovelace"}}}}, and a location a map of street_address, city, state, postal_code and country.
  • Records are found by id only. An item names its record with record_id, or with external_id, your system’s id in the job’s namespace, which a job keeps for each record it creates. A job never matches on a field’s value. For records made another way, look up their ids first (a query on your id field) and send record_id with external_id, so later jobs find them by external_id alone. Otherwise a create that repeats any unique field’s value, such as an email, fails its chunk.
  • A failure stops the job. Items are written in chunks (chunk_size, 200 by default), each whole or not at all. The first chunk that fails stops the job: its items all carry its error, and the items after it are skipped. Chunks before it stay written. To recover, fix what the error names and send the items whose outcome has an error_code in a new job.
  • Some writes are refused. A job can’t change a record’s stage or a field whose change a person decides. It needs the key’s person to be allowed to edit the ontology, not only its records. Not every organization can run jobs yet.

Imports

An ontology can declare imports: spreadsheet layouts that map a file onto records. They aren’t in GET /schema; find them as import declarations in the ontology’s text, GET /model, which needs the model:read scope. There are two kinds:
  • An import with columns acts on one record, named in subject_id (the fund a ledger belongs to, say): each row runs the same action on it. It saves nothing unless every row passes. A row with an issue is listed in issue_rows, by its row number in the sheet, with what is wrong in each column.
  • A tracker import (import … { tracker { … } }) takes no subject_id: it matches each row to the record it names. Its dry run answers each row’s match and changes in tracker.rows, with flags to answer in choices when you save, and its save writes each row on its own, so one refused row leaves the others saved. Set fallback_date_utc once and send it on every request for the same file.
Run one with POST /imports/{import_id}/run. The file goes in the body as base64 raw_bytes, with its name in metadata.name. It must be CSV, XLS or XLSX, and the body is at most 8 MiB, which leaves about 6 MiB for the file. Send "dry_run": true first: every row is checked and issue_rows lists what is wrong, and nothing is written. An import’s blank template can’t be downloaded through this API yet: get it from the app.

Changing the schema

Change the ontology with POST /model/configure, which needs the model:configure scope. The common change is to add or edit one field of a record type: an edit that names the field in member, with the field’s line as source.
Send it with "dry_run": true first, then without. If-Match is the version from GET /schema: if the ontology changed since, nothing is applied (412). A change that needs someone’s approval answers 202 and applies nothing yet: follow its pending_decision_id with GET /decisions/{decision_id}.

A field’s line

A field is written name: <storage> <modifiers>. The name must equal member; use lowercase letters, digits and underscores. The storage is one of the words a field’s storage shows in the schema: string, text, url, phone, int, decimal, number, bool, timestamp, single_select, multi_select, string_list, personal_name, location, image, ref(<type_id>), ref_list(<type_id>), ref(user), ref_list(user), or a currency such as USD. Modifiers can come in any order: A color is one of default, info, brand, warning, error, success, yellow, pink, brown, teal, lime, rose, navy, sea, forest, sage, camel, copper, plum, claret or slate. Some lines the API accepts:
  • To change a field, copy its line from GET /model, change what you need, and send the whole line. The line replaces the field: any option, label, color or description you leave out is removed. Don’t rebuild it from GET /schema, which doesn’t carry every clause.
  • Remove a field with {"op": "remove", "kind": "entity", "declaration_id": "<type_id>", "member": "<field>"}. It is refused while any record holds a value for the field: clear the values first.
  • Changes that would lose data are refused: changing a field’s type or currency, or removing an option, while records hold values it would change.
Types, relations, actions and quantities are written in the same language, which this page doesn’t cover. To change one, start from its text in GET /model, send the whole declaration as an upsert without member, and check it with dry_run.

Writing safely

  • Send an Idempotency-Key on every write, and the same key on every retry of it. See Idempotency.
  • Guard updates with the revision you read. Every record carries a revision. Send it as If-Match on an update: if the record has changed since, nothing is applied and the answer is 412 revision_mismatch, with details.current_revision. Read the record again and redo the change on what is there. An update is one write: its field changes, list edits and link edits are applied together or not at all.
  • Add to a list instead of replacing it. list_add and list_remove change a list field without reading it first. See Field types.
  • Fix a refusal and resend under a new key. A 422 names the field at fault in path.

What only the app does

Some things people do in the VectorShift app have no route in this API:
  • approving, denying or assigning decisions, and listing the ones waiting;
  • comments on records;
  • a record’s emails and meetings;
  • saved table views, favorites and exports;
  • asking to see fields hidden from you.

Before you write: a checklist

  1. Read GET /schema, and use the ids it gives.
  2. For each field you set, check storage, unit and format. Amounts are in the unit, and percents are fractions.
  3. Write option values, not labels.
  4. Decide whether a link between records is a reference field (values) or a relation (links).
  5. Write user ids, never emails or names, in ref(user) fields. Look them up with GET /v1/users.
  6. Make decided changes with the action that makes them, and follow any 202 with GET /decisions/{decision_id}.
  7. Guard updates with If-Match, and send an Idempotency-Key on every write.
  8. Revise a fact, or override it in a scenario, under its fact_id. A new id adds a second fact.