> ## 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.

# Add a memory

> Adds an arbitrary document to the index. This can be any text, email,
call transcript, etc. The document will be processed and made available for
querying once the processing is complete.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /memories/add
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:
  - APIKey: []
    AsUser: []
paths:
  /memories/add:
    post:
      tags:
        - Memories
      summary: Add a memory
      description: >-
        Adds an arbitrary document to the index. This can be any text, email,

        call transcript, etc. The document will be processed and made available
        for

        querying once the processing is complete.
      operationId: add_memories_add_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestRequest'
        required: true
      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: []
        - AsUser: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Hyperspell from '@hyperspell/hyperspell';

            const client = new Hyperspell({
              apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
            });

            const memoryStatus = await client.memories.add({ text: '...' });

            console.log(memoryStatus.resource_id);
        - lang: Python
          source: |-
            import os
            from hyperspell import Hyperspell

            client = Hyperspell(
                api_key=os.environ.get("HYPERSPELL_API_KEY"),  # This is the default and can be omitted
            )
            memory_status = client.memories.add(
                text="...",
            )
            print(memory_status.resource_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/hyperspell/hyperspell-go\"\n\t\"github.com/hyperspell/hyperspell-go/option\"\n)\n\nfunc main() {\n\tclient := hyperspell.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmemoryStatus, err := client.Memories.Add(context.TODO(), hyperspell.MemoryAddParams{\n\t\tText: \"...\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", memoryStatus.ResourceID)\n}\n"
        - lang: CLI
          source: |-
            hyperspell memories add \
              --api-key 'My API Key' \
              --text ...
components:
  schemas:
    IngestRequest:
      properties:
        resource_id:
          type: string
          title: Resource Id
          description: >-
            The resource ID to add the document to. If not provided, a new
            resource ID will be generated. If provided, the document will be
            updated if it already exists.
        text:
          type: string
          title: Text
          description: Full text of the document.
        collection:
          anyOf:
            - type: string
            - type: 'null'
          title: Collection
          description: >-
            The collection to add the document to — deprecated, set the
            collection using metadata instead.
          deprecated: true
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Title of the document.
        date:
          type: string
          format: date-time
          title: Date
          description: >-
            Date of the document. Depending on the document, this could be the
            creation date or date the document was last updated (eg. for a chat
            transcript, this would be the date of the last message). This helps
            the ranking algorithm and allows you to filter by date range.
        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.
      type: object
      required:
        - text
      title: IngestRequest
      examples:
        - collection: my-collection
          metadata:
            author: John Doe
            date: '2025-05-20T02:31:00Z'
            rating: 3
          text: ...
          title: My Document
    DocumentStatusResponse:
      properties:
        source:
          $ref: '#/components/schemas/DocumentProviders'
        resource_id:
          type: string
          title: Resource Id
        status:
          $ref: '#/components/schemas/DocumentStatus'
      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
        - box
        - dropbox
        - github
        - google_drive
        - vault
        - web_crawler
        - trace
        - microsoft_teams
        - gmail_actions
        - granola
        - fathom
        - fireflies
        - linear
        - hubspot
        - salesforce
        - coda
        - lightfield
        - gong
        - pylon
        - clickup
      title: DocumentProviders
    DocumentStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - pending_review
        - skipped
      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
      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>
    AsUser:
      type: apiKey
      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
      in: header
      name: X-As-User

````