> ## 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.

# Integrating with Lerian STA

> Integrating with Lerian STA: transactional-outbox audit and business records, inbound claim-checks, and source-product routing.

Lerian STA is event-first at its edges. A terminal transition can atomically create separate audit and business records through **transactional outboxes**, with a further post-commit durable-log sink. An outbox record reaches consumers only when the transfer's state change commits. Consumers are the **source-product** services that own the files Lerian STA delivers.

## Event channels

***

Lerian STA publishes on two channels:

* An **audit channel** carrying inbound-success and inbound-failure facts for observability and reconciliation.
* A **signed business channel**, routed as `sta.{direction}.{sanitized-source-product}` with an `unrouted` fallback, for external product consumers. Its terminal event types are `sta.transfer.accepted`, `sta.transfer.rejected`, `sta.transfer.inconsistent`, `sta.transfer.canceled`, and `sta.transfer.download_finished`.

Business events carry an enumerated **error code** only for non-success outcomes; successful `Accepted` and `DownloadFinished` events omit it. Inbound-success events carry the **claim-check**.

## The claim-check

***

On a completed inbound download, Lerian STA emits its terminal **download-finished** event, routed by the file's source product. The event carries a **claim-check** — `object_key`, `sha256`, `size_bytes`, and `file_name` — but not the bytes themselves. `document_type` is included only when non-empty.

The consuming domain product subscribes to its own key. It fetches the durable artefact by its object key and **re-verifies** the SHA-256. It then reconciles the result into the **client's ledger**. Lerian STA is the transport and integrity boundary. The consuming product owns the ledger posting.

## Ledger boundary

***

Lerian STA does not write to the client's ledger itself. It delivers the file and the claim-check. The consuming product performs the ledger reconciliation — for example, **Lerian SISBAJUD** for judicial asset-order files. This keeps Lerian STA a pure transport-and-integrity layer, independent of any one file's business meaning.

## Integration conventions

***

* **Commit-coupled events.** Every audit or business outbox record becomes available only after its transfer's state change commits.
* **Claim-check, not payload.** Consumers receive a reference to the durable artefact, fetch it, and re-verify its SHA-256 before acting on it.
* **Keyed subscription.** Clients choose their broker subscriptions. STA routes signed business events by direction and sanitized source product, with an `unrouted` fallback; it does not enforce that only one subscriber can receive a file.
