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

# Push state

> State from a system of record, up to 1,000 items: a field moves only when the item version is greater than the one that last wrote it. The `state:push` scope.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/objects/push
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/objects/push:
    post:
      tags:
        - state
      summary: Push state
      description: >-
        State from a system of record: a shared object's items are decided
        against the working set's hot

        copy with no database statement and written within a second; a
        customer's, kept in one statement.


        **Authentication.** Source key: `Authorization: Bearer nia_sk_...`.
        Required scope: `state:push`. It answers only in a space with the
        `state` feature on (the `features` document); in a space without it,
        404.
      operationId: push_objects_v1_objects_push_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObjectPushRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectPushResponse'
          description: Successful Response
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            from niadra.models.state import ObjectPush, ObjectPushRequest,
            Provenance, StateRef


            # The system of record pushes what it knows; a field moves only
            under a greater version

            niadra.api.push_objects(ObjectPushRequest(objects=[
                ObjectPush(
                    ref=StateRef(type="item_variant", namespace="store", id="991"),
                    version=1042,
                    fields={"available": True, "price_sale": 199.9},
                    provenance=Provenance(source="live", source_observed_at=now),
                ),
            ]))
        - lang: typescript
          label: TypeScript
          source: >-
            // The system of record pushes what it knows; a field moves only
            under a greater version

            await niadra.api.pushObjects({
              objects: [
                {
                  ref: { type: "item_variant", namespace: "store", id: "991" },
                  version: 1042,
                  fields: { available: true, price_sale: 199.9 },
                  provenance: { source: "live", source_observed_at: now },
                },
              ],
            });
components:
  schemas:
    ObjectPushRequest:
      additionalProperties: false
      properties:
        objects:
          items:
            $ref: '#/components/schemas/ObjectPush'
          maxItems: 1000
          minItems: 1
          title: Objects
          type: array
      required:
        - objects
      title: ObjectPushRequest
      type: object
    ObjectPushResponse:
      additionalProperties: false
      description: >-
        How many items of the request each decision took, against the hot layer,
        with no database statement.


        A shared object's item is `applied` when at least one of its fields
        moved forward: reads serve it at once,

        and the consolidator writes it within a second with the same per-field
        rule, so the stored object never

        disagrees with the answer. `stale_version`: every field was already
        written by this version or a greater

        one, as a retried request finds. `out_of_set`: the object is not in the
        working set, and nothing is kept.

        A subject's object is `recorded`: accepted as a system event about it,
        in the request's one statement,

        and its fields move by the same rule when the event is applied.
      properties:
        applied:
          title: Applied
          type: integer
        out_of_set:
          title: Out Of Set
          type: integer
        recorded:
          default: 0
          title: Recorded
          type: integer
        stale_version:
          title: Stale Version
          type: integer
      required:
        - applied
        - stale_version
        - out_of_set
      title: ObjectPushResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    ObjectPush:
      additionalProperties: false
      properties:
        fields:
          additionalProperties: true
          maxProperties: 200
          minProperties: 1
          title: Fields
          type: object
        inputs:
          anyOf:
            - additionalProperties:
                maxLength: 256
                minLength: 1
                type: string
              maxProperties: 20
              propertyNames:
                maxLength: 256
                minLength: 1
              type: object
            - type: 'null'
          description: >-
            For a customer's derived object (a quote): the objects its inputs
            are fields of, by the name its type gives them, as
            `type:namespace:id` (`{"lead": "lead:crm:L-9"}`). When a field of
            one of them changes, the object expires, naming the input.
          title: Inputs
        provenance:
          $ref: '#/components/schemas/Provenance'
        ref:
          $ref: '#/components/schemas/StateRef'
        request_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          description: >-
            The refresh request this item answers, from the resolver worker's
            lease: the request is settled, and a `watch_revalidation` is decided
            on these values even when they are not newer than the ones held.
          title: Request Id
        version:
          description: >-
            The source's version of the object. A field moves only when this is
            greater than the version that last wrote it; a source never reuses a
            version for other content.
          maximum: 9007199254740991
          minimum: 0
          title: Version
          type: integer
      required:
        - ref
        - version
        - fields
        - provenance
      title: ObjectPush
      type: object
    Provenance:
      additionalProperties: false
      description: >-
        Where pushed values come from: only a `live` source sustains a claim,
        and the age of every value counts

        from `source_observed_at`.
      properties:
        scope:
          default: global
          enum:
            - global
            - customer
            - context
          title: Scope
          type: string
        source:
          enum:
            - live
            - snapshot
            - cache
          title: Source
          type: string
        source_observed_at:
          format: date-time
          title: Source Observed At
          type: string
      required:
        - source
        - source_observed_at
      title: Provenance
      type: object
    StateRef:
      additionalProperties: false
      description: >-
        An object of the type registry: a subject's or a shared one, whose key
        may name a variant.
      properties:
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
        namespace:
          maxLength: 256
          minLength: 1
          title: Namespace
          type: string
        type:
          maxLength: 256
          minLength: 1
          title: Type
          type: string
        variant:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Variant
      required:
        - type
        - namespace
        - id
      title: StateRef
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````