## Set the delivery of MSP invoices (tenant:trade:msp:approve)

`PUT /api/trade/v1/msp/invoices/delivery`

Module: Trade · operationId: `setMspInvoiceDelivery` · Tag: MSP billing · Auth: access token (`Authorization: Bearer <accessToken>`) · **Deprecated**

Sets whether approving the invoices mails them (`send`) or only issues them (`issue`). Invoices that are
already booked keep their delivery. Deprecated: approving takes the delivery itself
(`POST /api/trade/v1/msp/invoices/{id}/approve` with `delivery`); the portal no longer sets it beforehand.

### Request body

`application/json` (required)

- `delivery` (MspDelivery, required): `send`: approving issues the invoice in Verkauf and mails it to the customer; `issue`: it is only issued (final number, XRechnung, the XML in DMS). (one of `send`, `issue`)
- `ids` (array of string (uuid), required)

Example:

```json
{
  "delivery": "issue",
  "ids": [
    "2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c01",
    "2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c02"
  ]
}
```

### Responses

- **200** Number of invoices changed (`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`)

Fields of the 200 answer:

- `updated` (integer, required)

Example 200 answer:

```json
{
  "updated": 2
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/trade/v1/msp/invoices/delivery' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"delivery":"issue","ids":["2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c01","2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c02"]}'
```
