> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs-beta.getzep.com/v4/deleting-data-from-the-graph/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-beta.getzep.com/_mcp/server. # Deleting Data from the Graph Each delete method in this page takes the UUID of the item. The graph artifact methods also take the UUID of the graph that contains the item. A delete is asynchronous: the call returns a task, and Zep removes the data in the background. See [Check data ingestion status](/check-data-ingestion-status#checking-operation-status-with-task-polling) to poll a task. ## Delete an Edge Here's how to delete an edge from a graph: **`Python`** ```python Python from zep_cloud.client import Zep client = Zep( api_key=API_KEY, ) result = client.graph.edge.delete(graph_uuid, edge_uuid) print(f"Delete task UUID: {result.task.uuid_}") ``` **`TypeScript`** ```typescript TypeScript import { ZepClient } from "@getzep/zep-cloud"; const client = new ZepClient({ apiKey: API_KEY, }); const result = await client.graph.edge.delete(graphUuid, edgeUuid); console.log(`Delete task UUID: ${result.task?.uuid}`); ``` **`Go`** ```go Go import ( "context" "log" "github.com/getzep/zep-go/v4/client" "github.com/getzep/zep-go/v4/option" ) ctx := context.TODO() zepClient := client.NewClient(option.WithAPIKey(apiKey)) result, err := zepClient.Graph.Edge.Delete(ctx, graphUUID, edgeUUID) if err != nil { log.Fatal("Error deleting edge:", err) } log.Println("Delete task UUID:", *result.Task.UUID) ``` Note that when you delete an edge, it never deletes the associated nodes, even if it means there will be a node with no edges. ## Delete a Node Here's how to delete a node from a graph: **`Python`** ```python Python from zep_cloud.client import Zep client = Zep( api_key=API_KEY, ) result = client.graph.node.delete(graph_uuid, node_uuid) print(f"Delete task UUID: {result.task.uuid_}") ``` **`TypeScript`** ```typescript TypeScript import { ZepClient } from "@getzep/zep-cloud"; const client = new ZepClient({ apiKey: API_KEY, }); const result = await client.graph.node.delete(graphUuid, nodeUuid); console.log(`Delete task UUID: ${result.task?.uuid}`); ``` **`Go`** ```go Go import ( "context" "log" "github.com/getzep/zep-go/v4/client" "github.com/getzep/zep-go/v4/option" ) ctx := context.TODO() zepClient := client.NewClient(option.WithAPIKey(apiKey)) result, err := zepClient.Graph.Node.Delete(ctx, graphUUID, nodeUUID) if err != nil { log.Fatal("Error deleting node:", err) } log.Println("Delete task UUID:", *result.Task.UUID) ``` > **Note** > > Deleting a node will also delete all edges connected to that node. This is a cascading delete operation - the node and all its relationships are permanently removed from the graph. ## Delete an Episode > **Note** > > Deleting an episode does not regenerate the names or summaries of nodes shared with other episodes. This episode information may still exist within these nodes. If an episode invalidates a fact, and the episode is deleted, the fact will remain marked as invalidated. When you delete an [episode](/graphiti/core-concepts/adding-episodes): * **Edges** are deleted only if no other episodes are associated with them. An edge associated with other episodes will be preserved. * **Nodes** are deleted only if no other episodes are associated with them. A node associated with other episodes will be preserved. * **User entity exception**: For user graphs, the user entity node is never deleted when an episode is deleted. The user entity is created automatically when the user is created, before any episodes are added, so it is always preserved. Here's how to delete an episode from a graph: **`Python`** ```python Python from zep_cloud.client import Zep client = Zep( api_key=API_KEY, ) result = client.graph.episode.delete(graph_uuid, episode_uuid) print(f"Delete task UUID: {result.task.uuid_}") ``` **`TypeScript`** ```typescript TypeScript import { ZepClient } from "@getzep/zep-cloud"; const client = new ZepClient({ apiKey: API_KEY, }); const result = await client.graph.episode.delete(graphUuid, episodeUuid); console.log(`Delete task UUID: ${result.task?.uuid}`); ``` **`Go`** ```go Go import ( "context" "log" "github.com/getzep/zep-go/v4/client" "github.com/getzep/zep-go/v4/option" ) ctx := context.TODO() zepClient := client.NewClient(option.WithAPIKey(apiKey)) result, err := zepClient.Graph.Episode.Delete(ctx, graphUUID, episodeUUID) if err != nil { log.Fatal("Error deleting episode:", err) } log.Println("Delete task UUID:", *result.Task.UUID) ``` ### How episodes become associated with edges and nodes Whether an edge or node survives an episode deletion depends on its episode associations — the links between an episode and the artifacts Zep derived from it. For a full explanation of how episodes associate with edges, nodes, and the other context types, how to inspect those associations, and how episode metadata projects across them, see [Episode metadata projection](/episode-metadata-projection#how-episodes-associate-with-each-context-type). ## Delete a Thread Deleting a thread removes all episodes associated with that thread. This triggers a cascading effect on the graph. When a thread is deleted, each associated episode is removed. For each episode: * **Edges** are deleted only if no other episodes are associated with them * **Nodes** are deleted only if no other episodes are associated with them * **User entity exception**: For user graphs, the user entity node is never deleted, even if all episodes are removed. The user entity is created when the user is created, before any episodes are added, so it is always preserved. This design preserves graph integrity. If multiple conversations mention the same entity or establish the same relationship, deleting one thread will not remove data that other threads contributed to the graph. Here's how to delete a thread: **`Python`** ```python Python from zep_cloud.client import Zep client = Zep( api_key=API_KEY, ) # The thread UUID that you stored when you created the thread result = client.thread.delete(zep_thread_uuid) print(f"Delete task UUID: {result.task.uuid_}") ``` **`TypeScript`** ```typescript TypeScript import { ZepClient } from "@getzep/zep-cloud"; const client = new ZepClient({ apiKey: API_KEY, }); // The thread UUID that you stored when you created the thread const result = await client.thread.delete(zepThreadUuid); console.log(`Delete task UUID: ${result.task?.uuid}`); ``` **`Go`** ```go Go import ( "context" "log" "github.com/getzep/zep-go/v4/client" "github.com/getzep/zep-go/v4/option" ) ctx := context.TODO() zepClient := client.NewClient(option.WithAPIKey(apiKey)) // The thread UUID that you stored when you created the thread result, err := zepClient.Thread.Delete(ctx, zepThreadUUID) if err != nil { log.Fatal("Error deleting thread:", err) } log.Println("Delete task UUID:", *result.Task.UUID) ``` > Delete edges, nodes, episodes, threads, users, and shared Context Graphs