diff --git a/docs/api-reference/memory/create-memory-export.mdx b/docs/api-reference/memory/create-memory-export.mdx index ca6b5f156..baaeee3be 100644 --- a/docs/api-reference/memory/create-memory-export.mdx +++ b/docs/api-reference/memory/create-memory-export.mdx @@ -4,4 +4,4 @@ description: "Submit an export job to create a structured memory export using a openapi: post /v1/exports/ --- -Submit a job to create a structured export of memories using a customizable Pydantic schema. This process may take some time to complete, especially if you're exporting a large number of memories. You can tailor the export by applying various filters (e.g., `user_id`, `agent_id`, `run_id`, or `session_id`) and by modifying the Pydantic schema to ensure the final data matches your exact needs. +Submit a job to create a structured export of memories using a customizable Pydantic schema. This process may take some time to complete, especially if you're exporting a large number of memories. You can tailor the export by applying various filters (e.g., `user_id`, `agent_id`, `app_id`, or `run_id`) and by modifying the Pydantic schema to ensure the final data matches your exact needs. diff --git a/docs/api-reference/memory/get-memory-export.mdx b/docs/api-reference/memory/get-memory-export.mdx index 1f3364edf..55558a0a6 100644 --- a/docs/api-reference/memory/get-memory-export.mdx +++ b/docs/api-reference/memory/get-memory-export.mdx @@ -4,4 +4,4 @@ description: "Retrieve the latest structured memory export after submitting an e openapi: post /v1/exports/get --- -Retrieve the latest structured memory export after submitting an export job. You can filter the export by `user_id`, `run_id`, `session_id`, or `app_id` to get the most recent export matching your filters. \ No newline at end of file +Retrieve the latest structured memory export after submitting an export job. You can filter the export by `user_id`, `agent_id`, `app_id`, `run_id`, `created_at`, or `updated_at` to get the most recent export matching your filters. \ No newline at end of file diff --git a/docs/api-reference/memory/search-memories.mdx b/docs/api-reference/memory/search-memories.mdx index c91c1a0f4..8afae23ec 100644 --- a/docs/api-reference/memory/search-memories.mdx +++ b/docs/api-reference/memory/search-memories.mdx @@ -23,8 +23,8 @@ The `filters` object supports complex logical operations (AND, OR, NOT) and comp | Parameter | V1/V2 | V3 | | --- | --- | --- | | `top_k` | Supported (default 10) | Supported (1-1000, default 10) | -| `threshold` | No default | Default `0.1` (pass `0.0` to disable) | -| `rerank` | Default `true` | Default `false` (pass `true` to enable) | +| `threshold` | V1: not supported / V2: default `0.3` | Default `0.1` (pass `0.0` to disable) | +| `rerank` | Default `false` | Default `false` (pass `true` to enable) | ```python Platform API Example diff --git a/docs/api-reference/organizations-projects.mdx b/docs/api-reference/organizations-projects.mdx index c1cc0c6b2..233ae1488 100644 --- a/docs/api-reference/organizations-projects.mdx +++ b/docs/api-reference/organizations-projects.mdx @@ -14,7 +14,7 @@ Organizations and projects are **optional** features. You can use Mem0 without t ## Key Capabilities -- **Multi-org/project Support**: Specify organization and project when initializing the Mem0 client to attribute API usage appropriately +- **Multi-org/project Support**: Organization and project are resolved automatically from your API key via `/v1/ping/` — no org or project params are accepted by `MemoryClient.__init__`. Use a project-specific API key to target a particular project. - **Member Management**: Control access to data through organization and project membership - **Access Control**: Only members can access memories and data within their organization/project scope - **Team Isolation**: Maintain data separation between different teams and projects for secure collaboration diff --git a/docs/openapi.json b/docs/openapi.json index 8609e2d58..11d02911f 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1232,7 +1232,7 @@ "tags": [ "memories" ], - "description": "Delete memories by filter. At least one filter is required — previously omitting all filters silently deleted everything; now it returns a validation error.", + "description": "Delete memories by filter. At least one filter is required \u2014 previously omitting all filters silently deleted everything; now it returns a validation error.", "operationId": "memories_delete_all", "parameters": [ { @@ -1315,15 +1315,15 @@ "x-code-samples": [ { "lang": "Python", - "source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\")\n\n# Delete all memories for a specific user\nclient.delete_all(user_id=\"\")\n\n# Delete all memories for every user in the project (wildcard)\nclient.delete_all(user_id=\"*\")\n\n# Full project wipe — all four filters must be explicitly set to \"*\"\nclient.delete_all(user_id=\"*\", agent_id=\"*\", app_id=\"*\", run_id=\"*\")\n\n# NOTE: Calling delete_all() with no filters raises a validation error.\n# At least one filter is required to prevent accidental data loss." + "source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\")\n\n# Delete all memories for a specific user\nclient.delete_all(user_id=\"\")\n\n# Delete all memories for every user in the project (wildcard)\nclient.delete_all(user_id=\"*\")\n\n# Full project wipe \u2014 all four filters must be explicitly set to \"*\"\nclient.delete_all(user_id=\"*\", agent_id=\"*\", app_id=\"*\", run_id=\"*\")\n\n# NOTE: Calling delete_all() with no filters raises a validation error.\n# At least one filter is required to prevent accidental data loss." }, { "lang": "JavaScript", - "source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\n// Delete all memories for a specific user\nclient.deleteAll({ user_id: \"\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Delete all memories for every user in the project (wildcard)\nclient.deleteAll({ user_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Full project wipe — all four filters must be explicitly set to \"*\"\nclient.deleteAll({ user_id: \"*\", agent_id: \"*\", app_id: \"*\", run_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));" + "source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\n// Delete all memories for a specific user\nclient.deleteAll({ user_id: \"\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Delete all memories for every user in the project (wildcard)\nclient.deleteAll({ user_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Full project wipe \u2014 all four filters must be explicitly set to \"*\"\nclient.deleteAll({ user_id: \"*\", agent_id: \"*\", app_id: \"*\", run_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));" }, { "lang": "cURL", - "source": "# Delete memories for a specific user\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=' \\\n --header 'Authorization: Token '\n\n# Delete memories for all users (wildcard)\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*' \\\n --header 'Authorization: Token '\n\n# Full project wipe — all four filters must be set to *\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*&agent_id=*&app_id=*&run_id=*' \\\n --header 'Authorization: Token '" + "source": "# Delete memories for a specific user\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=' \\\n --header 'Authorization: Token '\n\n# Delete memories for all users (wildcard)\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*' \\\n --header 'Authorization: Token '\n\n# Full project wipe \u2014 all four filters must be set to *\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*&agent_id=*&app_id=*&run_id=*' \\\n --header 'Authorization: Token '" }, { "lang": "Go", @@ -1740,7 +1740,7 @@ "memories" ], "summary": "Get all memories (V3, paginated)", - "description": "List memories scoped by filters, paginated. Entity IDs **must** be passed inside the `filters` object — top-level `user_id` / `agent_id` / `run_id` are rejected with 400. `filters` supports the same operator set as V2 search (`AND`, `OR`, `NOT`, `in`, `gte`, `lte`, etc.). Response is a paginated envelope; pass `page` and `page_size` as query parameters to step through results.", + "description": "List memories scoped by filters, paginated. Entity IDs **must** be passed inside the `filters` object \u2014 top-level `user_id` / `agent_id` / `run_id` are rejected with 400. `filters` supports the same operator set as V2 search (`AND`, `OR`, `NOT`, `in`, `gte`, `lte`, etc.). Response is a paginated envelope; pass `page` and `page_size` as query parameters to step through results.", "operationId": "memories_list_v3", "parameters": [ { @@ -1891,10 +1891,10 @@ } }, "400": { - "description": "Validation error — e.g. empty `filters` or no positively-scoped entity ID." + "description": "Validation error \u2014 e.g. empty `filters` or no positively-scoped entity ID." }, "401": { - "description": "Unauthorized — missing or invalid API key." + "description": "Unauthorized \u2014 missing or invalid API key." } }, "security": [ @@ -1996,7 +1996,7 @@ }, { "role": "assistant", - "content": "Got it — I'll update your location." + "content": "Got it \u2014 I'll update your location." } ], "user_id": "alice" @@ -2038,10 +2038,10 @@ } }, "400": { - "description": "Validation error — e.g. missing `messages` or no entity ID supplied." + "description": "Validation error \u2014 e.g. missing `messages` or no entity ID supplied." }, "401": { - "description": "Unauthorized — missing or invalid API key." + "description": "Unauthorized \u2014 missing or invalid API key." } }, "security": [ @@ -2052,15 +2052,15 @@ "x-codeSamples": [ { "lang": "cURL", - "source": "curl -X POST https://api.mem0.ai/v3/memories/add/ \\\n -H \"Authorization: Token \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"messages\": [\n {\"role\": \"user\", \"content\": \"I just moved to San Francisco from New York.\"},\n {\"role\": \"assistant\", \"content\": \"Got it — I\\u0027ll update your location.\"}\n ],\n \"user_id\": \"alice\"\n }'" + "source": "curl -X POST https://api.mem0.ai/v3/memories/add/ \\\n -H \"Authorization: Token \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"messages\": [\n {\"role\": \"user\", \"content\": \"I just moved to San Francisco from New York.\"},\n {\"role\": \"assistant\", \"content\": \"Got it \u2014 I\\u0027ll update your location.\"}\n ],\n \"user_id\": \"alice\"\n }'" }, { "lang": "Python", - "source": "from mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your-api-key\")\n\nresult = client.add(\n messages=[\n {\"role\": \"user\", \"content\": \"I just moved to San Francisco from New York.\"},\n {\"role\": \"assistant\", \"content\": \"Got it — I'll update your location.\"}\n ],\n user_id=\"alice\",\n)\nprint(result)" + "source": "from mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your-api-key\")\n\nresult = client.add(\n messages=[\n {\"role\": \"user\", \"content\": \"I just moved to San Francisco from New York.\"},\n {\"role\": \"assistant\", \"content\": \"Got it \u2014 I'll update your location.\"}\n ],\n user_id=\"alice\",\n)\nprint(result)" }, { "lang": "JavaScript", - "source": "import MemoryClient from \"mem0ai\";\n\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst result = await client.add(\n [\n { role: \"user\", content: \"I just moved to San Francisco from New York.\" },\n { role: \"assistant\", content: \"Got it — I'll update your location.\" },\n ],\n { userId: \"alice\" }\n);\nconsole.log(result);" + "source": "import MemoryClient from \"mem0ai\";\n\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst result = await client.add(\n [\n { role: \"user\", content: \"I just moved to San Francisco from New York.\" },\n { role: \"assistant\", content: \"Got it \u2014 I'll update your location.\" },\n ],\n { userId: \"alice\" }\n);\nconsole.log(result);" } ] } @@ -2071,7 +2071,7 @@ "memories" ], "summary": "Search memories (V3)", - "description": "Relevance-ranked search across stored memories. V3 uses hybrid retrieval and can also apply temporal reasoning for time-aware queries. Entity IDs **must** be passed inside the `filters` object — top-level `user_id` / `agent_id` / `run_id` are rejected with 400. At least one entity ID is required.", + "description": "Relevance-ranked search across stored memories. V3 uses hybrid retrieval and can also apply temporal reasoning for time-aware queries. Entity IDs **must** be passed inside the `filters` object \u2014 top-level `user_id` / `agent_id` / `run_id` are rejected with 400. At least one entity ID is required.", "operationId": "memories_search_v3", "requestBody": { "required": true, @@ -2220,10 +2220,10 @@ } }, "400": { - "description": "Validation error — e.g. empty `query`, missing `filters`, or no positively-scoped entity ID." + "description": "Validation error \u2014 e.g. empty `query`, missing `filters`, or no positively-scoped entity ID." }, "401": { - "description": "Unauthorized — missing or invalid API key." + "description": "Unauthorized \u2014 missing or invalid API key." } }, "security": [ @@ -4861,8 +4861,7 @@ "items": { "type": "object", "required": [ - "memory_id", - "text" + "memory_id" ], "properties": { "memory_id": { @@ -4873,6 +4872,11 @@ "text": { "type": "string", "description": "The new text content for the memory" + }, + "metadata": { + "type": "object", + "additionalProperties": true, + "description": "Updated metadata to associate with the memory." } } }, @@ -4948,18 +4952,27 @@ "schema": { "type": "object", "properties": { - "memory_ids": { + "memories": { "type": "array", "items": { - "type": "string", - "format": "uuid" + "type": "object", + "properties": { + "memory_id": { + "type": "string", + "format": "uuid", + "description": "The unique identifier of the memory to delete." + } + }, + "required": [ + "memory_id" + ] }, "maxItems": 1000, - "description": "Array of memory IDs to delete." + "description": "Array of memory objects to delete." } }, "required": [ - "memory_ids" + "memories" ] } } @@ -6256,4 +6269,4 @@ } }, "x-original-swagger-version": "2.0" -} \ No newline at end of file +}