Skip to main content

Create Profile Schema

Create a user profile schema and define profile fields

POST
/profile_schemas
cURL
curl --request POST \
  --url 'https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/profile_schemas' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "attributes": [
    {
      "name": "<string>",
      "description": "<string>"
    }
  ],
  "plan_version": "Pro"
}
'
Creates a user profile schema, defining the fields and descriptions included in the profile.

Request parameters

ParameterTypeRequiredDescription
namestringYesProfile schema name
descriptionstringNoSchema description, used to guide agent invocation
attributesarrayYesProfile field list, each item contains name and description
plan_versionstringNoPro or Lite, defaults to Pro if not provided

Code examples

Replace {workspaceId} with your actual workspace ID.
curl -X POST https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/profile_schemas \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "用户基础画像",
    "description": "包含年龄和兴趣的用户信息",
    "attributes": [
      {"name": "年龄", "description": "用户年龄"},
      {"name": "爱好", "description": "用户的兴趣爱好"},
      {"name": "职业", "description": "用户职业"}
    ]
  }'

# response
{
  "profile_schema_id": "schema_xxx",
  "request_id": "a1b2c3d4-..."
}
After creation, pass profile_schema via AddMemory to extract the profile, then use GetUserProfile to retrieve it.

Authorizations

string
header
required

Body

application/json
string
required

画像模板名称

object[]
required

画像字段列表

string

模板描述

enum<string>

策略版本,不传默认 Pro

Pro,Lite

Response

200-成功

成功