> 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/thread/add-messages/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-beta.getzep.com/_mcp/server. # Add thread messages POST https://api.getzep.com/api/v4/threads/{thread_uuid}/messages Content-Type: application/json Reference: https://docs-beta.getzep.com/sdk-reference/thread/add-messages ## Authentication - `Authorization` header (required) (prefixed with ` Api-Key `) — Type "Api-Key" followed by a space and the project API key. ## Request ### Path parameters - `thread_uuid` (string, required) — Thread UUID ### Body (application/json) This endpoint expects a v4.AddMessagesRequest. - `messages` (list of v4.AddMessage, required) — The messages to add to the thread. - `ignore_roles` (list of string, optional) — Message roles to skip during graph extraction; the messages are still stored. - `return_context` (boolean, optional) — When true, returns the context block for the thread's most recent messages. - `strict_ontology` (boolean, optional) — When true, prevents extraction of generic entity nodes that do not match the configured ontology. ## Response ### 202 Accepted - `context` (string, optional) — The context block assembled from the graph after adding the messages, present only when return_context is true in the request. - `messages` (list of v4.Message, optional) — The messages that were added, each including its assigned identifier. - `task` (v4.Task, optional) — The asynchronous task that tracks the messages' graph extraction and indexing. ## Errors ### 400 Bad Request Error Bad Request - `error` (v4.ErrorBody, optional) ### 401 Unauthorized Error Unauthorized - `error` (v4.ErrorBody, optional) ### 404 Not Found Error Not Found - `error` (v4.ErrorBody, optional) ### 409 Conflict Error Conflict - `error` (v4.ErrorBody, optional) ## Types ### v4.AddMessage - `content` (string, optional) — The content of the message. - `created_at` (string, optional) — The message's reference time, used for temporal reasoning rather than ingestion time. Defaults to the ingestion time. - `metadata` (map from string to any, optional) — Custom metadata to store with the message. Max 10 keys. Values must be strings, numbers, booleans, or arrays of scalars. - `name` (string, optional) — A customizable name for the sender of the message, for example "john" or "sales_agent". - `role` (enum, optional) — The role of the message's sender. - Allowed values: `system`, `assistant`, `user`, `function`, `tool` - `uuid` (string, optional) — Reserved for future use. Message identifiers are always server-assigned, so this field must be left unset. ### v4.Message - `content` (string, optional) — The content of the message. - `created_at` (string, optional) — The time the message was created. - `metadata` (map from string to any, optional) — Arbitrary key-value metadata attached to the message. - `name` (string, optional) — A custom name for the message's sender, for example a specific user or agent name. - `processed` (boolean, optional) — Whether the message has finished being ingested into the user's graph. - `role` (enum, optional) — The role of the message's sender: system, assistant, user, function, or tool. - Allowed values: `system`, `assistant`, `user`, `function`, `tool` - `thread_uuid` (string, optional) — The unique identifier of the thread this message belongs to. - `uuid` (string, optional) — The unique identifier of the message. ### 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.TaskProgress - `stage` (string, optional) — The most recent processing stage reported by the worker handling the task. ## Examples **Request** ```json { "messages": [ {} ] } ``` **Response** ```json { "context": "string", "messages": [ { "content": "string", "created_at": "string", "metadata": {}, "name": "string", "processed": true, "role": "system", "thread_uuid": "string", "uuid": "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" } } ```