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

# Cases

> The unit of work in Frayme — transactions, KYC submissions, KYB submissions, lifecycle events. One canonical shape, three concrete types.

A **case** is the abstraction Frayme uses to hold everything related to one decision. A case has a **type**, a **subject**, and a **payload**. It flows through a workflow, accumulates evidence, and resolves into a decision.

## Canonical shape

Every case carries the same envelope:

| Field       | Type     | Notes                                             |
| ----------- | -------- | ------------------------------------------------- |
| `case_id`   | string   | Globally unique. Idempotency anchor.              |
| `type`      | enum     | `transaction` · `kyc` · `kyb`                     |
| `subject`   | object   | The entity the case is about (see below by type). |
| `payload`   | object   | Type-specific body.                               |
| `opened_at` | datetime | When the case entered Frayme.                     |

The `subject` shape varies with the case type:

<Tabs>
  <Tab title="transaction">
    ```jsonc theme={null}
    "subject": {
      "main_account": "...",
      "subaccount": "...",
      "counterpart": { "key", "ispb", "document", "wallet_address", "tx_hash" },
      "currency": "BRL | USD | USDC",
      "amount": 12500
    }
    ```
  </Tab>

  <Tab title="kyc">
    ```jsonc theme={null}
    "subject": {
      "applicant_id": "...",
      "full_name": "...",
      "dob": "...",
      "declared_country": "BR",
      "declared_address": { ... },
      "email": "...",
      "phone": "..."
    }
    ```
  </Tab>

  <Tab title="kyb">
    ```jsonc theme={null}
    "subject": {
      "company_id": "...",
      "legal_name": "...",
      "tax_id": "...",
      "jurisdiction": "BR",
      "ubo_declared": [{ "name", "document", "ownership_pct" }],
      "corporate_docs": [...],
      "requested_limit": 50000
    }
    ```
  </Tab>
</Tabs>

## Lifecycle of a case

<Steps>
  <Step title="Open">
    Posted to the workflow endpoint or fanned-out from a stream. Validated
    against the workflow's input schema.
  </Step>

  <Step title="Enrich">
    Data Source and Custom API nodes attach vendor responses to the case
    context.
  </Step>

  <Step title="Evaluate">
    Rule, Decision Table, AI and Scorecard nodes consume the enriched context
    and emit a verdict.
  </Step>

  <Step title="Route">
    Split nodes send the case down the appropriate branch — auto-approve, manual
    review, block, regulator report.
  </Step>

  <Step title="Decide">
    Terminal Output node writes the decision. Analyst may override from the
    queue within the audit retention window.
  </Step>
</Steps>

## Idempotency

Frayme can receive an `idempotencyKey` as the idempotency key. A second post with the same key returns the previously committed decision rather than re-running the graph.
