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’sname,relation_id,quantity_id,definition_id,action_idandworld_id.display_nameis 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(underfacets) is absent from every record you read. - Cache it. Send the previous answer’s
declarations_fingerprintasknown_declarations_fingerprint. If nothing changed, the answer saysreuse_declarations: trueand 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’sattributes 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
facetsgroup fields that apply only while a condition on the record holds.whenis 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
hiddenis absent from every record you read, and a facet markedrestrictedis present on some records only. Don’t write or report a hidden field. - Fields scoped to a parent. A field with
scope_attributeandscope_record_idapplies only to records whosescope_attributeholds that record. A field withchoice_overridestakes 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 whosestorage 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:
relations. It is written on the record of from_type_id, under links, keyed by relation_id:
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 whosestorage 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 alifecycle 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:
- A record update that makes the change is refused with
422. - Make it by running the action that makes it: one whose
sourcesets that field. If the key’s person is not one of its deciders, the run answers202with adecision_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. - Follow the decision with
GET /decisions/{decision_id}. Itsstatusispending,approved,denied,expiredorwithdrawn. Onlyapprovedmakes the change, and the record then changes as the change feed and a read show.
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_idis a record of the action’ssubject_type_id.paramsare written like fields of the same type: each param’sparam_typeuses the same words as a field’sstorage. Alistparam takes an array of objects with the param’sfields, andref(quantity)andref(definition)take an id.- A
creatableparam takes an existing record’s id, or{"new": {<field>: <value>, …}}to create the record as the action runs. requireslists each rule’s message. A run that fails one is refused with422and writes nothing.sourceshows 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: falsemeans the key’s person may not run it at all.- Preview first.
dry_run: truechecks everything and writes nothing.
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:
422withcodewould_lose_access.result.lockoutnames the wall and counts what you would lose sight of (records, and of thoseown). To go ahead, send the run again with"confirm_lockout": trueunder a newIdempotency-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:
422withcodewalled. - A wall that asks the people inside passes a dry run. The live run writes nothing and asks them to take the record:
202withstatusproposedand adecision_idto follow, as for a decided change. For a record the run would create, it is refused withwalled.
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 asubject_type_id (a fact’s subject_id is a record of that type), a unit, and:
time: what a fact’s dates mean.intervalis a value overvalid_fromtovalid_to,instantis a value atvalid_from, andtimelesshas no history.measure_kind: how values combine. Aflow(rent collected in a quarter) adds up over a period. Alevel(an appraised value) is read at its latest, never summed.axis_ids: further dimensions each fact carries inaxis_values, from the schema’saxes.
{"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.
1 holds a ratio as a fraction (0.25 for 25%).
valid_fromis the date a fact is about. For anintervalquantity,valid_toends the interval and is not included. Figures place a fact byvalid_fromalone: 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 withGET /factsand send itsfact_idwith the new value. An assertion without one records a new fact beside the old, and aflowfigure counts both.
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
atis the first instant of its period, at midnight UTC. A fiscal year starts the month afterfiscal_year_end_month, and its quarters are its four three-month periods: with a June year end, the year that ends in June 2027 starts2026-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
flowfigures. A figure’smeasure_kindsays how it combines. Summinglevel,ratio,rateorstatefigures yourself gives a meaningless number: ask for the figure over the whole selection instead. - A figure may have no value.
not_computablemeans there were no facts to compute it from: show a blank, not zero.not_applicablemeans 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:
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:- Start it with
POST /record-write-jobs: thetype_id, amode(create,updateorupsert), anamespacefor your system’s ids, and anIdempotency-Key. - 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 ownpart_id. A job holds up to 100,000 items. - Seal it with
POST /record-write-jobs/{job_id}/seal, and writing starts. - Follow it with
GET /record-write-jobs/{job_id}untilstateiscompleted,failedorcancelled, then read each item’s outcome from.../results.
- 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. Apersonal_nameis{"map": {"items": {"first_name": {"string": "Ada"}, "last_name": {"string": "Lovelace"}}}}, and alocationamapofstreet_address,city,state,postal_codeandcountry. - Records are found by id only. An item names its record with
record_id, or withexternal_id, your system’s id in the job’snamespace, 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 sendrecord_idwithexternal_id, so later jobs find them byexternal_idalone. Otherwise a create that repeats anyuniquefield’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 areskipped. Chunks before it stay written. To recover, fix what the error names and send the items whose outcome has anerror_codein 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 inGET /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 inissue_rows, by its row number in the sheet, with what is wrong in each column. - A tracker import (
import … { tracker { … } }) takes nosubject_id: it matches each row to the record it names. Its dry run answers each row’s match and changes intracker.rows, with flags to answer inchoiceswhen you save, and its save writes each row on its own, so one refused row leaves the others saved. Setfallback_date_utconce and send it on every request for the same file.
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 withPOST /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.
"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 writtenname: <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 fromGET /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.
GET /model, send the whole declaration as an upsert without member, and check it with dry_run.
Writing safely
- Send an
Idempotency-Keyon 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 asIf-Matchon an update: if the record has changed since, nothing is applied and the answer is412 revision_mismatch, withdetails.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_addandlist_removechange a list field without reading it first. See Field types. - Fix a refusal and resend under a new key. A
422names the field at fault inpath.
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
- Read
GET /schema, and use the ids it gives. - For each field you set, check
storage,unitandformat. Amounts are in the unit, and percents are fractions. - Write option values, not labels.
- Decide whether a link between records is a reference field (
values) or a relation (links). - Write user ids, never emails or names, in
ref(user)fields. Look them up withGET /v1/users. - Make decided changes with the action that makes them, and follow any
202withGET /decisions/{decision_id}. - Guard updates with
If-Match, and send anIdempotency-Keyon every write. - Revise a fact, or override it in a scenario, under its
fact_id. A new id adds a second fact.
