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

# What is System Facts?

> System Facts is the shared record of what happened in your business flows. Services send immutable facts, and System Facts links them into flows that you read through one API.

**System Facts** is the shared record of what happened in your business flows. A service sends an immutable **fact** when a business moment happens: a ledger transaction is posted, a Pix settles, an order is placed. System Facts links the facts that carry the same business reference into one **flow**.

Then you ask one question, such as what happened to a transaction, and you get the facts of that flow, from every service that took part.

A stored fact never changes. System Facts records and correlates. It does not edit history.

## Where facts come from

***

### Facts from Lerian products

The System Facts worker is a separate component of System Facts. It reads the events that Lerian products publish, and records a fact for each event that it follows.

| Product | Fact type | System Facts records it when |
| :- | :- | :- |
| Midaz | `midaz.transaction_committed` | Midaz creates a transaction as approved, commits a pending transaction, or reverts a transaction. |
| Pix JD | `pix.transaction_settled` | Pix JD executes or refunds a Pix transaction. |
| Pix JD | `pix.transaction_failed` | A Pix transaction fails. |

Midaz transaction facts exist only in a deployment that runs the worker. Midaz must also publish its transaction events: see [Event publisher](https://docs.lerian.studio/en/products/midaz/event-publisher.md). The worker records Pix JD facts only when Pix JD publishes its events: see [Pix Direct via JD events](https://docs.lerian.studio/en/reference/events/pix-direct-jd.md).

A Pix JD fact that names its Midaz transaction lands in the same flow as the fact of that transaction.

> [!NOTE]
>
> The Midaz and Pix JD event pages call the events on the event stream facts. On the System Facts pages, a fact is the record that System Facts stores.

### Facts from your own services

Your services send facts through the API. A service registers its reference types and its contracts, then sends one fact for each business moment. The [API overview](https://docs.lerian.studio/en/reference/platform/system-facts/api-overview.md) shows the four steps.

## Flows

***

A **reference** is a business identifier that a fact carries, such as a Midaz transaction id or a Pix end-to-end id. System Facts links the facts that share an `exact` reference into one flow. When one fact carries references of two flows, the two flows merge into one.

You read flows with three operations:

* [Find the flow of a reference](https://docs.lerian.studio/en/reference/platform/system-facts/find-the-flow-of-a-reference.md) returns the one flow that a reference leads to.
* [Read a flow](https://docs.lerian.studio/en/reference/platform/system-facts/read-a-flow.md) returns a flow by its id.
* [List facts by a searchable reference](https://docs.lerian.studio/en/reference/platform/system-facts/list-facts-by-a-searchable-reference.md) returns every fact that carries a reference.

## Protected values

***

A contract marks the values that need protection, such as a document number or a name. A read returns such a value as a mask or as a digest. A caller that holds `facts:reveal` reads encrypted values in clear form. See [Sensitivity and protected values](https://docs.lerian.studio/en/reference/platform/system-facts/api-overview.md#sensitivity-and-protected-values).

## Access

***

Send an Access Manager token on every `/v1` request. To call System Facts from an application, create an application for System Facts and request a token: see [Machine-to-machine access](https://docs.lerian.studio/en/platform/access-manager/using-access-manager.md#machine-to-machine-access). The [API overview](https://docs.lerian.studio/en/reference/platform/system-facts/api-overview.md#authentication-and-permissions) lists the permissions of each operation.

## Deployment model

***

In BYOC, System Facts runs in your cloud as a single-tenant service. Every caller of the deployment reads and writes the same facts, flows and catalogs.

On Lerian Cloud, Lerian operates System Facts. Facts and flows belong to the tenant of the token.

## Next steps

***

> [card] [Complete an account statement with facts](https://docs.lerian.studio/en/platform/system-facts/completing-statements-with-facts.md)
>
> Read the entries of an account from Midaz, then add the facts of each transaction.

> [card] [System Facts API overview](https://docs.lerian.studio/en/reference/platform/system-facts/api-overview.md)
>
> Read the concepts, the four integration steps and the conventions every operation shares.


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