> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs-beta.getzep.com/v3/sdk-reference/thread/add-messages-to-a-thread/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-beta.getzep.com/_mcp/server. # Add messages to a thread POST https://api.getzep.com/api/v2/threads/{threadId}/messages Content-Type: application/json Add messages to a thread. Reference: https://docs-beta.getzep.com/sdk-reference/thread/add-messages-to-a-thread ## Request ### Path parameters - `threadId` (string, required) — The ID of the thread to which messages should be added. ### Body (application/json) This endpoint expects an apidata.AddThreadMessagesRequest. - `messages` (list of apidata.ThreadMessage, required) — A list of message objects, where each message contains a role and content. - `ignore_roles` (list of enum, optional) — Optional list of role types to ignore when adding messages to graph memory. The message itself will still be added, retained and used as context for messages that are added to a user's graph. - Allowed values: `norole`, `system`, `assistant`, `user`, `function`, `tool` - `return_context` (boolean, optional) — Optionally return context block relevant to the most recent messages. - `strict_ontology` (boolean, optional) — When true, prevents extraction of generic Entity nodes that do not match the configured ontology. ## Response ### 200 An object, optionally containing user context retrieved for the last thread message - `context` (string, optional) - `message_uuids` (list of string, optional) - `task_id` (string, optional) ## Errors ### 500 Internal Server Error Internal Server Error - `message` (string, optional) ## Types ### apidata.ThreadMessage - `content` (string, required) — The content of the message. - `role` (enum, required) — The role of message sender (e.g., "user", "system"). - Allowed values: `norole`, `system`, `assistant`, `user`, `function`, `tool` - `created_at` (string, optional) — The timestamp of when the message was created. - `metadata` (map from string to any, optional) — The metadata associated with the message. Max 10 keys. Values must be strings, numbers, booleans, or arrays of scalars. - `name` (string, optional) — Customizable name of the sender of the message (e.g., "john", "sales_agent"). - `processed` (boolean, optional) — Whether the message has been processed. - `uuid` (string, optional) — The unique identifier of the message. ## Examples **Request** ```json { "messages": [ { "content": "string", "role": "norole" } ] } ``` **Response** ```json { "context": "string", "message_uuids": [ "string" ], "task_id": "string" } ```