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

# Update a Vault memory only at the expected revision

> Update a Vault memory only if its current revision matches the precondition.



## OpenAPI

````yaml https://api.hyperspell.com/openapi.json post /memories/conditional/update/{resource_id}
openapi: 3.1.0
info:
  title: Hyperspell API
  summary: >-
    Hyperspell is the memory layer for AI apps and agents. Through the API, you
    can add memories, connect data sources to index them in real-time, and
    search memories with our natural language query engine.
  termsOfService: https://hyperspell.com/blog/tos
  contact:
    name: Hyperspell
    url: https://hyperspell.com/
    email: hello@hyperspell.com
  version: 0.32.1
servers:
  - url: https://api.hyperspell.com
    description: Production
security: []
paths:
  /memories/conditional/update/{resource_id}:
    post:
      tags:
        - Memories
      summary: Update a Vault memory only at the expected revision
      description: >-
        Update a Vault memory only if its current revision matches the
        precondition.
      operationId: update_conditional_memories_conditional_update__resource_id__post
      parameters:
        - name: resource_id
          in: path
          required: true
          schema:
            type: string
            title: Resource Id
        - name: X-As-User
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Optionally set this header to act as a specific user when using an
              API Key, equivalent to first exchanging the API Key for a User
              Token
            title: X-As-User
          description: >-
            Optionally set this header to act as a specific user when using an
            API Key, equivalent to first exchanging the API Key for a User Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConditionalUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentStatusResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
components:
  schemas:
    ConditionalUpdateRequest:
      properties:
        expected_revision:
          type: string
          maxLength: 128
          minLength: 1
          title: Expected Revision
        text:
          anyOf:
            - type: string
            - {}
            - type: 'null'
          title: Text
          description: >-
            Full text of the document. If provided, the document will be
            re-indexed.
          default: {}
        collection:
          anyOf:
            - type: string
            - {}
            - type: 'null'
          title: Collection
          description: >-
            The collection to move the document to — deprecated, set the
            collection using metadata instead.
          default: {}
          deprecated: true
        title:
          anyOf:
            - type: string
            - {}
            - type: 'null'
          title: Title
          description: Title of the document.
          default: {}
        date:
          anyOf:
            - type: string
              format: date-time
            - {}
            - type: 'null'
          title: Date
          description: Date of the document for ranking and filtering.
          default: {}
        metadata:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: integer
                  - type: number
                  - type: boolean
                  - type: 'null'
              type: object
            - {}
            - type: 'null'
          title: Metadata
          description: >-
            Custom metadata for filtering. Keys must be alphanumeric with
            underscores, max 64 chars. Values must be string, number, boolean,
            or null. Will be merged with existing metadata.
          default: {}
        share:
          anyOf:
            - type: string
              enum:
                - personal
                - shared
            - {}
          title: Share
          description: >-
            Change who can see this memory. Omit to leave sharing unchanged.
            `personal` makes it visible only to its user, removing it from
            everyone in the app if it was shared. `shared` shares it with
            everyone in the app, and is only accepted when the app allows direct
            sharing.
          default: {}
      type: object
      required:
        - expected_revision
      title: ConditionalUpdateRequest
    DocumentStatusResponse:
      properties:
        source:
          $ref: '#/components/schemas/DocumentProviders'
        resource_id:
          type: string
          title: Resource Id
        status:
          $ref: '#/components/schemas/DocumentStatus'
        revision:
          anyOf:
            - type: string
            - type: 'null'
          title: Revision
          description: Opaque Vault write version for a subsequent conditional write.
      type: object
      required:
        - source
        - resource_id
        - status
      title: DocumentStatusResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentProviders:
      type: string
      enum:
        - reddit
        - notion
        - slack
        - google_calendar
        - google_mail
        - imap
        - google_meet
        - box
        - dropbox
        - github
        - gitlab
        - google_drive
        - vault
        - web_crawler
        - trace
        - microsoft_outlook
        - microsoft_teams
        - granola
        - fathom
        - fireflies
        - figma
        - linear
        - hubspot
        - salesforce
        - coda
        - confluence
        - jira
        - metabase
        - gong
        - clickup
        - lightfield
        - pylon
        - fellow
        - odoo
        - external_mcp
        - page
      title: DocumentProviders
    DocumentStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - pending_review
        - skipped
        - filtered
        - cancelled
      title: DocumentStatus
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKey:
      type: http
      description: >-
        API Key or JWT User Token. If using an API Key, set the X-As-User header
        to act as a specific user. A JWT User Token is always scoped to a
        specific user.
      scheme: bearer
      bearerFormat: Bearer <token>

````

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