> ## 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 multiple memories

> Adds multiple documents to the index in a single request.

All items are validated before any database operations occur. If any item
fails validation, the entire batch is rejected with a 422 error detailing
which items failed and why.

Maximum 100 items per request. Each item follows the same schema as the
single-item /memories/add endpoint.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /memories/add/bulk
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/bulk:
    post:
      tags:
        - Memories
      summary: Add multiple memories
      description: >-
        Adds multiple documents to the index in a single request.


        All items are validated before any database operations occur. If any
        item

        fails validation, the entire batch is rejected with a 422 error
        detailing

        which items failed and why.


        Maximum 100 items per request. Each item follows the same schema as the

        single-item /memories/add endpoint.
      operationId: add_bulk_memories_add_bulk_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkIngestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkIngestResponse'
        '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 response = await client.memories.addBulk({ items: [{ text:
            '...' }] });


            console.log(response.count);
        - 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
            )
            response = client.memories.add_bulk(
                items=[{
                    "text": "..."
                }],
            )
            print(response.count)
        - 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\tresponse, err := client.Memories.AddBulk(context.TODO(), hyperspell.MemoryAddBulkParams{\n\t\tItems: []hyperspell.MemoryAddBulkParamsItem{{\n\t\t\tText: \"...\",\n\t\t}},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Count)\n}\n"
        - lang: CLI
          source: |-
            hyperspell memories add-bulk \
              --api-key 'My API Key' \
              --item '{text: ...}'
components:
  schemas:
    BulkIngestRequest:
      properties:
        items:
          items:
            $ref: '#/components/schemas/IngestRequest'
          type: array
          maxItems: 100
          minItems: 1
          title: Items
          description: List of memories to ingest. Maximum 100 items.
      type: object
      required:
        - items
      title: BulkIngestRequest
      description: Request schema for bulk memory ingestion.
    BulkIngestResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        count:
          type: integer
          title: Count
          description: Number of items successfully processed
        items:
          items:
            $ref: '#/components/schemas/DocumentStatusResponse'
          type: array
          title: Items
          description: Status of each ingested item
        skipped:
          items:
            $ref: '#/components/schemas/BulkItemSkip'
          type: array
          title: Skipped
          description: >-
            Items not ingested because their resource_id is already owned by
            another user on this app. Empty in the common case; a non-empty list
            is a partial success, not an error.
      type: object
      required:
        - count
        - items
      title: BulkIngestResponse
      description: Response schema for successful bulk ingestion.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
    BulkItemSkip:
      properties:
        resource_id:
          type: string
          title: Resource Id
          description: Resource ID of the skipped item
        reason:
          type: string
          title: Reason
          description: Why the item was skipped (e.g. 'owned_by_another_user')
      type: object
      required:
        - resource_id
        - reason
      title: BulkItemSkip
      description: >-
        A bulk item that was neither written nor indexed, with the reason.


        Currently the only reason is ``owned_by_another_user``: the document
        identity

        ``(app_id, source, resource_id)`` omits owner (ENG-2475/D1), so a
        resource_id

        already held by another user on the app cannot be written by this
        caller. The

        bulk endpoint skips it — never touching the other user's document —
        rather than

        rejecting the whole batch with a 409, which a client retries forever
        (the Micro

        vault 409 storm). Single-item ``/memories/add`` still returns 409.
    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
    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
  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

````