## Upload an ITC Riemer report (tenant:trade:msp:write)

`POST /api/trade/v1/msp/itc/reports`

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

ITC Riemer has no API: its monthly reports are uploaded (needs `msp.itc.enabled`). The file is scanned for
malware, its kind told by its header (`unknown_report` otherwise, nothing is kept) and filed in DMS under the ITC
supplier address (`msp.itc.supplierAddressId`, else the distributor link `itc`). Each report is the run of its own
connector for the month (`run`): the VM resource report (`vm`, provider `itc`) and the backup job report
(`backup-jobs`, provider `itc-backup`: per job `ITCHVBAKVM` × VMs and `ITCHVBAKGB` × GB) replace their usage of the
month, drafts become stale and are recomputed; so does the backup licence report (`licenses`, provider
`itc-licenses`: per customer `ITCVCSP` × points and `ITCVBAKGB` × storage quota in GB). A month is complete only
with all three. A recognised report that cannot be
read is filed, its run fails with the reason and the answer is 422 `report_unreadable`. Max 5 MB.

### Request body

`multipart/form-data` (required)

- `file` (string (binary), required): The report (CSV), at most 5 MB.
- `month` (string): Billing month `YYYY-MM`; default the previous month (Europe/Berlin).

### Responses

- **200** Report taken (`application/json`)
- **400** No file (`field` `file`) or a month that is not `YYYY-MM` (`field` `month`) (`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`)
- **409** Not allowed now: `itc_not_enabled`, `itc_no_supplier` (no ITC supplier address: neither `msp.itc.supplierAddressId` nor a distributor link `itc`), `msp_disabled`, `month_closed` (an invoice of the month is approved or booked) or `run_in_progress` (ITC's run of the month is running) (`application/json`)
- **413** The file is larger than 5 MB (code `too_large`) (`application/json`)
- **422** Refused: `unknown_report` (not an ITC Riemer report, nothing kept), `report_unreadable` (recognised but not readable – filed, its run failed with the reason) or `infected` (the malware scan found something) (`application/json`)
- **503** The file could not be scanned and is refused (`scan_failed`), or the trade settings are unavailable (`application/json`)

Fields of the 200 answer:

- `documentId` (string, required): The report's DMS document; empty where no DMS is connected (local runs).
- `kind` (string, required): Kind of the report, told by its header: the run of `itc`, `itc-licenses` or `itc-backup`. (one of `vm`, `licenses`, `backup-jobs`)
- `run` (object): The run of the report's connector for the month.

Example 200 answer:

```json
{
  "documentId": "9f2a3b4c-5d6e-4f7a-8b8c-1d2e3f4a5b31",
  "kind": "vm",
  "run": {
    "items": 6,
    "provider": "itc",
    "runId": "5d6e7f8a-9b0c-4d1e-8f2a-3b4c5d6e7f04",
    "status": "succeeded"
  }
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/msp/itc/reports' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@document.pdf'
```
