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

# Update an item

> Updates an item's properties, tier, timestamp, or natural-key `source_id`. Properties shallow-merge into the existing row (unmentioned keys keep their values). The optional `version` field enables optimistic concurrency — pass the version the caller is editing from; a mismatch returns `409 version_conflict` with the three-way context (current, ancestor, conflicting fields, resolved merge policy) the client needs to resolve. See [Conflicts](/concepts/conflicts) and [Errors — version_conflict](/api/errors#version-conflict).

The `edges` block has replace-all-for-specified-types semantics: any edge_type listed wipes existing outbound edges of that type from this item, then creates new edges to each listed target. Empty array for an edge_type deletes all edges of that type. Unmentioned edge types are untouched.

Tier and timestamp updates are last-writer-wins and never produce a version conflict.

The `source_id` field repoints the item at a new natural key under the item's `source`. The `(source, source_id)` tuple is unique per tenant — collisions with a different existing item return `409 source_id_conflict`. PATCHing the value the item already carries is a no-op success. Used by the sync agent to preserve item identity through file renames.



## OpenAPI

````yaml /openapi.json patch /items/{id}
openapi: 3.1.0
info:
  title: Marfa API
  version: 4.2.0
  description: Typed data layer for structured personal data
servers: []
security: []
paths:
  /items/{id}:
    patch:
      tags:
        - Items
      summary: Update an item
      description: >-
        Updates an item's properties, tier, timestamp, or natural-key
        `source_id`. Properties shallow-merge into the existing row (unmentioned
        keys keep their values). The optional `version` field enables optimistic
        concurrency — pass the version the caller is editing from; a mismatch
        returns `409 version_conflict` with the three-way context (current,
        ancestor, conflicting fields, resolved merge policy) the client needs to
        resolve. See [Conflicts](/concepts/conflicts) and [Errors —
        version_conflict](/api/errors#version-conflict).


        The `edges` block has replace-all-for-specified-types semantics: any
        edge_type listed wipes existing outbound edges of that type from this
        item, then creates new edges to each listed target. Empty array for an
        edge_type deletes all edges of that type. Unmentioned edge types are
        untouched.


        Tier and timestamp updates are last-writer-wins and never produce a
        version conflict.


        The `source_id` field repoints the item at a new natural key under the
        item's `source`. The `(source, source_id)` tuple is unique per tenant —
        collisions with a different existing item return `409
        source_id_conflict`. PATCHing the value the item already carries is a
        no-op success. Used by the sync agent to preserve item identity through
        file renames.
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                properties:
                  type: object
                  additionalProperties:
                    nullable: true
                version:
                  type: integer
                  minimum: 0
                force_snapshot:
                  type: boolean
                tier:
                  type: string
                  enum:
                    - library
                    - feed
                timestamp:
                  type: string
                source_id:
                  type: string
                edges:
                  type: object
                  additionalProperties:
                    type: array
                    items:
                      type: string
      responses:
        '200':
          description: Item updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  item:
                    type: object
                    properties:
                      id:
                        type: string
                      type:
                        type: string
                      properties:
                        type: object
                        additionalProperties:
                          nullable: true
                      state:
                        type: string
                        enum:
                          - active
                          - archived
                          - trashed
                          - revoked
                      tier:
                        type: string
                        enum:
                          - library
                          - feed
                      tenant_id:
                        type: string
                        nullable: true
                      version:
                        type: number
                      schema_version:
                        type: integer
                      source:
                        type: string
                      source_id:
                        type: string
                      device:
                        type: string
                      capture_latitude:
                        type: number
                      capture_longitude:
                        type: number
                      timestamp:
                        type: string
                      created_at:
                        type: string
                      updated_at:
                        type: string
                      edges:
                        type: object
                        additionalProperties:
                          type: object
                          properties:
                            edges:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  tenant_id:
                                    type: string
                                    nullable: true
                                  source_id:
                                    type: string
                                  target_id:
                                    type: string
                                  edge_type:
                                    type: string
                                  properties:
                                    type: object
                                    additionalProperties:
                                      nullable: true
                                  created_at:
                                    type: string
                                  updated_at:
                                    type: string
                                required:
                                  - id
                                  - source_id
                                  - target_id
                                  - edge_type
                                  - properties
                                  - created_at
                                  - updated_at
                            has_more:
                              type: boolean
                            next_cursor:
                              type: string
                          required:
                            - edges
                            - has_more
                      extensions:
                        type: object
                        additionalProperties:
                          type: object
                          additionalProperties:
                            nullable: true
                    required:
                      - id
                      - type
                      - properties
                      - state
                      - version
                      - schema_version
                      - source
                      - timestamp
                      - created_at
                      - updated_at
                  metadata:
                    type: object
                    properties:
                      item_id:
                        type: string
                      tags:
                        type: array
                        items:
                          type: string
                      extensions:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - item_id
                      - tags
                      - extensions
                required:
                  - item
                  - metadata
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - missing_required_field
                          - invalid_id
                          - invalid_properties
                          - edge_constraint_violation
                          - edge_cycle
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - unauthorized
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '404':
          description: Item not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - item_not_found
                          - edge_type_not_found
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '409':
          description: >-
            Version conflict (optimistic-concurrency mismatch on `properties`)
            or `source_id_conflict` (target natural key already in use by
            another item under the item's `source`).
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - version_conflict
                          status:
                            type: number
                            enum:
                              - 409
                        required:
                          - code
                          - status
                      current:
                        type: object
                        properties:
                          version:
                            type: number
                          properties:
                            type: object
                            additionalProperties:
                              nullable: true
                        required:
                          - version
                          - properties
                      ancestor:
                        type: object
                        properties:
                          version:
                            type: number
                          properties:
                            type: object
                            additionalProperties:
                              nullable: true
                        required:
                          - version
                          - properties
                      conflicting_fields:
                        type: array
                        items:
                          type: string
                      merge_policy:
                        type: object
                        properties:
                          fields:
                            type: object
                            additionalProperties:
                              type: string
                              enum:
                                - last_writer_wins
                                - keep_both_copies
                          default:
                            type: string
                            enum:
                              - last_writer_wins
                              - keep_both_copies
                    required:
                      - error
                      - current
                      - ancestor
                      - conflicting_fields
                      - merge_policy
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - source_id_conflict
                          message:
                            type: string
                          details:
                            type: object
                            additionalProperties:
                              nullable: true
                        required:
                          - code
                          - message
                    required:
                      - error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or OAuth Token
      description: Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)

````