chore: import upstream snapshot with attribution
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete User'
|
||||
description: "Remove a user entity from the Mem0 platform by entity type and ID using the DELETE endpoint."
|
||||
openapi: delete /v2/entities/{entity_type}/{entity_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Users'
|
||||
description: "Retrieve a list of all user entities stored in the Mem0 platform using the GET endpoint."
|
||||
openapi: get /v1/entities/
|
||||
---
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: 'Get Event'
|
||||
description: "Retrieve details of a specific event by ID, including status and payload for async memory operations."
|
||||
openapi: get /v1/event/{event_id}/
|
||||
---
|
||||
|
||||
Retrieve details about a specific event by passing its `event_id`. This endpoint is particularly helpful for tracking the status, payload, and completion details of asynchronous memory operations.
|
||||
|
||||
For `POST /v3/memories/add/`, the event confirms that the write pipeline completed. Temporal reasoning enrichment runs asynchronously by default, so the event may be `SUCCEEDED` slightly before temporal ranking signals are available to subsequent `search` calls.
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: 'Get Events'
|
||||
description: "List recent events for your organization and project, useful for dashboards, alerting, and audit logging."
|
||||
openapi: get /v1/events/
|
||||
---
|
||||
|
||||
List recent events for your organization and project.
|
||||
|
||||
## Use Cases
|
||||
|
||||
- **Dashboards**: Summarize adds/searches over time by paging through events.
|
||||
- **Alerting**: Poll for `FAILED` events and trigger follow-up workflows.
|
||||
- **Audit**: Store the returned payload/metadata for compliance logs.
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: Add Memories
|
||||
description: "Add facts, messages, or metadata to a user memory store with async processing and event tracking via the V3 additive pipeline."
|
||||
openapi: post /v3/memories/add/
|
||||
---
|
||||
|
||||
Extract and store memories from a conversation using the V3 additive pipeline. The endpoint uses single-pass ADD-only extraction: one LLM call, no UPDATE/DELETE. Memories accumulate over time; nothing is overwritten.
|
||||
|
||||
## Endpoint
|
||||
|
||||
- **Method**: `POST`
|
||||
- **URL**: `/v3/memories/add/`
|
||||
- **Content-Type**: `application/json`
|
||||
|
||||
Processing is asynchronous. The response returns an `event_id` you can poll via `GET /v1/event/{event_id}/`.
|
||||
|
||||
## Required headers
|
||||
|
||||
| Header | Required | Description |
|
||||
| --- | --- | --- |
|
||||
| `Authorization: Token <MEM0_API_KEY>` | Yes | API key scoped to your workspace. |
|
||||
| `Accept: application/json` | Yes | Ensures a JSON response. |
|
||||
|
||||
## Request body
|
||||
|
||||
Provide conversation messages for Mem0 to extract memories from. At least one entity ID (`user_id`, `agent_id`, `app_id`, or `run_id`) is required so the memory is scoped to a session. Entity IDs are accepted at the top level.
|
||||
|
||||
<CodeGroup>
|
||||
```json Basic request
|
||||
{
|
||||
"user_id": "alice",
|
||||
"messages": [
|
||||
{ "role": "user", "content": "I moved to Austin last month." }
|
||||
],
|
||||
"metadata": {
|
||||
"source": "onboarding_form"
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Common fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `messages` | array | Yes | Conversation turns for Mem0 to extract memories from. Each object should include `role` and `content`. |
|
||||
| `user_id` | string | No* | Associates the memory with a user. |
|
||||
| `agent_id` | string | No* | Associates the memory with an agent. |
|
||||
| `run_id` | string | No* | Associates the memory with a run. |
|
||||
| `app_id` | string | No* | Associates the memory with an app. |
|
||||
| `metadata` | object | Optional | Custom key/value metadata (e.g., `{"topic": "preferences"}`). |
|
||||
| `infer` | boolean (default `true`) | Optional | Set to `false` to skip inference and store the provided text as-is. |
|
||||
| `expiration_date` | string | Optional | Date in `YYYY-MM-DD` format. The memory is visible through this date and hidden by default after it passes. |
|
||||
|
||||
> \* At least one entity ID (`user_id`, `agent_id`, `app_id`, or `run_id`) is required.
|
||||
|
||||
<Tip>
|
||||
Need more details? See [all request parameters](#body-messages) below for complete field descriptions, types, and constraints.
|
||||
</Tip>
|
||||
|
||||
## Response
|
||||
|
||||
The request is queued for background processing. The response contains an `event_id` for tracking status.
|
||||
|
||||
<CodeGroup>
|
||||
```json 200 response
|
||||
{
|
||||
"message": "Memory processing has been queued for background execution",
|
||||
"status": "PENDING",
|
||||
"event_id": "evt-uuid"
|
||||
}
|
||||
```
|
||||
|
||||
```json 400 response
|
||||
{
|
||||
"error": "400 Bad Request",
|
||||
"details": {
|
||||
"message": "Invalid input data. Please refer to the memory creation documentation at https://docs.mem0.ai/platform/quickstart#4-1-create-memories for correct formatting and required fields."
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Info>
|
||||
Poll the event status via `GET /v1/event/{event_id}/`. Status will be `SUCCEEDED` or `FAILED` once processing completes.
|
||||
</Info>
|
||||
|
||||
<Info>
|
||||
Memories with `expiration_date` remain stored after they expire. Search and get-all hide them by default; pass `show_expired: true` to include them.
|
||||
</Info>
|
||||
|
||||
<Info>
|
||||
Python uses `expiration_date`; TypeScript uses `expirationDate`.
|
||||
</Info>
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Batch Delete Memories'
|
||||
description: "Delete multiple memories in a single batch request using the Mem0 API DELETE endpoint."
|
||||
openapi: delete /v1/batch/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Batch Update Memories'
|
||||
description: "Update multiple memories in a single batch request using the Mem0 API PUT endpoint."
|
||||
openapi: put /v1/batch/
|
||||
---
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: 'Create Memory Export'
|
||||
description: "Submit an export job to create a structured memory export using a customizable Pydantic schema and filters."
|
||||
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`, `app_id`, or `run_id`) and by modifying the Pydantic schema to ensure the final data matches your exact needs.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete Memories'
|
||||
description: "Delete all memories matching specified filters from the Mem0 memory store using the DELETE endpoint."
|
||||
openapi: delete /v1/memories/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete Memory'
|
||||
description: "Delete a single memory by its unique memory ID from the Mem0 platform using the DELETE endpoint."
|
||||
openapi: delete /v1/memories/{memory_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Feedback'
|
||||
description: "Submit positive or negative feedback on memory results to help improve memory accuracy and relevance."
|
||||
openapi: post /v1/feedback/
|
||||
---
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: "Get Memories"
|
||||
description: "Retrieve memories with paginated results and advanced filtering using logical operators like AND, OR, NOT, and comparison queries."
|
||||
openapi: post /v3/memories/
|
||||
---
|
||||
|
||||
List memories scoped by filters with paginated results. Entity IDs (`user_id`, `agent_id`, `app_id`, `run_id`) **must** be passed inside the `filters` object: top-level entity IDs are rejected with 400.
|
||||
|
||||
Expired memories are hidden by default. Pass `show_expired: true` to include memories whose `expiration_date` has passed.
|
||||
|
||||
Python uses `show_expired`; TypeScript uses `showExpired`.
|
||||
|
||||
The `filters` object supports complex logical operations (AND, OR, NOT) and comparison operators:
|
||||
|
||||
- `in`: Matches any of the values specified
|
||||
- `gte`: Greater than or equal to
|
||||
- `lte`: Less than or equal to
|
||||
- `gt`: Greater than
|
||||
- `lt`: Less than
|
||||
- `ne`: Not equal to
|
||||
- `icontains`: Case-insensitive containment check
|
||||
- `*`: Wildcard character that matches everything
|
||||
|
||||
Pass `page` and `page_size` as query parameters to paginate through results.
|
||||
|
||||
<CodeGroup>
|
||||
```python Code
|
||||
memories = client.get_all(
|
||||
filters={
|
||||
"AND": [
|
||||
{
|
||||
"user_id": "alex"
|
||||
},
|
||||
{
|
||||
"created_at": {"gte": "2024-07-01", "lte": "2024-07-31"}
|
||||
}
|
||||
]
|
||||
},
|
||||
show_expired=False,
|
||||
page=1,
|
||||
page_size=50
|
||||
)
|
||||
```
|
||||
|
||||
```python Output
|
||||
{
|
||||
"count": 2,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"id": "f4cbdb08-7062-4f3e-8eb2-9f5c80dfe64c",
|
||||
"memory": "Alex is planning a trip to San Francisco from July 1st to July 10th",
|
||||
"expiration_date": null,
|
||||
"created_at": "2024-07-01T12:00:00Z",
|
||||
"updated_at": "2024-07-01T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"id": "a2b8c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
|
||||
"memory": "Alex prefers vegetarian restaurants",
|
||||
"expiration_date": null,
|
||||
"created_at": "2024-07-05T15:30:00Z",
|
||||
"updated_at": "2024-07-05T15:30:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<Info>
|
||||
The response is a paginated envelope with `count`, `next`, `previous`, and `results`. Use `page` and `page_size` query params to step through results.
|
||||
</Info>
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: 'Get Memory Export'
|
||||
description: "Retrieve the latest structured memory export after submitting an export job, with optional entity filters."
|
||||
openapi: post /v1/exports/get
|
||||
---
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Memory'
|
||||
description: "Retrieve a single memory by its unique memory ID from the Mem0 platform using the GET endpoint."
|
||||
openapi: get /v1/memories/{memory_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Memory History'
|
||||
description: "Retrieve the full change history of a specific memory to track how it has evolved over time."
|
||||
openapi: get /v1/memories/{memory_id}/history/
|
||||
---
|
||||
@@ -0,0 +1,123 @@
|
||||
---
|
||||
title: 'Search Memories'
|
||||
description: "Search memories with hybrid retrieval (semantic + BM25 + entity matching) and advanced filtering using logical and comparison operators."
|
||||
openapi: post /v3/memories/search/
|
||||
---
|
||||
|
||||
Relevance-ranked hybrid search across stored memories. V3 uses multi-signal retrieval: semantic, BM25 keyword, and entity matching scored in parallel and fused. The returned `score` is a combined `[0, 1]` value.
|
||||
|
||||
Entity IDs (`user_id`, `agent_id`, `app_id`, `run_id`) **must** be passed inside the `filters` object: top-level entity IDs are rejected with 400. At least one entity ID is required.
|
||||
|
||||
Expired memories are hidden by default. Pass `show_expired: true` to include memories whose `expiration_date` has passed.
|
||||
|
||||
Python uses `show_expired`; TypeScript uses `showExpired`.
|
||||
|
||||
The `filters` object supports complex logical operations (AND, OR, NOT) and comparison operators:
|
||||
- `in`: Matches any of the values specified
|
||||
- `gte`: Greater than or equal to
|
||||
- `lte`: Less than or equal to
|
||||
- `gt`: Greater than
|
||||
- `lt`: Less than
|
||||
- `ne`: Not equal to
|
||||
- `icontains`: Case-insensitive containment check
|
||||
- `*`: Wildcard character that matches everything
|
||||
|
||||
### Search parameter defaults
|
||||
|
||||
| Parameter | Default |
|
||||
| --- | --- |
|
||||
| `top_k` | `10` (range 1–1000) |
|
||||
| `threshold` | `0.1` (pass `0.0` to disable) |
|
||||
| `rerank` | `false` (pass `true` to enable) |
|
||||
|
||||
<CodeGroup>
|
||||
```python Platform API Example
|
||||
related_memories = client.search(
|
||||
query="What are Alice's hobbies?",
|
||||
show_expired=False,
|
||||
filters={
|
||||
"OR": [
|
||||
{
|
||||
"user_id": "alice"
|
||||
},
|
||||
{
|
||||
"agent_id": {"in": ["travel-agent", "sports-agent"]}
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
```json Output
|
||||
{
|
||||
"results": [
|
||||
{
|
||||
"id": "ea925981-272f-40dd-b576-be64e4871429",
|
||||
"memory": "Likes to play cricket and plays cricket on weekends.",
|
||||
"user_id": "alice",
|
||||
"metadata": {
|
||||
"category": "hobbies"
|
||||
},
|
||||
"score": 0.82,
|
||||
"expiration_date": null,
|
||||
"created_at": "2024-07-26T10:29:36.630547-07:00",
|
||||
"updated_at": null,
|
||||
"categories": ["hobbies"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup>
|
||||
```python Wildcard Example
|
||||
# Using wildcard to match all run_ids for a specific user
|
||||
all_memories = client.search(
|
||||
query="What are Alice's hobbies?",
|
||||
filters={
|
||||
"AND": [
|
||||
{
|
||||
"user_id": "alice"
|
||||
},
|
||||
{
|
||||
"run_id": "*"
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup>
|
||||
```python Categories Filter Examples
|
||||
# Example 1: Using 'contains' for partial matching
|
||||
finance_memories = client.search(
|
||||
query="What are my financial goals?",
|
||||
filters={
|
||||
"AND": [
|
||||
{ "user_id": "alice" },
|
||||
{
|
||||
"categories": {
|
||||
"contains": "finance"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
# Example 2: Using 'in' for exact matching
|
||||
personal_memories = client.search(
|
||||
query="What personal information do you have?",
|
||||
filters={
|
||||
"AND": [
|
||||
{ "user_id": "alice" },
|
||||
{
|
||||
"categories": {
|
||||
"in": ["personal_information"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: 'Update Memory'
|
||||
description: "Update the content, metadata, timestamp, or expiration date of a single memory by its unique ID using the PUT endpoint."
|
||||
openapi: put /v1/memories/{memory_id}/
|
||||
---
|
||||
|
||||
Use this endpoint to update mutable memory fields. To make a memory expire, set `expiration_date` to a `YYYY-MM-DD` date. To make it permanent again, send `expiration_date: null`.
|
||||
|
||||
```python
|
||||
client.update("mem_123", expiration_date="2030-01-31")
|
||||
client.update("mem_123", expiration_date=None)
|
||||
```
|
||||
|
||||
TypeScript uses `expirationDate`.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: 'Add Member'
|
||||
description: "Add a new member to an organization with a specified role such as READER or OWNER access level."
|
||||
openapi: post /api/v1/orgs/organizations/{org_id}/members/
|
||||
---
|
||||
|
||||
The API provides two roles for organization members:
|
||||
|
||||
- `READER`: Allows viewing of organization resources.
|
||||
- `OWNER`: Grants full administrative access to manage the organization and its resources.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Create Organization'
|
||||
description: "Create a new organization on the Mem0 platform to manage projects, members, and memory resources."
|
||||
openapi: post /api/v1/orgs/organizations/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete Organization'
|
||||
description: "Permanently delete an organization and its associated resources from the Mem0 platform."
|
||||
openapi: delete /api/v1/orgs/organizations/{org_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Members'
|
||||
description: "Retrieve a list of all members belonging to a specific organization on the Mem0 platform."
|
||||
openapi: get /api/v1/orgs/organizations/{org_id}/members/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Organization'
|
||||
description: "Retrieve details of a specific organization by its ID from the Mem0 platform using the GET endpoint."
|
||||
openapi: get /api/v1/orgs/organizations/{org_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Organizations'
|
||||
description: "Retrieve a list of all organizations associated with your Mem0 account using the GET endpoint."
|
||||
openapi: get /api/v1/orgs/organizations/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Remove Organization Member"
|
||||
description: "Remove a member from an organization to revoke their access to its projects and resources."
|
||||
openapi: "delete /api/v1/orgs/organizations/{org_id}/members/"
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Update Organization Member"
|
||||
description: "Update an existing member's role within an organization to change their permissions and access level."
|
||||
openapi: "put /api/v1/orgs/organizations/{org_id}/members/"
|
||||
---
|
||||
@@ -0,0 +1,246 @@
|
||||
---
|
||||
title: Organizations & Projects
|
||||
icon: "building"
|
||||
description: "Manage multi-tenant applications with organization and project APIs"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Organizations and projects provide multi-tenant support, access control, and team collaboration capabilities for Mem0 Platform. Use these APIs to build applications that support multiple teams, customers, or isolated environments.
|
||||
|
||||
<Info>
|
||||
Organizations and projects are **optional** features. You can use Mem0 without them for single-user or simple multi-user applications.
|
||||
</Info>
|
||||
|
||||
## Key Capabilities
|
||||
|
||||
- **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
|
||||
|
||||
---
|
||||
|
||||
## Using Organizations & Projects
|
||||
|
||||
### Initialize with Org/Project Context
|
||||
|
||||
Example with the mem0 Python package:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Python">
|
||||
|
||||
```python
|
||||
from mem0 import MemoryClient
|
||||
client = MemoryClient(api_key="your-api-key")
|
||||
```
|
||||
|
||||
</Tab>
|
||||
|
||||
<Tab title="Node.js">
|
||||
|
||||
```javascript
|
||||
import { MemoryClient } from "mem0ai";
|
||||
const client = new MemoryClient({ apiKey: "your-api-key" });
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
---
|
||||
|
||||
## Project Management
|
||||
|
||||
The Mem0 client provides comprehensive project management through the `client.project` interface:
|
||||
|
||||
### Get Project Details
|
||||
|
||||
Retrieve information about the current project:
|
||||
|
||||
```python
|
||||
# Get all project details
|
||||
project_info = client.project.get()
|
||||
|
||||
# Get specific fields only
|
||||
project_info = client.project.get(fields=["name", "description", "custom_categories"])
|
||||
```
|
||||
|
||||
### Create a New Project
|
||||
|
||||
Create a new project within your organization:
|
||||
|
||||
```python
|
||||
# Create a project with name and description
|
||||
new_project = client.project.create(
|
||||
name="My New Project",
|
||||
description="A project for managing customer support memories"
|
||||
)
|
||||
```
|
||||
|
||||
### Update Project Settings
|
||||
|
||||
Modify project configuration including custom instructions, categories, language preferences, retrieval criteria, and memory decay:
|
||||
|
||||
```python
|
||||
# Update project with custom categories
|
||||
client.project.update(
|
||||
custom_categories=[
|
||||
{"customer_preferences": "Customer likes, dislikes, and preferences"},
|
||||
{"support_history": "Previous support interactions and resolutions"}
|
||||
]
|
||||
)
|
||||
|
||||
# Update project with custom instructions
|
||||
client.project.update(
|
||||
custom_instructions="..."
|
||||
)
|
||||
|
||||
# Use the input language for memory storage and retrieval
|
||||
client.project.update(multilingual=True)
|
||||
|
||||
# Set retrieval criteria to control which memories are surfaced in search
|
||||
client.project.update(
|
||||
retrieval_criteria=[
|
||||
{"name": "relevance", "description": "How directly relevant this memory is to the current topic or user query", "weight": 3},
|
||||
{"name": "access_frequency", "description": "How often this memory has been accessed or surfaced recently", "weight": 1}
|
||||
]
|
||||
)
|
||||
|
||||
# Enable Memory Decay (boosts recently-accessed memories at search time)
|
||||
client.project.update(decay=True)
|
||||
|
||||
# Update multiple settings at once
|
||||
client.project.update(
|
||||
custom_instructions="...",
|
||||
custom_categories=[
|
||||
{"personal_info": "User personal information and preferences"},
|
||||
{"work_context": "Professional context and work-related information"}
|
||||
],
|
||||
multilingual=True
|
||||
)
|
||||
```
|
||||
|
||||
#### Set Retrieval Criteria
|
||||
|
||||
`retrieval_criteria` is a per-project list of dictionaries (`List[Dict]`) that shapes how memories are ranked and filtered during search. Each dictionary has three fields: `name` (identifier), `description` (interpreted by the LLM to score each memory), and `weight` (relative influence on the final score). Use this to focus retrieval on intent-aligned or signal-specific memories:
|
||||
|
||||
```python
|
||||
client.project.update(
|
||||
retrieval_criteria=[
|
||||
{
|
||||
"name": "joy",
|
||||
"description": "Measure the intensity of positive emotions such as happiness, excitement, or amusement expressed in the memory. A higher score reflects greater joy.",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"name": "curiosity",
|
||||
"description": "Assess the extent to which the memory reflects inquisitiveness or interest in exploring new information. A higher score reflects stronger curiosity.",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"name": "access_frequency",
|
||||
"description": "How often this memory has been accessed or surfaced recently.",
|
||||
"weight": 1
|
||||
}
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
Pass an empty list to clear all criteria and restore default retrieval behaviour.
|
||||
|
||||
#### Toggle Memory Decay
|
||||
|
||||
`decay` is a per-project boolean that turns on [Memory Decay](/platform/features/memory-decay): a search-time ranking bias that reinforces recently-accessed memories and gently dampens stale ones. The flag is `false` by default; set it via the same project-update endpoint:
|
||||
|
||||
```bash cURL
|
||||
curl -X PATCH https://api.mem0.ai/api/v1/orgs/organizations/$ORG_ID/projects/$PROJECT_ID/ \
|
||||
-H "Authorization: Token $MEM0_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"decay": true}'
|
||||
```
|
||||
|
||||
The current state is returned on every project read (and supports `?fields=decay` for a minimal response). Toggling has no effect on stored memories, only on how v3 search ranks them.
|
||||
|
||||
### Delete Project
|
||||
|
||||
<Warning>
|
||||
This action will remove all memories, messages, and other related data in the project. **This operation is irreversible.**
|
||||
</Warning>
|
||||
|
||||
Remove a project and all its associated data:
|
||||
|
||||
```python
|
||||
# Delete the current project (irreversible)
|
||||
result = client.project.delete()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Member Management
|
||||
|
||||
Manage project members and their access levels:
|
||||
|
||||
```python
|
||||
# Get all project members
|
||||
members = client.project.get_members()
|
||||
|
||||
# Add a new member as a reader
|
||||
client.project.add_member(
|
||||
email="colleague@company.com",
|
||||
role="READER" # or "OWNER"
|
||||
)
|
||||
|
||||
# Update a member's role
|
||||
client.project.update_member(
|
||||
email="colleague@company.com",
|
||||
role="OWNER"
|
||||
)
|
||||
|
||||
# Remove a member from the project
|
||||
client.project.remove_member(email="colleague@company.com")
|
||||
```
|
||||
|
||||
### Member Roles
|
||||
|
||||
| Role | Permissions |
|
||||
|------|-------------|
|
||||
| **READER** | Can view and search memories, but cannot modify project settings or manage members |
|
||||
| **OWNER** | Full access including project modification, member management, and all reader permissions |
|
||||
|
||||
---
|
||||
|
||||
## Async Support
|
||||
|
||||
All project methods are available in async mode:
|
||||
|
||||
```python
|
||||
from mem0 import AsyncMemoryClient
|
||||
|
||||
async def manage_project():
|
||||
client = AsyncMemoryClient(api_key="your-api-key")
|
||||
|
||||
# All methods support async/await
|
||||
project_info = await client.project.get()
|
||||
await client.project.update(multilingual=True)
|
||||
members = await client.project.get_members()
|
||||
|
||||
# To call the async function properly
|
||||
import asyncio
|
||||
asyncio.run(manage_project())
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API Reference
|
||||
|
||||
For complete API specifications and additional endpoints, see:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Organizations APIs" icon="building" href="/api-reference/organization/create-org">
|
||||
Create, get, and manage organizations
|
||||
</Card>
|
||||
|
||||
<Card title="Project APIs" icon="folder" href="/api-reference/project/create-project">
|
||||
Full project CRUD and member management endpoints
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: 'Add Member'
|
||||
description: "Add a new member to a project with a specified role such as READER or OWNER access level."
|
||||
openapi: post /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
|
||||
---
|
||||
|
||||
The API provides two roles for project members:
|
||||
|
||||
- `READER`: Allows viewing of project resources.
|
||||
- `OWNER`: Grants full administrative access to manage the project and its resources.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Create Project'
|
||||
description: "Create a new project within an organization on the Mem0 platform to isolate memory resources."
|
||||
openapi: post /api/v1/orgs/organizations/{org_id}/projects/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete Project'
|
||||
description: "Permanently delete a project and its associated data from the Mem0 platform by project ID."
|
||||
openapi: delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Members'
|
||||
description: "Retrieve a list of all members belonging to a specific project on the Mem0 platform."
|
||||
openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Project'
|
||||
description: "Retrieve details of a specific project by its organization and project ID using the GET endpoint."
|
||||
openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Get Projects'
|
||||
description: "Retrieve a list of all projects within an organization on the Mem0 platform using the GET endpoint."
|
||||
openapi: get /api/v1/orgs/organizations/{org_id}/projects/
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Remove Project Member"
|
||||
description: "Remove a member from a project to revoke their access to its memories, configuration, and resources."
|
||||
openapi: "delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/"
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Update Project Member"
|
||||
description: "Update an existing member's role within a project to change their permissions and access level."
|
||||
openapi: "put /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/"
|
||||
---
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Update Project"
|
||||
description: "Update a project's settings, including name, custom instructions, and other configuration options."
|
||||
openapi: "patch /api/v1/orgs/organizations/{org_id}/projects/{project_id}/"
|
||||
---
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: 'Create Webhook'
|
||||
description: "Create a new webhook for a project to receive real-time notifications about memory events."
|
||||
openapi: post /api/v1/webhooks/projects/{project_id}/
|
||||
---
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: 'Delete Webhook'
|
||||
description: "Delete an existing webhook by its ID to stop receiving notifications for memory events."
|
||||
openapi: delete /api/v1/webhooks/{webhook_id}/
|
||||
---
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: 'Get Webhook'
|
||||
description: "Retrieve webhook configuration details for a specific project on the Mem0 platform."
|
||||
openapi: get /api/v1/webhooks/projects/{project_id}/
|
||||
---
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: 'Update Webhook'
|
||||
description: "Update an existing webhook configuration, such as its URL or event subscriptions, by webhook ID."
|
||||
openapi: put /api/v1/webhooks/{webhook_id}/
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user