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

# Patch AP settings

> Partially update the Client's accounts-payable matching settings — rounding tolerance, fuzzy line/supplier thresholds, the supplier name/address weighting, the date-proximity window, the header-affinity weights (reference/currency/date + floor), and the line-affinity weights (price/quantity + floor). Applies to every organisation under the client. Only supplied fields change; a settings row is created on first write. Caller must be Admin/Owner of the Client. See eng-docs "AP - Three-way Matching Engine" §1a.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/settings/ap
openapi: 3.1.1
info:
  title: Dolfin API
  description: >-
    Dolfin API for AR & AP. Authenticate using the `x-dolfin-api-key` header
    with the API key distributed to your organisation.
  version: v1
servers:
  - url: https://api.dolfinai.co
    description: Production
security:
  - {}
tags:
  - name: Webhooks
  - name: Users
  - name: TaxRates
  - name: Suppliers
  - name: Supplier Credit Notes
  - name: Bills
  - name: SpendCategories
  - name: Payables
  - name: RecurringInvoices
  - name: Receivables
  - name: Purchase Orders
  - name: Products
  - name: Payments
  - name: Invoices
  - name: Organisations
  - name: Clients
  - name: Members
  - name: MCP
  - name: Matching
  - name: Invoice Reminders
  - name: Industries
  - name: Gmail
  - name: Delivery Notes
  - name: Customers
  - name: Currencies
  - name: Credit Notes
  - name: ClientInvites
  - name: BankPayments
  - name: Bank details
  - name: Auth
  - name: ApprovalPolicies
  - name: ApiKeys
  - name: Agent
paths:
  /v1/settings/ap:
    patch:
      tags:
        - Clients
      summary: Patch AP settings
      description: >-
        Partially update the Client's accounts-payable matching settings —
        rounding tolerance, fuzzy line/supplier thresholds, the supplier
        name/address weighting, the date-proximity window, the header-affinity
        weights (reference/currency/date + floor), and the line-affinity weights
        (price/quantity + floor). Applies to every organisation under the
        client. Only supplied fields change; a settings row is created on first
        write. Caller must be Admin/Owner of the Client. See eng-docs "AP -
        Three-way Matching Engine" §1a.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchApSettingsRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApSettingsResponse'
        '400':
          description: >-
            ApSettings.Invalid — an AP settings value is out of its allowed
            range
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Member.Forbidden — caller is not an Admin or Owner of this Client
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    PatchApSettingsRequest:
      type: object
      properties:
        matchRoundingTolerance:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Per-line rounding tolerance (in the bill's currency) for three-way
            matching. Must be >= 0.
          format: double
        matchSimilarityThreshold:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Minimum description-similarity score to suggest a fuzzy PO/DN line
            match. Must be between 0 and 1.
          format: double
        matchDateWindowDays:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: >-
            Soft date-proximity window in days preferring bills close to a
            candidate PO's expected delivery date. Must be >= 0.
          format: int32
        supplierMatchSimilarityThreshold:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Minimum combined supplier-match score to suggest a fuzzy supplier
            link. Must be between 0 and 1.
          format: double
        supplierMatchNameWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Relative weight of supplier-name similarity in the combined
            supplier-match score. Must be >= 0; cannot be 0 alongside a 0
            address weight.
          format: double
        supplierMatchAddressWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Relative weight of delivery-address similarity in the combined
            supplier-match score. Must be >= 0; cannot be 0 alongside a 0 name
            weight.
          format: double
        headerMatchCurrencyWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Header-affinity weight (§1a.6) for a bill↔PO currency match. Must be
            >= 0.
          format: double
        headerMatchDateWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Header-affinity weight (§1a.6) for bill↔PO/DN date proximity. Must
            be >= 0. The two header weights cannot both be 0.
          format: double
        headerAffinityFloor:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Lower bound (0-1) on the combined header affinity, so a header
            mismatch never buries a genuine line match below this fraction of
            its line-similarity score. Must be between 0 and 1.
          format: double
        lineMatchPriceWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Line-affinity weight (§1a.7) for a bill-line↔PO-line unit-price
            match. Must be >= 0; cannot be 0 alongside a 0 quantity weight.
          format: double
        lineMatchQuantityWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Line-affinity weight (§1a.7) for a bill-line↔PO-line
            ordered-quantity match. Must be >= 0; cannot be 0 alongside a 0
            price weight.
          format: double
        lineAffinityFloor:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Lower bound (0-1) on the combined line affinity, so a price/quantity
            mismatch never buries a genuine line match below this fraction of
            its line-similarity score. Must be between 0 and 1.
          format: double
    ApSettingsResponse:
      required:
        - payByBankEnabled
        - matchRoundingTolerance
        - matchSimilarityThreshold
        - matchDateWindowDays
        - supplierMatchSimilarityThreshold
        - supplierMatchNameWeight
        - supplierMatchAddressWeight
        - headerMatchCurrencyWeight
        - headerMatchDateWeight
        - headerAffinityFloor
        - lineMatchPriceWeight
        - lineMatchQuantityWeight
        - lineAffinityFloor
      type: object
      properties:
        payByBankEnabled:
          type: boolean
        matchRoundingTolerance:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Per-line rounding tolerance (in the bill's currency) for three-way
            matching. Line amounts within this of each other are treated as
            reconciled. Default 0.01 (1p).
          format: double
        matchSimilarityThreshold:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Minimum description-similarity score (0-1) for the matching engine
            to suggest a fuzzy PO/DN line match. Exact SKU matches bypass this.
            Default 0.7.
          format: double
        matchDateWindowDays:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: >-
            Soft date-proximity window (days): bills whose invoice date is
            within this many days of a candidate PO's expected delivery date are
            preferred when scoring. Never excludes a PO. Default 7.
          format: int32
        supplierMatchSimilarityThreshold:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Minimum combined supplier-match score (0-1) to suggest a fuzzy
            supplier link. Exact tax-id/email/name matches bypass this and
            auto-link. Default 0.7.
          format: double
        supplierMatchNameWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Relative weight of supplier-name similarity in the combined
            supplier-match score. Normalised against the address weight, so the
            two need not sum to 1. Default 0.7.
          format: double
        supplierMatchAddressWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Relative weight of delivery-address similarity in the combined
            supplier-match score. Normalised against the name weight. Default
            0.3.
          format: double
        headerMatchCurrencyWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Header-affinity weight (§1a.6) for a bill↔PO currency match.
            Normalised at use against the other header weights. Default 0.3.
          format: double
        headerMatchDateWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Header-affinity weight (§1a.6) for bill↔PO/DN date proximity.
            Normalised at use against the other header weights. Default 0.2.
          format: double
        headerAffinityFloor:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Lower bound (0-1) on the combined header affinity — a header
            mismatch never buries a genuine line match below this fraction of
            its line-similarity score. Default 0.5.
          format: double
        lineMatchPriceWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Line-affinity weight (§1a.7) for a bill-line↔PO-line unit-price
            match. Normalised at use against the quantity weight. Default 0.7.
          format: double
        lineMatchQuantityWeight:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Line-affinity weight (§1a.7) for a bill-line↔PO-line
            ordered-quantity match. Normalised at use against the price weight.
            Default 0.3.
          format: double
        lineAffinityFloor:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Lower bound (0-1) on the combined line affinity — a price/quantity
            mismatch never buries a genuine line match below this fraction of
            its line-similarity score. Default 0.3.
          format: double
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string

````