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

# Bank Transaction object

Bank transactions are transactions that have occurred within a bank account owned by a business.

### Attributes

<ParamField body="id" type="string">
  Unique identifier for the bank transaction.
</ParamField>

<ParamField body="external_id" type="string">
  Unique ID of the bank transaction in your system for linking purposes. **Idempotency key.**
</ParamField>

<ParamField body="type" type="string">
  Resource type. Value will be "Bank\_Transaction".
</ParamField>

<ParamField body="business_id" type="string">
  ID for the Business this transaction belongs to.
</ParamField>

<ParamField body="source" type="enum">
  The source that the bank transaction was imported from.
  Values can be: `UNIT`, `PLAID`, `API`
</ParamField>

<ParamField body="source_transaction_id" type="string">
  Unique ID of the bank transaction in its source system. **Idempotency key.**
</ParamField>

<ParamField body="source_account_id" type="string">
  ID of the source account in the source system.
</ParamField>

<ParamField body="date" type="ISO8601 timestamp">
  Date the transaction occurred.
</ParamField>

<ParamField body="direction" type="enum">
  The direction of the transaction relative to the source account.
  Values can be: `CREDIT`, `DEBIT`
</ParamField>

<ParamField body="amount" type="integer">
  The amount of the transaction in cents.
</ParamField>

<ParamField body="counterparty_name" type="string">
  The name of the merchant or counterparty associated with the transaction.
</ParamField>

<ParamField body="description" type="string">
  Description of the transaction.
</ParamField>

<ParamField body="type" type="string">
  The type of bank account transaction.
  Example values: `PURCHASE`, `BOOK`, `ATM`, `WIRE`, etc.
</ParamField>

<ParamField body="categorization_status" type="enum">
  The status of the transaction's categorization in Layer's systems.
  Values can be: `PENDING`, `READY_FOR_INPUT`, `CATEGORIZED`, `LAYER_REVIEW`
</ParamField>

<ParamField body="category" type="Category object">
  The category assigned to the transaction. Only populated for transactions that have a finalized category.

  <Expandable title="properties">
    <ResponseField name="category" type="enum">
      String enum for the category assigned to the transaction. The set of category enums will vary based on chart of account configured for the business.
    </ResponseField>

    <ResponseField name="display_name" type="string">
      A human-readable string describing the category. This can be presented to the end user in your UI.
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="update_categorization_rules_suggestion" type="Create_Categorization_Rule_For_Counterparty object (nullable)">
  Optional rule suggestion returned after categorization when Layer recommends creating a reusable categorization rule. If no suggestion is available, this field is `null`.

  See [Categorization Rule Suggestions](/guides/transaction-categorization/rules-suggestion) for more details.

  <Expandable title="properties">
    <ResponseField name="type" type="enum">
      Suggestion type. Value will be `Create_Categorization_Rule_For_Counterparty`.
    </ResponseField>

    <ResponseField name="id" type="string (uuid)">
      Unique identifier for this suggestion. Use this ID for tracking suggestion state and rejecting a suggestion.
    </ResponseField>

    <ResponseField name="created_at" type="ISO8601 timestamp">
      Timestamp when the suggestion was created.
    </ResponseField>

    <ResponseField name="status" type="enum">
      Suggestion status. Values can be: `PENDING`, `ACCEPTED`, `REJECTED`.
    </ResponseField>

    <ResponseField name="counterparty" type="object">
      Counterparty associated with the suggestion.
    </ResponseField>

    <ResponseField name="suggestion_prompt" type="string">
      UI-ready prompt text to display when asking a user whether to create the suggested rule.
    </ResponseField>

    <ResponseField name="new_rule" type="CreateCategorizationRuleParams object">
      Prebuilt payload that can be sent to [Create Categorization Rule](/api-reference/v1/categorization-rules/create-categorization-rule) (this is how suggestions are accepted).

      <Expandable title="common properties">
        <ResponseField name="apply_retroactively" type="boolean">
          Whether to apply the rule to existing uncategorized transactions.
        </ResponseField>

        <ResponseField name="created_by_suggestion_id" type="string (uuid)">
          Suggestion ID used to create this rule.
        </ResponseField>

        <ResponseField name="counterparty_filter" type="string (uuid)">
          Counterparty filter for the rule.
        </ResponseField>

        <ResponseField name="category" type="Account Identifier object">
          Rule category identifier.
        </ResponseField>

        <ResponseField name="bank_direction_filter" type="enum">
          Direction filter. Values can be: `DEBIT`, `CREDIT`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="transactions_that_will_be_affected" type="array">
      Preview list of transactions affected by the suggested rule.
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="suggested_matches" type="array containing SuggestedMatch objects">
  The suggested matches for the transaction.
  See [Match Bank Transaction](/api-reference/v1/match-bank-transaction) for more details.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      The unique identifier for the suggested match. Can be used to [match a bank transaction](/api-reference/v1/match-bank-transaction).
    </ResponseField>

    <ResponseField name="matchType" type="string">
      The type of suggested match. Options include `Transfer_Match`, `Invoice_Match`, `Payout_Match`, and `Journal_Entry_Match`.
    </ResponseField>

    <ResponseField name="details" type="object">
      The details of the suggested match.

      <Expandable title="properties">
        <ResponseField name="type" type="string">
          The type of the details object based off the matchable target. Options include `TRANSFER`, `INVOICE_PAYMENT`, `PAYOUT`, and `MANUAL_JOURNAL_ENTRY`.
        </ResponseField>

        <ResponseField name="id" type="string">
          The unique identifier of the matchable target (e.g., invoice payment ID).
        </ResponseField>

        <ResponseField name="amount" type="integer">
          The amount involved in the match, in cents.
        </ResponseField>

        <ResponseField name="date" type="ISO8601 timestamp">
          The date of the target of the suggested match in ISO8601 format.
        </ResponseField>

        <ResponseField name="description" type="string">
          A description of the suggested match.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ParamField>

<ResponseExample>
  ```json Example theme={null}
  {
    "id":"67cee0d8-3b8e-4b4b-a857-78ce3bb1d895",
    "type":"Bank_Transaction",
    "transaction_type":"Purchase",
    "business_id":"cfee5365-dcc3-425e-b403-cc9568f7121e",
    "source":"API",
    "source_transaction_id":"11111113",
    "source_account_id":"111113",
    "imported_at":"2023-06-07T00:42:08.664543Z",
    "date":"2023-05-15T14:13:07Z",
    "direction":"Debit",
    "amount":8026,
    "counterparty_name":"SUNOCO",
    "description":null,
    "categorization_status":"CATEGORIZED",
    "category":{
      "category":"FUEL",
      "display_name":"Fuel"
    },
    "update_categorization_rules_suggestion": {
      "type": "Create_Categorization_Rule_For_Counterparty",
      "id": "b3488b6a-c7b4-4d2a-a8c7-7d15f9942ed4",
      "created_at": "2025-02-14T17:22:01Z",
      "status": "PENDING",
      "counterparty": {
        "id": "f1664961-43d8-42f1-9a6d-c6c32a9f0adf",
        "name": "SUNOCO"
      },
      "suggestion_prompt": "Would you like to create a rule for outbound SUNOCO transactions?",
      "new_rule": {
        "apply_retroactively": true,
        "created_by_suggestion_id": "b3488b6a-c7b4-4d2a-a8c7-7d15f9942ed4",
        "counterparty_filter": "f1664961-43d8-42f1-9a6d-c6c32a9f0adf",
        "category": {
          "type": "StableName",
          "stable_name": "FUEL"
        },
        "bank_direction_filter": "MONEY_OUT"
      },
      "transactions_that_will_be_affected": []
    },
    "suggested_matches": [
        {
            "id": "cf33f1b6-ac18-480e-ab58-82aab4ab86f4",
            "matchType": "INVOICE_PAYMENT",
            "details": {
                "type": "Invoice_Match",
                "id": "0cfb7d11-874a-4c15-a9f9-875c21d95c86",
                "amount": 8026,
                "date": "2023-05-16T10:12:09Z",
                "description": "Invoice payment from FakeCustomer"
            }
        }
    ],
  }
  ```
</ResponseExample>
