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

# addFacts()

> Reference for the Embedded API addFacts() method.

Use `addFacts()` to attach contextual facts to the current interaction.

<Info>
  Applies to Web Component, Window API, and PostMessage. Examples on this page
  use the Web Component API shape.
</Info>

## Usage

```typescript theme={null}
await api.addFacts([
  { text: "Chest pain", group: "other" },
  { text: "Shortness of breath", group: "other" },
  { text: "Fatigue", group: "other" },
]);
```

## Prerequisites

* User must be authenticated.
* An interaction must already exist.

## Input validation

* Web Component / React: pass an array of facts.
* Window API / PostMessage: pass `{ facts: [...] }`.
* `facts[].text`: Required, non-empty string.
* `facts[].group`: Optional string, defaults to `"other"`.
* `facts[].source`: Optional, defaults to `"user"`.

## Possible errors

* `NOT_READY`: No active interaction.
* `UNAUTHORIZED`: User not authenticated.
* `INVALID_PAYLOAD`: Empty facts array or missing text field.
* `INTERNAL_ERROR`: Failed to save facts.

## Returns

`void`

## Patient gender guidance

In languages where patient gender affects phrasing in documentation, provide a clear sentence in the target document language through `addFacts()`.

Common German examples:

```text theme={null}
Das Geschlecht des Patienten ist männlich.
Das Geschlecht des Patienten ist weiblich.
Das Geschlecht des Patienten ist divers.
Das Geschlecht des Patienten ist unbekannt.
```

## Related reference

* [API Reference Overview](/assistant/api-reference)
* [createInteraction()](/assistant/api/create-interaction)
