Delete a Memory
anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.Delete a Memory
Parameters
The ID of the memory to delete (mem_...).
params BetaMemoryStoreMemoryDeleteParams
The ID of the memory store that holds the memory (memstore_...).
ExpectedContentSha256 param.Opt[string] OptionalQuery parameterDelete the memory only if its current content_sha256 equals this value, given as 64 lowercase hexadecimal characters. Omit it to delete unconditionally.
Delete the memory only if its current content_sha256 equals this value, given as 64 lowercase hexadecimal characters. Omit it to delete unconditionally.
If the hashes differ, the request fails with HTTP status 409 and nothing is deleted.
Betas []AnthropicBeta OptionalHeader parameterThis endpoint is in beta: requests must send agent-memory-2026-07-22 or managed-agents-2026-04-01 in this header.
This endpoint is in beta: requests must send agent-memory-2026-07-22 or managed-agents-2026-04-01 in this header.
const AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24"Deprecated
const AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31"Deprecated
const AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25"Deprecated
const AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01"Deprecated
const AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19"Deprecated
const AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14"Deprecated
const AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11"Deprecated
const AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02"Deprecated
const AnthropicBetaCacheDiagnosis2026_04_07 AnthropicBeta = "cache-diagnosis-2026-04-07"Deprecated
const AnthropicBetaCEUserManagement2026_07_13 AnthropicBeta = "ce-user-management-2026-07-13"Deprecated
WorkspaceID param.Opt[string] OptionalHeader parameterOptional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy).
Optional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy).
Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.
Returns
type BetaManagedAgentsDeletedMemory struct { Type: "memory_deleted"; ID }The confirmation that Delete a Memory returns.
The confirmation that Delete a Memory returns.
Deleting a memory doesn't delete its versions. List Memory Versions returns them while they are retained: each version is kept for at least the version retention period after it was written, unless the store itself is deleted.
See the memory guide to learn more about how long versions are kept.
ID of the deleted memory (a mem_... value).
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go/v2"
"github.com/anthropics/anthropic-sdk-go/v2/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"),
)
betaManagedAgentsDeletedMemory, err := client.Beta.MemoryStores.Memories.Delete(
context.TODO(),
"memory_id",
anthropic.BetaMemoryStoreMemoryDeleteParams{
MemoryStoreID: "memory_store_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", betaManagedAgentsDeletedMemory.ID)
}{
"id": "id",
"type": "memory_deleted"
}Returns Examples
{
"id": "id",
"type": "memory_deleted"
}