Create Profile Template
Create a Profile template in the project of the API Key and return the template ID. A template defines the field structure, default values, and whether each field can be updated by the algorithm. Once created, bind it to users or Agents via Bind Profile Template to create Profile instances. Each call creates a new 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"
data = {
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": False},
"Occupation": {"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']}/add/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/add/profile_template \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": false},
"Occupation": {"value": "", "algorithm_updatable": true}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": true}
}
}
}'
{
"code": 0,
"data": {
"profile_template_id": "tpl_user_001"
},
"message": "ok"
}Authorizations
Authorization
string
header
required
Token API_key, available in API Console > API Keys
Body
application/json
name
string
required
Template name. Must contain at least one character after trimming leading and trailing whitespace.
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"
data = {
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": False},
"Occupation": {"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']}/add/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/add/profile_template \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Service User Profile",
"metadata": {
"Basic Info": {
"Name": {"value": "", "algorithm_updatable": false},
"Occupation": {"value": "", "algorithm_updatable": true}
},
"Service Preferences": {
"Preferred Contact Time": {"value": "Weekday daytime", "algorithm_updatable": true}
}
}
}'
{
"code": 0,
"data": {
"profile_template_id": "tpl_user_001"
},
"message": "ok"
}