Update Profile Template
Update the template name or attribute structure. Changes are synced to every Profile instance bound to the template.
POST
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
# Submit the full updated template: this example adds "City of Residence" and keeps the other fields
data = {
"profile_template_id": "tpl_user_001",
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": False},
"Occupation": {"value": "", "algorithm_updatable": True},
"City of Residence": {"value": "", "algorithm_updatable": True}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": True}
}
}
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/update/profile_template"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/update/profile_template \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"profile_template_id": "tpl_user_001",
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": false},
"Occupation": {"value": "", "algorithm_updatable": true},
"City of Residence": {"value": "", "algorithm_updatable": true}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": true}
}
}
}'
{
"code": 0,
"data": {
"success": true,
"profile_template_id": "<string>",
"affected_instances": 0
},
"message": "ok"
}Authorizations
Authorization
string
header
required
Token API_key, available in API Console > API Keys
Body
application/json
profile_template_id
string
required
ID of a template in the current project.
name
string
required
The new template name. When only the name changes, the attribute structure and bound instance values stay unchanged.
metadata
object
required
The full attribute tree after the update. Changes are synced to all bound instances: new fields are filled with the template's values and auto-update settings; modified field values or settings overwrite the corresponding fields; removed fields are deleted along with their saved values; unchanged fields stay as they are.
Show child attributes
Response
application/json
Successful Response
code
number
API status code.
Example: 0
data
object
Show child attributes
message
string
API response message.
Example: "ok"
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
# Submit the full updated template: this example adds "City of Residence" and keeps the other fields
data = {
"profile_template_id": "tpl_user_001",
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": False},
"Occupation": {"value": "", "algorithm_updatable": True},
"City of Residence": {"value": "", "algorithm_updatable": True}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": True}
}
}
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/update/profile_template"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/update/profile_template \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"profile_template_id": "tpl_user_001",
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": false},
"Occupation": {"value": "", "algorithm_updatable": true},
"City of Residence": {"value": "", "algorithm_updatable": true}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": true}
}
}
}'
{
"code": 0,
"data": {
"success": true,
"profile_template_id": "<string>",
"affected_instances": 0
},
"message": "ok"
}