## Post the goods receipt of a delivery note (tenant:delivery-note:post)

`POST /api/trade/v1/inbound-delivery-notes/{id}/post`

Module: Trade · operationId: `postInboundDeliveryNote` · Tag: Inbound delivery notes · Auth: access token (`Authorization: Bearer <accessToken>`)

Books a goods receipt (`WE-…`, numbered by trade) against the assigned purchase order with the
confirmed quantity per order line; without `lines` every line found on the order is posted with its
delivered quantity. A quantity may not exceed what is still open on the order line (`422`). The
receipt and the posted delivery note commit together: a note is posted once, and posting a posted
note answers it unchanged. Afterwards the inbound invoices of the order are checked again
(`FEHLENDER_WARENEINGANG`) and the DMS document is linked to the receipt. Publishes
`trade.goodsreceipt.created` and `trade.inbounddeliverynote.posted` (`auto: false`; a note that matches its
order exactly may be posted by the system instead, see `autoPost`, with `auto: true`).

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json`

- `lines` (array of object)
  - `poLineId` (string (uuid), required)
  - `receivedQty` (number, required): 0 leaves the line out.
- `note` (string): Note of the goods receipt; default „Lieferschein <number> (<supplier number>)“. (max length 1000)

Example:

```json
{
  "lines": [
    {
      "poLineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e01",
      "receivedQty": 1
    },
    {
      "poLineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e02",
      "receivedQty": 3
    }
  ],
  "note": "Lieferschein LS-778812 (Kabelwerk Süd GmbH), vollständig und unbeschädigt."
}
```

### Responses

- **200** The posted delivery note (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).
- **403** Missing permission, no active tenant in the token, or a missing CSRF token on a cookie write. (`application/json`)
- **404** Not found in the tenant. (`application/json`)
- **409** The note is not checked yet or rejected, or the purchase order is draft, closed or cancelled. (`application/json`)
- **422** No purchase order assigned, nothing to post, or a quantity exceeds what is open. (`application/json`)
- **423** An active workflow locks the transaction. (`application/json`)

Fields of the 200 answer:

- `autoPost` (AutoPostDecision): Verdict of the automatic goods receipt on an inbound delivery note, stored whenever the mode is not `off`.
  - `eligible` (boolean): Every condition holds: matched without discrepancy, every line on the order and delivered completely, from EGIS (per shipment) or read with enough confidence and covering every open line of the order (`match.uncoveredPoPositions` empty), order not chosen by a person.
  - `evaluatedAt` (string (date-time)): When the decision was evaluated.
  - `mode` (string): Mode of the automatic goods receipt when the verdict was made (`off`, `dryRun`, `on`). (one of `off`, `dryRun`, `on`)
  - `posted` (boolean): The system posted the goods receipt (mode `on`).
  - `reasons` (array of string): Each failed condition (German text).
  - `rule` (string): The rule an automatic post applied (German text), also in the protocol entry of the posting.
- `createdAt` (string (date-time)): When the delivery note was created.
- `deliveryDate` (string (date)): Delivery date.
- `deliveryNoteNumber` (string): The supplier's number.
- `dmsDocumentId` (string (uuid)): Missing for delivery notes EGIS reported (`source` egis).
- `error` (string): Why processing failed.
- `externalReference` (string): `egis:<EGIS order number>:<EGIS delivery note id>` for EGIS delivery notes (one per order the note covers).
- `extraction` (object): What the AI read; never changed afterwards. Not in lists.
  - `confidence` (number): Confidence of the extraction (0–1).
  - `customerNumber` (string): Our customer number at the supplier.
  - `deliveryDate` (string): Delivery date (YYYY-MM-DD).
  - `deliveryNoteNumber` (string): The supplier's delivery note number.
  - `lines` (array of InboundDeliveryNoteLine): Lines read from the document.
    - `articleNumber` (string): The masterdata article the line was assigned to.
    - `description` (string): Description of the line.
    - `ean` (string): EAN (GTIN) of the article.
    - `mpn` (string): Manufacturer part number.
    - `orderNumber` (string): Purchase order number printed on the line.
    - `position` (integer): Position number of the line.
    - `productId` (string): Masterdata article (product) id.
    - `quantity` (number): Delivered quantity.
    - `serialNumbers` (array of string): Serial numbers.
    - `unit` (string): Unit of measure.
    - `vendorArticleNo` (string): The supplier's article number as read.
  - `model` (string): AI model that read the document.
  - `notes` (string): Notes of the extraction.
  - `orderNumbers` (array of string): Order numbers stated on the delivery note.
  - `supplier` (Party)
    - `address` (string): Single-line address (e-invoice).
    - `city` (string): City.
    - `country` (string): Country.
    - `iban` (string): IBAN.
    - `name` (string): Name.
    - `street` (string): Street and house number.
    - `taxNumber` (string): Tax number.
    - `vatId` (string): VAT identification number.
    - `zip` (string): Postal code.
- `fullText` (string): OCR text; only in the single read.
- `id` (string (uuid)): Id of the delivery note.
- `lines` (array of InboundDeliveryNoteLine): Empty in lists.
  - `articleNumber` (string): The masterdata article the line was assigned to.
  - `description` (string): Description of the line.
  - `ean` (string): EAN (GTIN) of the article.
  - `mpn` (string): Manufacturer part number.
  - `orderNumber` (string): Purchase order number printed on the line.
  - `position` (integer): Position number of the line.
  - `productId` (string): Masterdata article (product) id.
  - `quantity` (number): Delivered quantity.
  - `serialNumbers` (array of string): Serial numbers.
  - `unit` (string): Unit of measure.
  - `vendorArticleNo` (string): The supplier's article number as read.
- `match` (DeliveryCheck): The check of the delivered lines against the open quantities (ordered − received) of the purchase order.
  - `discrepancies` (array of LockReason): `MINDERLIEFERUNG` (partial delivery, not blocking), `MEHRLIEFERUNG` (more than open), `UNBEKANNTE_POSITION`, `FEHLENDE_BESTELLUNG`, `BESTELLUNG_NICHT_GEFUNDEN`.
    - `article` (string): Article of the line.
    - `code` (string): E.g. `PREISABWEICHUNG`, `MENGENABWEICHUNG`, `DUPLIKAT`, `FEHLENDER_LIEFERANT`, `FEHLENDER_ARTIKEL`, `KEINE_E_RECHNUNG`, `NIEDRIGE_KONFIDENZ`, `EMPFAENGER_ABWEICHUNG`, `LIEFERANT_GESPERRT` (the supplier is blocked or payment-blocked in masterdata), `FEHLENDE_BESTELLUNG`, `BESTELLUNG_NICHT_GEFUNDEN`, `EGIS_ABWEICHUNG` (amounts differ from the distributor's invoice data in EGIS).
    - `description` (string): Human-readable explanation.
    - `isBlocking` (boolean): The reason blocks the release until it is accepted or overridden.
    - `position` (integer): Line position the reason refers to; 0 for the whole invoice.
    - `variance` (number): Variance found (amount or quantity).
  - `evaluatedAt` (string (date-time)): When the check ran.
  - `lines` (array of object): Result per delivery note line.
    - `deliveredQty` (number): Quantity delivered.
    - `description` (string): Description of the line.
    - `openQty` (number): Ordered minus received before this note.
    - `orderedQty` (number): Quantity ordered.
    - `poLineId` (string (uuid)): Empty when the line is not on the order.
    - `poPosition` (integer): Position on the purchase order.
    - `position` (integer): Position number of the line.
    - `result` (string): Result of the line. (one of `OK`, `SHORT`, `OVER`, `UNKNOWN_POSITION`)
    - `variance` (number): Delivered minus open (negative: partial delivery).
  - `status` (string): Outcome of the check against the purchase order. (one of `matched`, `discrepancy`)
  - `uncoveredPoPositions` (array of integer): Positions of order lines with an open quantity the note does not deliver at all (a partial delivery of the order; no discrepancy).
- `orderReference` (string): Order numbers named on the note.
- `posting` (object): The goods receipt posted from the delivery note.
  - `goodsReceiptId` (string (uuid)): Id of the goods receipt.
  - `grNumber` (string): Number of the goods receipt.
  - `postedAt` (string (date-time)): When it was posted.
  - `postedBy` (string): Who posted it.
- `purchaseOrderFixed` (boolean): A person chose the purchase order.
- `purchaseOrderId` (string (uuid)): Purchase order the delivery note was assigned to.
- `purchaseOrderNumber` (string): Number of the purchase order.
- `source` (string): `egis` for a delivery note EGIS reported for an order sent through it (structured, with serial numbers; no document, no AI reading). (one of `egis`)
- `status` (InboundDeliveryNoteStatus): `RECEIVED` waits for the text, `EXTRACTED` is read, `MATCHED` / `DISCREPANCY` checked against the purchase order (findings in `match.discrepancies`), `POSTED` booked as goods receipt, `FAILED` could not be read (`error`, retry with reprocess), `REJECTED` discarded by a person. (one of `RECEIVED`, `EXTRACTED`, `MATCHED`, `DISCREPANCY`, `POSTED`, `REJECTED`, `FAILED`)
- `supplierAddressId` (string (uuid)): Masterdata address of the supplier.
- `supplierAssignment` (object): How the supplier was found.
  - `confidence` (number): Confidence of the assignment (0–1).
  - `evidence` (string): What the assignment is based on.
  - `method` (string): How the supplier was found: `exact_vat`, `exact_iban`, `exact_number`, `supplier_number`, `semantic`, `llm`, `fallback` or `manual`.
- `supplierName` (string): Name of the supplier.
- `transactionNumber` (string): Internal number of the delivery note (e.g. `LE-2026-00001`).
- `updatedAt` (string (date-time)): When the delivery note was last changed.

Example 200 answer:

```json
{
  "autoPost": {
    "eligible": true,
    "evaluatedAt": "2026-11-18T10:02:30Z",
    "mode": "dryRun",
    "posted": false,
    "reasons": [],
    "rule": "Lieferschein deckt die Bestellung BE-2026-00068 vollständig (KI-Konfidenz 0,96 ≥ 0,90)."
  },
  "createdAt": "2026-11-18T10:01:00Z",
  "deliveryDate": "2026-11-18",
  "deliveryNoteNumber": "LS-778812",
  "dmsDocumentId": "9f2a3b4c-5d6e-4f7a-8b8c-1d2e3f4a5b11",
  "extraction": {
    "confidence": 0.96,
    "customerNumber": "204711",
    "deliveryDate": "2026-11-18",
    "deliveryNoteNumber": "LS-778812",
    "lines": [
      {
        "articleNumber": "NW-2004",
        "description": "Netzwerkschrank 19 Zoll 12 HE",
        "orderNumber": "BE-2026-00068",
        "position": 1,
        "productId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7c04",
        "quantity": 1,
        "serialNumbers": [
          "RK12-26-0457"
        ],
        "unit": "STK",
        "vendorArticleNo": "KW-RACK12HE"
      },
      {
        "articleNumber": "NW-2005",
        "description": "Verlegekabel Cat.7 Simplex, 100 m",
        "orderNumber": "BE-2026-00068",
        "position": 2,
        "productId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7c05",
        "quantity": 3,
        "serialNumbers": [],
        "unit": "PAK",
        "vendorArticleNo": "KW-CAT7-100"
      }
    ],
    "model": "medium",
    "orderNumbers": [
      "BE-2026-00068"
    ],
    "supplier": {
      "city": "Augsburg",
      "country": "DE",
      "name": "Kabelwerk Süd GmbH",
      "street": "Gewerbering 7",
      "vatId": "DE701000002",
      "zip": "86167"
    }
  },
  "id": "4e7f8a9b-0c1d-4e2f-9a3b-5c6d7e8f9a01",
  "lines": [
    {
      "articleNumber": "NW-2004",
      "description": "Netzwerkschrank 19 Zoll 12 HE",
      "orderNumber": "BE-2026-00068",
      "position": 1,
      "productId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7c04",
      "quantity": 1,
      "serialNumbers": [
        "RK12-26-0457"
      ],
      "unit": "STK",
      "vendorArticleNo": "KW-RACK12HE"
    },
    {
      "articleNumber": "NW-2005",
      "description": "Verlegekabel Cat.7 Simplex, 100 m",
      "orderNumber": "BE-2026-00068",
      "position": 2,
      "productId": "4b7d9f13-5e6a-4c8b-a1d2-3e4f5a6b7c05",
      "quantity": 3,
      "serialNumbers": [],
      "unit": "PAK",
      "vendorArticleNo": "KW-CAT7-100"
    }
  ],
  "match": {
    "discrepancies": [],
    "evaluatedAt": "2026-11-18T10:02:30Z",
    "lines": [
      {
        "deliveredQty": 1,
        "description": "Netzwerkschrank 19 Zoll 12 HE",
        "openQty": 1,
        "orderedQty": 1,
        "poLineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e01",
        "poPosition": 1,
        "position": 1,
        "result": "OK",
        "variance": 0
      },
      {
        "deliveredQty": 3,
        "description": "Verlegekabel Cat.7 Simplex, 100 m",
        "openQty": 3,
        "orderedQty": 3,
        "poLineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e02",
        "poPosition": 2,
        "position": 2,
        "result": "OK",
        "variance": 0
      }
    ],
    "status": "matched",
    "uncoveredPoPositions": []
  },
  "orderReference": "BE-2026-00068",
  "posting": {
    "goodsReceiptId": "3d6e7f8a-9b0c-4d1e-8f2a-4b5c6d7e8f52",
    "grNumber": "WE-2026-00052",
    "postedAt": "2026-11-18T10:15:00Z",
    "postedBy": "david.richter@muster-it.example"
  },
  "purchaseOrderFixed": false,
  "purchaseOrderId": "1b4c5d6e-7f8a-4b9c-8d0e-2f3a4b5c6d68",
  "purchaseOrderNumber": "BE-2026-00068",
  "status": "POSTED",
  "supplierAddressId": "6d8f0a12-3c4e-4a5b-9d6f-7e8a9b0c1d02",
  "supplierAssignment": {
    "confidence": 1,
    "evidence": "USt-IdNr. DE701000002",
    "method": "exact_vat"
  },
  "supplierName": "Kabelwerk Süd GmbH",
  "transactionNumber": "LE-2026-00012",
  "updatedAt": "2026-11-18T10:15:00Z"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/inbound-delivery-notes/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/post' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"lines":[{"poLineId":"2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e01","receivedQty":1},{"poLineId":"2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e02","receivedQty":3}],"note":"Lieferschein LS-778812 (Kabelwerk Süd GmbH), vollständig und unbeschädigt."}'
```
