Update Profile Template
Update the template name or attribute structure. Behaves the same as editing in the Dashboard: changes are synced to every Profile instance bound to the template. New fields are filled with the template's values and settings; modified field values or algorithm-updatable settings overwrite the corresponding fields; removed fields and their saved values are deleted; unchanged fields stay as they are.
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.
metadata
object
required
Attribute tree structure with up to three levels of nesting; leaf nodes are field value objects.
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"
}