# Register complaint

POST `https://app.iteras.dk/api/customers/registercomplaint/`

The API key must allow "Change subscriber data".

Registers a delivery complaint on a subscription, e.g. a missing paper. The customer may be compensated.

In order to register complaints, you need to have a distribution integration set up inside Iteras.

If the complaint is allowed, it is registered and a possible compensation is created. Defaults for the selected reason code are used for compensation.

Possible dates and reason codes for the complaint for the subscription can be found in [the customer data](/api/docs/server/retrievingcustomers.md) by adding `subscriptions.allowed_complaints` to `fields`, which adds `allowed_complaint_dates` and `allowed_complaint_reason_codes` to each subscription. A complaint might not be allowed on a given date due to a rule, e.g. too many complaints on that day.

## Parameters

- `id` (string, required): ID of the customer.
- `subscription_id` (string, required): ID of the subscription to register the complaint for.
- `reason_code` (string, required): Code for the complaint reason, defined in the distribution integration, e.g. `20`.
- `complaint_date` (date, required): Date of the incident the complaint is about, as `YYYY-MM-DD`.
- `skip_processing` (bool, Defaults to `false`): Set to `true` to register the complaint when importing complaints from another system, e.g. `"skip_processing": true`. The complaint is registered as already sent, and no compensation is created.

  The date must still be within the subscription period, but it's not checked that the date is a delivery date within the allowed complaint window.
- `exclude_from_webhooks` (bool, Defaults to `false`): Set to `true` to keep every event the request causes from being sent to webhooks, invoice and payment events included, e.g. `"exclude_from_webhooks": true`. The events are still added to the history.

## Examples

```http
POST /api/customers/registercomplaint/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "id": "12345",
  "subscription_id": "32142532",
  "reason_code": "20",
  "complaint_date": "2026-11-21"
}
```

## Return value

On success the endpoint returns the ID of the registered complaint:

```json
{ "complaint_id": "5512" }
```

## Errors

Invalid requests due to programming error, e.g. invalid JSON, returns 400.

A well-formed operation where a supplied value is invalid is not executed and returns an HTTP 422 error. The response is a JSON object with the errors keyed by the field they concern, e.g. an invalid reason code or a complaint date that isn't a delivery date:

```json
{
  "reason_code": ["Invalid complaint reason code: 20"]
}
```

Errors that are not specific to a field are returned with the empty string as key, e.g. an unknown subscription or a subscription without a distribution integration:

```json
{
  "": ["Distribution integration does not exist."]
}
```