> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorylake.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 添加 Actor 事实

> 向 Actor 添加一条或多条事实，按原文存储

```
POST /openapi/memorylake/api/v3/workspaces/{workspaceId}/actors/{actorId}/facts
```

向工作空间中的某个 Actor 添加一条或多条事实。您发送的每个字符串都会按原文存为一条独立的新事实，不做提取、合并或改写。适用于您已经确定某条事实、希望直接写入记忆的场景；否则事实会从会话中自动提取。

响应按您发送的顺序返回每条新事实的 `id` 和文本。如需读取事实的元数据和时间戳，请调用[获取 Actor 事实](/features/memorylake/api-reference/facts/get-actor-fact)。在该事实的[变更历史](/features/memorylake/api-reference/facts/get-actor-fact-trace)中，以这种方式添加的事实以一条 `source_kind` 为 `MANUAL` 的 `ADD` 记录开始。

<Note>
  **所需权限：** `workspace_actor:fact_modify`
</Note>

### 路径参数

<ParamField path="workspaceId" type="string" required>
  工作空间 ID
</ParamField>

<ParamField path="actorId" type="string" required>
  Actor ID
</ParamField>

### 请求体

<ParamField body="facts" type="string[]" required>
  要添加的事实文本，每个元素对应一条事实。列表不能为空，任何元素都不能为空白，否则请求会以 `400` 被拒绝。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-fe314186ccd18cde04d6af48a5afd79f/actors/actor_5e4d3c2b1a0f/facts' \
    -H 'Authorization: Bearer sk_xxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "facts": [
        "Prefers metric units.",
        "Works in the Singapore office."
      ]
    }'
  ```
</RequestExample>

### 响应

<ResponseField name="data" type="object">
  <Expandable title="新建的事实">
    <ResponseField name="facts" type="array">
      新建的事实，顺序与您发送的顺序一致

      <Expandable title="事实">
        <ResponseField name="id" type="string">事实唯一标识符</ResponseField>
        <ResponseField name="fact" type="string">事实文本，与您发送的原文一致</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "data": {
      "facts": [
        {
          "id": "fact-45c6986397ee45d6a915ae51c79516bb",
          "fact": "Prefers metric units."
        },
        {
          "id": "fact-6773ba1dc34d4efc96e715efd8935026",
          "fact": "Works in the Singapore office."
        }
      ]
    }
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.