Skip to main content
POST
/
match-groups
/
{id}
/
allocations
Add allocation
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({billLineId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', matchedQuantity: 123})
};

fetch('https://api.dolfinai.co/match-groups/{id}/allocations', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "billId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "tolerance": 123,
  "isClean": true,
  "lines": [
    {
      "billLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "description": "<string>",
      "billedQuantity": 123,
      "billedUnitPrice": 123,
      "billedNet": 123,
      "allocatedQuantity": 123,
      "allocatedNet": 123,
      "unallocatedNet": 123,
      "fullyAllocated": true,
      "hasPriceVariance": true,
      "hasQuantityVariance": true,
      "hasOverBillingVariance": true,
      "allocations": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "matchedQuantity": 123,
          "matchedAmount": 123,
          "poLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "poId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "poNumber": "<string>",
          "poLineDescription": "<string>",
          "poSku": "<string>",
          "orderedUnitPrice": 123,
          "dnLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "dnId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "dnNumber": "<string>",
          "dnLineDescription": "<string>",
          "quantityReceived": 123,
          "matchConfidence": 123
        }
      ],
      "priceVariancePerUnit": 123,
      "priceVarianceTotal": 123,
      "receivedQuantity": 123,
      "quantityVariance": 123,
      "orderedQuantity": 123,
      "quantityOverOrdered": 123,
      "resolution": {
        "resolvedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "resolvedAt": "2023-11-07T05:31:56Z",
        "notes": "<string>"
      }
    }
  ],
  "suggestions": [
    {
      "billLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "poLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "poId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "poNumber": "<string>",
      "poLineDescription": "<string>",
      "quantityOrdered": 123,
      "orderedUnitPrice": 123,
      "confidence": 123,
      "poSku": "<string>"
    }
  ],
  "dnSuggestions": [
    {
      "billLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "dnLineId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "dnId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "dnNumber": "<string>",
      "dnLineDescription": "<string>",
      "quantityReceived": 123,
      "confidence": 123,
      "dnSku": "<string>"
    }
  ]
}

Path Parameters

id
string<uuid>
required

Body

application/json

Allocates a bill line against a purchase-order line (price) and/or a delivery-note line (receipt quantity). At least one counterpart is required.

billLineId
string<uuid>
required

The bill line being matched.

matchedQuantity
required

Quantity to match on this allocation.

poLineId
null | string<uuid>

The purchase-order line to match against (the price dimension). Optional, but at least one of purchase-order or delivery-note line is required.

dnLineId
null | string<uuid>

The delivery-note line to match against (the receipt-quantity dimension). Optional, but at least one of purchase-order or delivery-note line is required.

matchedAmount

Net amount to match. Optional — when omitted the service derives it from the bill line's unit price.

method
enum<string>

How the match was made. Defaults to Manual; set to Fuzzy when confirming a suggested match (and carry its Confidence).

Available options:
Manual,
Exact,
Fuzzy
confidence

Fuzzy match confidence (0–1) to record, when confirming a suggestion (Method = Fuzzy).

Response

OK

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.

id
string<uuid>
required

Unique identifier of this match group.

billId
string<uuid>
required

The bill under review.

status
enum<string>
required

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

Available options:
Open,
Variance,
Resolved,
Synced
tolerance
required

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.

isClean
boolean
required

True when every line is fully allocated with no outstanding variance.

lines
object[]
required

One entry per bill line, carrying its allocations and derived variances.

suggestions
object[]
required

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
object[]
required

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.