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

# Update suggested categorization rule

> Updates a suggested categorization rule.

Use this endpoint to mark a categorization rules suggestion as not dismissed.
This allows the transaction categorization flow to show the suggestion again to the user.

### Undoing a dismissed suggestion

Set `dismissed_at` to `null` to mark the suggestion as not dismissed and return it to normal suggestion flow.

### Rejecting a suggestion

To reject a suggestion, see [reject suggested categorization rule](/api-reference/v1/categorization-rules/reject-suggested-categorization-rule).
Do not use this endpoint to set the dismissed\_at field to some timestamp.


## OpenAPI

````yaml patch /v1/businesses/{businessId}/categorization-rules/suggestions/{suggestionId}
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/categorization-rules/suggestions/{suggestionId}:
    patch:
      tags:
        - Categorization Rules
      summary: Update suggested categorization rule
      description: Updates a suggested categorization rule.
      operationId: business.categorization-rules.suggestions.patch
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
        - name: suggestionId
          in: path
          description: The UUID of the suggestion to update.
          required: true
          schema:
            type: string
            format: uuid
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSuggestedCategorizationRuleParams'
      responses:
        '200':
          description: Suggested categorization rule updated successfully.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ApiCreateCategorizationRuleForCounterpartySuggestion
        '404':
          description: Suggestion not found.
      deprecated: false
components:
  schemas:
    UpdateSuggestedCategorizationRuleParams:
      type: object
      description: Fields that can be patched on a suggested categorization rule.
      properties:
        dismissed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Timestamp that marks the suggestion as dismissed. Set to null to
            clear dismissal.
    ApiCreateCategorizationRuleForCounterpartySuggestion:
      type: object
      description: >-
        Consumer-facing rule suggestion for creating a categorization rule for a
        specific counterparty.
      properties:
        type:
          type: string
          enum:
            - Create_Categorization_Rule_For_Counterparty
        id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        new_rule:
          $ref: '#/components/schemas/CreateCategorizationRuleParams'
        business_id:
          type: string
          format: uuid
          nullable: true
        business_name:
          type: string
          nullable: true
        counterparty:
          type: object
          description: Counterparty associated with the suggestion.
          additionalProperties: true
        suggestion_prompt:
          type: string
        transactions_that_will_be_affected:
          type: array
          items:
            $ref: '#/components/schemas/ApiBankTransactionDataOnly'
        accepted_at:
          type: string
          format: date-time
          nullable: true
        dismissed_at:
          type: string
          format: date-time
          nullable: true
        status:
          type: string
          enum:
            - PENDING
            - ACCEPTED
            - REJECTED
      required:
        - type
        - id
        - created_at
        - suggestion_prompt
        - new_rule
        - transactions_that_will_be_affected
        - status
    CreateCategorizationRuleParams:
      type: object
      description: >-
        Parameters for creating or updating a categorization rule. At least one
        filter must be specified.
      properties:
        name:
          type: string
          description: Optional name for the rule.
        category:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_1:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_2:
          $ref: '#/components/schemas/BankTransactionClassification'
        suggestion_3:
          $ref: '#/components/schemas/BankTransactionClassification'
        apply_retroactively:
          type: boolean
          default: false
          description: Whether to apply this rule to existing uncategorized transactions.
        external_id:
          type: string
          description: >-
            External identifier for idempotency. Used for create/upsert
            operations.
        created_by_suggestion_id:
          type: string
          format: uuid
          description: UUID of the suggestion that created this rule (if applicable).
        merchant_type_filter:
          type: string
          description: Regex pattern to match against merchant type (minimum 7 characters).
          minLength: 7
        transaction_description_filter:
          type: string
          description: >-
            Regex pattern to match against transaction description (minimum 7
            characters).
          minLength: 7
        counterparty_filter:
          type: string
          format: uuid
          description: UUID of a specific counterparty (merchant/vendor) to match.
        bank_transaction_type_filter:
          $ref: '#/components/schemas/BankTransactionType'
        bank_direction_filter:
          type: string
          enum:
            - MONEY_IN
            - MONEY_OUT
          description: Transaction direction to match.
        amount_min_filter:
          type: integer
          format: int64
          description: Minimum transaction amount in cents.
        amount_max_filter:
          type: integer
          format: int64
          description: Maximum transaction amount in cents.
    ApiBankTransactionDataOnly:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the bank transaction.
        business_id:
          type: string
          format: uuid
          description: >-
            Unique identifier of the business the bank transaction is associated
            with.
        source:
          $ref: '#/components/schemas/TransactionSource'
          description: Source of the transaction.
        source_transaction_id:
          type: string
          description: >-
            External transaction ID from the source platform (e.g, Plaid
            transaction ID).
          example: g4DlKyjXqGH3Kp5XlaWMtwLRrE4Z9AiE8B4Ko
        source_account_id:
          type: string
          description: >-
            External account ID from the source platform (e.g, Plaid account
            ID).
          example: Aaoy8G7VXZHVeqNoL1GvcmkPdqpLRWi9NArdG
        imported_at:
          type: string
          format: date-time
          description: Timestamp when the transaction was imported.
        date:
          type: string
          format: date-time
          description: Date of the transaction.
        direction:
          $ref: '#/components/schemas/BankTransactionDirection'
          description: Direction of the transaction.
        amount:
          type: integer
          format: int64
          description: Transaction amount in cents.
        counterparty_name:
          type: string
          nullable: true
          description: Name of the transaction counterparty.
          example: WeWork
        description:
          type: string
          nullable: true
          description: Description of the transaction.
          example: WeWork monthly rent payment
        account_name:
          type: string
          nullable: true
          description: Name of the bank account.
          example: Plaid Checking
        categorizationStatus:
          $ref: '#/components/schemas/CategorizationStatus'
          description: The status of the transaction’s categorization in Layer’s systems.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the bank
            transaction (for example, to display to end users).
        metadata:
          $ref: '#/components/schemas/PlatformDefinedJson'
          nullable: true
          description: Arbitrary custom metadata in JSON format with a size limit of 1KB.
        reference_number:
          type: string
          nullable: true
          description: >-
            Any (typically user-visible) identifier you would like to associate
            with the bank transaction. Can be used to filter when listing bank
            transactions.
    BankTransactionClassification:
      discriminator:
        propertyName: type
        mapping:
          AccountId:
            $ref: '#/components/schemas/AccountId'
          StableName:
            $ref: '#/components/schemas/AccountStableName'
          Exclusion:
            $ref: '#/components/schemas/Exclusion'
      oneOf:
        - $ref: '#/components/schemas/AccountId'
          title: Account ID
        - $ref: '#/components/schemas/AccountStableName'
          title: Account Stable Name
        - $ref: '#/components/schemas/Exclusion'
          title: Exclusion
    BankTransactionType:
      type: string
      description: Type of bank transaction.
      enum:
        - REVENUE
        - LOAN_DISBURSEMENT
        - REFUND_RECEIVED
        - INCOMING_P2P_TRANSFER
        - INTRA_ACCOUNT_TRANSFER_IN
        - CHECK_WITHDRAWAL
        - ATM_DEPOSIT
        - BANK_DEPOSIT
        - BANK_VERIFICATION_TRIAL_CREDIT
        - REVERSAL_IN
        - CREDIT_CARD_REWARD
        - CREDIT_CARD_PAYMENT_IN
        - INTEREST_EARNED
        - GOVERNMENT_OR_OTHER_GRANT
        - TAX_REFUND
        - PURCHASE
        - REFUND_GIVEN
        - OUTGOING_P2P_TRANSFER
        - INTRA_ACCOUNT_TRANSFER_OUT
        - CHECK_DEPOSIT
        - CREDIT_CARD_PAYMENT_OUT
        - ATM_WITHDRAWAL
        - BANK_WITHDRAWAL
        - BANKING_FEE
        - PAYMENT_PROCESSING_FEE
        - BANK_VERIFICATION_TRIAL_DEBIT
        - REVERSAL_OUT
        - LOAN_PAYMENT
        - TAX_PAYMENT
        - NOT_ENOUGH_INFORMATION
    TransactionSource:
      type: string
      enum:
        - UNIT
        - PLAID
        - API
        - STRIPE
        - CUSTOM
    BankTransactionDirection:
      type: string
      enum:
        - CREDIT
        - DEBIT
    CategorizationStatus:
      type: string
      enum:
        - PENDING
        - READY_FOR_INPUT
        - CATEGORIZED
        - SPLIT
        - LAYER_REVIEW
        - JOURNALING
        - MATCHED
    PlatformDefinedJson:
      type: object
      description: Arbitrary JSON data defined by the caller, with a 1KB size constraint.
      additionalProperties: true
      example:
        custom_field: value
        any valid json: below 1kb
        nested:
          meaning of life: 42
          array: []
    AccountId:
      type: object
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - AccountId
          description: Resource type. Value will be `AccountId`.
          example: AccountId
        id:
          type: string
          format: uuid
          description: ID of the account.
    AccountStableName:
      type: object
      required:
        - type
        - stable_name
      properties:
        type:
          type: string
          enum:
            - StableName
          description: Resource type. Value will be `StableName`.
          example: StableName
        stable_name:
          type: string
          example: CURRENT_ASSETS
          description: Stable name of the account.
    Exclusion:
      type: object
      properties:
        type:
          type: string
          enum:
            - Exclusion
          description: Resource type. Value will be `Exclusion`.
        exclusion_type:
          $ref: '#/components/schemas/ExclusionType'
      required:
        - type
        - exclusion_type
    ExclusionType:
      type: string
      description: Type of exclusion for a bank transaction.
      enum:
        - PERSONAL_EXPENSES
        - PERSONAL_INFLOWS
        - DUPLICATE_TRANSACTION
        - OTHER_EXCLUSION
      x-displayStrings:
        PERSONAL_EXPENSES: Personal transactions
        PERSONAL_INFLOWS: Personal income sources
        DUPLICATE_TRANSACTION: Duplicate transaction
        OTHER_EXCLUSION: Other exclusion
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````