## Check a purchase order before sending it to its supplier (tenant:purchase-order:send)

`POST /api/trade/v1/purchase-orders/{id}/send/preview`

Module: Trade · operationId: `previewPurchaseOrderSend` · Tag: Procurement · Auth: access token (`Authorization: Bearer <accessToken>`)

What the chosen channel (`channel`, else the resolved one) would send and what is missing, e.g. the recipient of
a mail. Sends nothing. The body is optional. A supplier ordered through EGIS is answered `409` with the EGIS route
(`route`): EGIS orders are checked and sent with `previewEgisOrder` / `sendEgisOrder`.

### Parameters

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

### Request body

`application/json`

- `channel` (string): Another available channel than the resolved one; `mail` also with only a `recipient`. (one of `ingram`, `infinigate`, `mail`, `manual`)
- `comment` (string): Remark for the supplier. (max length 500)
- `externalOrderNumber` (string): Manual only: the supplier's order number. (max length 64)
- `recipient` (string (email)): Mail only: overrides the supplier's order mail address. (max length 254)
- `requestedDeliveryDate` (string (date)): Requested delivery date.

Example:

```json
{
  "channel": "mail",
  "comment": "Bitte an den Wareneingang, Tor 2, liefern.",
  "requestedDeliveryDate": "2026-11-20"
}
```

### Responses

- **200** What would be sent (`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** A supplier ordered through EGIS is answered with `code` `use_egis`, `details.channel` `egis` and the EGIS route (`details.route`) – EGIS orders keep their own routes and permission. (`application/json`)
- **422** The channel is not available for the supplier, or the supplier is no longer in masterdata (German text). (`application/json`)
- **502** A dependent service (DMS, masterdata, a distributor) failed or is unreachable. (`application/json`)

Fields of the 200 answer:

- `channel` (string): Channel the order goes out by (`ingram`, `infinigate`, `mail` or `manual`). (one of `ingram`, `infinigate`, `mail`, `manual`)
- `lines` (array of object): The purchase order lines as the supplier will get them.
  - `description` (string): Description of the line.
  - `lineId` (string (uuid)): Id of the purchase order line.
  - `position` (integer): Position number of the line.
  - `problems` (array of string): What is missing for the line.
  - `quantity` (number): Quantity.
  - `supplierArticleNumber` (string): The number the supplier gets (mail: the manufacturer part number, else the article number; Ingram: the Ingram part number found by manufacturer part number, else EAN).
  - `supplierPrice` (number): The supplier's current price (API channels).
  - `unitPrice` (number): Net unit price.
  - `warnings` (array of string): Hints that do not keep the order from being sent, e.g. a supplier price that differs (Ingram).
- `problems` (array of string): German texts of what the order lacks.
- `ready` (boolean): Nothing is missing; the order can be sent.
- `recipient` (string (email)): Where the mail would go (mail).

Example 200 answer:

```json
{
  "channel": "mail",
  "lines": [
    {
      "description": "Netzwerkschrank 19 Zoll 12 HE",
      "lineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e01",
      "position": 1,
      "problems": [],
      "quantity": 1,
      "supplierArticleNumber": "KW-RACK12HE",
      "unitPrice": 289,
      "warnings": []
    },
    {
      "description": "Verlegekabel Cat.7 Simplex, 100 m",
      "lineId": "2c5d6e7f-8a9b-4c0d-9e1f-3a4b5c6d7e02",
      "position": 2,
      "problems": [],
      "quantity": 3,
      "supplierArticleNumber": "KW-CAT7-100",
      "unitPrice": 64,
      "warnings": []
    }
  ],
  "problems": [],
  "ready": true,
  "recipient": "bestellung@kabelwerk-sued.example"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/purchase-orders/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/send/preview' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"channel":"mail","comment":"Bitte an den Wareneingang, Tor 2, liefern.","requestedDeliveryDate":"2026-11-20"}'
```
