> ## Documentation Index
> Fetch the complete documentation index at: https://oma-codex-339-workspace-permissions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 删除记忆

> 通过 OMA API 删除记忆。

<Info>每个请求都必须发送 `?beta=true`。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json delete /v1/memory_stores/{memory_store_id}/memories/{memory_id}
openapi: 3.1.0
info:
  title: OMA API 参考
  version: 1.0.0
  description: Open Managed Agents 应用 API 参考。
servers:
  - url: http://localhost:38080
    description: 本地 OMA 服务器
security:
  - omaApiKey: []
  - omaBearer: []
paths:
  /v1/memory_stores/{memory_store_id}/memories/{memory_id}:
    delete:
      summary: 删除记忆
      operationId: BetaDeleteMemory
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
        - name: anthropic-beta
          in: header
          required: false
          schema:
            type: string
            items:
              type: string
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: 用于指定一个或多个 Beta 版本的可选请求头。
              items:
                $ref: '#/components/schemas/AnthropicBeta'
            x-default: agent-memory-2026-07-22
        - name: memory_store_id
          in: path
          required: true
          schema:
            type: string
          description: 记忆存储标识符。
        - name: memory_id
          in: path
          required: true
          schema:
            type: string
          description: 记忆标识符。
        - name: expected_content_sha256
          in: query
          required: false
          schema:
            type: string
          description: expected_content_sha256 的查询参数
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsDeletedMemory'
        '400':
          description: Invalid argument - 客户端指定了无效的参数
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '401':
          description: 未认证 - 请求没有有效的认证凭据
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '403':
          description: 权限被拒绝 - 调用方没有执行指定操作的权限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '404':
          description: 未找到 - 请求的某个实体不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '408':
          description: 超出截止时间 - 截止时间在操作完成之前已过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '409':
          description: 自定义错误状态
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '412':
          description: 前置条件不满足 - 由于系统未处于所需状态，操作被拒绝
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '413':
          description: Out of range - 尝试的操作超出了有效范围
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '429':
          description: 资源耗尽 - 某些资源已被耗尽（限流）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '431':
          description: 请求头字段过大 - 请求元数据过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '499':
          description: Cancelled - 操作已被客户端取消
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '500':
          description: Internal - 内部服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '501':
          description: 未实现 - 该操作未实现或不受支持
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '503':
          description: 不可用 - 服务当前不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
        '504':
          description: 超时 - 上游服务未及时响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsErrorResponse'
components:
  schemas:
    BetaManagedAgentsDeletedMemory:
      description: 由删除记忆操作返回的墓碑记录。该记忆的版本历史仍会保留，并可通过列出记忆版本接口继续列举，直到存储本身被删除。
      type: object
      additionalProperties: false
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - memory_deleted
        id:
          description: 被删除记忆的 ID（`mem_...` 值）。
          type: string
    BetaManagedAgentsErrorResponse:
      type: object
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
          description: 错误响应始终为 "error"
        error:
          $ref: '#/components/schemas/BetaManagedAgentsError'
    BetaManagedAgentsError:
      discriminator:
        propertyName: type
        mapping:
          invalid_request_error:
            $ref: '#/components/schemas/BetaInvalidRequestError'
          authentication_error:
            $ref: '#/components/schemas/BetaAuthenticationError'
          billing_error:
            $ref: '#/components/schemas/BetaBillingError'
          permission_error:
            $ref: '#/components/schemas/BetaPermissionError'
          not_found_error:
            $ref: '#/components/schemas/BetaNotFoundError'
          rate_limit_error:
            $ref: '#/components/schemas/BetaRateLimitError'
          timeout_error:
            $ref: '#/components/schemas/BetaGatewayTimeoutError'
          api_error:
            $ref: '#/components/schemas/BetaAPIError'
          overloaded_error:
            $ref: '#/components/schemas/BetaOverloadedError'
          memory_precondition_failed_error:
            $ref: >-
              #/components/schemas/BetaManagedAgentsMemoryPreconditionFailedError
          memory_path_conflict_error:
            $ref: '#/components/schemas/BetaManagedAgentsMemoryPathConflictError'
          conflict_error:
            $ref: '#/components/schemas/BetaManagedAgentsConflictError'
      oneOf:
        - $ref: '#/components/schemas/BetaInvalidRequestError'
        - $ref: '#/components/schemas/BetaAuthenticationError'
        - $ref: '#/components/schemas/BetaBillingError'
        - $ref: '#/components/schemas/BetaPermissionError'
        - $ref: '#/components/schemas/BetaNotFoundError'
        - $ref: '#/components/schemas/BetaRateLimitError'
        - $ref: '#/components/schemas/BetaGatewayTimeoutError'
        - $ref: '#/components/schemas/BetaAPIError'
        - $ref: '#/components/schemas/BetaOverloadedError'
        - $ref: '#/components/schemas/BetaManagedAgentsMemoryPreconditionFailedError'
        - $ref: '#/components/schemas/BetaManagedAgentsMemoryPathConflictError'
        - $ref: '#/components/schemas/BetaManagedAgentsConflictError'
    BetaInvalidRequestError:
      properties:
        message:
          default: Invalid request
          title: 消息
          type: string
        type:
          const: invalid_request_error
          default: invalid_request_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: InvalidRequestError
      type: object
    BetaAuthenticationError:
      properties:
        message:
          default: Authentication error
          title: 消息
          type: string
        type:
          const: authentication_error
          default: authentication_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: AuthenticationError
      type: object
    BetaBillingError:
      properties:
        message:
          default: Billing error
          title: 消息
          type: string
        type:
          const: billing_error
          default: billing_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: BillingError
      type: object
    BetaPermissionError:
      properties:
        message:
          default: Permission denied
          title: 消息
          type: string
        type:
          const: permission_error
          default: permission_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: PermissionError
      type: object
    BetaNotFoundError:
      properties:
        message:
          default: Not found
          title: 消息
          type: string
        type:
          const: not_found_error
          default: not_found_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: NotFoundError
      type: object
    BetaRateLimitError:
      properties:
        message:
          default: Rate limited
          title: 消息
          type: string
        type:
          const: rate_limit_error
          default: rate_limit_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: RateLimitError
      type: object
    BetaGatewayTimeoutError:
      properties:
        message:
          default: Request timeout
          title: 消息
          type: string
        type:
          const: timeout_error
          default: timeout_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: GatewayTimeoutError
      type: object
    BetaAPIError:
      properties:
        message:
          default: Internal server error
          title: 消息
          type: string
        type:
          const: api_error
          default: api_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: APIError
      type: object
    BetaOverloadedError:
      properties:
        message:
          default: Overloaded
          title: 消息
          type: string
        type:
          const: overloaded_error
          default: overloaded_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: OverloadedError
      type: object
    BetaManagedAgentsMemoryPreconditionFailedError:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - memory_precondition_failed_error
        message:
          type: string
    BetaManagedAgentsMemoryPathConflictError:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - memory_path_conflict_error
        message:
          type: string
        conflicting_path:
          type: string
        conflicting_memory_id:
          type: string
    BetaManagedAgentsConflictError:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - conflict_error
        message:
          type: string
  securitySchemes:
    omaApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: OMA 工作区 API 密钥。
      x-default: sk-ant-local-default
    omaBearer:
      type: http
      scheme: bearer
      description: 以 Bearer 令牌形式发送的 OMA 工作区 API 密钥。

````