Skip to main content

Create Profile Schema

Create a user profile schema and define profile fields

Creates a user profile schema, defining the fields and descriptions included in the profile.

Method and endpoint

POST https://dashscope.aliyuncs.com/api/v2/apps/memory/profile_schemas

Request parameters

ParameterTypeRequiredLocationDescription
namestringYesBodyProfile schema name, up to 32 characters
descriptionstringNoBodyProfile schema description
plan_versionstringNoBodyBilling plan: pro or lite
extract_scenestringNoBodyExtraction mode: efficient or intelligent; defaults to efficient
attributesarrayYesBodyProfile attribute definitions; the array cannot be empty
attributes[].namestringYesBodyAttribute name
attributes[].descriptionstringNoBodyAttribute description
memory_library_idstringNoBodyMemory library ID. If omitted, the default memory library is used

Code examples

curl -X POST https://dashscope.aliyuncs.com/api/v2/apps/memory/profile_schemas \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Basic user profile",
    "description": "User information including age and interests",
    "extract_scene": "efficient",
    "attributes": [
      {"name": "Age", "description": "User age"},
      {"name": "Hobbies", "description": "User interests and hobbies"},
      {"name": "Occupation", "description": "User occupation"}
    ]
  }'

Response example

{
  "profile_schema_id": "50edf54eaa5842e891d959ae115205be",
  "request_id": "f190a540-814e-9c1c-873e-0661851c8fca"
}
After creation, pass profile_schema via AddMemory to extract the profile, then use GetUserProfile to retrieve it.
Managed Agent API
Flow Agent API
Sandbox API
RAG API
ParseX API
Security API
Framework Integration