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

# Update accounting rule

> Update an existing accounting rule, with the filters, accounts and required fields the rule editor applies to its category.



## OpenAPI

````yaml put /v1/accounting/rules/{id}
openapi: 3.1.0
info:
  title: Hyperline API
  version: 0.0.0
servers:
  - url: https://api.hyperline.co
  - url: https://sandbox.api.hyperline.co
security: []
paths:
  /v1/accounting/rules/{id}:
    put:
      tags:
        - Accounting > Rules
      summary: Update accounting rule
      description: >-
        Update an existing accounting rule, with the filters, accounts and
        required fields the rule editor applies to its category.
      operationId: updateAccountingRule
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAccountingRuleCommand'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountingRule'
      security:
        - bearer: []
components:
  schemas:
    UpdateAccountingRuleCommand:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
          description: Optional user-defined name for the rule.
          example: Recurring subscriptions
        category:
          type:
            - string
            - 'null'
          enum:
            - invoice_posted
            - invoice_settled
            - revenue_recognition
            - credit_note_created
            - accounting_software
          description: >-
            Rule category. Cannot be changed after creation, must match the
            current category when sent.
          example: accounting_software
        priority:
          type: number
          description: Override order. Higher priority wins when multiple rules match.
          example: 100
        product_ids:
          type: array
          items:
            type: string
          description: Product IDs to match. Empty means match all.
          example:
            - prod_abc123def456
        product_types:
          type: array
          items:
            type: string
            enum:
              - flat_fee
              - dynamic
              - seat
              - credit
          description: >-
            Product types to match. Allowed values: flat_fee, dynamic, seat,
            credit. Empty means match all.
          example:
            - flat_fee
        customer_ids:
          type: array
          items:
            type: string
          description: Customer IDs for customer-specific overrides.
          example:
            - cus_abc123def456
        currencies:
          type: array
          items:
            type: string
            enum:
              - EUR
              - AED
              - AFN
              - XCD
              - ALL
              - AMD
              - AOA
              - ARS
              - USD
              - AUD
              - AWG
              - AZN
              - BAM
              - BBD
              - BDT
              - BGN
              - BHD
              - BIF
              - XOF
              - BMD
              - BND
              - BOB
              - BRL
              - BSD
              - BTN
              - NOK
              - BWP
              - BYR
              - BZD
              - CAD
              - CDF
              - XAF
              - CHF
              - NZD
              - CLP
              - CNY
              - COP
              - CRC
              - CUP
              - CVE
              - ANG
              - CZK
              - DJF
              - DKK
              - DOP
              - DZD
              - EGP
              - MAD
              - ERN
              - ETB
              - FJD
              - FKP
              - GBP
              - GEL
              - GHS
              - GIP
              - GMD
              - GNF
              - GTQ
              - GYD
              - HKD
              - HNL
              - HRK
              - HTG
              - HUF
              - IDR
              - ILS
              - INR
              - IQD
              - IRR
              - ISK
              - JMD
              - JOD
              - JPY
              - KES
              - KGS
              - KHR
              - KMF
              - KPW
              - KRW
              - KWD
              - KYD
              - KZT
              - LAK
              - LBP
              - LKR
              - LRD
              - LSL
              - LYD
              - MDL
              - MGA
              - MKD
              - MMK
              - MNT
              - MOP
              - MRO
              - MUR
              - MVR
              - MWK
              - MXN
              - MYR
              - MZN
              - NAD
              - XPF
              - NGN
              - NIO
              - NPR
              - OMR
              - PAB
              - PEN
              - PGK
              - PHP
              - PKR
              - PLN
              - PYG
              - QAR
              - RON
              - RSD
              - RUB
              - RWF
              - SAR
              - SBD
              - SCR
              - SDG
              - SEK
              - SGD
              - SHP
              - SLL
              - SOS
              - SRD
              - SSP
              - STD
              - SYP
              - SZL
              - THB
              - TJS
              - TMT
              - TND
              - TOP
              - TRY
              - TTD
              - TWD
              - TZS
              - UAH
              - UGX
              - UYU
              - UZS
              - VEF
              - VND
              - VUV
              - WST
              - YER
              - ZAR
              - ZMW
              - ZWL
            description: >-
              Currency code. See [ISO
              4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes).
            example: EUR
          description: Currency codes to match (e.g. EUR, USD).
          example:
            - EUR
        countries:
          type: array
          items:
            type: string
            enum:
              - AD
              - AE
              - AF
              - AG
              - AI
              - AL
              - AM
              - AO
              - AQ
              - AR
              - AS
              - AT
              - AU
              - AW
              - AX
              - AZ
              - BA
              - BB
              - BD
              - BE
              - BG
              - BH
              - BI
              - BJ
              - BL
              - BM
              - BN
              - BO
              - BQ
              - BR
              - BS
              - BT
              - BF
              - BV
              - BW
              - BY
              - BZ
              - CA
              - CC
              - CD
              - CF
              - CG
              - CH
              - CI
              - CK
              - CL
              - CM
              - CN
              - CO
              - CR
              - CU
              - CV
              - CW
              - CX
              - CY
              - CZ
              - DE
              - DJ
              - DK
              - DM
              - DO
              - DZ
              - EC
              - EE
              - EG
              - EH
              - ER
              - ES
              - ES-CE
              - ES-ML
              - ET
              - FI
              - FJ
              - FK
              - FM
              - FO
              - FR
              - GA
              - GB
              - GD
              - GE
              - GF
              - GG
              - GH
              - GI
              - GL
              - GM
              - GN
              - GP
              - GQ
              - GR
              - GS
              - GT
              - GU
              - GW
              - GY
              - HK
              - HM
              - HN
              - HR
              - HT
              - HU
              - IC
              - ID
              - IE
              - IL
              - IM
              - IN
              - IO
              - IQ
              - IR
              - IS
              - IT
              - JE
              - JM
              - JO
              - JP
              - KE
              - KG
              - KH
              - KI
              - KM
              - KN
              - KP
              - KR
              - KW
              - KY
              - KZ
              - LA
              - LB
              - LC
              - LI
              - LK
              - LR
              - LS
              - LT
              - LU
              - LV
              - LY
              - MA
              - MC
              - MD
              - ME
              - MF
              - MG
              - MH
              - MK
              - ML
              - MM
              - MN
              - MO
              - MP
              - MQ
              - MR
              - MS
              - MT
              - MU
              - MV
              - MW
              - MX
              - MY
              - MZ
              - NA
              - NC
              - NE
              - NF
              - NG
              - NI
              - NL
              - 'NO'
              - NP
              - NR
              - NU
              - NZ
              - OM
              - PA
              - PE
              - PF
              - PG
              - PH
              - PK
              - PL
              - PM
              - PN
              - PR
              - PS
              - PT
              - PT-20
              - PT-30
              - PW
              - PY
              - QA
              - RE
              - RO
              - RS
              - RU
              - RW
              - SA
              - SB
              - SC
              - SD
              - SE
              - SG
              - SH
              - SI
              - SJ
              - SK
              - SL
              - SM
              - SN
              - SO
              - SR
              - SS
              - ST
              - SV
              - SX
              - SY
              - SZ
              - TC
              - TD
              - TF
              - TG
              - TH
              - TJ
              - TK
              - TL
              - TM
              - TN
              - TO
              - TR
              - TT
              - TV
              - TW
              - TZ
              - UA
              - UG
              - UM
              - US
              - UY
              - UZ
              - VA
              - VC
              - VE
              - VG
              - VI
              - VN
              - VU
              - WF
              - WS
              - XK
              - YE
              - YT
              - ZA
              - ZM
              - ZW
            description: >-
              Two-letter country code in ISO format. See [ISO 3166-1
              alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
            example: FR
          description: Country codes for jurisdiction-based overrides.
          example:
            - FR
        tax_schemes:
          type: array
          items:
            type: string
            enum:
              - standard
              - reverse_charge
              - exempt
              - not_eligible
              - manual
          description: >-
            Tax schemes to match. A context without a tax scheme never matches a
            rule that sets this filter. Empty means match all.
          example:
            - reverse_charge
        tax_territories:
          type: array
          items:
            type: string
            enum:
              - AD
              - AE
              - AF
              - AG
              - AI
              - AL
              - AM
              - AO
              - AQ
              - AR
              - AS
              - AT
              - AU
              - AW
              - AX
              - AZ
              - BA
              - BB
              - BD
              - BE
              - BG
              - BH
              - BI
              - BJ
              - BL
              - BM
              - BN
              - BO
              - BQ
              - BR
              - BS
              - BT
              - BF
              - BV
              - BW
              - BY
              - BZ
              - CA
              - CC
              - CD
              - CF
              - CG
              - CH
              - CI
              - CK
              - CL
              - CM
              - CN
              - CO
              - CR
              - CU
              - CV
              - CW
              - CX
              - CY
              - CZ
              - DE
              - DJ
              - DK
              - DM
              - DO
              - DZ
              - EC
              - EE
              - EG
              - EH
              - ER
              - ES
              - ES-CE
              - ES-ML
              - ET
              - FI
              - FJ
              - FK
              - FM
              - FO
              - FR
              - GA
              - GB
              - GD
              - GE
              - GF
              - GG
              - GH
              - GI
              - GL
              - GM
              - GN
              - GP
              - GQ
              - GR
              - GS
              - GT
              - GU
              - GW
              - GY
              - HK
              - HM
              - HN
              - HR
              - HT
              - HU
              - IC
              - ID
              - IE
              - IL
              - IM
              - IN
              - IO
              - IQ
              - IR
              - IS
              - IT
              - JE
              - JM
              - JO
              - JP
              - KE
              - KG
              - KH
              - KI
              - KM
              - KN
              - KP
              - KR
              - KW
              - KY
              - KZ
              - LA
              - LB
              - LC
              - LI
              - LK
              - LR
              - LS
              - LT
              - LU
              - LV
              - LY
              - MA
              - MC
              - MD
              - ME
              - MF
              - MG
              - MH
              - MK
              - ML
              - MM
              - MN
              - MO
              - MP
              - MQ
              - MR
              - MS
              - MT
              - MU
              - MV
              - MW
              - MX
              - MY
              - MZ
              - NA
              - NC
              - NE
              - NF
              - NG
              - NI
              - NL
              - 'NO'
              - NP
              - NR
              - NU
              - NZ
              - OM
              - PA
              - PE
              - PF
              - PG
              - PH
              - PK
              - PL
              - PM
              - PN
              - PR
              - PS
              - PT
              - PT-20
              - PT-30
              - PW
              - PY
              - QA
              - RE
              - RO
              - RS
              - RU
              - RW
              - SA
              - SB
              - SC
              - SD
              - SE
              - SG
              - SH
              - SI
              - SJ
              - SK
              - SL
              - SM
              - SN
              - SO
              - SR
              - SS
              - ST
              - SV
              - SX
              - SY
              - SZ
              - TC
              - TD
              - TF
              - TG
              - TH
              - TJ
              - TK
              - TL
              - TM
              - TN
              - TO
              - TR
              - TT
              - TV
              - TW
              - TZ
              - UA
              - UG
              - UM
              - US
              - UY
              - UZ
              - VA
              - VC
              - VE
              - VG
              - VI
              - VN
              - VU
              - WF
              - WS
              - XK
              - YE
              - YT
              - ZA
              - ZM
              - ZW
            description: >-
              Two-letter country code in ISO format. See [ISO 3166-1
              alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
            example: FR
          description: >-
            Tax territory country codes to match. A context without a tax
            territory never matches a rule that sets this filter. Empty means
            match all.
          example:
            - FR
        tax_rate_classes:
          type: array
          items:
            type: string
            enum:
              - standard_rate
              - reduced_rate
              - reduced_rate_alt
              - super_reduced_rate
              - parking_rate
              - exempt
              - reverse_charge
          description: >-
            Tax rate classes to match. A context without a tax rate class never
            matches a rule that sets this filter. Empty means match all.
          example:
            - standard_rate
        coupon_ids:
          type: array
          items:
            type: string
          description: Coupon IDs to match. Empty means match all.
          example:
            - cpn_abc123def456
        client_provider_ids:
          type: array
          items:
            type: string
          description: Client provider IDs to match. Empty means match all.
          example:
            - clp_abc123def456
        payment_method_types:
          type: array
          items:
            type: string
            enum:
              - card
              - transfer
              - transfer_automated
              - direct_debit
              - direct_debit_ach
              - direct_debit_bacs
              - apple_pay
              - google_pay
              - paypal
              - stripe_link
              - external
          description: Payment method types to match. Empty means match all.
          example:
            - card
        bank_account_ids:
          type: array
          items:
            type: string
          description: Bank account IDs to match. Empty means match all.
          example:
            - bac_abc123def456
        invoice_types:
          type: array
          items:
            type: string
            enum:
              - invoice
              - document
          description: >-
            Invoice kinds to match: `invoice` or `document`. Refunds and other
            standard invoices match as `invoice`. A context without an invoice,
            such as a PSP payout, never matches a rule that sets this filter.
            Empty means match all.
          example:
            - document
        interval_period:
          type:
            - string
            - 'null'
          enum:
            - days
            - weeks
            - quarters
            - months
            - years
            - once
            - all
            - recurring
          description: >-
            Billing interval period filter (months, years, etc.). `recurring`
            matches every interval except `once` and requires a null
            `interval_count`. `null` matches every interval, including `once`.
          example: months
        interval_count:
          type:
            - number
            - 'null'
          description: Billing interval count filter.
          example: 1
        custom_property_filters:
          type: array
          items:
            $ref: '#/components/schemas/AccountingRuleCustomPropertyFilter'
          description: >-
            Invoice custom property filters. A rule matches only when every
            entry matches (AND across entries), and an entry matches when the
            invoice value is one of its `values` (any-of). Matching is strict:
            an invoice without a value for the property never matches. Each
            entry adds 10 to the `suggested_priority` returned by the rule
            defaults endpoint. Allowed on invoice_posted, invoice_settled,
            revenue_recognition, credit_note_created and accounting_software
            (invoice side) rules. An invoice_settled rule with filters cannot
            set `payments_clearing_ledger_account_id`, as PSP payouts are booked
            without the invoice. Empty means match all.
          example:
            - slug: fee_type
              values:
                - service
        revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Revenue ledger account ID used for invoice line revenue routing.
            Must be a `revenue` account. On accounting_software rules, a
            `revenue` or `contra_revenue` account with entity_type invoice, an
            `asset` or `contra_asset` account with entity_type payment.
          example: lac_abc123def456
        deferred_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Deferred revenue ledger account ID used before revenue is
            recognized. Must be a `liability` account.
          example: lac_abc123def456
        deferred_discount_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Deferred discount ledger account ID used before discounts are
            recognized. Must be an `asset` or `contra_liability` account.
          example: lac_abc123def456
        contra_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Contra revenue ledger account ID used for amounts that reduce
            revenue. Must be a `contra_revenue` account.
          example: lac_abc123def456
        discount_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Discount ledger account ID used for recognized discounts. Must be a
            `contra_revenue` account.
          example: lac_abc123def456
        ar_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Accounts receivable ledger account ID used for invoice posting. Must
            be an `asset` account.
          example: lac_abc123def456
        cash_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Cash ledger account ID used for payment settlement. Must be an
            `asset` account.
          example: lac_abc123def456
        payments_clearing_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Payments clearing ledger account ID used while payments settle. Must
            be an `asset` account.
          example: lac_abc123def456
        output_tax_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Output tax ledger account ID used for tax liability. Must be a
            `liability` account.
          example: lac_abc123def456
        uncollectible_debit_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Ledger account ID debited when an invoice becomes uncollectible.
            Must be an `asset` account, for doubtful-receivable
            reclassification, or an `expense` account, for direct write-off.
          example: lac_abc123def456
        allowance_for_doubtful_accounts_id:
          type:
            - string
            - 'null'
          description: >-
            Allowance for doubtful accounts ledger account ID, set on
            credit_note_created rules. Must be a `contra_asset` account.
          example: lac_abc123def456
        provider_fees_expense_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Expense ledger account ID debited for payment provider fees when a
            payment settles. Must be an `expense` account.
          example: lac_abc123def456
        payment_processing_fees_expense_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Expense ledger account ID debited for payment processing fees when a
            payment settles. Takes precedence over
            `provider_fees_expense_ledger_account_id` when set by the same or a
            higher priority rule. Must be an `expense` account.
          example: lac_abc123def456
        payment_processing_fees_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Payment processing fees revenue ledger account ID, set on
            invoice_settled rules. Must be a `revenue` account.
          example: lac_abc123def456
        customer_credits_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Customer credits ledger account ID used for credit balances. Must be
            a `liability` account.
          example: lac_abc123def456
        rev_rec_method:
          type:
            - string
            - 'null'
          enum:
            - none
            - point_in_time
            - over_time
            - usage_based
            - milestone
            - manual
          description: Revenue recognition method.
          example: over_time
        rev_rec_granularity:
          type:
            - string
            - 'null'
          enum:
            - day
            - month
            - quarter
            - year
          description: >-
            Recognition period granularity. Used when `rev_rec_method` is
            `over_time`.
          example: month
        rev_rec_point_in_time_basis:
          type:
            - string
            - 'null'
          enum:
            - invoice_date
            - service_start_date
            - service_end_date
            - custom_date
          description: >-
            Date revenue is recognized on. Used when `rev_rec_method` is
            `point_in_time`.
          example: service_end_date
        discount_recognition_method:
          type:
            - string
            - 'null'
          enum:
            - immediate
            - deferred
            - use_net_amount
          description: Method used to recognize discounts.
          example: deferred
        journal_id:
          type:
            - string
            - 'null'
          description: Journal ID used to route entries in the accounting provider.
          example: jou_abc123def456
        entity_type:
          type:
            - string
            - 'null'
          enum:
            - invoice
            - payment
          description: Entity type the rule applies to.
          example: invoice
    AccountingRule:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the accounting rule.
          example: arl_abc123def456
        code:
          type: string
          description: Auto-generated rule code (e.g. R-001).
          example: R-001
        name:
          type:
            - string
            - 'null'
          description: Optional user-defined name for the rule.
          example: Recurring subscriptions
        ledger_id:
          type: string
          description: Identifier of the ledger this rule belongs to.
          example: led_abc123def456
        category:
          type:
            - string
            - 'null'
          description: Rule category (e.g. accounting_software, invoice_posted).
          example: accounting_software
        priority:
          type: number
          description: Override order. Higher priority wins when multiple rules match.
          example: 100
        product_ids:
          type: array
          items:
            type: string
          description: Product IDs to match. Empty means match all.
          example:
            - prod_abc123def456
        product_types:
          type: array
          items:
            type: string
          description: >-
            Product types to match. Allowed values: flat_fee, dynamic, seat,
            credit. Empty means match all.
          example:
            - flat_fee
        customer_ids:
          type: array
          items:
            type: string
          description: Customer IDs for customer-specific overrides.
          example:
            - cus_abc123def456
        currencies:
          type: array
          items:
            type: string
            enum:
              - EUR
              - AED
              - AFN
              - XCD
              - ALL
              - AMD
              - AOA
              - ARS
              - USD
              - AUD
              - AWG
              - AZN
              - BAM
              - BBD
              - BDT
              - BGN
              - BHD
              - BIF
              - XOF
              - BMD
              - BND
              - BOB
              - BRL
              - BSD
              - BTN
              - NOK
              - BWP
              - BYR
              - BZD
              - CAD
              - CDF
              - XAF
              - CHF
              - NZD
              - CLP
              - CNY
              - COP
              - CRC
              - CUP
              - CVE
              - ANG
              - CZK
              - DJF
              - DKK
              - DOP
              - DZD
              - EGP
              - MAD
              - ERN
              - ETB
              - FJD
              - FKP
              - GBP
              - GEL
              - GHS
              - GIP
              - GMD
              - GNF
              - GTQ
              - GYD
              - HKD
              - HNL
              - HRK
              - HTG
              - HUF
              - IDR
              - ILS
              - INR
              - IQD
              - IRR
              - ISK
              - JMD
              - JOD
              - JPY
              - KES
              - KGS
              - KHR
              - KMF
              - KPW
              - KRW
              - KWD
              - KYD
              - KZT
              - LAK
              - LBP
              - LKR
              - LRD
              - LSL
              - LYD
              - MDL
              - MGA
              - MKD
              - MMK
              - MNT
              - MOP
              - MRO
              - MUR
              - MVR
              - MWK
              - MXN
              - MYR
              - MZN
              - NAD
              - XPF
              - NGN
              - NIO
              - NPR
              - OMR
              - PAB
              - PEN
              - PGK
              - PHP
              - PKR
              - PLN
              - PYG
              - QAR
              - RON
              - RSD
              - RUB
              - RWF
              - SAR
              - SBD
              - SCR
              - SDG
              - SEK
              - SGD
              - SHP
              - SLL
              - SOS
              - SRD
              - SSP
              - STD
              - SYP
              - SZL
              - THB
              - TJS
              - TMT
              - TND
              - TOP
              - TRY
              - TTD
              - TWD
              - TZS
              - UAH
              - UGX
              - UYU
              - UZS
              - VEF
              - VND
              - VUV
              - WST
              - YER
              - ZAR
              - ZMW
              - ZWL
            description: >-
              Currency code. See [ISO
              4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes).
            example: EUR
          description: Currency codes to match (e.g. EUR, USD).
          example:
            - EUR
        countries:
          type: array
          items:
            type: string
            enum:
              - AD
              - AE
              - AF
              - AG
              - AI
              - AL
              - AM
              - AO
              - AQ
              - AR
              - AS
              - AT
              - AU
              - AW
              - AX
              - AZ
              - BA
              - BB
              - BD
              - BE
              - BG
              - BH
              - BI
              - BJ
              - BL
              - BM
              - BN
              - BO
              - BQ
              - BR
              - BS
              - BT
              - BF
              - BV
              - BW
              - BY
              - BZ
              - CA
              - CC
              - CD
              - CF
              - CG
              - CH
              - CI
              - CK
              - CL
              - CM
              - CN
              - CO
              - CR
              - CU
              - CV
              - CW
              - CX
              - CY
              - CZ
              - DE
              - DJ
              - DK
              - DM
              - DO
              - DZ
              - EC
              - EE
              - EG
              - EH
              - ER
              - ES
              - ES-CE
              - ES-ML
              - ET
              - FI
              - FJ
              - FK
              - FM
              - FO
              - FR
              - GA
              - GB
              - GD
              - GE
              - GF
              - GG
              - GH
              - GI
              - GL
              - GM
              - GN
              - GP
              - GQ
              - GR
              - GS
              - GT
              - GU
              - GW
              - GY
              - HK
              - HM
              - HN
              - HR
              - HT
              - HU
              - IC
              - ID
              - IE
              - IL
              - IM
              - IN
              - IO
              - IQ
              - IR
              - IS
              - IT
              - JE
              - JM
              - JO
              - JP
              - KE
              - KG
              - KH
              - KI
              - KM
              - KN
              - KP
              - KR
              - KW
              - KY
              - KZ
              - LA
              - LB
              - LC
              - LI
              - LK
              - LR
              - LS
              - LT
              - LU
              - LV
              - LY
              - MA
              - MC
              - MD
              - ME
              - MF
              - MG
              - MH
              - MK
              - ML
              - MM
              - MN
              - MO
              - MP
              - MQ
              - MR
              - MS
              - MT
              - MU
              - MV
              - MW
              - MX
              - MY
              - MZ
              - NA
              - NC
              - NE
              - NF
              - NG
              - NI
              - NL
              - 'NO'
              - NP
              - NR
              - NU
              - NZ
              - OM
              - PA
              - PE
              - PF
              - PG
              - PH
              - PK
              - PL
              - PM
              - PN
              - PR
              - PS
              - PT
              - PT-20
              - PT-30
              - PW
              - PY
              - QA
              - RE
              - RO
              - RS
              - RU
              - RW
              - SA
              - SB
              - SC
              - SD
              - SE
              - SG
              - SH
              - SI
              - SJ
              - SK
              - SL
              - SM
              - SN
              - SO
              - SR
              - SS
              - ST
              - SV
              - SX
              - SY
              - SZ
              - TC
              - TD
              - TF
              - TG
              - TH
              - TJ
              - TK
              - TL
              - TM
              - TN
              - TO
              - TR
              - TT
              - TV
              - TW
              - TZ
              - UA
              - UG
              - UM
              - US
              - UY
              - UZ
              - VA
              - VC
              - VE
              - VG
              - VI
              - VN
              - VU
              - WF
              - WS
              - XK
              - YE
              - YT
              - ZA
              - ZM
              - ZW
            description: >-
              Two-letter country code in ISO format. See [ISO 3166-1
              alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
            example: FR
          description: Country codes for jurisdiction-based overrides.
          example:
            - FR
        tax_schemes:
          type: array
          items:
            type: string
            enum:
              - standard
              - reverse_charge
              - exempt
              - not_eligible
              - manual
          description: >-
            Tax schemes to match. A context without a tax scheme never matches a
            rule that sets this filter. Empty means match all.
          example:
            - reverse_charge
        tax_territories:
          type: array
          items:
            type: string
            enum:
              - AD
              - AE
              - AF
              - AG
              - AI
              - AL
              - AM
              - AO
              - AQ
              - AR
              - AS
              - AT
              - AU
              - AW
              - AX
              - AZ
              - BA
              - BB
              - BD
              - BE
              - BG
              - BH
              - BI
              - BJ
              - BL
              - BM
              - BN
              - BO
              - BQ
              - BR
              - BS
              - BT
              - BF
              - BV
              - BW
              - BY
              - BZ
              - CA
              - CC
              - CD
              - CF
              - CG
              - CH
              - CI
              - CK
              - CL
              - CM
              - CN
              - CO
              - CR
              - CU
              - CV
              - CW
              - CX
              - CY
              - CZ
              - DE
              - DJ
              - DK
              - DM
              - DO
              - DZ
              - EC
              - EE
              - EG
              - EH
              - ER
              - ES
              - ES-CE
              - ES-ML
              - ET
              - FI
              - FJ
              - FK
              - FM
              - FO
              - FR
              - GA
              - GB
              - GD
              - GE
              - GF
              - GG
              - GH
              - GI
              - GL
              - GM
              - GN
              - GP
              - GQ
              - GR
              - GS
              - GT
              - GU
              - GW
              - GY
              - HK
              - HM
              - HN
              - HR
              - HT
              - HU
              - IC
              - ID
              - IE
              - IL
              - IM
              - IN
              - IO
              - IQ
              - IR
              - IS
              - IT
              - JE
              - JM
              - JO
              - JP
              - KE
              - KG
              - KH
              - KI
              - KM
              - KN
              - KP
              - KR
              - KW
              - KY
              - KZ
              - LA
              - LB
              - LC
              - LI
              - LK
              - LR
              - LS
              - LT
              - LU
              - LV
              - LY
              - MA
              - MC
              - MD
              - ME
              - MF
              - MG
              - MH
              - MK
              - ML
              - MM
              - MN
              - MO
              - MP
              - MQ
              - MR
              - MS
              - MT
              - MU
              - MV
              - MW
              - MX
              - MY
              - MZ
              - NA
              - NC
              - NE
              - NF
              - NG
              - NI
              - NL
              - 'NO'
              - NP
              - NR
              - NU
              - NZ
              - OM
              - PA
              - PE
              - PF
              - PG
              - PH
              - PK
              - PL
              - PM
              - PN
              - PR
              - PS
              - PT
              - PT-20
              - PT-30
              - PW
              - PY
              - QA
              - RE
              - RO
              - RS
              - RU
              - RW
              - SA
              - SB
              - SC
              - SD
              - SE
              - SG
              - SH
              - SI
              - SJ
              - SK
              - SL
              - SM
              - SN
              - SO
              - SR
              - SS
              - ST
              - SV
              - SX
              - SY
              - SZ
              - TC
              - TD
              - TF
              - TG
              - TH
              - TJ
              - TK
              - TL
              - TM
              - TN
              - TO
              - TR
              - TT
              - TV
              - TW
              - TZ
              - UA
              - UG
              - UM
              - US
              - UY
              - UZ
              - VA
              - VC
              - VE
              - VG
              - VI
              - VN
              - VU
              - WF
              - WS
              - XK
              - YE
              - YT
              - ZA
              - ZM
              - ZW
            description: >-
              Two-letter country code in ISO format. See [ISO 3166-1
              alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
            example: FR
          description: >-
            Tax territory country codes to match. A context without a tax
            territory never matches a rule that sets this filter. Empty means
            match all.
          example:
            - FR
        tax_rate_classes:
          type: array
          items:
            type: string
            enum:
              - standard_rate
              - reduced_rate
              - reduced_rate_alt
              - super_reduced_rate
              - parking_rate
              - exempt
              - reverse_charge
          description: >-
            Tax rate classes to match. A context without a tax rate class never
            matches a rule that sets this filter. Empty means match all.
          example:
            - standard_rate
        coupon_ids:
          type: array
          items:
            type: string
          description: Coupon IDs to match. Empty means match all.
          example:
            - cpn_abc123def456
        client_provider_ids:
          type: array
          items:
            type: string
          description: Client provider IDs to match. Empty means match all.
          example:
            - clp_abc123def456
        payment_method_types:
          type: array
          items:
            type: string
            enum:
              - card
              - transfer
              - transfer_automated
              - direct_debit
              - direct_debit_ach
              - direct_debit_bacs
              - apple_pay
              - google_pay
              - paypal
              - stripe_link
              - external
          description: Payment method types to match. Empty means match all.
          example:
            - card
        bank_account_ids:
          type: array
          items:
            type: string
          description: Bank account IDs to match. Empty means match all.
          example:
            - bac_abc123def456
        invoice_types:
          type: array
          items:
            type: string
            enum:
              - invoice
              - document
          description: >-
            Invoice kinds to match: `invoice` or `document`. Refunds and other
            standard invoices match as `invoice`. A context without an invoice,
            such as a PSP payout, never matches a rule that sets this filter.
            Empty means match all.
          example:
            - document
        interval_period:
          type:
            - string
            - 'null'
          enum:
            - days
            - weeks
            - quarters
            - months
            - years
            - once
            - all
            - recurring
          description: >-
            Billing interval period filter (months, years, etc.). `recurring`
            matches every interval except `once` and requires a null
            `interval_count`. `null` matches every interval, including `once`.
          example: months
        interval_count:
          type:
            - number
            - 'null'
          description: Billing interval count filter.
          example: 1
        custom_property_filters:
          type: array
          items:
            $ref: '#/components/schemas/AccountingRuleCustomPropertyFilter'
          description: >-
            Invoice custom property filters. A rule matches only when every
            entry matches (AND across entries), and an entry matches when the
            invoice value is one of its `values` (any-of). Matching is strict:
            an invoice without a value for the property never matches. Each
            entry adds 10 to the `suggested_priority` returned by the rule
            defaults endpoint. Allowed on invoice_posted, invoice_settled,
            revenue_recognition, credit_note_created and accounting_software
            (invoice side) rules. An invoice_settled rule with filters cannot
            set `payments_clearing_ledger_account_id`, as PSP payouts are booked
            without the invoice. Empty means match all.
          example:
            - slug: fee_type
              values:
                - service
        revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: Revenue ledger account ID used for invoice line revenue routing.
          example: lac_abc123def456
        revenue_ledger_account:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              description: Unique identifier of the ledger account.
              example: lac_abc123def456
            code:
              type: string
              description: Accounting code of the ledger account.
              example: '706100'
            name:
              type: string
              description: Display name of the ledger account.
              example: Revenue
            integration:
              type:
                - object
                - 'null'
              properties:
                entity_id:
                  type: string
                  description: ID of the entity in the provider.
                provider_name:
                  type: string
                  enum:
                    - adyen
                    - stripe
                    - mollie
                    - gocardless
                    - airwallex
                    - salesforce
                    - hubspot
                    - attio
                    - xero
                    - pennylane
                    - zoho-books
                    - exact-online
                    - quickbooks
                    - netsuite
                    - rillet
                    - campfire
                    - dualentry
                    - datev
                    - anrok
                    - sphere
                    - chargebee
                    - slack
                    - plain
                    - zendesk
                    - pylon
                    - intercom
                    - front
                    - helpscout
                    - claap
                    - grain
                    - gong
                    - jiminny
                    - modjo
                    - posthog
                  description: Provider name.
                provider_account_id:
                  type: string
                  description: ID of the connected provider account.
                created_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                  description: >-
                    Creation date of the entity in the provider, when it was
                    imported from there. Exposed on products, coupons and
                    subscriptions; `null` when the provider does not report one.
                  example: '2024-12-20T16:04:11Z'
                activated_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                  description: >-
                    Activation date of the entity in the provider, when it was
                    imported from there. Exposed on subscriptions; `null` when
                    the provider does not report one.
                  example: '2024-12-20T16:04:11Z'
              required:
                - entity_id
                - provider_name
                - provider_account_id
              description: External provider reference associated with the ledger account.
              example:
                entity_id: '123456789'
                provider_name: stripe
                provider_account_id: acc_1234567890
          required:
            - id
            - code
            - name
            - integration
          description: Expanded revenue ledger account reference when available.
        deferred_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Deferred revenue ledger account ID used before revenue is
            recognized.
          example: lac_abc123def456
        deferred_discount_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Deferred discount ledger account ID used before discounts are
            recognized.
          example: lac_abc123def456
        contra_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Contra revenue ledger account ID used for amounts that reduce
            revenue.
          example: lac_abc123def456
        discount_ledger_account_id:
          type:
            - string
            - 'null'
          description: Discount ledger account ID used for recognized discounts.
          example: lac_abc123def456
        ar_ledger_account_id:
          type:
            - string
            - 'null'
          description: Accounts receivable ledger account ID used for invoice posting.
          example: lac_abc123def456
        cash_ledger_account_id:
          type:
            - string
            - 'null'
          description: Cash ledger account ID used for payment settlement.
          example: lac_abc123def456
        payments_clearing_ledger_account_id:
          type:
            - string
            - 'null'
          description: Payments clearing ledger account ID used while payments settle.
          example: lac_abc123def456
        output_tax_ledger_account_id:
          type:
            - string
            - 'null'
          description: Output tax ledger account ID used for tax liability.
          example: lac_abc123def456
        uncollectible_debit_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Ledger account ID debited when an invoice becomes uncollectible. Use
            an asset account for doubtful-receivable reclassification or an
            expense account for direct write-off.
          example: lac_abc123def456
        allowance_for_doubtful_accounts_id:
          type:
            - string
            - 'null'
          description: >-
            Allowance for doubtful accounts ledger account ID, set on
            credit_note_created rules.
          example: lac_abc123def456
        provider_fees_expense_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Expense ledger account ID debited for payment provider fees when a
            payment settles.
          example: lac_abc123def456
        payment_processing_fees_expense_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Expense ledger account ID debited for payment processing fees when a
            payment settles. Takes precedence over
            `provider_fees_expense_ledger_account_id` when set by the same or a
            higher priority rule.
          example: lac_abc123def456
        payment_processing_fees_revenue_ledger_account_id:
          type:
            - string
            - 'null'
          description: >-
            Payment processing fees revenue ledger account ID, set on
            invoice_settled rules.
          example: lac_abc123def456
        customer_credits_ledger_account_id:
          type:
            - string
            - 'null'
          description: Customer credits ledger account ID used for credit balances.
          example: lac_abc123def456
        rev_rec_method:
          type:
            - string
            - 'null'
          enum:
            - none
            - point_in_time
            - over_time
            - usage_based
            - milestone
            - manual
          description: Revenue recognition method.
          example: over_time
        rev_rec_granularity:
          type:
            - string
            - 'null'
          enum:
            - day
            - month
            - quarter
            - year
          description: >-
            Recognition period granularity. Used when `rev_rec_method` is
            `over_time`.
          example: month
        rev_rec_point_in_time_basis:
          type:
            - string
            - 'null'
          enum:
            - invoice_date
            - service_start_date
            - service_end_date
            - custom_date
          description: >-
            Date revenue is recognized on. Used when `rev_rec_method` is
            `point_in_time`.
          example: service_end_date
        discount_recognition_method:
          type:
            - string
            - 'null'
          enum:
            - immediate
            - deferred
            - use_net_amount
          description: Method used to recognize discounts.
          example: deferred
        journal_id:
          type:
            - string
            - 'null'
          description: Journal ID used to route entries in the accounting provider.
          example: jou_abc123def456
        entity_type:
          type:
            - string
            - 'null'
          description: Entity type the rule applies to.
          example: invoice
        created_at:
          type: string
          format: date
          description: Timestamp when the rule was created.
        updated_at:
          type: string
          format: date
          description: Timestamp when the rule was last updated.
      required:
        - id
        - code
        - name
        - ledger_id
        - category
        - priority
        - product_ids
        - product_types
        - customer_ids
        - currencies
        - countries
        - tax_schemes
        - tax_territories
        - tax_rate_classes
        - coupon_ids
        - client_provider_ids
        - payment_method_types
        - bank_account_ids
        - invoice_types
        - interval_period
        - interval_count
        - custom_property_filters
        - revenue_ledger_account_id
        - deferred_revenue_ledger_account_id
        - deferred_discount_ledger_account_id
        - contra_revenue_ledger_account_id
        - discount_ledger_account_id
        - ar_ledger_account_id
        - cash_ledger_account_id
        - payments_clearing_ledger_account_id
        - output_tax_ledger_account_id
        - uncollectible_debit_ledger_account_id
        - allowance_for_doubtful_accounts_id
        - provider_fees_expense_ledger_account_id
        - payment_processing_fees_expense_ledger_account_id
        - payment_processing_fees_revenue_ledger_account_id
        - customer_credits_ledger_account_id
        - rev_rec_method
        - rev_rec_granularity
        - rev_rec_point_in_time_basis
        - discount_recognition_method
        - journal_id
        - entity_type
        - created_at
        - updated_at
    AccountingRuleCustomPropertyFilter:
      type: object
      properties:
        slug:
          type: string
          description: Slug of an invoice custom property.
          example: fee_type
        values:
          type: array
          items:
            type: string
          minItems: 1
          description: >-
            Values of the custom property to match, as strings. For `select` and
            `multi_select` they must be authorized values; a number or boolean
            is its string form (e.g. `12`, `true`), a date its UTC ISO
            timestamp, matched on the exact same instant. The filter matches
            when the invoice holds any of them.
          example:
            - service
      required:
        - slug
        - values
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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