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

# Delete memory

> Delete a memory and its associated chunks from the index.

This removes the memory completely from the vector index and database.
The operation deletes:
1. All chunks associated with the resource (including embeddings)
2. The documents row AND any legacy resources rows sharing the identity —
   leaving either one behind would resurrect the memory through the
   double-read path (ENG-2477).

Args:
    source: The document provider (e.g., gmail, notion, vault)
    resource_id: The unique identifier of the resource to delete
    api_token: Authentication token

Returns:
    MemoryDeletionResponse with deletion details

Raises:
    DocumentNotFound: If the resource doesn't exist or user doesn't have access



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml delete /memories/delete/{source}/{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:
  - APIKey: []
    AsUser: []
paths:
  /memories/delete/{source}/{resource_id}:
    delete:
      tags:
        - Memories
      summary: Delete memory
      description: >-
        Delete a memory and its associated chunks from the index.


        This removes the memory completely from the vector index and database.

        The operation deletes:

        1. All chunks associated with the resource (including embeddings)

        2. The documents row AND any legacy resources rows sharing the identity
        —
           leaving either one behind would resurrect the memory through the
           double-read path (ENG-2477).

        Args:
            source: The document provider (e.g., gmail, notion, vault)
            resource_id: The unique identifier of the resource to delete
            api_token: Authentication token

        Returns:
            MemoryDeletionResponse with deletion details

        Raises:
            DocumentNotFound: If the resource doesn't exist or user doesn't have access
      operationId: delete_memory_memories_delete__source___resource_id__delete
      parameters:
        - name: source
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/DocumentProviders'
        - name: resource_id
          in: path
          required: true
          schema:
            type: string
            title: Resource Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryDeletionResponse'
        '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 memory = await client.memories.delete('resource_id', { source:
            'reddit' });


            console.log(memory.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 = client.memories.delete(
                resource_id="resource_id",
                source="reddit",
            )
            print(memory.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\tmemory, err := client.Memories.Delete(\n\t\tcontext.TODO(),\n\t\t\"resource_id\",\n\t\thyperspell.MemoryDeleteParams{\n\t\t\tSource: hyperspell.MemoryDeleteParamsSourceReddit,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", memory.ResourceID)\n}\n"
        - lang: CLI
          source: |-
            hyperspell memories delete \
              --api-key 'My API Key' \
              --source reddit \
              --resource-id resource_id
components:
  schemas:
    DocumentProviders:
      type: string
      enum:
        - reddit
        - notion
        - slack
        - google_calendar
        - google_mail
        - google_meet
        - box
        - dropbox
        - github
        - gitlab
        - google_drive
        - vault
        - web_crawler
        - trace
        - microsoft_teams
        - granola
        - fathom
        - fireflies
        - linear
        - hubspot
        - salesforce
        - coda
        - confluence
        - jira
        - lightfield
        - gong
        - pylon
        - clickup
      title: DocumentProviders
    MemoryDeletionResponse:
      properties:
        success:
          type: boolean
          title: Success
        resource_id:
          type: string
          title: Resource Id
        source:
          $ref: '#/components/schemas/DocumentProviders'
        chunks_deleted:
          type: integer
          title: Chunks Deleted
        message:
          type: string
          title: Message
      type: object
      required:
        - success
        - resource_id
        - source
        - chunks_deleted
        - message
      title: MemoryDeletionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````