> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs-beta.getzep.com/v4/sdk-reference/graph/episode/add/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-beta.getzep.com/_mcp/server. # Add episode POST https://api.getzep.com/api/v4/graphs/{graph_uuid}/episodes Content-Type: application/json Reference: https://docs-beta.getzep.com/sdk-reference/graph/episode/add ## Authentication - `Authorization` header (required) (prefixed with ` Api-Key `) — Type "Api-Key" followed by a space and the project API key. ## Request ### Path parameters - `graph_uuid` (string, required) — Graph UUID ### Body (application/json) This endpoint expects a v4.AddEpisodeRequest. - `data` (string, required) — The episode content to add to the graph. - `created_at` (string, optional) — The episode's reference time, used for temporal reasoning rather than ingestion time. - `document_id` (string, optional) — Groups this episode as a chunk of a document on the graph. - `metadata` (map from string to any, optional) — Metadata to store on the episode. Max 10 keys. Values must be strings, numbers, booleans, or arrays of scalars. - `source_description` (string, optional) — A description of the source of this episode. - `strict_ontology` (boolean, optional) — When true, prevents extraction of generic entity nodes that do not match the configured ontology. - `type` (enum, optional) — The data format of the episode: text, json, or message. Defaults to text. - Allowed values: `text`, `json`, `message` ## Response ### 202 Accepted - `episode` (v4.Episode, optional) — The newly created episode, a full resource that is readable immediately. Its processed field is false until graph extraction finishes. - `task` (v4.Task, optional) — The asynchronous task that tracks the episode's graph extraction and indexing. ## Errors ### 400 Bad Request Error Bad Request - `error` (v4.ErrorBody, optional) ### 401 Unauthorized Error Unauthorized - `error` (v4.ErrorBody, optional) ### 403 Forbidden Error Forbidden - `error` (v4.ErrorBody, optional) ### 404 Not Found Error Not Found - `error` (v4.ErrorBody, optional) ### 409 Conflict Error Conflict - `error` (v4.ErrorBody, optional) ## Types ### v4.Episode - `content` (string, optional) — The raw content of the episode. - `content_policy` (v4.EpisodeContentPolicy, optional) — The content policy state of the episode, present only on a graph with a bound content policy rule. - `created_at` (string, optional) — The time the episode was created. - `document_id` (string, optional) — The developer-assigned identifier of the document this episode belongs to, present only for episodes added to a document. - `graph_uuid` (string, optional) — The unique identifier of the graph this episode belongs to. - `metadata` (map from string to any, optional) — Custom metadata associated with the episode. - `processed` (boolean, optional) — Whether the episode has finished graph extraction and indexing. - `relevance` (double, optional) — A cross-encoder-derived relevance score, present only when the cross-encoder reranker scored this result; like score, it is omitted from plain list results. - `role` (enum, optional) — The role of the episode's sender, present only when the episode was added as a message. - Allowed values: `system`, `assistant`, `user`, `function`, `tool` - `role_name` (string, optional) — The free-form display name of the episode's sender, present only when the episode was added as a message. - `score` (double, optional) — The ranking score returned with every search result; omitted when the episode appears in a plain list rather than a search result. - `source` (enum, optional) — The format of the episode's content: text, json, or message. - Allowed values: `text`, `json`, `message`, `fact_triple` - `source_description` (string, optional) — A free-form description of where the episode's content came from. - `thread_uuid` (string, optional) — The thread this episode belongs to, present only for episodes added to a thread. - `uuid` (string, optional) — The unique identifier of the episode. - `valid_at` (string, optional) — The time the episode's content became true or was observed, used for temporal reasoning. ### v4.Task - `completed_at` (string, optional) — The time the task reached a terminal status; absent while it is still in progress. - `created_at` (string, optional) — The time the task was created. - `error` (v4.ErrorBody, optional) — The error that caused the task to fail; also present on a partial task when the worker can name a single cause. - `progress` (v4.TaskProgress, optional) — The last processing stage a worker reported for this task. It is not cleared when the task finishes, so a completed task may still show its final stage. - `result` (map from string to any, optional) — Operation-specific output populated once the task reaches succeeded or partial, such as identifiers the operation could not return synchronously. - `started_at` (string, optional) — The time a worker began processing the task; absent until then. - `status` (string, optional) — The task's current state: pending, processing, succeeded, partial, or failed. - `type` (string, optional) — The kind of asynchronous operation the task represents. - `updated_at` (string, optional) — The time the task was last updated. - `uuid` (string, optional) — The unique identifier of the task, used to poll its status. ### v4.ErrorBody - `code` (string, optional) - `details` (map from string to any, optional) - `message` (string, optional) - `param` (string, optional) - `request_id` (string, optional) ### v4.EpisodeContentPolicy - `category_keys` (list of string, optional) — The keys of the categories with a matched rule. - `dropped_count` (integer, optional) — The number of derived candidates that were dropped. - `retained_count` (integer, optional) — The number of derived candidates that were published to the graph. - `revision` (integer, optional) — The project revision number of the policy the graph bound. - `status` (enum, optional) — The evaluation status. pending means the evaluation has not finished, complete means every candidate was evaluated and the graph batch was written, and failed means ingestion retries were exhausted. - Allowed values: `pending`, `complete`, `failed` - `violated` (boolean, optional) — Whether at least one derived candidate matched a rule. Once true, it stays true. ### v4.TaskProgress - `stage` (string, optional) — The most recent processing stage reported by the worker handling the task. ## Examples **Request** ```json { "data": "string" } ``` **Response** ```json { "episode": { "content": "string", "content_policy": { "category_keys": [ "health" ], "dropped_count": 0, "retained_count": 7, "revision": 3, "status": "complete", "violated": false }, "created_at": "string", "document_id": "string", "graph_uuid": "string", "metadata": {}, "processed": true, "relevance": 1.1, "role": "system", "role_name": "string", "score": 1.1, "source": "text", "source_description": "string", "thread_uuid": "string", "uuid": "string", "valid_at": "string" }, "task": { "completed_at": "string", "created_at": "string", "error": { "code": "string", "details": {}, "message": "string", "param": "string", "request_id": "string" }, "progress": { "stage": "string" }, "result": {}, "started_at": "string", "status": "string", "type": "string", "updated_at": "string", "uuid": "string" } } ```