Entities API Fresh
Manage user, agent, app, and run entities in Mem0.
Base URL: https://api.mem0.ai
Authentication: Authorization: Token <MEM0_API_KEY>
Get Users (List Entities)
GET /v1/entities/
List all entities with their memory counts.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
org_id | string | Filter entities by organization ID. |
project_id | string | Filter entities by project ID. |
Response (200)
Returns an array of entity objects:
json
[
{
"id": "string",
"name": "string",
"created_at": "2024-07-15T10:30:00Z",
"updated_at": "2024-07-15T10:30:00Z",
"total_memories": 42,
"owner": "string",
"organization": "string",
"metadata": {},
"type": "user"
}
]Entity type is one of: user, agent, app, run.
python
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key", org_id="your_org_id",
project_id="your_project_id")
users = client.users()
print(users)javascript
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });
const users = await client.users();
console.log(users);bash
curl --request GET \
--url 'https://api.mem0.ai/v1/entities/' \
--header 'Authorization: Token <api-key>'Delete User (Delete Entity)
DELETE /v2/entities/{entity_type}/{entity_id}/
Remove an entity and its associated data.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_type | string | Yes | One of: user, agent, app, run. |
entity_id | string | Yes | Unique identifier of the entity. |
Response (204)
json
{ "message": "Entity deleted successfully!" }Error (400)
json
{ "message": "Invalid entity type" }python
client.delete_users(entity_type="user", entity_id="alex")bash
curl --request DELETE \
--url https://api.mem0.ai/v2/entities/user/alex/ \
--header 'Authorization: Token <api-key>'