docs(api-reference): align API docs and openapi schema with v3 spec

- create-memory-export.mdx: replace `session_id` filter with `app_id`
  (spec: /v1/exports/ filters = user_id, agent_id, app_id, run_id)
- get-memory-export.mdx: replace stale filter list (session_id removed)
  with correct fields: user_id, agent_id, app_id, run_id, created_at, updated_at
- search-memories.mdx: fix comparison table — rerank V1/V2 default was
  `true`, spec shows `false`; threshold V1 is absent (not "No default"),
  V2 default is 0.3 (not absent)
- organizations-projects.mdx: rewrite Key Capabilities bullet — org/project
  are NOT init params; they resolve automatically from the API key via /v1/ping/
- openapi.json DELETE /v1/batch/: fix request schema from {memory_ids:[uuid]}
  to {memories:[{memory_id:uuid}]} to match Python client.batch_delete()
- openapi.json PUT /v1/batch/: make `text` optional (remove from required),
  add optional `metadata` property — matches Python client.batch_update() docstring
This commit is contained in:
kartik-mem0
2026-06-25 12:01:24 +05:30
parent ac296f7534
commit bbfe0f9bb2
5 changed files with 42 additions and 29 deletions
@@ -4,4 +4,4 @@ description: "Submit an export job to create a structured memory export using a
openapi: post /v1/exports/ 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.
@@ -4,4 +4,4 @@ description: "Retrieve the latest structured memory export after submitting an e
openapi: post /v1/exports/get 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. 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.
@@ -23,8 +23,8 @@ The `filters` object supports complex logical operations (AND, OR, NOT) and comp
| Parameter | V1/V2 | V3 | | Parameter | V1/V2 | V3 |
| --- | --- | --- | | --- | --- | --- |
| `top_k` | Supported (default 10) | Supported (1-1000, default 10) | | `top_k` | Supported (default 10) | Supported (1-1000, default 10) |
| `threshold` | No default | Default `0.1` (pass `0.0` to disable) | | `threshold` | V1: not supported / V2: default `0.3` | Default `0.1` (pass `0.0` to disable) |
| `rerank` | Default `true` | Default `false` (pass `true` to enable) | | `rerank` | Default `false` | Default `false` (pass `true` to enable) |
<CodeGroup> <CodeGroup>
```python Platform API Example ```python Platform API Example
@@ -14,7 +14,7 @@ Organizations and projects are **optional** features. You can use Mem0 without t
## Key Capabilities ## 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 - **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 - **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 - **Team Isolation**: Maintain data separation between different teams and projects for secure collaboration
+37 -24
View File
@@ -1232,7 +1232,7 @@
"tags": [ "tags": [
"memories" "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", "operationId": "memories_delete_all",
"parameters": [ "parameters": [
{ {
@@ -1315,15 +1315,15 @@
"x-code-samples": [ "x-code-samples": [
{ {
"lang": "Python", "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=\"<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=\"<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", "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: \"<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: \"<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", "lang": "cURL",
"source": "# Delete memories for a specific user\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=<user_id>' \\\n --header 'Authorization: Token <api-key>'\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 <api-key>'\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 <api-key>'" "source": "# Delete memories for a specific user\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=<user_id>' \\\n --header 'Authorization: Token <api-key>'\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 <api-key>'\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 <api-key>'"
}, },
{ {
"lang": "Go", "lang": "Go",
@@ -1740,7 +1740,7 @@
"memories" "memories"
], ],
"summary": "Get all memories (V3, paginated)", "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", "operationId": "memories_list_v3",
"parameters": [ "parameters": [
{ {
@@ -1891,10 +1891,10 @@
} }
}, },
"400": { "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": { "401": {
"description": "Unauthorized — missing or invalid API key." "description": "Unauthorized \u2014 missing or invalid API key."
} }
}, },
"security": [ "security": [
@@ -1996,7 +1996,7 @@
}, },
{ {
"role": "assistant", "role": "assistant",
"content": "Got it — I'll update your location." "content": "Got it \u2014 I'll update your location."
} }
], ],
"user_id": "alice" "user_id": "alice"
@@ -2038,10 +2038,10 @@
} }
}, },
"400": { "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": { "401": {
"description": "Unauthorized — missing or invalid API key." "description": "Unauthorized \u2014 missing or invalid API key."
} }
}, },
"security": [ "security": [
@@ -2052,15 +2052,15 @@
"x-codeSamples": [ "x-codeSamples": [
{ {
"lang": "cURL", "lang": "cURL",
"source": "curl -X POST https://api.mem0.ai/v3/memories/add/ \\\n -H \"Authorization: Token <api-key>\" \\\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 <api-key>\" \\\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", "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", "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" "memories"
], ],
"summary": "Search memories (V3)", "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", "operationId": "memories_search_v3",
"requestBody": { "requestBody": {
"required": true, "required": true,
@@ -2220,10 +2220,10 @@
} }
}, },
"400": { "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": { "401": {
"description": "Unauthorized — missing or invalid API key." "description": "Unauthorized \u2014 missing or invalid API key."
} }
}, },
"security": [ "security": [
@@ -4861,8 +4861,7 @@
"items": { "items": {
"type": "object", "type": "object",
"required": [ "required": [
"memory_id", "memory_id"
"text"
], ],
"properties": { "properties": {
"memory_id": { "memory_id": {
@@ -4873,6 +4872,11 @@
"text": { "text": {
"type": "string", "type": "string",
"description": "The new text content for the memory" "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": { "schema": {
"type": "object", "type": "object",
"properties": { "properties": {
"memory_ids": { "memories": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string", "type": "object",
"format": "uuid" "properties": {
"memory_id": {
"type": "string",
"format": "uuid",
"description": "The unique identifier of the memory to delete."
}
},
"required": [
"memory_id"
]
}, },
"maxItems": 1000, "maxItems": 1000,
"description": "Array of memory IDs to delete." "description": "Array of memory objects to delete."
} }
}, },
"required": [ "required": [
"memory_ids" "memories"
] ]
} }
} }
@@ -6256,4 +6269,4 @@
} }
}, },
"x-original-swagger-version": "2.0" "x-original-swagger-version": "2.0"
} }