## Record CSAT feedback (tenant:crm:write)

`POST /api/crm/v1/csat`

Module: CRM · operationId: `createCsatFeedback` · Tag: CSAT · Auth: access token (`Authorization: Bearer <accessToken>`)

`addressId` and `ticketId` are stored as given and not checked. Without `channel` it is
`PORTAL`. Emits `crm.csat.created`.

### Request body

`application/json` (required)

- `rating` (integer, required): Rating from 1 (bad) to 5 (very good). (max 5)
- `addressId` (string (uuid)): Masterdata address the feedback is about.
- `channel` (object): Default `PORTAL`.
- `comment` (string): Comment of the customer. (max length 10000)
- `submittedBy` (string): Who gave the feedback. Left out by a person: their name (or e-mail); by a service: not set. (max length 255)
- `ticketId` (string): Ticket the feedback is about. (max length 64)

Example:

```json
{
  "channel": "EMAIL",
  "comment": "Schnelle Hilfe, Techniker war sehr freundlich.",
  "rating": 4,
  "submittedBy": "Sabine Müller",
  "ticketId": "4711"
}
```

### Responses

- **201** Created (`application/json`)
- **400** Invalid input (`invalid`): `field` names the first invalid field, `details.fields` every one (JSON paths for
bodies, parameter names for the query). Some refusals have their own code (`invalid_sort`,
`invalid_stages`, `invalid_custom_fields`, `convert_target_required`, `invalid_csv`, …).
 (`application/json`)
- **401** Missing, invalid or expired token (no body).
- **403** The token lacks the permission (`insufficient permissions`) or has no active tenant.
 (`application/json`)
- **500** Unexpected error; details are only logged. (`application/json`)

Fields of the 201 answer:

- `channel` (CSATChannel, required): (one of `PORTAL`, `EMAIL`, `PHONE`, `IN_PERSON`)
- `createdAt` (string (date-time), required): When the feedback was given.
- `customerNo` (string, required): Customer number of the tenant.
- `id` (string (uuid), required): Id of the feedback.
- `rating` (integer, required): Rating from 1 (bad) to 5 (very good). (max 5)
- `tenantName` (string, required): Tenant name.
- `addressId` (string (uuid)): Omitted when not set.
- `comment` (string): Omitted when not set.
- `submittedBy` (string): Omitted when not set.
- `ticketId` (string): Omitted when not set. For a rating from the customer portal the desk ticket id.
- `ticketNumber` (integer (int64)): Number of the desk ticket the customer rated in the portal (desk.ticket.rated); omitted for feedback recorded by hand.

Example 201 answer:

```json
{
  "addressId": "3c5e7a9c-1d3f-4b5a-9c7e-1a3c5e7a9c1e",
  "channel": "PORTAL",
  "comment": "Schnelle Hilfe, das WLAN im Restaurant läuft wieder stabil.",
  "createdAt": "2026-11-17T11:05:00Z",
  "customerNo": "99999",
  "id": "9f1b3d5f-7a9c-4e1d-8b3f-7e9a1c3e5b7d",
  "rating": 5,
  "submittedBy": "Katrin Stadler",
  "tenantName": "DEMO",
  "ticketId": "6a8c0e2a-4b6d-4f8a-9c1e-3b5d7f9a1c3e",
  "ticketNumber": 214
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/crm/v1/csat' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"channel":"EMAIL","comment":"Schnelle Hilfe, Techniker war sehr freundlich.","rating":4,"submittedBy":"Sabine Müller","ticketId":"4711"}'
```
