docs/openapi.json
Rama main · réplica de lectura del repositorio original.
{
"openapi": "3.0.1",
"info": {
"title": "Mem0 API Docs",
"description": "mem0.ai API Docs",
"contact": {
"email": "support@mem0.ai"
},
"license": {
"name": "Apache 2.0"
},
"version": "v1"
},
"servers": [
{
"url": "https://api.mem0.ai/"
}
],
"security": [
{
"ApiKeyAuth": []
}
],
"paths": {
"/v1/agents/": {
"post": {
"tags": [
"agents"
],
"description": "Create a new Agent.",
"operationId": "agents_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateAgent"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Agent created successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentResponse"
}
}
}
}
},
"x-codegen-request-body-name": "data"
}
},
"/v1/apps/": {
"post": {
"tags": [
"apps"
],
"description": "Create a new App.",
"operationId": "apps_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateApp"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "App created successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AppResponse"
}
}
}
}
},
"x-codegen-request-body-name": "data"
}
},
"/v1/entities/": {
"get": {
"tags": [
"entities"
],
"operationId": "entities_list",
"parameters": [
{
"name": "org_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter entities by organization ID."
},
{
"name": "project_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter entities by project ID."
}
],
"responses": {
"200": {
"description": "Successfully retrieved list of entities.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "Total number of entities matching the filters."
},
"next": {
"type": "string",
"nullable": true,
"description": "URL of the next page of results, or null if this is the last page."
},
"previous": {
"type": "string",
"nullable": true,
"description": "URL of the previous page of results, or null if this is the first page."
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the entity."
},
"name": {
"type": "string",
"description": "Name of the entity."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the entity was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the entity was last updated."
},
"owner": {
"type": "string",
"description": "Owner of the entity."
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the entity."
},
"type": {
"type": "string",
"enum": [
"user",
"agent",
"app",
"run"
]
}
},
"required": [
"id",
"name",
"created_at",
"updated_at",
"owner",
"type"
]
}
},
"total_users": {
"type": "integer",
"description": "Total number of user entities in the project."
},
"total_agents": {
"type": "integer",
"description": "Total number of agent entities in the project."
},
"total_apps": {
"type": "integer",
"description": "Total number of app entities in the project."
},
"total_runs": {
"type": "integer",
"description": "Total number of run entities in the project."
}
},
"required": [
"count",
"next",
"previous",
"results"
]
}
}
}
}
},
"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\")\nusers = client.users()\nprint(users)"
},
{
"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// Retrieve all users\nclient.users()\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/entities/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/entities/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/entities/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/entities/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/entities/filters/": {
"get": {
"tags": [
"entities"
],
"operationId": "entities_filters_list",
"responses": {
"200": {
"description": "Successfully retrieved entity filters.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"event_type": {
"type": "array",
"items": {
"type": "string"
},
"description": "Event types that can be filtered on.",
"example": [
"ADD",
"UPDATE",
"DELETE",
"SEARCH",
"GET_ALL",
"GET",
"DELETE_ALL",
"DELETE_USER"
]
},
"categories": {
"type": "array",
"items": {},
"description": "Memory categories that can be filtered on."
},
"users": {
"type": "array",
"items": {
"type": "string"
},
"description": "User IDs that can be filtered on."
},
"parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"options": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"label": {
"type": "string"
}
}
}
}
}
},
"description": "Filter UI field definitions used by the Mem0 dashboard."
}
}
}
}
}
}
}
}
},
"/v1/entities/{entity_type}/{entity_id}/": {
"delete": {
"tags": [
"entities"
],
"deprecated": true,
"description": "Delete an entity by its numeric ID. Deprecated in favor of `DELETE /v2/entities/{entity_type}/{entity_id}/`, which takes the entity's string name instead of this numeric ID.",
"operationId": "entities_delete_v1",
"parameters": [
{
"name": "entity_type",
"in": "path",
"required": true,
"schema": {
"type": "string",
"enum": [
"user",
"agent",
"app",
"run"
]
},
"description": "The type of the entity (user, agent, app, or run)."
},
{
"name": "entity_id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
},
"description": "The numeric identifier of the entity, as returned in the `id` field by `GET /v1/entities/`."
}
],
"responses": {
"200": {
"description": "Entity deletion has been queued for background (async) execution.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Delete in progress. This may take some time."
},
"event_id": {
"type": "string",
"format": "uuid"
}
}
}
}
}
},
"400": {
"description": "Invalid entity ID. The path parameter must be an integer.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Invalid entity ID. Must be an integer."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/v1/entities/user/12345/ \\\n --header 'Authorization: Token <api-key>'"
}
]
}
},
"/v2/entities/{entity_type}/{entity_id}/": {
"get": {
"tags": [
"entities"
],
"operationId": "entities_read",
"parameters": [
{
"name": "entity_type",
"in": "path",
"required": true,
"schema": {
"type": "string",
"enum": [
"user",
"agent",
"app",
"run"
]
},
"description": "The type of the entity (user, agent, app, or run)."
},
{
"name": "entity_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The unique identifier of the entity."
}
],
"responses": {
"200": {
"description": "Successfully retrieved entity details.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"owner": {
"type": "string"
},
"metadata": {
"type": "object",
"nullable": true
},
"type": {
"type": "string"
}
}
}
}
}
}
}
}
},
"delete": {
"tags": [
"entities"
],
"operationId": "entities_delete",
"parameters": [
{
"name": "entity_type",
"in": "path",
"required": true,
"schema": {
"type": "string",
"enum": [
"user",
"agent",
"app",
"run"
]
},
"description": "The type of the entity (user, agent, app, or run)."
},
{
"name": "entity_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The unique identifier of the entity."
}
],
"responses": {
"200": {
"description": "Entity deletion has been queued for background (async) execution.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Delete in progress. This may take some time."
},
"event_id": {
"type": "string",
"format": "uuid"
}
}
}
}
}
},
"400": {
"description": "Invalid entity type.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Invalid entity type"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"DELETE\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'DELETE', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/v2/entities/{entity_type}/{entity_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/events/": {
"get": {
"tags": [
"events"
],
"summary": "Retrieve all events for current organization and project.",
"operationId": "events_list",
"responses": {
"200": {
"description": "Successfully retrieved events.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "Total number of events matching the filters."
},
"next": {
"type": "string",
"nullable": true,
"description": "URL for the next page of results."
},
"previous": {
"type": "string",
"nullable": true,
"description": "URL for the previous page of results."
},
"results": {
"type": "array",
"description": "Array of event objects.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "The unique identifier of the event."
},
"event_type": {
"type": "string",
"description": "The type of event (e.g., ADD, SEARCH)."
},
"status": {
"type": "string",
"enum": [
"PENDING",
"RUNNING",
"FAILED",
"SUCCEEDED"
],
"description": "The current status of the event."
},
"payload": {
"type": "object",
"description": "The original payload associated with the event."
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the event."
},
"results": {
"type": "array",
"description": "Array of results produced by the event. For add events, this confirms the write completed; temporal reasoning enrichment runs asynchronously by default."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event was last updated."
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when event processing started."
},
"completed_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when event processing completed."
},
"latency": {
"type": "number",
"description": "Processing time in milliseconds."
}
}
}
}
},
"required": [
"count",
"results"
]
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/v1/events/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/v1/events/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/events/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/events/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/events/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/events/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/event/{event_id}/": {
"get": {
"tags": [
"events"
],
"summary": "Retrieve details of a specific event by its ID.",
"operationId": "event_read",
"parameters": [
{
"name": "event_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "The unique identifier of the event (UUID)."
}
],
"responses": {
"200": {
"description": "Successfully retrieved event details.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "The unique identifier of the event."
},
"event_type": {
"type": "string",
"description": "The type of event (e.g., ADD, SEARCH)."
},
"status": {
"type": "string",
"enum": [
"PENDING",
"RUNNING",
"FAILED",
"SUCCEEDED"
],
"description": "The current status of the event."
},
"payload": {
"type": "object",
"description": "The original payload associated with the event."
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the event."
},
"results": {
"type": "array",
"description": "Array of results produced by the event."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event was last updated."
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when event processing started."
},
"completed_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when event processing completed."
},
"latency": {
"type": "number",
"description": "Processing time in milliseconds."
},
"graph_status": {
"type": "string",
"nullable": true,
"description": "Status of graph memory processing for this event, if graph memory is enabled."
},
"error": {
"type": "string",
"nullable": true,
"description": "Error message if the event failed to process."
}
}
}
}
}
},
"404": {
"description": "Event not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Event not found or you don't have permission to access it."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/v1/event/{event_id}/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/v1/event/{event_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/event/{event_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/event/{event_id}/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/event/{event_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/event/{event_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/exports/": {
"post": {
"tags": [
"exports"
],
"summary": "Create an export job with schema",
"description": "Create a structured export of memories based on a provided schema.",
"operationId": "exports_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"schema"
],
"properties": {
"schema": {
"type": "object",
"description": "Schema definition for the export"
},
"filters": {
"type": "object",
"description": "Filters to apply while exporting memories, using the structured AND/OR filter format (see `/v2/memories/search/`), e.g. `{\"AND\": [{\"user_id\": \"<user_id>\"}]}`. Available fields are: user_id, agent_id, app_id, run_id. Flat filter objects (e.g. `{\"user_id\": \"<user_id>\"}`) are rejected with a 400 error."
},
"org_id": {
"type": "string",
"description": "Filter exports by organization ID."
},
"project_id": {
"type": "string",
"description": "Filter exports by project ID."
}
}
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Export created successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Memory export request received. The export will be ready in a few seconds."
},
"id": {
"type": "string",
"format": "uuid",
"example": "550e8400-e29b-41d4-a716-446655440000"
}
},
"required": [
"message",
"id"
]
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"description": "Returned when the schema is missing or invalid.",
"properties": {
"message": {
"type": "string",
"example": "Schema is required and must be a valid object"
}
}
},
{
"type": "object",
"description": "Returned when filters are missing or not in the required structured AND/OR format.",
"properties": {
"error": {
"type": "string",
"example": "One of the filters: app_id, user_id, agent_id, run_id, memory_export_id is required!"
}
}
}
]
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\njson_schema = {pydantic_json_schema}\nfilters = {\n \"AND\": [\n {\"user_id\": \"alex\"}\n ]\n}\n\nresponse = client.create_memory_export(\n schema=json_schema,\n filters=filters\n)\nprint(response)"
},
{
"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\nconst jsonSchema = {pydantic_json_schema};\nconst filters = {\n AND: [\n {user_id: 'alex'}\n ]\n};\n\nclient.createMemoryExport({\n schema: jsonSchema,\n filters: filters\n})\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url 'https://api.mem0.ai/v1/exports/' \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"schema\": {pydantic_json_schema},\n \"filters\": {\n \"AND\": [\n {\"user_id\": \"alex\"}\n ]\n }\n }'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\turl := \"https://api.mem0.ai/v1/exports/\"\n\n\tfilters := map[string]interface{}{\n\t\t\"AND\": []map[string]interface{}{\n\t\t\t{\"user_id\": \"alex\"},\n\t\t},\n\t}\n\n\tdata := map[string]interface{}{\n\t\t\"schema\": map[string]interface{}{}, // Your schema here\n\t\t\"filters\": filters,\n\t}\n\n\tjsonData, _ := json.Marshal(data)\n\n\treq, _ := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonData))\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\n$filters = [\n 'AND' => [\n ['user_id' => 'alex']\n ]\n];\n\n$data = array(\n \"schema\" => array(), // Your schema here\n \"filters\" => $filters\n);\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/exports/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => json_encode($data),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "import com.mashape.unirest.http.HttpResponse;\nimport com.mashape.unirest.http.JsonNode;\nimport com.mashape.unirest.http.Unirest;\nimport org.json.JSONObject;\nimport org.json.JSONArray;\n\nJSONObject filters = new JSONObject()\n .put(\"AND\", new JSONArray()\n .put(new JSONObject().put(\"user_id\", \"alex\")));\n\nJSONObject data = new JSONObject()\n .put(\"schema\", new JSONObject()) // Your schema here\n .put(\"filters\", filters);\n\nHttpResponse<JsonNode> response = Unirest.post(\"https://api.mem0.ai/v1/exports/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(data.toString())\n .asJson();"
}
]
}
},
"/v1/exports/get/": {
"post": {
"tags": [
"exports"
],
"summary": "Export data based on filters",
"description": "Get the latest memory export.",
"operationId": "exports_list",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"memory_export_id": {
"type": "string",
"description": "The unique identifier of the memory export."
},
"filters": {
"type": "object",
"properties": {
"user_id": {
"type": "string"
},
"agent_id": {
"type": "string"
},
"app_id": {
"type": "string"
},
"run_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"description": "Filters to apply while exporting memories. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at."
},
"org_id": {
"type": "string",
"description": "Filter exports by organization ID."
},
"project_id": {
"type": "string",
"description": "Filter exports by project ID."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful export.",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Export data response in an object format."
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}
}
}
}
}
},
"404": {
"description": "Not Found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "No memory export request found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\nmemory_export_id = \"<memory_export_id>\"\n\nresponse = client.get_memory_export(memory_export_id=memory_export_id)\nprint(response)"
},
{
"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\nconst memory_export_id = \"<memory_export_id>\";\n\n// Get memory export\nclient.getMemoryExport({ memory_export_id })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url 'https://api.mem0.ai/v1/exports/get/' \\\n --header 'Authorization: Token <api-key>' \\\n --data '{\n \"memory_export_id\": \"<memory_export_id>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\tmemory_export_id := \"<memory_export_id>\"\n\n\treq, _ := http.NewRequest(\"POST\", \"https://api.mem0.ai/v1/exports/get/\", nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\n$data = json_encode(['memory_export_id' => '<memory_export_id>']);\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/exports/get/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => $data,\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "String data = \"{\\\"memory_export_id\\\":\\\"<memory_export_id>\\\"}\";\n\nHttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/v1/exports/get/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(data)\n .asString();"
}
]
}
},
"/v1/memories/": {
"get": {
"tags": [
"memories"
],
"description": "Get all memories.",
"operationId": "memories_list",
"deprecated": true,
"parameters": [
{
"name": "user_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by user ID."
},
{
"name": "agent_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by agent ID."
},
{
"name": "app_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by app ID."
},
{
"name": "run_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by run ID."
},
{
"name": "metadata",
"in": "query",
"schema": {
"type": "object"
},
"description": "Filter memories by metadata (JSON string).",
"style": "deepObject",
"explode": true
},
{
"name": "categories",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"description": "Filter memories by categories."
},
{
"name": "org_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by organization ID."
},
{
"name": "project_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by project ID."
},
{
"name": "fields",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"description": "Filter memories by fields."
},
{
"name": "keywords",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by keywords."
},
{
"name": "page",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Page number for pagination. Default: 1."
},
{
"name": "page_size",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Number of items per page. Default: 100."
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"maximum": 200
},
"description": "Maximum number of memories to return. Maximum accepted value: 200. Ignored when both `page` and `page_size` are supplied."
},
{
"name": "start_date",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by start date."
},
{
"name": "end_date",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by end date."
}
],
"responses": {
"200": {
"description": "Successfully retrieved memories.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "array",
"description": "Returned when the `page` and `page_size` query parameters are not both supplied.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"memory": {
"type": "string"
},
"user_id": {
"type": "string",
"nullable": true,
"description": "ID of the user this memory belongs to, if scoped to a user."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "User-supplied metadata attached to the memory."
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"expiration_date": {
"type": "string",
"format": "date",
"description": "The date when the memory will expire. Format: YYYY-MM-DD.",
"nullable": true,
"default": null
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
},
"lifecycle_state": {
"type": "string",
"description": "Lifecycle state of the memory."
}
},
"required": [
"id",
"memory",
"created_at",
"updated_at"
]
}
},
{
"type": "object",
"description": "Returned when both the `page` and `page_size` query parameters are supplied.",
"properties": {
"count": {
"type": "integer"
},
"next": {
"type": "string",
"nullable": true
},
"previous": {
"type": "string",
"nullable": true
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"memory": {
"type": "string"
},
"user_id": {
"type": "string",
"nullable": true,
"description": "ID of the user this memory belongs to, if scoped to a user."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "User-supplied metadata attached to the memory."
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"expiration_date": {
"type": "string",
"format": "date",
"description": "The date when the memory will expire. Format: YYYY-MM-DD.",
"nullable": true,
"default": null
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
},
"lifecycle_state": {
"type": "string",
"description": "Lifecycle state of the memory."
}
},
"required": [
"id",
"memory",
"created_at",
"updated_at"
]
}
}
},
"required": [
"count",
"next",
"previous",
"results"
]
}
]
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "array",
"description": "Returned when none of the required filters (app_id, user_id, agent_id, run_id) is supplied.",
"items": {
"type": "string"
},
"example": [
"One of the filters: app_id, user_id, agent_id, run_id is required!"
]
},
{
"type": "object",
"description": "Returned when the `limit` query parameter is invalid.",
"properties": {
"error": {
"type": "string"
}
},
"example": {
"error": "limit must be <= 200"
}
}
]
}
}
}
},
"404": {
"description": "Not Found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"detail": {
"type": "string",
"example": "Invalid page."
}
}
}
}
}
}
},
"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# Retrieve memories for a specific user\nuser_memories = client.get_all(filters={\"user_id\": \"<user_id>\"})\n\nprint(user_memories)"
},
{
"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// Retrieve memories for a specific user\nclient.getAll({ user_id: \"<user_id>\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --location --request GET 'https://api.mem0.ai/v1/memories/' \\\n--header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/memories/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"post": {
"tags": [
"memories"
],
"description": "Add memories.",
"operationId": "memories_create",
"deprecated": true,
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemoryInput"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Memory processing has been queued for background (async) execution. The response reports queueing status, not the final memory content; poll `GET /v1/event/{event_id}/` with the returned `event_id` to see the processed result. By default (or with `version=v1` / `output_format=v1.0`) the response is a bare array. When both `output_format=v1.1` and `version=v2` are requested, the response is an object wrapping the same array under `results`.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "array",
"description": "Default response shape.",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Memory processing has been queued for background execution"
},
"status": {
"type": "string",
"example": "PENDING"
},
"event_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"message",
"status",
"event_id"
]
}
},
{
"type": "object",
"description": "Response shape when both `output_format=v1.1` and `version=v2` are requested.",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Memory processing has been queued for background execution"
},
"status": {
"type": "string",
"example": "PENDING"
},
"event_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"message",
"status",
"event_id"
]
}
},
"relations": {
"type": "array",
"items": {}
}
},
"required": [
"results",
"relations"
]
}
]
}
}
}
},
"400": {
"description": "Bad Request. 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.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error",
"details"
],
"example": {
"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."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\nmessages = [\n {\"role\": \"user\", \"content\": \"<user-message>\"},\n {\"role\": \"assistant\", \"content\": \"<assistant-response>\"}\n]\n\nclient.add(messages, user_id=\"<user-id>\")"
},
{
"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\nconst messages = [\n { role: \"user\", content: \"Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts.\" },\n { role: \"assistant\", content: \"Hello Alex! I've noted that you're a vegetarian and have a nut allergy. I'll keep this in mind for any food-related recommendations or discussions.\" }\n];\n\nclient.add(messages, { user_id: \"<user_id>\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/v1/memories/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"messages\": [\n {}\n ],\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"app_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"metadata\": {},\n \"includes\": \"<string>\",\n \"excludes\": \"<string>\",\n \"infer\": true,\n \"custom_categories\": {}, \n \"org_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"version\": \"v2\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"messages\\\": [\n {}\n ],\n \\\"agent_id\\\": \\\"<string>\\\",\n \\\"user_id\\\": \\\"<string>\\\",\n \\\"app_id\\\": \\\"<string>\\\",\n \\\"run_id\\\": \\\"<string>\\\",\n \\\"metadata\\\": {},\n \\\"includes\\\": \\\"<string>\\\",\n \\\"excludes\\\": \\\"<string>\\\",\n \\\"infer\\\": true,\n \\\"custom_categories\\\": {},\n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\",\n \\\"version\\\": \"v2\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"messages\\\": [\n {}\n ],\n \\\"agent_id\\\": \\\"<string>\\\",\n \\\"user_id\\\": \\\"<string>\\\",\n \\\"app_id\\\": \\\"<string>\\\",\n \\\"run_id\\\": \\\"<string>\\\",\n \\\"metadata\\\": {},\n \\\"includes\\\": \\\"<string>\\\",\n \\\"excludes\\\": \\\"<string>\\\",\n \\\"infer\\\": true,\n \\\"custom_categories\\\": {}, \n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\",\n \\\"version\\\": \"v2\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/v1/memories/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"messages\\\": [\n {}\n ],\n \\\"agent_id\\\": \\\"<string>\\\",\n \\\"user_id\\\": \\\"<string>\\\",\n \\\"app_id\\\": \\\"<string>\\\",\n \\\"run_id\\\": \\\"<string>\\\",\n \\\"metadata\\\": {},\n \\\"includes\\\": \\\"<string>\\\",\n \\\"excludes\\\": \\\"<string>\\\",\n \\\"infer\\\": true,\n \\\"custom_categories\\\": {}, \n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\",\n \\\"version\\\": \"v2\"\n}\")\n .asString();"
}
],
"x-codegen-request-body-name": "data"
},
"delete": {
"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.",
"operationId": "memories_delete_all",
"parameters": [
{
"name": "user_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by user ID. Pass `*` to delete memories for all users."
},
{
"name": "agent_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by agent ID. Pass `*` to delete memories for all agents."
},
{
"name": "app_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by app ID. Pass `*` to delete memories for all apps."
},
{
"name": "run_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by run ID. Pass `*` to delete memories for all runs."
},
{
"name": "metadata",
"in": "query",
"schema": {
"type": "object"
},
"description": "Filter memories by metadata (JSON string).",
"style": "deepObject",
"explode": true
},
{
"name": "org_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by organization ID."
},
{
"name": "project_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter memories by project ID."
}
],
"responses": {
"200": {
"description": "Deletion of memories has been queued for background (async) execution.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Delete in progress. This may take some time."
},
"event_id": {
"type": "string",
"format": "uuid"
}
}
}
}
}
}
},
"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=\"<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."
},
{
"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));"
},
{
"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>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/v1/memories/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
],
"x-codegen-request-body-name": "data"
}
},
"/v2/memories/": {
"post": {
"tags": [
"memories"
],
"description": "Get all memories.",
"operationId": "memories_list_v2",
"deprecated": true,
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemoryGetInputV2"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully retrieved memories.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique memory identifier."
},
"memory": {
"type": "string",
"description": "The extracted memory fact."
},
"user_id": {
"type": "string",
"nullable": true,
"description": "User the memory is scoped to."
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "Agent the memory is scoped to."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "App the memory is scoped to."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "Run/session the memory is scoped to. Note: this endpoint returns this field as `session_id`, matching `POST /v3/memories/`."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was last updated."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "The date when the memory will expire. Format: YYYY-MM-DD."
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
}
},
"required": [
"id",
"memory",
"created_at",
"updated_at"
]
}
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}
}
}
}
}
}
},
"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# Retrieve memories with filters\nmemories = client.get_all(\n filters={\n \"AND\": [\n {\n \"user_id\": \"alex\"\n },\n {\n \"created_at\": {\n \"gte\": \"2024-07-01\",\n \"lte\": \"2024-07-31\"\n }\n }\n ]\n }\n)\n\nprint(memories)"
},
{
"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\nconst filters = {\n AND: [\n { user_id: 'alex' },\n { created_at: { gte: '2024-07-01', lte: '2024-07-31' } }\n ]\n};\n\nclient.getAll({ filters })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl -X POST 'https://api.mem0.ai/v2/memories/' \\\n-H 'Authorization: Token your-api-key' \\\n-H 'Content-Type: application/json' \\\n-d '{\n \"filters\": {\n \"AND\": [\n { \"user_id\": \"alex\" },\n { \"created_at\": { \"gte\": \"2024-07-01\", \"lte\": \"2024-07-31\" } }\n ]\n },\n \"org_id\": \"your-org-id\",\n \"project_id\": \"your-project-id\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc main() {\n\turl := \"https://api.mem0.ai/v2/memories/\"\n\tfilters := map[string]interface{}{\n\t\t\"AND\": []map[string]interface{}{\n\t\t\t{\"user_id\": \"alex\"},\n\t\t\t{\"created_at\": map[string]string{\n\t\t\t\t\"gte\": \"2024-07-01\",\n\t\t\t\t\"lte\": \"2024-07-31\",\n\t\t\t}},\n\t\t},\n\t}\n\tpayload, _ := json.Marshal(map[string]interface{}{\"filters\": filters})\n\treq, _ := http.NewRequest(\"POST\", url, bytes.NewBuffer(payload))\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\n$filters = [\n 'AND' => [\n ['user_id' => 'alex'],\n ['created_at' => ['gte' => '2024-07-01', 'lte' => '2024-07-31']]\n ]\n];\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v2/memories/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => json_encode(['filters' => $filters]),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token your-api-key\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "import com.konghq.unirest.http.HttpResponse;\nimport com.konghq.unirest.http.Unirest;\nimport org.json.JSONObject;\n\nJSONObject filters = new JSONObject()\n .put(\"AND\", new JSONArray()\n .put(new JSONObject().put(\"user_id\", \"alex\"))\n .put(new JSONObject().put(\"created_at\", new JSONObject()\n .put(\"gte\", \"2024-07-01\")\n .put(\"lte\", \"2024-07-31\")\n ))\n );\n\nHttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/v2/memories/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .header(\"Content-Type\", \"application/json\")\n .body(new JSONObject().put(\"filters\", filters).toString())\n .asString();\n\nSystem.out.println(response.getBody());"
}
]
}
},
"/v1/memories/events/": {
"get": {
"tags": [
"memories"
],
"description": "Despite the endpoint name, this returns memory history entries (the same shape as `GET /v1/memories/{memory_id}/history/`), not event/ingestion-job records. For event/ingestion-job status, use `GET /v1/event/{event_id}/`.",
"operationId": "memories_events_list",
"parameters": [
{
"name": "page",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Page number for pagination. Default: 1. Default page size is 100."
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Number of items per page. Default: 100."
}
],
"responses": {
"200": {
"description": "Successfully retrieved memory history entries.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"next": {
"type": "string",
"nullable": true
},
"previous": {
"type": "string",
"nullable": true
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the history entry."
},
"memory_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier of the associated memory."
},
"input": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
}
},
"description": "The conversation input that led to this memory change"
},
"old_memory": {
"type": "string",
"nullable": true,
"description": "The previous state of the memory, if applicable"
},
"new_memory": {
"type": "string",
"description": "The new or updated state of the memory"
},
"user_id": {
"type": "string",
"description": "The identifier of the user associated with this memory"
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the agent associated with this memory, if any."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the app associated with this memory, if any."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "The run identifier associated with this memory, returned as `session_id`."
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
},
"description": "Categories associated with the memory at this point in its history"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when this history entry was created."
},
"event": {
"type": "string",
"enum": [
"ADD",
"UPDATE",
"DELETE"
],
"description": "The type of event that occurred"
},
"previous_embedding_qwen": {
"type": "string",
"nullable": true,
"description": "Previous internal embedding representation (Qwen model), if applicable"
},
"embedding_qwen": {
"type": "string",
"nullable": true,
"description": "Internal embedding representation (Qwen model), if available"
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the memory change"
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when this history entry was last updated."
}
},
"required": [
"id",
"memory_id",
"new_memory",
"user_id",
"event",
"created_at",
"updated_at"
]
}
}
},
"required": [
"count",
"next",
"previous",
"results"
]
}
}
}
},
"404": {
"description": "Invalid page.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"detail": {
"type": "string",
"example": "Invalid page."
}
}
}
}
}
}
}
}
},
"/v1/memories/search/": {
"post": {
"tags": [
"memories"
],
"description": "Perform a semantic search on memories.",
"operationId": "memories_search_create",
"deprecated": true,
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemorySearchInput"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully retrieved search results.",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "array",
"description": "Default response shape. Returned when `output_format` is omitted or set to `v1.0`.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the memory."
},
"memory": {
"type": "string",
"description": "The content of the memory"
},
"user_id": {
"type": "string",
"description": "The identifier of the user associated with this memory"
},
"score": {
"type": "number",
"description": "Relevance score of the memory for the search query."
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories associated with the memory"
},
"expiration_date": {
"type": "string",
"format": "date",
"description": "The date when the memory will expire. Format: YYYY-MM-DD.",
"title": "Expiration date",
"nullable": true,
"default": null
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was last updated."
}
},
"required": [
"id",
"memory",
"user_id",
"created_at",
"updated_at"
]
}
},
{
"type": "object",
"description": "Returned when `output_format=v1.1` is requested.",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the memory."
},
"memory": {
"type": "string",
"description": "The content of the memory"
},
"user_id": {
"type": "string",
"description": "The identifier of the user associated with this memory"
},
"score": {
"type": "number",
"description": "Relevance score of the memory for the search query."
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories associated with the memory"
},
"expiration_date": {
"type": "string",
"format": "date",
"description": "The date when the memory will expire. Format: YYYY-MM-DD.",
"title": "Expiration date",
"nullable": true,
"default": null
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was last updated."
}
},
"required": [
"id",
"memory",
"user_id",
"created_at",
"updated_at"
]
}
},
"relations": {
"type": "array",
"items": {}
}
},
"required": [
"results",
"relations"
]
}
]
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "At least one of the filters: agent_id, user_id, app_id, run_id is required!"
}
}
}
}
}
}
},
"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\nquery = \"Your search query here\"\n\nresults = client.search(query, filters={\"user_id\": \"<user_id>\"})\nprint(results)"
},
{
"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\nconst query = \"Your search query here\";\n\nclient.search(query, { user_id: \"<user_id>\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/v1/memories/search/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"query\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"app_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"metadata\": {},\n \"top_k\": 123,\n \"fields\": [\n \"<string>\"\n ],\n \"rerank\": true,\n \"org_id\": \"<string>\",\n \"project_id\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/memories/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
],
"x-codegen-request-body-name": "data"
}
},
"/v2/memories/search/": {
"post": {
"tags": [
"memories"
],
"description": "Search memories based on a query and filters.",
"operationId": "memories_search_v2",
"deprecated": true,
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemorySearchInputV2"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully retrieved search results.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the memory."
},
"memory": {
"type": "string",
"description": "The content of the memory"
},
"user_id": {
"type": "string",
"description": "The identifier of the user associated with this memory"
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories associated with the memory"
},
"expiration_date": {
"type": "string",
"format": "date",
"description": "The date when the memory will expire. Format: YYYY-MM-DD.",
"title": "Expiration date",
"nullable": true,
"default": null
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when the memory was last updated."
},
"score": {
"type": "number",
"format": "float",
"minimum": 0,
"maximum": 1,
"description": "Combined multi-signal relevance score in [0, 1] (search responses only)."
},
"agent_id": {
"type": "string",
"nullable": true
},
"app_id": {
"type": "string",
"nullable": true
},
"session_id": {
"type": "string",
"nullable": true,
"description": "Run/session the memory is scoped to. Note: this endpoint returns this field as `session_id`, matching `POST /v3/memories/`."
}
},
"required": [
"id",
"memory",
"user_id",
"created_at",
"updated_at"
]
}
}
}
}
}
},
"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\nquery = \"What do you know about me?\"\nfilters = {\n \"OR\":[\n {\n \"user_id\":\"alex\"\n },\n {\n \"agent_id\":{\n \"in\":[\n \"travel-assistant\",\n \"customer-support\"\n ]\n }\n }\n ]\n}\nclient.search(query, filters=filters)"
},
{
"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\nconst query = \"What do you know about me?\";\nconst filters = {\n OR: [\n { user_id: \"alex\" },\n { agent_id: { in: [\"travel-assistant\", \"customer-support\"] } }\n ]\n};\n\nclient.search(query, { filters })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/v2/memories/search/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"query\": \"<string>\",\n \"filters\": {},\n \"top_k\": 123,\n \"fields\": [\n \"<string>\"\n ],\n \"rerank\": true,\n \"org_id\": \"<string>\",\n \"project_id\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v2/memories/search/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"query\\\": \\\"<string>\\\",\n \\\"filters\\\": {},\n \\\"top_k\\\": 123,\n \\\"fields\\\": [\n \\\"<string>\\\"\n ],\n \\\"rerank\\\": true,\n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v2/memories/search/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"query\\\": \\\"<string>\\\",\n \\\"filters\\\": {},\n \\\"top_k\\\": 123,\n \\\"fields\\\": [\n \\\"<string>\\\"\n ],\n \\\"rerank\\\": true,\n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/v2/memories/search/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"query\\\": \\\"<string>\\\",\n \\\"filters\\\": {},\n \\\"top_k\\\": 123,\n \\\"fields\\\": [\n \\\"<string>\\\"\n ],\n \\\"rerank\\\": true,\n \\\"org_id\\\": \\\"<string>\\\",\n \\\"project_id\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
],
"x-codegen-request-body-name": "data"
}
},
"/v3/memories/": {
"post": {
"tags": [
"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.",
"operationId": "memories_list_v3",
"parameters": [
{
"in": "query",
"name": "page",
"schema": {
"type": "integer",
"minimum": 1,
"default": 1
},
"description": "1-indexed page number."
},
{
"in": "query",
"name": "page_size",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 200,
"default": 100
},
"description": "Results per page."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"filters"
],
"properties": {
"filters": {
"type": "object",
"description": "Entity and metadata filters. Must include at least one entity ID (`user_id`, `agent_id`, `app_id`, or `run_id`).",
"additionalProperties": true
},
"show_expired": {
"type": "boolean",
"default": false,
"description": "When true, include memories whose `expiration_date` has passed. Expired memories are hidden by default."
},
"start_date": {
"type": "string",
"format": "date",
"description": "Only include memories created on or after this date (YYYY-MM-DD)."
},
"end_date": {
"type": "string",
"format": "date",
"description": "Only include memories created on or before this date (YYYY-MM-DD)."
},
"categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Restrict results to memories tagged with any of these categories."
},
"fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "Restrict the fields returned per memory, e.g. [\"id\", \"memory\"]."
},
"keywords": {
"type": "string",
"description": "Free-text keyword filter applied on top of filters."
},
"page": {
"type": "integer",
"description": "1-indexed page number. Also accepted here in the request body; the query parameter of the same name takes precedence."
},
"page_size": {
"type": "integer",
"description": "Results per page. Also accepted here in the request body; the query parameter of the same name takes precedence."
}
}
},
"example": {
"filters": {
"user_id": "alice"
}
}
}
}
},
"responses": {
"200": {
"description": "Paginated envelope of memories.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "Total number of memories matching the filters."
},
"next": {
"type": "string",
"format": "uri",
"nullable": true,
"description": "URL for the next page, or `null` if this is the last page."
},
"previous": {
"type": "string",
"format": "uri",
"nullable": true,
"description": "URL for the previous page, or `null` if this is the first page."
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique memory identifier."
},
"memory": {
"type": "string",
"description": "The extracted memory fact."
},
"user_id": {
"type": "string",
"nullable": true,
"description": "User the memory is scoped to."
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "Agent the memory is scoped to."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "App the memory is scoped to."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "Run/session the memory is scoped to. Note: this endpoint returns this field as `session_id`, while `POST /v3/memories/search/` returns the same value as `run_id`."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "User-supplied metadata attached to the memory."
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "Date after which the memory is hidden from search and get-all unless `show_expired` is true."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"memory",
"created_at"
]
}
}
},
"required": [
"count",
"next",
"previous",
"results"
]
},
"example": {
"count": 123,
"next": "https://api.mem0.ai/v3/memories/?page=2&page_size=100",
"previous": null,
"results": [
{
"id": "mem-uuid",
"memory": "User moved to San Francisco from New York in January 2026",
"metadata": {},
"categories": [
"location"
],
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-15T10:30:00Z"
}
]
}
}
}
},
"400": {
"description": "Validation error, e.g. empty `filters` or no positively-scoped entity ID."
},
"401": {
"description": "Unauthorized: missing or invalid API key."
}
},
"security": [
{
"tokenAuth": []
}
],
"x-codeSamples": [
{
"lang": "cURL",
"source": "curl -X POST 'https://api.mem0.ai/v3/memories/?page=1&page_size=50' \\\n -H \"Authorization: Token <api-key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"filters\": {\"user_id\": \"alice\"}}'"
},
{
"lang": "Python",
"source": "from mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your-api-key\")\n\npage = client.get_all(filters={\"user_id\": \"alice\"}, page=1, page_size=50)\n# page == {\"count\": 123, \"next\": \"...\", \"previous\": None, \"results\": [...]}\nprint(page[\"count\"], len(page[\"results\"]))"
},
{
"lang": "JavaScript",
"source": "import MemoryClient from \"mem0ai\";\n\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst page = await client.getAll({\n filters: { userId: \"alice\" },\n page: 1,\n pageSize: 50,\n});\nconsole.log(page.count, page.results.length);"
}
]
}
},
"/v3/memories/add/": {
"post": {
"tags": [
"memories"
],
"summary": "Add memories (V3)",
"description": "Extract and store memories from a conversation using the V3 additive pipeline. Entity IDs (`user_id` / `agent_id` / `run_id`) are accepted at the top level. At least one entity ID is required so the memory is scoped to a session.",
"operationId": "memories_add_v3",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"messages"
],
"properties": {
"messages": {
"type": "array",
"description": "Conversation messages to extract memories from.",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"assistant",
"system"
]
},
"content": {
"type": "string"
}
},
"required": [
"role",
"content"
]
}
},
"user_id": {
"type": "string",
"description": "Scope memories to this user."
},
"agent_id": {
"type": "string",
"description": "Scope memories to this agent."
},
"run_id": {
"type": "string",
"description": "Scope memories to this session / run."
},
"metadata": {
"type": "object",
"additionalProperties": true,
"description": "User-supplied metadata to attach to each extracted memory."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "Optional expiration date in YYYY-MM-DD format. After this date, memories are hidden from search and get-all unless `show_expired` is true."
},
"custom_instructions": {
"type": "string",
"description": "Project-level instructions that guide extraction for this call."
},
"agent_custom_instructions": {
"type": "string",
"description": "Extraction instructions for agent-scoped memories, overriding the project-level setting for this call. Applied when `agent_id` is sent without `user_id`; when both are sent it governs the assistant-attributed memories while `custom_instructions` governs the rest."
},
"custom_categories": {
"type": "array",
"description": "Category catalog for this call. Replaces the project-level list rather than merging with it. Omit to fall back to the project list, then the default catalog.",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Maps a category name to the description the classifier matches against."
}
},
"infer": {
"type": "boolean",
"default": true,
"description": "When `false`, stores each message verbatim without running the extraction LLM."
},
"app_id": {
"type": "string",
"description": "Scope memories to this app."
},
"immutable": {
"type": "boolean",
"default": false,
"description": "Mark stored memories as immutable, excluding them from future update/consolidation."
},
"includes": {
"type": "string",
"description": "Free-text hint of what to include during extraction, e.g. \"vehicles\"."
},
"excludes": {
"type": "string",
"description": "Free-text hint of what to exclude during extraction, e.g. \"politics\"."
},
"enable_graph": {
"type": "boolean",
"description": "Enable graph memory extraction for this call."
},
"structured_data_schema": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "Optional schema constraining structured extraction. Exact shape not fully characterized; observed only as null in captured traffic."
},
"output_format": {
"type": "string",
"nullable": true,
"description": "Response envelope version, e.g. \"v1.1\". Full set of accepted values not confirmed."
},
"prompt_profile_id": {
"type": "string",
"nullable": true,
"description": "ID of a saved prompt profile to use for extraction."
},
"temporal_reasoning": {
"type": "boolean",
"description": "Enable temporal reasoning during extraction."
},
"timezone": {
"type": "string",
"description": "IANA timezone used to interpret observation_datetime and observation_date, e.g. \"UTC\"."
},
"observation_datetime": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 datetime the conversation was observed."
},
"observation_date": {
"type": "string",
"format": "date",
"description": "Date the conversation was observed (YYYY-MM-DD)."
},
"timestamp": {
"type": "integer",
"description": "Unix epoch seconds used to backdate created_at on the stored memories. Not echoed back in the event payload but confirmed applied."
}
}
},
"example": {
"messages": [
{
"role": "user",
"content": "I just moved to San Francisco from New York."
},
{
"role": "assistant",
"content": "Got it, I'll update your location."
}
],
"user_id": "alice"
}
}
}
},
"responses": {
"200": {
"description": "Memory addition queued; returns an event identifier clients can poll via `GET /v1/event/{event_id}/`.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Only present when `infer` is `false`, where processing is synchronous."
},
"status": {
"type": "string",
"enum": [
"PENDING",
"SUCCEEDED",
"FAILED"
]
},
"event_id": {
"type": "string",
"format": "uuid"
},
"results": {
"type": "array",
"description": "Only present when `infer` is `false`, where processing is synchronous and memories are stored verbatim without extraction.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"data": {
"type": "object",
"properties": {
"memory": {
"type": "string"
}
}
},
"event": {
"type": "string",
"example": "ADD"
}
}
}
}
}
},
"example": {
"event_id": "2c4d1f44-4f7b-4b2f-9f6e-7b5b4f5a1234",
"status": "PENDING"
}
}
}
},
"400": {
"description": "Validation error, e.g. missing `messages` or no entity ID supplied."
},
"401": {
"description": "Unauthorized: missing or invalid API key."
}
},
"security": [
{
"tokenAuth": []
}
],
"x-codeSamples": [
{
"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 }'"
},
{
"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)"
},
{
"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);"
}
]
}
},
"/v3/memories/search/": {
"post": {
"tags": [
"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.",
"operationId": "memories_search_v3",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"query",
"filters"
],
"properties": {
"query": {
"type": "string",
"minLength": 1,
"description": "Natural-language search query."
},
"filters": {
"type": "object",
"description": "Entity and metadata filters. Must include at least one entity ID (`user_id`, `agent_id`, `app_id`, or `run_id`). Supports `AND`, `OR`, `NOT`, and comparison operators (`in`, `gte`, `lte`, `gt`, `lt`, `contains`, `icontains`, `ne`).",
"additionalProperties": true
},
"show_expired": {
"type": "boolean",
"default": false,
"description": "When true, include memories whose `expiration_date` has passed. Expired memories are hidden by default."
},
"top_k": {
"type": "integer",
"minimum": 1,
"maximum": 1000,
"default": 10,
"description": "Number of results to return."
},
"threshold": {
"type": "number",
"minimum": 0.0,
"maximum": 1.0,
"default": 0.1,
"description": "Minimum semantic relevance score. Pass `0.0` to disable filtering."
},
"rerank": {
"type": "boolean",
"default": false,
"description": "Apply the managed reranker for better ordering (adds latency)."
},
"reference_date": {
"oneOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
],
"nullable": true,
"description": "Date and time to simulate the search from. Accepts a Unix epoch, YYYY-MM-DD, or ISO datetime."
},
"fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "Restrict the fields returned per memory."
},
"categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Filter results to memories tagged with any of these categories."
},
"metadata": {
"type": "object",
"additionalProperties": true,
"description": "Filter results to memories matching this metadata."
}
}
},
"example": {
"query": "where does the user live?",
"filters": {
"user_id": "alice"
},
"top_k": 10
}
}
}
},
"responses": {
"200": {
"description": "Ranked search results.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique memory identifier."
},
"memory": {
"type": "string",
"description": "The extracted memory fact."
},
"user_id": {
"type": "string",
"nullable": true,
"description": "User the memory is scoped to."
},
"score": {
"type": "number",
"format": "float",
"minimum": 0,
"maximum": 1,
"description": "Combined multi-signal relevance score in [0, 1] (search responses only)."
},
"score_breakdown": {
"type": "object",
"description": "Per-signal breakdown of the relevance score.",
"properties": {
"semantic": {
"type": "number"
},
"bm25": {
"type": "number"
},
"entity": {
"type": "number"
}
}
},
"agent_id": {
"type": "string",
"nullable": true
},
"app_id": {
"type": "string",
"nullable": true
},
"run_id": {
"type": "string",
"nullable": true,
"description": "Run/session the memory is scoped to. Note: this endpoint returns this field as `run_id`, while `POST /v3/memories/` returns the same value as `session_id`."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "Date after which the memory is hidden from search unless `show_expired` is true."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "User-supplied metadata attached to the memory."
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"memory",
"created_at"
]
}
}
},
"required": [
"results"
]
},
"example": {
"results": [
{
"id": "mem-uuid",
"memory": "User moved to San Francisco from New York in January 2026",
"score": 0.82,
"metadata": {},
"categories": [
"location"
],
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-15T10:30:00Z"
}
]
}
}
}
},
"400": {
"description": "Validation error, e.g. empty `query`, missing `filters`, or no positively-scoped entity ID."
},
"401": {
"description": "Unauthorized: missing or invalid API key."
}
},
"security": [
{
"tokenAuth": []
}
],
"x-codeSamples": [
{
"lang": "cURL",
"source": "curl -X POST https://api.mem0.ai/v3/memories/search/ \\\n -H \"Authorization: Token <api-key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"query\": \"where does the user live?\",\n \"filters\": {\"user_id\": \"alice\"},\n \"top_k\": 10\n }'"
},
{
"lang": "Python",
"source": "from mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your-api-key\")\n\nresults = client.search(\n \"where does the user live?\",\n filters={\"user_id\": \"alice\"},\n top_k=10,\n)\nfor r in results[\"results\"]:\n print(r[\"memory\"], r[\"score\"])"
},
{
"lang": "JavaScript",
"source": "import MemoryClient from \"mem0ai\";\n\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst results = await client.search(\"where does the user live?\", {\n filters: { userId: \"alice\" },\n topK: 10,\n});\nfor (const r of results.results) {\n console.log(r.memory, r.score);\n}"
}
]
}
},
"/v1/memories/{entity_type}/{entity_id}/": {
"get": {
"tags": [
"memories"
],
"description": "Returns a paginated list of memories belonging to the given entity.",
"operationId": "memories_entity_read",
"parameters": [
{
"name": "entity_type",
"in": "path",
"required": true,
"schema": {
"type": "string",
"enum": [
"user",
"agent",
"run",
"app"
]
},
"description": "The type of entity to retrieve memories for. Any other value returns `400 {\"error\": \"Invalid entity type\"}`."
},
{
"name": "entity_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The identifier of the entity whose memories to retrieve."
},
{
"name": "page",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Page number for pagination. Default: 1. Page size is fixed at 100 and is not client-configurable."
}
],
"responses": {
"200": {
"description": "Successfully retrieved memories.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"next": {
"type": "string",
"nullable": true
},
"previous": {
"type": "string",
"nullable": true
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"memory": {
"type": "string"
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"input": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
}
},
"description": "The conversation input that produced this memory."
},
"is_updated": {
"type": "boolean"
}
},
"required": [
"id",
"memory",
"created_at",
"updated_at"
]
}
}
},
"required": [
"count",
"next",
"previous",
"results"
]
}
}
}
},
"400": {
"description": "Invalid entity type.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Invalid entity type"
}
}
}
}
}
},
"404": {
"description": "Invalid page.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"detail": {
"type": "string",
"example": "Invalid page."
}
}
}
}
}
}
}
}
},
"/v1/memories/{memory_id}/": {
"get": {
"tags": [
"memories"
],
"description": "Get a memory.",
"operationId": "memories_read",
"parameters": [
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "The unique identifier of the memory to retrieve."
}
],
"responses": {
"200": {
"description": "Successfully retrieved the memory.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the memory."
},
"memory": {
"type": "string",
"description": "The content of the memory"
},
"user_id": {
"type": "string",
"nullable": true,
"description": "Identifier of the user associated with this memory"
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the agent associated with this memory, if any."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the app associated with this memory, if any."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "The run identifier associated with this memory, returned as `session_id`."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was last updated."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "The date when the memory will expire. Format: YYYY-MM-DD."
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
},
"lifecycle_state": {
"type": "string",
"description": "Lifecycle state of the memory."
}
}
}
}
}
},
"400": {
"description": "Invalid memory ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "memory_id should be a valid UUID"
}
}
}
}
}
},
"404": {
"description": "Memory not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Memory not found!"
}
}
}
}
}
}
},
"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\nmemory = client.get(memory_id=\"<memory_id>\")"
},
{
"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// Retrieve a specific memory\nclient.get(\"<memory_id>\")\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/memories/{memory_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/{memory_id}/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/{memory_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/memories/{memory_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"put": {
"tags": [
"memories"
],
"description": "Update a memory's text, metadata, or expiration date.",
"operationId": "memories_update",
"parameters": [
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "The unique identifier of the memory to update."
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The updated text content of the memory"
},
"metadata": {
"type": "object",
"description": "Additional metadata associated with the memory"
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "Expiration date in YYYY-MM-DD format, or null to clear the expiration date."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully updated memory.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "The unique identifier of the updated memory."
},
"memory": {
"type": "string",
"description": "The updated content of the memory."
},
"user_id": {
"type": "string",
"nullable": true,
"description": "Identifier of the user associated with this memory"
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the agent associated with this memory, if any."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the app associated with this memory, if any."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "The run identifier associated with this memory, returned as `session_id`."
},
"metadata": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "Additional metadata associated with the memory"
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the memory was last updated."
},
"expiration_date": {
"type": "string",
"format": "date",
"nullable": true,
"description": "The date when the memory will expire. Format: YYYY-MM-DD."
},
"structured_attributes": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "System-derived temporal breakdown of the memory's creation time (e.g. year, month, day_of_week)."
},
"replaced_by": {
"type": "string",
"nullable": true,
"description": "ID of the memory that superseded this one, if any."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was synthesized rather than directly extracted."
},
"lifecycle_state": {
"type": "string",
"description": "Lifecycle state of the memory."
}
}
}
}
}
},
"400": {
"description": "Invalid memory ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "memory_id should be a valid UUID"
}
}
}
}
}
},
"404": {
"description": "Memory not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Memory not found!"
}
}
}
}
}
}
},
"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# Update a memory\nmemory_id = \"<memory_id>\"\nclient.update(\n memory_id=memory_id,\n text=\"Your updated memory message here\",\n metadata={\"category\": \"example\"}\n)"
},
{
"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// Update a specific memory\nconst memory_id = \"<memory_id>\";\nclient.update(memory_id, { \n text: \"Your updated memory message here\",\n metadata: { category: \"example\" }\n})\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request PUT \\\n --url https://api.mem0.ai/v1/memories/{memory_id}/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\"text\": \"Your updated memory text here\", \"metadata\": {\"category\": \"example\"}}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/{memory_id}/\"\n\n\tpayload := strings.NewReader(`{\n\t\"text\": \"Your updated memory text here\",\n\t\"metadata\": {\n\t\t\"category\": \"example\"\n\t}\n}`)\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/{memory_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"PUT\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n CURLOPT_POSTFIELDS => json_encode([\n \"text\" => \"Your updated memory text here\",\n \"metadata\" => [\"category\" => \"example\"]\n ])\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.put(\"https://api.mem0.ai/v1/memories/{memory_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\\\"text\\\": \\\"Your updated memory text here\\\", \\\"metadata\\\": {\\\"category\\\": \\\"example\\\"}}\")\n .asString();"
}
],
"x-codegen-request-body-name": "data"
},
"delete": {
"tags": [
"memories"
],
"description": "Delete a memory.",
"operationId": "memories_delete",
"parameters": [
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "The unique identifier of the memory to delete."
},
{
"name": "delete_linked",
"in": "query",
"schema": {
"type": "boolean",
"default": false
},
"description": "If true, also delete memories linked to this one. The response then includes a `cascade_count` field with the number of linked memories deleted."
}
],
"responses": {
"200": {
"description": "Successful deletion of memory.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Memory deleted successfully!"
},
"cascade_count": {
"type": "integer",
"description": "Number of linked memories also deleted. Only present when `delete_linked=true` was passed."
}
}
}
}
}
},
"400": {
"description": "Invalid memory ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "memory_id should be a valid UUID"
}
}
}
}
}
},
"404": {
"description": "Memory not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Memory not found!"
}
}
}
}
}
}
},
"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\nmemory_id = \"<memory_id>\"\nclient.delete(memory_id=memory_id)"
},
{
"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 a specific memory\nclient.delete(\"<memory_id>\")\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/v1/memories/{memory_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/{memory_id}/\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/{memory_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/v1/memories/{memory_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/memories/{memory_id}/history/": {
"get": {
"tags": [
"memories"
],
"description": "Retrieve the history of a memory.",
"operationId": "memories_history_list",
"parameters": [
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "The unique identifier of the memory to retrieve."
}
],
"responses": {
"200": {
"description": "Successfully retrieved the memory history.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the history entry."
},
"memory_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier of the associated memory."
},
"input": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"assistant"
],
"description": "The role of the speaker in the conversation"
},
"content": {
"type": "string",
"description": "The content of the message"
}
},
"required": [
"role",
"content"
]
},
"description": "The conversation input that led to this memory change"
},
"old_memory": {
"type": "string",
"nullable": true,
"description": "The previous state of the memory, if applicable"
},
"new_memory": {
"type": "string",
"description": "The new or updated state of the memory"
},
"user_id": {
"type": "string",
"description": "The identifier of the user associated with this memory"
},
"agent_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the agent associated with this memory, if any."
},
"app_id": {
"type": "string",
"nullable": true,
"description": "The identifier of the app associated with this memory, if any."
},
"session_id": {
"type": "string",
"nullable": true,
"description": "The run identifier associated with this memory, returned as `session_id`."
},
"categories": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
},
"description": "Categories associated with the memory at this point in its history"
},
"event": {
"type": "string",
"enum": [
"ADD",
"UPDATE",
"DELETE"
],
"description": "The type of event that occurred"
},
"previous_embedding_qwen": {
"type": "string",
"nullable": true,
"description": "Previous internal embedding representation (Qwen model), if applicable"
},
"embedding_qwen": {
"type": "string",
"nullable": true,
"description": "Internal embedding representation (Qwen model), if available"
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional metadata associated with the memory change"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when this history entry was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "The timestamp when this history entry was last updated."
}
},
"required": [
"id",
"memory_id",
"input",
"new_memory",
"user_id",
"event",
"created_at",
"updated_at"
]
}
}
}
}
}
},
"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# Add some message to create history\nmessages = [{\"role\": \"user\", \"content\": \"<user-message>\"}]\nclient.add(messages, user_id=\"<user-id>\")\n\n# Add second message to update history\nmessages.append({\"role\": \"user\", \"content\": \"<user-message>\"})\nclient.add(messages, user_id=\"<user-id>\")\n\n# Get history of how memory changed over time\nmemory_id = \"<memory-id-here>\"\nhistory = client.history(memory_id)"
},
{
"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// Get history of how memory changed over time\nclient.history(\"<memory_id>\")\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/memories/{memory_id}/history/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/memories/{memory_id}/history/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/memories/{memory_id}/history/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/v1/memories/{memory_id}/history/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/runs/": {
"post": {
"tags": [
"runs"
],
"description": "Create a new Agent Run.",
"operationId": "runs_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateRun"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Run created successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunResponse"
}
}
}
}
},
"x-codegen-request-body-name": "data"
}
},
"/v1/stats/": {
"get": {
"tags": [
"stats"
],
"summary": "Retrieve memory-related statistics for the authenticated user.",
"description": "This endpoint returns the following statistics:\n- Total number of memories created\n- Total number of search events\n- Total number of add events",
"operationId": "stats_list",
"responses": {
"200": {
"description": "Successfully retrieved statistics.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"total_memories": {
"type": "integer"
},
"total_retrieval_events": {
"type": "integer"
},
"total_add_events": {
"type": "integer"
},
"total_api_retrieval_events": {
"type": "integer"
},
"total_retrieval_events_limit": {
"type": "integer"
},
"total_users_with_memories": {
"type": "integer"
},
"total_agents_with_memories": {
"type": "integer"
},
"total_runs_with_memories": {
"type": "integer"
},
"memories_per_user": {
"type": "integer"
},
"memories_per_agent": {
"type": "integer"
},
"memories_per_run": {
"type": "integer"
}
}
}
}
}
}
}
}
},
"/v1/ping/": {
"get": {
"tags": [
"stats"
],
"summary": "Check API key validity and resolve organization/project context.",
"description": "Both the Python and TypeScript SDKs call this endpoint on client construction to validate the API key and resolve the default `org_id` and `project_id`.",
"operationId": "ping_read",
"responses": {
"200": {
"description": "The API key is valid.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "ok"
},
"org_id": {
"type": "string"
},
"project_id": {
"type": "string"
},
"user_email": {
"type": "string",
"format": "email"
}
}
}
}
}
},
"401": {
"description": "Invalid API key.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"detail": {
"type": "string",
"example": "Invalid API key. You can find your API key on https://app.mem0.ai/dashboard/api-keys."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/v1/ping/ \\\n --header 'Authorization: Token <api-key>'"
}
]
}
},
"/v1/summary/": {
"post": {
"tags": [
"memories"
],
"summary": "Get a summary of memories matching the given filters.",
"description": "Backs the Python SDK's `client.get_summary()`. Not currently exposed by the TypeScript SDK.",
"operationId": "summary_create",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"filters": {
"type": "object",
"description": "Either flat field:value pairs (e.g. `{\"user_id\": \"<user_id>\"}`) or the structured AND/OR filter format used by `/v2/memories/search/`."
}
},
"required": [
"filters"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully retrieved the summary.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {}
}
}
}
}
},
"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\nsummary = client.get_summary(filters={\"user_id\": \"<user_id>\"})\nprint(summary)"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/v1/summary/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"filters\": {\"user_id\": \"<user_id>\"}\n}'"
}
]
}
},
"/v1/users/": {
"post": {
"tags": [
"users"
],
"description": "Create a new User.",
"operationId": "users_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateUser"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "User created successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponse"
}
}
}
}
},
"x-codegen-request-body-name": "data"
}
},
"/v1/feedback/": {
"post": {
"tags": [
"feedback"
],
"description": "Submit feedback for a memory.",
"operationId": "submit_feedback",
"requestBody": {
"content": {
"application/json": {
"schema": {
"required": [
"memory_id"
],
"type": "object",
"properties": {
"memory_id": {
"type": "string",
"description": "ID of the memory to provide feedback for"
},
"feedback": {
"type": "string",
"enum": [
"POSITIVE",
"NEGATIVE",
"VERY_NEGATIVE"
],
"nullable": true,
"description": "Type of feedback"
},
"feedback_reason": {
"type": "string",
"nullable": true,
"description": "Reason for the feedback"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Feedback ID"
},
"feedback": {
"type": "string",
"enum": [
"POSITIVE",
"NEGATIVE",
"VERY_NEGATIVE"
],
"nullable": true,
"description": "Type of feedback"
},
"feedback_reason": {
"type": "string",
"nullable": true,
"description": "Reason for the feedback"
}
}
}
}
}
},
"400": {
"description": "Invalid request"
},
"401": {
"description": "Unauthorized"
}
},
"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# Submit feedback for a memory\nfeedback = client.feedback(memory_id=\"memory_id\", feedback=\"POSITIVE\")\nprint(feedback)"
},
{
"lang": "JavaScript",
"source": "// To use the JavaScript SDK, install the package:\n// npm install mem0ai\n\nimport MemoryClient from 'mem0ai';\n\nconst client = new MemoryClient({ apiKey: 'your-api-key'});\n\nclient.feedback({\n memory_id: \"your-memory-id\", \n feedback: \"NEGATIVE\", \n feedback_reason: \"I don't like this memory because it is not relevant.\"\n})"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/v1/feedback/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\"memory_id\": \"memory_id\", \"feedback\": \"POSITIVE\"}'"
}
]
}
},
"/api/v1/orgs/organizations/": {
"get": {
"tags": [
"organizations"
],
"operationId": "organizations_read",
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"org_id": {
"type": "string",
"description": "Organization's unique string identifier."
},
"name": {
"type": "string",
"description": "Name of the organization."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the organization was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the organization was last updated."
},
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"role": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"description": "Members belonging to the organization."
},
"is_default": {
"type": "boolean",
"description": "Whether this is the caller's default organization."
},
"byok_enabled": {
"type": "boolean",
"description": "Whether bring-your-own-key is enabled for the organization."
},
"invitations": {
"type": "array",
"items": {},
"description": "Pending invitations for the organization."
},
"owner_pricing_plan": {
"type": "string",
"description": "Pricing plan of the organization owner."
},
"is_owner": {
"type": "boolean",
"description": "Whether the caller owns the organization."
},
"user_role": {
"type": "string",
"description": "The caller's role within the organization."
}
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"post": {
"tags": [
"organizations"
],
"description": "Create a new organization.",
"operationId": "create_organization",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the new organization."
}
},
"required": [
"name"
]
}
}
}
},
"responses": {
"201": {
"description": "Successfully created a new organization.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization created successfully."
},
"org_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the organization."
}
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "object",
"description": "Errors found in the payload.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/\"\n\npayload = {\"name\": \"<string>\"}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'POST',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"name\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"name\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"name\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"name\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/": {
"get": {
"tags": [
"organizations"
],
"description": "Get a organization.",
"operationId": "get_organization",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "The unique identifier of the organization",
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"org_id": {
"type": "string",
"description": "Organization's unique string identifier."
},
"name": {
"type": "string",
"description": "Name of the organization."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the organization was created."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the organization was last updated."
},
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"role": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"description": "Members belonging to the organization."
},
"is_default": {
"type": "boolean",
"description": "Whether this is the caller's default organization."
},
"byok_enabled": {
"type": "boolean",
"description": "Whether bring-your-own-key is enabled for the organization."
},
"invitations": {
"type": "array",
"items": {},
"description": "Pending invitations for the organization."
},
"owner_pricing_plan": {
"type": "string",
"description": "Pricing plan of the organization owner."
},
"is_owner": {
"type": "boolean",
"description": "Whether the caller owns the organization."
},
"user_role": {
"type": "string",
"description": "The caller's role within the organization."
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/api/v1/orgs/organizations/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\\n \\\"name\\\": \\\"<string>\\\"\\n}\")\n .asString();"
}
]
},
"delete": {
"tags": [
"organizations"
],
"summary": "Delete an organization",
"description": "Delete an organization by its ID.",
"operationId": "delete_organization",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization to delete.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Organization deleted successfully!",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization deleted successfully!"
}
}
}
}
}
},
"403": {
"description": "Unauthorized.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized"
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"DELETE\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'DELETE', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/members/": {
"get": {
"tags": [
"organizations"
],
"summary": "Get organization members",
"description": "Retrieve a list of members for a specific organization.",
"operationId": "get_organization_members",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"user_id": {
"type": "string",
"description": "Unique identifier of the member."
},
"role": {
"type": "string",
"description": "Role of the member in the organization."
}
}
},
"description": "List of members belonging to the organization."
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"put": {
"tags": [
"organizations"
],
"summary": "Update organization member role",
"description": "Update the role of an existing member in a specific organization.",
"operationId": "update_organization_member_role",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email",
"role"
],
"properties": {
"email": {
"type": "string",
"description": "Email of the member whose role is to be updated."
},
"role": {
"type": "string",
"description": "New role of the member in the organization"
}
}
}
}
}
},
"responses": {
"200": {
"description": "User role updated successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "User role updated successfully"
}
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "object",
"description": "Errors found in the payload.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\npayload = {\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"PUT\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'PUT',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"email\":\"<string>\",\"role\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request PUT \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"PUT\",\n CURLOPT_POSTFIELDS => \"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.put(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
]
},
"post": {
"tags": [
"organizations"
],
"summary": "Add organization member",
"description": "Add a new member to a specific organization.",
"operationId": "add_organization_member",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email",
"role"
],
"properties": {
"email": {
"type": "string",
"description": "Email of the member to be added."
},
"role": {
"type": "string",
"description": "Role of the member in the organization."
}
}
}
}
}
},
"responses": {
"201": {
"description": "Member added successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "User added to the organization."
}
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "object",
"description": "Errors found in the payload.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\npayload = {\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'POST',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"email\":\"<string>\",\"role\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"delete": {
"tags": [
"organizations"
],
"summary": "Remove a member from the organization",
"operationId": "remove_organization_member",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email"
],
"properties": {
"email": {
"type": "string",
"description": "Email of the member to be removed."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Member removed successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "User removed from organization."
}
}
}
}
}
},
"404": {
"description": "Organization not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\npayload = {\"email\": \"<string>\"}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"DELETE\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'DELETE',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"email\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"email\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"email\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"DELETE\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_POSTFIELDS => \"{\n \\\"email\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"email\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/projects/": {
"get": {
"tags": [
"projects"
],
"summary": "Get projects",
"description": "Retrieve a list of projects for a specific organization.",
"operationId": "get_projects",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"project_id": {
"type": "string",
"description": "Unique string identifier of the project"
},
"name": {
"type": "string",
"description": "Name of the project"
},
"description": {
"type": "string",
"description": "Description of the project"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the project was created"
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the project was last updated"
},
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Username of the project member"
},
"role": {
"type": "string",
"description": "Role of the member in the project."
},
"email": {
"type": "string",
"description": "Email address of the project member."
}
}
},
"description": "List of members belonging to the project"
},
"usecase": {
"type": "string",
"nullable": true,
"description": "Configured use case for the project."
},
"memory_depth": {
"type": "string",
"description": "Memory extraction depth setting for this project."
},
"inclusion_prompt": {
"type": "string",
"nullable": true,
"description": "Custom prompt describing what should be included when extracting memories."
},
"exclusion_prompt": {
"type": "string",
"nullable": true,
"description": "Custom prompt describing what should be excluded when extracting memories."
},
"custom_categories": {
"type": "array",
"items": {
"type": "object"
},
"description": "List of custom categories configured for memory categorization in this project."
},
"custom_instructions": {
"type": "string",
"description": "Custom instructions for memory processing in this project."
},
"update_custom_instructions": {
"type": "string",
"nullable": true,
"description": "Custom instructions applied when updating existing memories."
},
"summary_custom_instructions": {
"type": "string",
"nullable": true,
"description": "Custom instructions applied when generating summaries."
},
"summary_batch_size": {
"type": "integer",
"description": "Number of items processed per batch when generating summaries."
},
"summary_max_tokens": {
"type": "integer",
"nullable": true,
"description": "Maximum tokens allowed in a generated summary."
},
"expiration_date": {
"type": "string",
"nullable": true,
"description": "Default expiration date applied to memories created in this project."
},
"enable_graph": {
"type": "boolean",
"description": "Whether graph memory is enabled for this project."
},
"multilingual": {
"type": "boolean",
"description": "Whether to use the input language for memory storage and retrieval."
},
"version": {
"type": "string",
"description": "API version used by this project."
},
"is_default": {
"type": "boolean",
"description": "Whether this is the organization's default project."
},
"active_prompt_profile": {
"type": "string",
"nullable": true,
"description": "Identifier of the active prompt profile for this project."
},
"decay": {
"type": "boolean",
"description": "Whether memory decay is enabled for this project."
},
"user_role": {
"type": "string",
"description": "Role of the requesting user within this project."
}
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"post": {
"tags": [
"projects"
],
"summary": "Create project",
"description": "Create a new project within an organization.",
"operationId": "create_project",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the project to be created"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Project created successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Project created successfully."
},
"project_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the project."
}
}
}
}
}
},
"403": {
"description": "Unauthorized.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized to create projects in this organization."
}
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Project could not be created."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\"\n\npayload = {\"name\": \"<string>\"}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'POST',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"name\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"name\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"name\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"name\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"name\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/": {
"get": {
"tags": [
"projects"
],
"summary": "Get project details",
"description": "Retrieve details of a specific project within an organization.",
"operationId": "get_project",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"project_id": {
"type": "string",
"description": "Unique string identifier of the project"
},
"name": {
"type": "string",
"description": "Name of the project"
},
"description": {
"type": "string",
"description": "Description of the project"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the project was created"
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the project was last updated"
},
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Username of the project member"
},
"role": {
"type": "string",
"description": "Role of the member in the project."
},
"email": {
"type": "string",
"description": "Email address of the project member."
}
}
},
"description": "List of members belonging to the project"
},
"usecase": {
"type": "string",
"nullable": true,
"description": "Configured use case for the project."
},
"memory_depth": {
"type": "string",
"description": "Memory extraction depth setting for this project."
},
"inclusion_prompt": {
"type": "string",
"nullable": true,
"description": "Custom prompt describing what should be included when extracting memories."
},
"exclusion_prompt": {
"type": "string",
"nullable": true,
"description": "Custom prompt describing what should be excluded when extracting memories."
},
"custom_categories": {
"type": "array",
"items": {
"type": "object"
},
"description": "List of custom categories configured for memory categorization in this project."
},
"custom_instructions": {
"type": "string",
"description": "Custom instructions for memory processing in this project."
},
"update_custom_instructions": {
"type": "string",
"nullable": true,
"description": "Custom instructions applied when updating existing memories."
},
"summary_custom_instructions": {
"type": "string",
"nullable": true,
"description": "Custom instructions applied when generating summaries."
},
"summary_batch_size": {
"type": "integer",
"description": "Number of items processed per batch when generating summaries."
},
"summary_max_tokens": {
"type": "integer",
"nullable": true,
"description": "Maximum tokens allowed in a generated summary."
},
"expiration_date": {
"type": "string",
"nullable": true,
"description": "Default expiration date applied to memories created in this project."
},
"enable_graph": {
"type": "boolean",
"description": "Whether graph memory is enabled for this project."
},
"multilingual": {
"type": "boolean",
"description": "Whether to use the input language for memory storage and retrieval."
},
"version": {
"type": "string",
"description": "API version used by this project."
},
"is_default": {
"type": "boolean",
"description": "Whether this is the organization's default project."
},
"active_prompt_profile": {
"type": "string",
"nullable": true,
"description": "Identifier of the active prompt profile for this project."
},
"decay": {
"type": "boolean",
"description": "Whether memory decay is enabled for this project."
},
"user_role": {
"type": "string",
"description": "Role of the requesting user within this project."
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\nresponse = client.get_project()\nprint(response)"
},
{
"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\nclient.getProject()\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "// To use the Go SDK, install the package:\n// go get github.com/mem0ai/mem0-go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mem0ai/mem0-go\"\n)\n\nfunc main() {\n\tclient := mem0.NewClient(\"your-api-key\")\n\n\tresponse, err := client.GetProject()\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}"
},
{
"lang": "PHP",
"source": "<?php\n// To use the PHP SDK, install the package:\n// composer require mem0ai/mem0-php\n\nrequire_once('vendor/autoload.php');\n\nuse Mem0\\MemoryClient;\n\n$client = new MemoryClient('your-api-key');\n\ntry {\n $response = $client->getProject();\n print_r($response);\n} catch (Exception $e) {\n echo 'Error: ' . $e->getMessage();\n}"
},
{
"lang": "Java",
"source": "// To use the Java SDK, add this dependency to your pom.xml:\n// <dependency>\n// <groupId>ai.mem0</groupId>\n// <artifactId>mem0-java</artifactId>\n// <version>1.0.0</version>\n// </dependency>\n\nimport ai.mem0.MemoryClient;\n\npublic class Example {\n public static void main(String[] args) {\n MemoryClient client = new MemoryClient(\"your-api-key\");\n \n try {\n Object response = client.getProject();\n System.out.println(response);\n } catch (Exception e) {\n System.err.println(\"Error: \" + e.getMessage());\n }\n }\n}"
}
]
},
"patch": {
"tags": [
"projects"
],
"summary": "Update Project",
"description": "Update a specific project's settings.",
"operationId": "update_project",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project to be updated.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the project"
},
"description": {
"type": "string",
"description": "Description of the project"
},
"custom_instructions": {
"type": "array",
"items": {
"type": "string"
},
"description": "Custom instructions for memory processing in this project"
},
"agent_custom_instructions": {
"type": "string",
"nullable": true,
"description": "Extraction instructions for agent-scoped memories. Falls back to `custom_instructions` when unset. Send an empty string to clear it."
},
"custom_categories": {
"type": "array",
"items": {
"type": "object"
},
"description": "List of custom categories to be used for memory categorization."
},
"multilingual": {
"type": "boolean",
"description": "Whether to use the input language for memory storage and retrieval."
},
"memory_depth": {
"type": "string",
"description": "Memory extraction depth setting for this project."
},
"decay": {
"type": "boolean",
"description": "Whether memory decay is enabled for this project."
},
"enable_graph": {
"type": "boolean",
"description": "Whether graph memory is enabled for this project."
},
"version": {
"type": "string",
"description": "API version used by this project."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Project updated successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Project updated successfully"
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\nnew_categories = [\n {\"cooking\": \"For users interested in cooking and culinary experiences\"},\n {\"fitness\": \"Includes content related to fitness and workouts\"}\n]\n\nresponse = client.update_project(custom_categories=new_categories)\nprint(response)"
},
{
"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\nconst newCategories = [\n {\"cooking\": \"For users interested in cooking and culinary experiences\"},\n {\"fitness\": \"Includes content related to fitness and workouts\"}\n];\n\nclient.updateProject({ custom_categories: newCategories })\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request PATCH \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"custom_categories\": [\n {\"cooking\": \"For users interested in cooking and culinary experiences\"},\n {\"fitness\": \"Includes content related to fitness and workouts\"}\n ]\n }'"
},
{
"lang": "Go",
"source": "// To use the Go SDK, install the package:\n// go get github.com/mem0ai/mem0-go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mem0ai/mem0-go\"\n)\n\nfunc main() {\n\tclient := mem0.NewClient(\"your-api-key\")\n\n\tnewCategories := []map[string]string{\n\t\t{\"cooking\": \"For users interested in cooking and culinary experiences\"},\n\t\t{\"fitness\": \"Includes content related to fitness and workouts\"},\n\t}\n\n\tresponse, err := client.UpdateProject(mem0.UpdateProjectParams{\n\t\tCustomCategories: newCategories,\n\t})\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}"
},
{
"lang": "PHP",
"source": "<?php\n// To use the PHP SDK, install the package:\n// composer require mem0ai/mem0-php\n\nrequire_once('vendor/autoload.php');\n\nuse Mem0\\MemoryClient;\n\n$client = new MemoryClient('your-api-key');\n\n$newCategories = [\n ['cooking' => 'For users interested in cooking and culinary experiences'],\n ['fitness' => 'Includes content related to fitness and workouts']\n];\n\ntry {\n $response = $client->updateProject(['custom_categories' => $newCategories]);\n print_r($response);\n} catch (Exception $e) {\n echo 'Error: ' . $e->getMessage();\n}"
},
{
"lang": "Java",
"source": "// To use the Java SDK, add this dependency to your pom.xml:\n// <dependency>\n// <groupId>ai.mem0</groupId>\n// <artifactId>mem0-java</artifactId>\n// <version>1.0.0</version>\n// </dependency>\n\nimport ai.mem0.MemoryClient;\nimport java.util.*;\n\npublic class Example {\n public static void main(String[] args) {\n MemoryClient client = new MemoryClient(\"your-api-key\");\n \n List<Map<String, String>> newCategories = Arrays.asList(\n Collections.singletonMap(\"cooking\", \"For users interested in cooking and culinary experiences\"),\n Collections.singletonMap(\"fitness\", \"Includes content related to fitness and workouts\")\n );\n \n try {\n Map<String, Object> params = new HashMap<>();\n params.put(\"custom_categories\", newCategories);\n \n Object response = client.updateProject(params);\n System.out.println(response);\n } catch (Exception e) {\n System.err.println(\"Error: \" + e.getMessage());\n }\n }\n}"
}
]
},
"delete": {
"tags": [
"projects"
],
"summary": "Delete Project",
"description": "Delete a specific project and its related data.",
"operationId": "delete_project",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project to be deleted.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Project and related data deleted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Project and related data deleted successfully."
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
},
"403": {
"description": "Unauthorized to modify this project",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized to modify this project."
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"DELETE\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'DELETE', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/": {
"get": {
"tags": [
"projects"
],
"summary": "Get Project Members",
"description": "Retrieve a list of members for a specific project.",
"operationId": "get_project_members",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully retrieved project members",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"role": {
"type": "string"
}
}
}
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'GET', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request GET \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
},
"post": {
"tags": [
"projects"
],
"summary": "Add member to project",
"description": "Add a new member to a specific project within an organization.",
"operationId": "add_project_member",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email",
"role"
],
"properties": {
"email": {
"type": "string",
"description": "Email of the member to be added."
},
"role": {
"type": "string",
"description": "Role of the member in the project."
}
}
}
}
}
},
"responses": {
"200": {
"description": "User added to the project successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "User added to the project successfully."
}
}
}
}
}
},
"403": {
"description": "Unauthorized to modify project members",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized to modify project members."
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\npayload = {\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'POST',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"email\":\"<string>\",\"role\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request POST \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
]
},
"put": {
"tags": [
"projects"
],
"summary": "Update project member role",
"description": "Update the role of a member in a specific project within an organization.",
"operationId": "update_project_member",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email",
"role"
],
"properties": {
"email": {
"type": "string",
"description": "Email of the member to be updated"
},
"role": {
"type": "string",
"description": "New role of the member in the project"
}
}
}
}
}
},
"responses": {
"200": {
"description": "User role updated successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "User role updated successfully."
}
}
}
}
}
},
"403": {
"description": "Unauthorized to modify project members",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized to modify project members."
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\npayload = {\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}\nheaders = {\n \"Authorization\": \"Token <api-key>\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.request(\"PUT\", url, json=payload, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {\n method: 'PUT',\n headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},\n body: '{\"email\":\"<string>\",\"role\":\"<string>\"}'\n};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request PUT \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ \\\n --header 'Authorization: Token <api-key>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\n\tpayload := strings.NewReader(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n\n\treq, _ := http.NewRequest(\"PUT\", url, payload)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"PUT\",\n CURLOPT_POSTFIELDS => \"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.put(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"email\\\": \\\"<string>\\\",\n \\\"role\\\": \\\"<string>\\\"\n}\")\n .asString();"
}
]
},
"delete": {
"summary": "Delete Project Member",
"operationId": "deleteProjectMember",
"tags": [
"Project"
],
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
},
{
"name": "email",
"in": "query",
"required": true,
"description": "Email of the member to be removed",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Member removed from the project successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Member removed from the project"
}
}
}
}
}
},
"403": {
"description": "Unauthorized to modify project members",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Unauthorized to modify project members."
}
}
}
}
}
},
"404": {
"description": "Organization or project not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Organization or project not found"
}
}
}
}
}
}
},
"x-code-samples": [
{
"lang": "Python",
"source": "import requests\n\nurl = \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\nheaders = {\"Authorization\": \"Token <api-key>\"}\n\nresponse = requests.request(\"DELETE\", url, headers=headers)\n\nprint(response.text)"
},
{
"lang": "JavaScript",
"source": "const options = {method: 'DELETE', headers: {Authorization: 'Token <api-key>'}};\n\nfetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "curl --request DELETE \\\n --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ \\\n --header 'Authorization: Token <api-key>'"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\"\n\n\treq, _ := http.NewRequest(\"DELETE\", url, nil)\n\n\treq.Header.Add(\"Authorization\", \"Token <api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token <api-key>\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"
},
{
"lang": "Java",
"source": "HttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/\")\n .header(\"Authorization\", \"Token <api-key>\")\n .asString();"
}
]
}
},
"/v1/batch/": {
"put": {
"tags": [
"memories"
],
"description": "Batch update multiple memories (up to 1000) in a single API call.",
"operationId": "memories_batch_update",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"memories": {
"type": "array",
"items": {
"type": "object",
"required": [
"memory_id"
],
"properties": {
"memory_id": {
"type": "string",
"format": "uuid",
"description": "The unique identifier of the memory to update"
},
"text": {
"type": "string",
"description": "The new text content for the memory"
},
"metadata": {
"type": "object",
"additionalProperties": true,
"description": "Updated metadata to associate with the memory."
}
}
},
"maxItems": 1000
}
},
"required": [
"memories"
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully updated memories",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Successfully updated 2 memories"
}
}
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Maximum of 1000 memories can be updated in a single request"
}
}
}
}
}
}
},
"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\nupdate_memories = [\n {\n \"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"text\": \"Watches football\"\n },\n {\n \"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n \"text\": \"Likes to travel\"\n }\n]\n\nresponse = client.batch_update(update_memories)\nprint(response)"
},
{
"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\nconst updateMemories = [\n {\n memoryId: \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n text: \"Watches football\"\n },\n {\n memoryId: \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n text: \"Likes to travel\"\n }\n];\n\nclient.batchUpdate(updateMemories)\n .then(response => console.log('Batch update response:', response))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl -X PUT \"https://api.mem0.ai/v1/batch/\" \\\n -H \"Authorization: Token your-api-key\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"memories\": [\n {\n \"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"text\": \"Watches football\"\n },\n {\n \"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n \"text\": \"Likes to travel\"\n }\n ]\n }'"
}
]
},
"delete": {
"tags": [
"memories"
],
"description": "Batch delete multiple memories (up to 1000) in a single API call.",
"operationId": "memories_batch_delete",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"memories": {
"type": "array",
"items": {
"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 objects to delete."
}
},
"required": [
"memories"
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully deleted memories",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Successfully deleted 2 memories"
}
}
}
}
}
},
"400": {
"description": "Bad Request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Maximum of 1000 memories can be deleted in a single request"
}
}
}
}
}
}
},
"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\ndelete_memories = [\n {\"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\"},\n {\"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\"}\n]\n\nresponse = client.batch_delete(delete_memories)\nprint(response)"
},
{
"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\nconst deleteMemories = [\n { memory_id: \"285ed74b-6e05-4043-b16b-3abd5b533496\" },\n { memory_id: \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\" }\n];\n\nclient.batchDelete(deleteMemories)\n .then(response => console.log('Batch delete response:', response))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl -X DELETE \"https://api.mem0.ai/v1/batch/\" \\\n -H \"Authorization: Token your-api-key\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"memories\": [\n {\n \"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\"\n },\n {\n \"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\"\n }\n ]\n }'"
}
]
}
},
"/api/v1/webhooks/projects/{project_id}/": {
"get": {
"tags": [
"webhooks"
],
"summary": "Get Project Webhooks",
"description": "Retrieve all webhooks for a specific project",
"operationId": "get_project_webhooks",
"parameters": [
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "List of webhooks for the project.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"webhook_id": {
"type": "string",
"description": "Unique identifier of the webhook."
},
"name": {
"type": "string",
"description": "Name of the webhook"
},
"url": {
"type": "string",
"description": "URL endpoint for the webhook."
},
"event_types": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of event types the webhook subscribes to."
},
"owner": {
"type": "string",
"description": "Username of the webhook's owner."
},
"is_active": {
"type": "boolean",
"description": "Whether the webhook is active"
},
"project": {
"type": "string",
"description": "Name of the project the webhook is associated with"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the webhook was created"
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the webhook was last updated"
}
}
}
}
}
}
},
"403": {
"description": "Unauthorized access",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "You don't have access to this project"
}
}
}
}
}
}
},
"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# Get all webhooks\nwebhooks = client.get_webhooks(project_id=\"your_project_id\")\nprint(webhooks)\n\n# Create a webhook\nwebhook = client.create_webhook(\n url=\"https://your-webhook-url.com\",\n name=\"My Webhook\",\n project_id=\"your_project_id\",\n event_types=[\"memory_add\", \"memory_categorize\"]\n)\nprint(webhook)"
},
{
"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// Get all webhooks\nclient.getWebhooks('your_project_id')\n .then(webhooks => console.log(webhooks))\n .catch(err => console.error(err));\n\n// Create a webhook\nclient.createWebhook({\n url: 'https://your-webhook-url.com',\n name: 'My Webhook',\n project_id: 'your_project_id',\n event_types: ['memory_add']\n})\n .then(webhook => console.log(webhook))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "# Get all webhooks\ncurl --request GET \\\n --url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \\\n --header 'Authorization: Token your-api-key'\n\n# Create a webhook\ncurl --request POST \\\n --url 'https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/' \\\n --header 'Authorization: Token your-api-key' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"url\": \"https://your-webhook-url.com\",\n \"name\": \"My Webhook\",\n \"event_types\": [\"memory_add\"]\n }'"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\n// Get all webhooks\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_HTTPHEADER => [\"Authorization: Token your-api-key\"],\n]);\n\n$response = curl_exec($curl);\n\n// Create a webhook\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => json_encode([\n \"url\" => \"https://your-webhook-url.com\",\n \"name\" => \"My Webhook\",\n \"event_types\" => [\"memory_add\"]\n ]),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token your-api-key\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\ncurl_close($curl);"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\t// Get all webhooks\n\treq, _ := http.NewRequest(\"GET\", \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\", nil)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n\n\t// Create a webhook\n\tpayload := strings.NewReader(`{\n\t\t\"url\": \"https://your-webhook-url.com\",\n\t\t\"name\": \"My Webhook\",\n\t\t\"event_types\": [\"memory_add\"]\n\t}`)\n\n\treq, _ = http.NewRequest(\"POST\", \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\", payload)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ = http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ = ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
},
{
"lang": "Java",
"source": "// Get all webhooks\nHttpResponse<String> response = Unirest.get(\"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .asString();\n\n// Create a webhook\nHttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"url\\\": \\\"https://your-webhook-url.com\\\",\n \\\"name\\\": \\\"My Webhook\\\",\n \\\"event_types\\\": [\\\"memory_add\\\"]\n }\")\n .asString();"
}
]
},
"post": {
"tags": [
"webhooks"
],
"summary": "Create Webhook",
"description": "Create a new webhook for a specific project",
"operationId": "create_webhook",
"parameters": [
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"url",
"name",
"event_types"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the webhook"
},
"url": {
"type": "string",
"description": "URL endpoint for the webhook."
},
"event_types": {
"type": "array",
"items": {
"type": "string",
"enum": [
"memory_add",
"memory_update",
"memory_delete",
"memory_categorize",
"ingest_job_completed",
"ingest_job_partially_completed",
"ingest_job_failed",
"ingest_job_cancelled"
]
},
"description": "List of event types to subscribe to. Required: omitting this field does not fall back to a usable default."
},
"is_active": {
"type": "boolean",
"description": "Whether the webhook is active"
},
"project_id": {
"type": "string",
"description": "Unique identifier of the project."
}
}
}
}
}
},
"responses": {
"201": {
"description": "Webhook created successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"webhook_id": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
},
"owner": {
"type": "string",
"description": "Username of the webhook's owner."
},
"is_active": {
"type": "boolean"
},
"project": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Field-keyed validation errors. Each key is a request field name; the value is an array of message strings or a nested object of messages.",
"additionalProperties": true,
"example": {
"name": [
"This field is required."
]
}
}
}
}
},
"403": {
"description": "Unauthorized access",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "You don't have access to this project"
}
}
}
}
}
}
},
"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# Create a webhook\nwebhook = client.create_webhook(\n url=\"https://your-webhook-url.com\",\n name=\"My Webhook\",\n project_id=\"your_project_id\",\n event_types=[\"memory_add\", \"memory_categorize\"]\n)\nprint(webhook)"
},
{
"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// Create a webhook\nclient.createWebhook({\n url: \"https://your-webhook-url.com\",\n name: \"My Webhook\",\n project_id: \"your_project_id\",\n event_types: [\"memory_add\"]\n})\n .then(response => console.log('Create webhook response:', response))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl -X POST \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\" \\\n -H \"Authorization: Token your-api-key\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://your-webhook-url.com\",\n \"name\": \"My Webhook\",\n \"event_types\": [\"memory_add\"]\n }'"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => json_encode([\n \"url\" => \"https://your-webhook-url.com\",\n \"name\" => \"My Webhook\",\n \"event_types\" => [\"memory_add\"]\n ]),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token your-api-key\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\ncurl_close($curl);\n\necho $response;"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n \"fmt\"\n \"strings\"\n \"net/http\"\n \"io/ioutil\"\n)\n\nfunc main() {\n payload := strings.NewReader(`{\n \"url\": \"https://your-webhook-url.com\",\n \"name\": \"My Webhook\",\n \"event_types\": [\"memory_add\"]\n }`)\n\n req, _ := http.NewRequest(\"POST\", \"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\", payload)\n req.Header.Add(\"Authorization\", \"Token your-api-key\")\n req.Header.Add(\"Content-Type\", \"application/json\")\n\n res, _ := http.DefaultClient.Do(req)\n defer res.Body.Close()\n body, _ := ioutil.ReadAll(res.Body)\n\n fmt.Println(string(body))\n}"
},
{
"lang": "Java",
"source": "import com.konghq.unirest.http.HttpResponse;\nimport com.konghq.unirest.http.Unirest;\n\n// Create a webhook\nHttpResponse<String> response = Unirest.post(\"https://api.mem0.ai/api/v1/webhooks/your_project_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"url\\\": \\\"https://your-webhook-url.com\\\",\n \\\"name\\\": \\\"My Webhook\\\",\n \\\"event_types\\\": [\\\"memory_add\\\"]\n }\")\n .asString();\n\nSystem.out.println(response.getBody());"
}
]
}
},
"/api/v1/webhooks/{webhook_id}/": {
"put": {
"tags": [
"webhooks"
],
"summary": "Update Webhook",
"description": "Update an existing webhook",
"operationId": "update_webhook",
"parameters": [
{
"name": "webhook_id",
"in": "path",
"required": true,
"description": "Unique identifier of the webhook.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "New name for the webhook"
},
"url": {
"type": "string",
"description": "New URL endpoint for the webhook"
},
"event_types": {
"type": "array",
"items": {
"type": "string",
"enum": [
"memory_add",
"memory_update",
"memory_delete",
"memory_categorize",
"ingest_job_completed",
"ingest_job_partially_completed",
"ingest_job_failed",
"ingest_job_cancelled"
]
},
"description": "New list of event types to subscribe to"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Webhook updated successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Webhook updated successfully"
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Field-keyed validation errors. Each key is a request field name; the value is an array of message strings or a nested object of messages.",
"additionalProperties": true,
"example": {
"name": [
"This field is required."
]
}
}
}
}
},
"403": {
"description": "Unauthorized access",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "You don't have access to this webhook"
}
}
}
}
}
},
"404": {
"description": "Webhook not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Webhook not found"
}
}
}
}
}
}
},
"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# Update a webhook\nwebhook = client.update_webhook(\n webhook_id=\"your_webhook_id\",\n name=\"Updated Webhook\",\n url=\"https://new-webhook-url.com\",\n event_types=[\"memory_add\", \"memory_categorize\"]\n)\nprint(webhook)\n\n# Delete a webhook\nresponse = client.delete_webhook(webhook_id=\"your_webhook_id\")\nprint(response)"
},
{
"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// Update a webhook\nclient.updateWebhook('your_webhook_id', {\n name: 'Updated Webhook',\n url: 'https://new-webhook-url.com',\n event_types: ['memory_add', 'memory_categorize']\n})\n .then(webhook => console.log(webhook))\n .catch(err => console.error(err));\n\n// Delete a webhook\nclient.deleteWebhook('your_webhook_id')\n .then(response => console.log(response))\n .catch(err => console.error(err));"
},
{
"lang": "cURL",
"source": "# Update a webhook\ncurl --request PUT \\\n --url 'https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/' \\\n --header 'Authorization: Token your-api-key' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"name\": \"Updated Webhook\",\n \"url\": \"https://new-webhook-url.com\",\n \"event_types\": [\"memory_add\"]\n }'\n\n# Delete a webhook\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/' \\\n --header 'Authorization: Token your-api-key'"
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\n// Update a webhook\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_CUSTOMREQUEST => \"PUT\",\n CURLOPT_POSTFIELDS => json_encode([\n \"name\" => \"Updated Webhook\",\n \"url\" => \"https://new-webhook-url.com\",\n \"event_types\" => [\"memory_add\"]\n ]),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token your-api-key\",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n\n// Delete a webhook\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\"Authorization: Token your-api-key\"],\n]);\n\n$response = curl_exec($curl);\ncurl_close($curl);"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\t// Update a webhook\n\tpayload := strings.NewReader(`{\n\t\t\"name\": \"Updated Webhook\",\n\t\t\"url\": \"https://new-webhook-url.com\",\n\t\t\"event_types\": [\"memory_add\"]\n\t}`)\n\n\treq, _ := http.NewRequest(\"PUT\", \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\", payload)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n\n\t// Delete a webhook\n\treq, _ = http.NewRequest(\"DELETE\", \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\", nil)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\n\tres, _ = http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ = ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
},
{
"lang": "Java",
"source": "// Update a webhook\nHttpResponse<String> response = Unirest.put(\"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .header(\"Content-Type\", \"application/json\")\n .body(\"{\n \\\"name\\\": \\\"Updated Webhook\\\",\n \\\"url\\\": \\\"https://new-webhook-url.com\\\",\n \\\"event_types\\\": [\\\"memory_add\\\"]\n }\")\n .asString();\n\n// Delete a webhook\nHttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .asString();"
}
]
},
"delete": {
"tags": [
"webhooks"
],
"summary": "Delete Webhook",
"description": "Delete an existing webhook",
"operationId": "delete_webhook",
"parameters": [
{
"name": "webhook_id",
"in": "path",
"required": true,
"description": "Unique identifier of the webhook.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Webhook deleted successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Webhook deleted successfully"
}
}
}
}
}
},
"403": {
"description": "Unauthorized access",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "You don't have access to this webhook"
}
}
}
}
}
},
"404": {
"description": "Webhook not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Webhook not found"
}
}
}
}
}
}
},
"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 a webhook\nresponse = client.delete_webhook(webhook_id=\"your_webhook_id\")\nprint(response)"
},
{
"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 a webhook\nclient.deleteWebhook(\"your_webhook_id\")\n .then(response => console.log('Delete webhook response:', response))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
"source": "curl -X DELETE \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\" \\\n -H \"Authorization: Token your-api-key\""
},
{
"lang": "PHP",
"source": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\"Authorization: Token your-api-key\"],\n]);\n\n$response = curl_exec($curl);\ncurl_close($curl);\n\necho $response;"
},
{
"lang": "Go",
"source": "package main\n\nimport (\n \"fmt\"\n \"net/http\"\n \"io/ioutil\"\n)\n\nfunc main() {\n req, _ := http.NewRequest(\"DELETE\", \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\", nil)\n req.Header.Add(\"Authorization\", \"Token your-api-key\")\n\n res, _ := http.DefaultClient.Do(req)\n defer res.Body.Close()\n body, _ := ioutil.ReadAll(res.Body)\n\n fmt.Println(string(body))\n}"
},
{
"lang": "Java",
"source": "import com.konghq.unirest.http.HttpResponse;\nimport com.konghq.unirest.http.Unirest;\n\n// Delete a webhook\nHttpResponse<String> response = Unirest.delete(\"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\")\n .header(\"Authorization\", \"Token your-api-key\")\n .asString();\n\nSystem.out.println(response.getBody());"
}
]
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/config/": {
"get": {
"tags": [
"dream"
],
"summary": "Get Dream configuration",
"description": "Retrieve the project's Dream (memory synthesis) configuration together with the plan entitlement snapshot. Dream automatically supersedes/merges memories on the add path; **Synthesis** (reflection) is the opt-in part controlled by `reflection_enabled`.",
"operationId": "get_dream_config",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"reflection_enabled": {
"type": "boolean",
"description": "Whether background synthesis (reflection) is enabled for the project."
},
"reflection_enabled_at": {
"type": "string",
"description": "When synthesis was last enabled. Synthesis only considers memories created on or after this time (forward-only).",
"format": "date-time",
"nullable": true
},
"reflection_mode": {
"type": "string",
"description": "Synthesis execution mode.",
"enum": [
"batch",
"direct"
]
}
}
},
"entitlements": {
"type": "object",
"properties": {
"plan": {
"type": "string",
"description": "Resolved billing tier for the project (e.g. `free`, `pro`, `custom`)."
},
"reflection_interval_days": {
"type": "integer",
"description": "How often synthesis runs for this plan, in days (Pro weekly, Enterprise daily)."
},
"features": {
"type": "object",
"properties": {},
"description": "Per-feature entitlement snapshot, keyed by Dream feature (e.g. `dream_reflection`, `dream_tab`, `dream_preview`).",
"additionalProperties": {
"type": "object",
"properties": {
"entitled": {
"type": "boolean",
"description": "Whether the plan is entitled to the feature."
},
"killed": {
"type": "boolean",
"description": "Whether the feature is globally disabled by a kill switch."
},
"enabled": {
"type": "boolean",
"description": "Effective state: entitled AND not killed AND turned on."
}
}
}
}
}
}
}
}
}
}
}
}
},
"patch": {
"tags": [
"dream"
],
"summary": "Update Dream configuration",
"description": "Enable or disable Synthesis (reflection) for the project, or change the reflection mode. Requires a Pro or Enterprise (CUSTOM) plan and organization-owner permission. Synthesis is forward-only: after enabling, it only synthesizes memories added from that point on.",
"operationId": "update_dream_config",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"reflection_enabled": {
"type": "boolean",
"description": "Turn background synthesis on or off."
},
"reflection_mode": {
"type": "string",
"description": "Synthesis execution mode.",
"enum": [
"batch",
"direct"
]
}
}
}
}
}
},
"responses": {
"200": {
"description": "Updated configuration.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"reflection_enabled": {
"type": "boolean",
"description": "Whether background synthesis (reflection) is enabled for the project."
},
"reflection_enabled_at": {
"type": "string",
"description": "When synthesis was last enabled. Synthesis only considers memories created on or after this time (forward-only).",
"format": "date-time",
"nullable": true
},
"reflection_mode": {
"type": "string",
"description": "Synthesis execution mode.",
"enum": [
"batch",
"direct"
]
}
}
},
"entitlements": {
"type": "object",
"properties": {
"plan": {
"type": "string",
"description": "Resolved billing tier for the project (e.g. `free`, `pro`, `custom`)."
},
"reflection_interval_days": {
"type": "integer",
"description": "How often synthesis runs for this plan, in days (Pro weekly, Enterprise daily)."
},
"features": {
"type": "object",
"properties": {},
"description": "Per-feature entitlement snapshot, keyed by Dream feature (e.g. `dream_reflection`, `dream_tab`, `dream_preview`).",
"additionalProperties": {
"type": "object",
"properties": {
"entitled": {
"type": "boolean",
"description": "Whether the plan is entitled to the feature."
},
"killed": {
"type": "boolean",
"description": "Whether the feature is globally disabled by a kill switch."
},
"enabled": {
"type": "boolean",
"description": "Effective state: entitled AND not killed AND turned on."
}
}
}
}
}
}
}
}
}
}
},
"400": {
"description": "Validation error (e.g. a field the plan is not entitled to change)."
},
"403": {
"description": "Not entitled on the current plan (`upgrade_required: true`), or the caller is not an organization owner."
}
}
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/stats/": {
"get": {
"tags": [
"dream"
],
"summary": "Get Dream stats",
"description": "Lifecycle + synthesis counts for the project's Dream dashboard, plus reflection freshness. Requires a Pro or Enterprise (CUSTOM) plan.",
"operationId": "get_dream_stats",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"active": {
"type": "integer",
"description": "Active (current) memory count."
},
"merged": {
"type": "integer",
"description": "Count of memories merged into a canonical one."
},
"superseded": {
"type": "integer",
"description": "Count of memories superseded by a newer one."
},
"synthesized": {
"type": "integer",
"description": "Count of higher-order pattern memories created by synthesis."
},
"last_run_at": {
"type": "string",
"description": "When synthesis last completed.",
"format": "date-time",
"nullable": true
},
"processed_through": {
"type": "string",
"description": "Timestamp of the newest source memory synthesis has processed.",
"format": "date-time",
"nullable": true
},
"running": {
"type": "boolean",
"description": "Whether a synthesis run is currently in flight."
},
"next_run_at": {
"type": "string",
"description": "Projected next synthesis run.",
"format": "date-time",
"nullable": true
}
}
}
}
}
},
"403": {
"description": "Not entitled on the current plan (`upgrade_required: true`)."
}
}
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/activity/": {
"get": {
"tags": [
"dream"
],
"summary": "Get Dream activity",
"description": "Supersede/merge activity feed (newest first), keyset-paginated. Synthesis output is not included here — see the runs endpoint.",
"operationId": "get_dream_activity",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Page size (default 50, max 200).",
"schema": {
"type": "integer",
"default": 50
}
},
{
"name": "cursor",
"in": "query",
"required": false,
"description": "Opaque keyset cursor from a previous page's `next_cursor`.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"memory_id": {
"type": "string",
"description": "The superseded/merged memory's ID."
},
"text": {
"type": "string",
"description": "The memory's text (truncated)."
},
"transition": {
"type": "string",
"description": "Lifecycle transition.",
"enum": [
"merged",
"superseded"
]
},
"at": {
"type": "string",
"description": "When the transition happened.",
"format": "date-time"
},
"replaced_by": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "ID of the newer memory."
},
"text": {
"type": "string",
"description": "Text of the newer memory (truncated).",
"nullable": true
}
},
"nullable": true,
"description": "The newer memory that replaced this one (null for a merge with no single replacement)."
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Source memory ID."
},
"text": {
"type": "string",
"description": "Source memory text (truncated)."
}
}
},
"nullable": true,
"description": "Always null on this feed; synthesis provenance is shown on the runs feed."
}
}
}
},
"next_cursor": {
"type": "string",
"description": "Cursor for the next page, or null when there are no more.",
"nullable": true
}
}
}
}
}
}
}
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/runs/": {
"get": {
"tags": [
"dream"
],
"summary": "Get Dream synthesis runs",
"description": "Synthesis activity grouped per run (newest first), keyset-paginated. Each run inlines its first page of synthesized memories with their sources; larger runs page the rest via the run-memories endpoint.",
"operationId": "get_dream_runs",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Number of runs per page (default 20, max 100).",
"schema": {
"type": "integer",
"default": 20
}
},
{
"name": "cursor",
"in": "query",
"required": false,
"description": "Opaque keyset cursor from a previous page's `next_cursor`.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"run_id": {
"type": "string",
"description": "Identifier of the synthesis run."
},
"at": {
"type": "string",
"description": "When the run produced memories.",
"format": "date-time"
},
"count": {
"type": "integer",
"description": "Total synthesized memories in this run."
},
"synthesized": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Synthesized memory ID."
},
"text": {
"type": "string",
"description": "Synthesized (pattern) memory text."
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Source memory ID."
},
"text": {
"type": "string",
"description": "Source memory text (truncated)."
}
}
},
"description": "Source memories this pattern was distilled from."
}
}
},
"description": "First page of synthesized memories (each with its sources)."
},
"has_more": {
"type": "boolean",
"description": "Whether the run has more memories than are inlined here."
},
"mem_cursor": {
"type": "string",
"description": "Cursor to page this run's remaining memories via the run-memories endpoint.",
"nullable": true
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Source memory ID."
},
"text": {
"type": "string",
"description": "Source memory text (truncated)."
}
}
},
"description": "De-duplicated source memories across the inlined page."
}
}
}
},
"next_cursor": {
"type": "string",
"description": "Cursor for the next page, or null when there are no more.",
"nullable": true
}
}
}
}
}
}
}
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/runs/{run_id}/memories/": {
"get": {
"tags": [
"dream"
],
"summary": "Get memories in a Dream run",
"description": "Keyset page of the synthesized memories within a single run (for runs whose `has_more` is true).",
"operationId": "get_dream_run_memories",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
},
{
"name": "run_id",
"in": "path",
"required": true,
"description": "Identifier of the synthesis run.",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Page size (default 50, max 200).",
"schema": {
"type": "integer",
"default": 50
}
},
{
"name": "cursor",
"in": "query",
"required": false,
"description": "Opaque keyset cursor (use the run's `mem_cursor` or a previous `next_cursor`).",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Synthesized memory ID."
},
"text": {
"type": "string",
"description": "Synthesized (pattern) memory text."
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Source memory ID."
},
"text": {
"type": "string",
"description": "Source memory text (truncated)."
}
}
},
"description": "Source memories this pattern was distilled from."
}
}
}
},
"next_cursor": {
"type": "string",
"description": "Cursor for the next page, or null when there are no more.",
"nullable": true
}
}
}
}
}
}
}
}
},
"/api/v1/orgs/organizations/{org_id}/projects/{project_id}/dream/memory/{memory_id}/sources/": {
"get": {
"tags": [
"dream"
],
"summary": "Get a synthesized memory's sources",
"description": "The source memories a synthesized (pattern) memory was distilled from, for the memory drawer's provenance panel.",
"operationId": "get_dream_memory_sources",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"description": "Unique identifier of the organization.",
"schema": {
"type": "string"
}
},
{
"name": "project_id",
"in": "path",
"required": true,
"description": "Unique identifier of the project.",
"schema": {
"type": "string"
}
},
{
"name": "memory_id",
"in": "path",
"required": true,
"description": "ID of the (synthesized) memory.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"memory_id": {
"type": "string",
"description": "The memory's ID."
},
"synthesized": {
"type": "boolean",
"description": "Whether this memory was produced by synthesis."
},
"sources": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Source memory ID."
},
"text": {
"type": "string",
"description": "Source memory text."
},
"lifecycle_state"