> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vectorshift.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Query changes

> The change feed with every record filter, including a field's change from one value to another. Fact events are not filtered. A filtered page can hold fewer events than `limit`, even none, while `has_more` is set: keep reading from `next_cursor`.

Not taken on this route yet, until how they combine is published: `head` (400 `unsupported_parameter`).



## OpenAPI

````yaml ontology/openapi.json POST /v1/object-model/changes/query
openapi: 3.1.0
info:
  description: >-
    An organization's records, facts and figures.


    **Beta.** Every operation is `x-stability: beta`: paths, fields and codes
    may still change before v1 is declared stable. From then on, changes within
    v1 are additive only — new operations, optional fields, response fields,
    enum values and error codes — so a client must ignore fields and values it
    does not know. Anything else needs a new version or a six-month deprecation
    announced with Deprecation and Sunset headers.


    ## Idempotency


    Every write needs an `Idempotency-Key` header: 1–255 printable ASCII
    characters, one key per logical write, sent again unchanged on every retry
    of that write. Reads, the read-only POSTs (`/record-search`,
    `/records/{type_id}/query`, `/facts/query`, `/figures/query`,
    `/figures/explain`) and dry runs (`dry_run: true`) need none and are never
    recorded. A write without one is refused with 400
    `idempotency_key_required`.


    A key belongs to the organization and the person the API key acts for, so
    two of one person's API keys retrying one write agree; another person's
    request under the same key is their own. The API records the request — the
    method, the route, the path parameters, the body as parsed (JSON key order
    and spacing do not matter) and any `If-Match` — and its answer:


    - **The same key and the same request, finished**: the recorded answer again
    — status, body, `Object-Model-Version` and `X-Request-Id` — with
    `Idempotent-Replayed: true`. Nothing runs again, and an `If-Match` the
    original carried is not checked again (the original's own success moved the
    version it named).

    - **The same key and the same request, still running**: 409
    `request_in_progress` with `Retry-After`.

    - **The same key and a different request**: 409 `idempotency_key_reused`.
    Use a new key for a new request.


    A replay is authorized like any request first: the API key must still be
    valid and carry the route's scope, and the rate limit counts it.


    **Retention.** A finished write answers its replays for 24 hours; after that
    the key is free again and a request under it runs. A request still running
    holds its key for as long as the API waits for it plus 30 seconds. Each
    write says, under **Re-sent under the same Idempotency-Key**, what a request
    sent again after that gets — past the 24 hours, or after a 504 ("past the
    replay window"). Most writes still recognize their key then, and are not
    made twice.


    **What is recorded.** Every answer the request got, refusals included: a 422
    for an action that stopped part way replays with what it committed, so a
    retry never silently writes more. A 403 for a missing permission, a 5xx, a
    503 and a 504 are not recorded, because none says what was committed: a
    retry with the same key runs again, and the write's own key keeps it from
    being made twice. After a 504 the request may still be running, so a retry
    within its hold hears `request_in_progress`. If the record cannot be written
    or read, the write is not run: 503 `idempotency_unavailable` with
    `Retry-After`.


    **A lost response.**


    ```http

    POST /v1/object-model/records/company

    Idempotency-Key: create-acme-2026-11-12


    {"values": {"name": "Acme"}}

    ```


    The connection drops before the answer arrives. The client sends the same
    request with the same key:


    ```http

    HTTP/1.1 200 OK

    Idempotent-Replayed: true

    X-Request-Id: 7f3a…   (the original request's)


    {"written_id": "6650…", "disposition": "created", "records": […]}

    ```


    **A concurrent duplicate.** A second copy arrives while the first is still
    running:


    ```http

    HTTP/1.1 409 Conflict

    Retry-After: 2


    {"status": "failed", "code": "request_in_progress", "error": "a request with
    this Idempotency-Key is still running; retry after it finishes to get its
    answer"}

    ```


    Retried after it finishes, it gets the first copy's answer with
    `Idempotent-Replayed: true`.


    **The generic endpoint** (`POST /v1/object-model/{object_model_id}/request`,
    the older endpoint these routes replace) takes `Idempotency-Key` optionally:
    without one a request runs every time it is sent; with one it is recorded
    and replayed as above. The model create (`POST /v1/object-model`) needs
    none: an organization has one model, and a second create is refused.
  title: VectorShift Object Model API
  version: '1'
servers:
  - url: https://api.vectorshift.ai
security: []
paths:
  /v1/object-model/changes/query:
    post:
      tags:
        - changes
      summary: >-
        The change feed with every record filter, including a field's change
        from one value to another. Fact events are not filtered. A filtered page
        can hold fewer events than `limit`, even none, while `has_more` is set:
        keep reading from `next_cursor`.
      description: >-
        The change feed with every record filter, including a field's change
        from one value to another. Fact events are not filtered. A filtered page
        can hold fewer events than `limit`, even none, while `has_more` is set:
        keep reading from `next_cursor`.


        Not taken on this route yet, until how they combine is published: `head`
        (400 `unsupported_parameter`).
      operationId: post_changes_query
      requestBody:
        content:
          application/json:
            examples:
              example:
                summary: 'An illustrative body: real ids come from GET /schema.'
                value:
                  cursor: ''
                  exclude_facts: true
                  record_filter:
                    kinds:
                      - updated
                    transitions:
                      - after: won
                        field_id: stage
            schema:
              $ref: >-
                #/components/schemas/object_model_ChangesRequest__post_changes_query
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/object_model_ChangesResult'
          description: Answered.
          headers:
            Object-Model-Version:
              description: The model version the request was served under.
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            Malformed JSON, an unknown field, an unknown query parameter, or one
            naming a field the route fixes.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: Missing, invalid or expired API key.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            The key lacks the scope (`scope_required`), the person lacks the
            permission (`forbidden`), or a feature the request needs is not
            enabled for the organization (`not_enabled`).
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            No such record, or one this caller cannot see — the same answer on
            purpose.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            The organization's records were migrated since this cursor was
            issued, so it names no place in their history (code
            `cursor_resync`): reconcile the records you mirror by listing, then
            read on from `details.cursor`, which starts at the head of their
            history now and keeps your place among fact changes.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: The body is over 8 MiB.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            Understood and declined: a filter, cursor or parameter the read
            can't take.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: Rate limited. Retry-After says when to try again.
          headers:
            Retry-After:
              description: Seconds to wait before trying again.
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: No answer in time. Retry the request.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
      security:
        - apiKey:
            - object_model:changes:read
            - object_model:records:read
        - apiKey:
            - object_model:changes:read
            - object_model:facts:read
components:
  schemas:
    object_model_ChangesRequest__post_changes_query:
      additionalProperties: false
      description: >-
        What `POST /changes/query` takes. Not taken on this route yet, until how
        they combine is published: `head` (400 `unsupported_parameter`).
      properties:
        cursor:
          description: >-
            The previous page's `next_cursor`. Leave it out to start from the
            earliest change kept.
          type: string
        exclude_facts:
          description: Leave out fact events.
          type: boolean
        exclude_records:
          description: Leave out record events.
          type: boolean
        limit:
          description: Events per page, 1 to 500. Default 100.
          type: integer
        record_filter:
          allOf:
            - $ref: '#/components/schemas/object_model_RecordEventFilter'
          description: Only the record events that match it. Fact events are not filtered.
        type_ids:
          description: >-
            Only record events of these types. Fact events are not filtered by
            it.
          items:
            type: string
          type: array
      type: object
    object_model_ChangesResult:
      additionalProperties: false
      properties:
        events:
          items:
            $ref: '#/components/schemas/object_model_ChangeEvent'
          type: array
        has_more:
          type: boolean
        next_cursor:
          type: string
      type: object
    Failure:
      properties:
        code:
          type: string
        details:
          additionalProperties:
            type: string
          type: object
        error:
          type: string
        path:
          type: string
        request_id:
          type: string
        result:
          description: >-
            The operation's own result, when a declined operation has one: what
            it did before it stopped. An action that stopped part way
            (`partial`) carries its `instance_id`, the records it created, its
            `fact_ids` and `field_outcomes` here — the steps that committed.
            Same shape as the route's 200 body.
          type: object
        status:
          const: failed
          type: string
      required:
        - status
        - code
        - error
      type: object
    object_model_RecordEventFilter:
      additionalProperties: false
      description: >-
        An event matches when it meets every member that is set; within one
        list, any entry will do. An empty filter matches every event. A change
        is matched as the caller may see it, so a field they cannot read never
        makes it match. At most 50 entries in each list, and 20 transitions.
      properties:
        actor_ids:
          description: >-
            Only changes made by these people, agents or other objects (the
            event's `actor_id`).
          items:
            type: string
          type: array
        author_ids:
          description: >-
            Only changes made for these people (the event's `author_id`): an
            agent writing for someone is the actor, and that person the author.
          items:
            type: string
          type: array
        field_ids:
          description: >-
            Only changes to one of these fields. A field you cannot read never
            makes a change match.
          items:
            type: string
          type: array
        kinds:
          description: 'Only events of these kinds: `created`, `updated` or `deleted`.'
          items:
            type: string
          type: array
        transitions:
          description: >-
            Only changes of a field from one value to another: the field, and
            its value before and after on the same change.
          items:
            $ref: '#/components/schemas/object_model_FieldTransition'
          type: array
        via:
          description: >-
            Only changes that came from these surfaces (the event's `via`):
            `agent`, `form`, `import`, an API key's channel.
          items:
            type: string
          type: array
      type: object
      x-bounds:
        max_entries: 50
        max_transitions: 20
    object_model_ChangeEvent:
      additionalProperties: false
      properties:
        fact:
          $ref: '#/components/schemas/object_model_Fact'
        kind:
          type: string
        occurred_at:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        record:
          $ref: '#/components/schemas/object_model_RecordChange'
        record_id:
          type: string
        removal:
          $ref: '#/components/schemas/object_model_FactRemoval'
        type_id:
          type: string
      type: object
    object_model_FieldTransition:
      additionalProperties: false
      properties:
        after:
          allOf:
            - $ref: '#/components/schemas/google_protobuf_Value'
          description: >-
            Its value after the change. `null` matches a field the change
            emptied; leave it out to match any value.
        before:
          allOf:
            - $ref: '#/components/schemas/google_protobuf_Value'
          description: >-
            Its value before the change. `null` matches a field that was empty;
            leave it out to match any value.
        field_id:
          description: The field that changed.
          type: string
      type: object
    object_model_Fact:
      additionalProperties: false
      properties:
        asserted_at:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        asserted_by:
          type: string
        asserted_by_label:
          type: string
        axis_values:
          additionalProperties:
            type: string
          type: object
        derived:
          type: boolean
        fact_id:
          type: string
        note:
          type: string
        quantity_id:
          type: string
        retracted:
          type: boolean
        seq:
          format: int64
          type:
            - string
            - integer
        source_channel:
          type: string
        source_kind:
          type: string
        subject_id:
          type: string
        subject_label:
          type: string
        superseded_count:
          type: integer
        valid_from:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        valid_to:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        value:
          type: number
        verified:
          type: boolean
        world_id:
          type: string
      type: object
    google_protobuf_Timestamp:
      format: date-time
      type: string
    object_model_RecordChange:
      additionalProperties: false
      properties:
        actor_id:
          type: string
        actor_kind:
          type: string
        actor_label:
          type: string
        attributes:
          items:
            $ref: '#/components/schemas/object_model_RecordFieldChange'
          type: array
        author_id:
          type: string
        author_label:
          type: string
        kind:
          type: string
        recorded_at:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        relationships:
          items:
            $ref: '#/components/schemas/object_model_RecordActivityRelationship'
          type: array
        revision:
          type: string
        type_id:
          type: string
        via:
          type: string
      type: object
    object_model_FactRemoval:
      additionalProperties: false
      properties:
        fact_id:
          type: string
        quantity_id:
          type: string
        reason:
          type: string
        removed_by:
          type: string
        seq:
          format: int64
          type:
            - string
            - integer
        subject_id:
          type: string
        world_id:
          type: string
      type: object
    google_protobuf_Value: {}
    object_model_RecordFieldChange:
      additionalProperties: false
      properties:
        after:
          allOf:
            - $ref: '#/components/schemas/google_protobuf_Value'
          description: >-
            The value after the change, as `before`. Absent when the change
            emptied the field.
        before:
          allOf:
            - $ref: '#/components/schemas/google_protobuf_Value'
          description: >-
            The value before the change, as a record's `values` holds it: text,
            a number, true or false, an RFC 3339 time, a list, or an image, name
            or location as an object of its parts. Absent when the field was
            empty.
        id:
          type: string
        label:
          type: string
        storage:
          type: string
        unit:
          type: string
      type: object
    object_model_RecordActivityRelationship:
      additionalProperties: false
      properties:
        after:
          items:
            type: string
          type: array
        before:
          items:
            type: string
          type: array
        id:
          type: string
      type: object
  securitySchemes:
    apiKey:
      description: >-
        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`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.