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

# Get a bill's match group

> The three-way match group for a bill (derived variances + fuzzy suggestions). 404 when the bill has no match group yet.



## OpenAPI

````yaml /api-reference/openapi.json get /bills/{billId}/match-group
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: Members
  - name: MCP
  - name: Matching
  - name: Invoice Reminders
  - name: Industries
  - name: Gmail
  - name: Delivery Notes
  - name: Customers
  - name: Currencies
  - name: Credit Notes
  - name: Clients
  - name: ClientInvites
  - name: BankPayments
  - name: Bank details
  - name: Auth
  - name: ApprovalPolicies
  - name: ApiKeys
  - name: Agent
paths:
  /bills/{billId}/match-group:
    get:
      tags:
        - Matching
      summary: Get a bill's match group
      description: >-
        The three-way match group for a bill (derived variances + fuzzy
        suggestions). 404 when the bill has no match group yet.
      parameters:
        - name: billId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MatchGroupView'
        '404':
          description: Match.NoGroupForBill — no match group exists for this bill yet
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    MatchGroupView:
      required:
        - id
        - billId
        - status
        - tolerance
        - isClean
        - lines
        - suggestions
        - dnSuggestions
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of this match group.
          format: uuid
        billId:
          type: string
          description: The bill under review.
          format: uuid
        status:
          $ref: '#/components/schemas/MatchGroupStatus'
          description: >-
            Lifecycle status of the match: Open (nothing to settle), Variance (a
            flagged difference awaits a human decision), Resolved (settled), or
            Synced (exported — not reachable yet).
        tolerance:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Per-line rounding tolerance, in the bill's currency, that every
            variance was judged against. Configured per organisation; a
            difference within tolerance is treated as clean.
          format: double
        isClean:
          type: boolean
          description: >-
            True when every line is fully allocated with no outstanding
            variance.
        lines:
          type: array
          items:
            $ref: '#/components/schemas/MatchLineView'
          description: >-
            One entry per bill line, carrying its allocations and derived
            variances.
        suggestions:
          type: array
          items:
            $ref: '#/components/schemas/MatchSuggestionView'
          description: >-
            Fuzzy purchase-order-line suggestions for bill lines with no exact
            (SKU) match. Derived, never stored; confirm one (POST an allocation)
            to create a real match.
        dnSuggestions:
          type: array
          items:
            $ref: '#/components/schemas/MatchDnSuggestionView'
          description: >-
            Fuzzy delivery-note-line suggestions — the receipt-quantity
            counterpart of Suggestions. Lets the UI ask 'which delivery does
            this line belong to?' without the caller knowing line ids.
      description: >-
        A bill's three-way match: each bill line with its allocations and
        derived price/quantity variances (computed at read time, never stored),
        plus fuzzy purchase-order and delivery-note suggestions for lines that
        still need matching.
    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
    MatchGroupStatus:
      enum:
        - Open
        - Variance
        - Resolved
        - Synced
      description: >-
        Lifecycle status of a match group: Open (nothing to settle), Variance (a
        flagged difference awaits a decision), Resolved (settled), or Synced
        (exported to accounting — not reachable yet).
    MatchLineView:
      required:
        - billLineId
        - description
        - billedQuantity
        - billedUnitPrice
        - billedNet
        - allocatedQuantity
        - allocatedNet
        - unallocatedNet
        - fullyAllocated
        - hasPriceVariance
        - hasQuantityVariance
        - hasOverBillingVariance
        - allocations
      type: object
      properties:
        billLineId:
          type: string
          description: The bill line this row describes.
          format: uuid
        description:
          type: string
          description: Bill line description, as it appears on the bill.
        billedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Quantity billed on this line.
          format: double
        billedUnitPrice:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Unit price billed on this line.
          format: double
        billedNet:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Net (ex-tax) amount billed on this line.
          format: double
        allocatedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Quantity allocated against purchase-order lines (the priced
            dimension).
          format: double
        allocatedNet:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Net amount allocated against purchase-order lines (the dimension
            that owns the net).
          format: double
        unallocatedNet:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: >-
            Billed net not yet covered by a purchase-order allocation (billedNet
            − allocatedNet).
          format: double
        fullyAllocated:
          type: boolean
          description: True when the line's net is fully covered, within tolerance.
        priceVariancePerUnit:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Billed unit price minus the ordered unit price. Null when the line
            has no purchase-order match; positive means billed above the order.
          format: double
        priceVarianceTotal:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Total price variance across the matched quantity. Null when the line
            has no purchase-order match.
          format: double
        hasPriceVariance:
          type: boolean
          description: True when the price variance exceeds tolerance.
        receivedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Quantity matched against delivery-note lines (the receipt
            dimension). Null when the line has no delivery-note match.
          format: double
        quantityVariance:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Billed quantity minus received quantity. Null when there is no
            delivery-note match; positive means billed more than was delivered.
          format: double
        hasQuantityVariance:
          type: boolean
          description: >-
            True when the billed-vs-received quantity variance exceeds
            tolerance.
        orderedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Total quantity ordered across the distinct purchase-order lines this
            bill line is matched to. Null when the line has no purchase-order
            match.
          format: double
        quantityOverOrdered:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Billed quantity minus ordered quantity. Positive means billed for
            more than the purchase order authorises (a surplus).
          format: double
        hasOverBillingVariance:
          type: boolean
          description: >-
            True when the line is billed for more than was ordered, beyond
            tolerance — the surplus clears by allocating a second purchase-order
            line or by accepting it.
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/MatchAllocationView'
          description: The purchase-order and delivery-note allocations backing this line.
        resolution:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/MatchResolutionView'
              description: >-
                The human resolution recorded for this line's variance, or null
                if none. Per-line: a multi-line bill can accept one line while
                disputing another.
      description: >-
        One bill line within a match group: its billed figures, derived
        price/quantity variances, backing allocations and any recorded
        resolution.
    MatchSuggestionView:
      required:
        - billLineId
        - poLineId
        - poId
        - poNumber
        - poLineDescription
        - quantityOrdered
        - orderedUnitPrice
        - confidence
      type: object
      properties:
        billLineId:
          type: string
          description: The bill line this suggestion is for.
          format: uuid
        poLineId:
          type: string
          description: The suggested purchase-order line.
          format: uuid
        poId:
          type: string
          description: >-
            The parent purchase order of the suggested line — for labelling and
            linking. Two purchase orders can carry the same line description, so
            the number/id disambiguate them.
          format: uuid
        poNumber:
          type: string
          description: Human purchase-order number of the suggested line.
        poLineDescription:
          type: string
          description: Description of the suggested purchase-order line.
        poSku:
          type:
            - 'null'
            - string
          description: SKU of the suggested purchase-order line, if any.
        quantityOrdered:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Quantity ordered on the suggested line.
          format: double
        orderedUnitPrice:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Unit price on the suggested line.
          format: double
        confidence:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Fuzzy match confidence (0–1), the trigram similarity between the
            bill and purchase-order line descriptions. Only suggestions above
            the organisation's similarity threshold are returned.
          format: double
      description: >-
        A fuzzy purchase-order-line suggestion for a bill line with no exact
        (SKU) match, scored by description similarity. Confirm it by creating an
        allocation.
    MatchDnSuggestionView:
      required:
        - billLineId
        - dnLineId
        - dnId
        - dnNumber
        - dnLineDescription
        - quantityReceived
        - confidence
      type: object
      properties:
        billLineId:
          type: string
          description: The bill line this suggestion is for.
          format: uuid
        dnLineId:
          type: string
          description: The suggested delivery-note line.
          format: uuid
        dnId:
          type: string
          description: >-
            The parent delivery note of the suggested line — for labelling and
            linking.
          format: uuid
        dnNumber:
          type: string
          description: Human delivery-note number of the suggested line.
        dnLineDescription:
          type: string
          description: Description of the suggested delivery-note line.
        dnSku:
          type:
            - 'null'
            - string
          description: SKU of the suggested delivery-note line, if any.
        quantityReceived:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Quantity received on the suggested line.
          format: double
        confidence:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - number
            - string
          description: >-
            Fuzzy match confidence (0–1), the trigram similarity between the
            bill and delivery-note line descriptions. Only suggestions above the
            organisation's similarity threshold are returned.
          format: double
      description: >-
        A fuzzy delivery-note-line suggestion for a bill line with no exact
        match — the receipt-quantity counterpart of a purchase-order suggestion.
    MatchAllocationView:
      required:
        - id
        - matchedQuantity
        - matchedAmount
        - matchMethod
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of this allocation.
          format: uuid
        poLineId:
          type:
            - 'null'
            - string
          description: The matched purchase-order line, when this allocation pins one.
          format: uuid
        poId:
          type:
            - 'null'
            - string
          description: The parent purchase order of the matched line.
          format: uuid
        poNumber:
          type:
            - 'null'
            - string
          description: >-
            Human purchase-order number, for labelling and linking. Null when
            this allocation has no purchase-order counterpart (a
            delivery-note-only row).
        poLineDescription:
          type:
            - 'null'
            - string
          description: Description of the matched purchase-order line.
        poSku:
          type:
            - 'null'
            - string
          description: SKU of the matched purchase-order line, if any.
        orderedUnitPrice:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Unit price on the matched purchase-order line.
          format: double
        dnLineId:
          type:
            - 'null'
            - string
          description: The matched delivery-note line, when this allocation pins one.
          format: uuid
        dnId:
          type:
            - 'null'
            - string
          description: The parent delivery note of the matched line.
          format: uuid
        dnNumber:
          type:
            - 'null'
            - string
          description: >-
            Human delivery-note number, for labelling and linking. Null when
            this allocation has no delivery-note counterpart.
        dnLineDescription:
          type:
            - 'null'
            - string
          description: Description of the matched delivery-note line.
        quantityReceived:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Quantity received on the matched delivery-note line.
          format: double
        matchedQuantity:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Quantity matched by this allocation.
          format: double
        matchedAmount:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - number
            - string
          description: Net amount matched by this allocation.
          format: double
        matchMethod:
          $ref: '#/components/schemas/MatchMethod'
          description: >-
            How the match was made: Exact (by SKU), Fuzzy (a confirmed
            suggestion) or Manual.
        matchConfidence:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$
          type:
            - 'null'
            - number
            - string
          description: >-
            Fuzzy match confidence (0–1) when MatchMethod is Fuzzy; null
            otherwise.
          format: double
      description: >-
        A confirmed match between a bill line and a purchase-order line (price)
        and/or a delivery-note line (receipt quantity). The purchase-order row
        owns the net; a delivery-note-only row is receipt-only.
    MatchResolutionView:
      required:
        - action
      type: object
      properties:
        action:
          $ref: '#/components/schemas/MatchResolutionAction'
          description: The resolution taken (e.g. Accept, RequestCreditNote, Dispute).
        resolvedBy:
          type:
            - 'null'
            - string
          description: The user who recorded the resolution, if known.
          format: uuid
        resolvedAt:
          type:
            - 'null'
            - string
          description: When the resolution was recorded.
          format: date-time
        notes:
          type:
            - 'null'
            - string
          description: Optional free-text note captured with the resolution.
      description: A human decision recorded against a bill line's variance.
    MatchMethod:
      enum:
        - Manual
        - Exact
        - Fuzzy
      description: >-
        How an allocation was matched: Manual (chosen by a reviewer), Exact
        (auto-matched by SKU), or Fuzzy (a confirmed description-similarity
        suggestion).
    MatchResolutionAction:
      enum:
        - Accept
        - AcceptAndUpdateCatalog
        - RequestCreditNote
        - Dispute
      description: >-
        How a bill line's variance was resolved. Accept settles the line
        whatever the variance kind (price, short delivery, or over-order
        surplus). AcceptAndUpdateCatalog also records a catalog-write intent.
        RequestCreditNote and Dispute keep the line (and so the bill) blocked.

````