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

# Set Fact

> Record something about a person

## Overview

Records a fact about a person in an assistant's memory. Pass a `fact_type` (one of your workspace's fields, see [Vocabulary](https://docs.personal.ai/composer/memory/vocabulary.md)) so the value is checked and stored on the person's record. Setting the same value again changes nothing.

> [!NOTE]
>
> Changes data, so it needs a key that isn't read-only.

Operation name: `fact.set`.

## Authorization

**x-api-key** `string` *required*

Your Composer API key

## Headers

**Content-Type** `string` *required*

Must be set to application/json

## Body

**value** `string` *required*

The value to record.

```json Example theme={null}
"value": "America/Los_Angeles"
```

**fact\_type** `string`

The field to record it as, such as `timezone`.

```json Example theme={null}
"fact_type": "timezone"
```

**agent** `string`

The assistant whose memory it goes into. Without it, no assistant will recall the fact.

```json Example theme={null}
"agent": "my-assistant"
```

**subject** `string`

The id of the person it is about. Defaults to the caller.

**replaces** `string`

An old value this corrects. Facts with that value are forgotten.

**expires\_at** `string`

When the fact stops being true (RFC 3339).

**confidence** `number`

How certain the fact is, 0–1. Default 1.

```json Example Request theme={null}
{
  "value": "America/Los_Angeles",
  "fact_type": "timezone",
  "agent": "my-assistant"
}
```

***

## Response

**fact\_id** `string`

The id of the recorded fact.

**changed** `boolean`

False when the value was already recorded.

**replaced** `array`

Facts this value replaced.

**retired** `array`

Facts forgotten because of `replaces`.

```json Example Success Response theme={null}
{
  "fact_id": "e2d1c0b9-a8f7-4e6d-5c4b-3a2f1e0d9c8b",
  "node": "5d1c3a52-8f1e-4b7e-9c0a-2a4f8e6b9d31",
  "replaced": [],
  "changed": true,
  "fact_type": "timezone",
  "retired": [],
  "copied_to": []
}
```

***

## Example cURL

```bash cURL theme={null}
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/fact.set' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"value": "America/Los_Angeles", "fact_type": "timezone", "agent": "my-assistant"}'
```

***

## Error Codes

| Code | Description |
| - | - |
| 400 | The body doesn't match the fields above, or the operation failed. The response body says why. |
| 401 | Missing or invalid API key |
| 403 | This key isn't allowed to call this operation (for example, a read-only key) |


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