User profiles

Updated at:

The Long-term Memory Service continuously extracts user characteristics from conversations to form user profiles. The service automatically maintains profiles, and you can also manually update or delete them through APIs. This topic describes how to query, update, and delete user profiles.

Prerequisites

  • You have enabled LindormTable, the search engine, the vector engine, and the AI engine, and completed the Long-term Memory Service configuration.

  • You have created a project and obtained a valid Secret Key (SK).

Request conventions

ItemDescription
Request URLThe complete URL formed by combining the service endpoint and the API path.
AuthenticationThe request header includes Authorization: Bearer sk-....
Project scopeDetermined by the SK. You do not need to pass project_id separately.
User scopeDetermined by the user ID in the path of each API request. Your application is responsible for verifying user identities.
Request formatThe JSON request body uses Content-Type: application/json.
Response formatA successful response contains request_id and data. For the error format, see Service overview: Response format.

Prepare connection information

Replace ENDPOINT with the service endpoint, including the protocol, hostname, and port. Replace SK with the project Secret Key. The user ID u1 in the example request paths is a sample value. Replace it with the actual user ID.

ENDPOINT="<service endpoint>"
SK="<project SK>"

List profiles

Run a paged query for user profiles in the current project.

Request example

curl --request GET "${ENDPOINT}/lmemo/v1/profiles?page=1&page_size=20" \
  --header "Authorization: Bearer ${SK}"

Query parameters

ParameterDescription
pageThe page number. Pages start at 1. Default value: 1.
page_sizeThe number of entries per page. Valid values: 1 to 100. Default value: 20.

Response example

{
  "request_id": "req-example",
  "data": {
    "items": [],
    "pagination": {
      "page": 1,
      "page_size": 20,
      "total": 0,
      "has_more": false
    }
  }
}

For descriptions of profile record fields, see Get a profile. pagination.total is a reference count for pagination.

Get a profile

Query profile content by user ID.

Request example

curl --request GET "${ENDPOINT}/lmemo/v1/profiles/u1" \
  --header "Authorization: Bearer ${SK}"

Response example

{
  "request_id": "req-example",
  "data": {
    "user_id": "u1",
    "traits": {
      "favorite_drink": "Latte",
      "city": "Hangzhou"
    },
    "summary": "...",
    "updated_at": "2026-07-24T08:00:00Z"
  }
}

Response parameters

FieldDescription
user_idThe ID of the user.
traitsKey-value pairs of profile traits. If the user has no profile, traits is an empty object.
summaryReturned only when it has a value.
updated_atReturned only when it has a value.

Update a profile

Update the profile traits of a specified user. You can merge updates into the existing traits or replace the entire profile.

Request example

curl --request PATCH "${ENDPOINT}/lmemo/v1/profiles/u1" \
  --header "Authorization: Bearer ${SK}" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "traits": {
    "favorite_drink": "Americano"
  },
  "replace": false
}'

Request parameters

Pass the following parameters in the JSON request body.

ParameterTypeRequiredDescription
traitsobjectYesKey-value pairs of profile traits.
replacebooleanNoDefault value: false (merge update). When set to true, the submitted traits replace the existing traits in full.

Response example

{
  "request_id": "req-example",
  "data": {
    "user_id": "u1",
    "traits": {
      "favorite_drink": "Americano"
    },
    "updated_at": "2026-07-24T08:00:00Z"
  }
}

For descriptions of the response fields, see Get a profile.

Delete a profile

Delete the aggregated profile content of a specified user.

Request example

curl --request DELETE "${ENDPOINT}/lmemo/v1/profiles/u1" \
  --header "Authorization: Bearer ${SK}"

Response example

{
  "request_id": "req-example",
  "data": {
    "user_id": "u1",
    "deleted": true
  }
}
Note

The delete operation clears only aggregated profile content. After subsequent conversations trigger extraction, the service can regenerate the profile.