# Problem types

Some endpoints answer errors as **problem details** ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)). Each error names its problem type in `type`. This is a stable URI under `https://code.salaxy.com/problems/` that opens the page describing it.

Endpoints that use problem details say so on their own page. Today these are the [payment channel config](https://code.salaxy.com/integration/company-settings.md#payment-channel-config) endpoints (v04 beta). Other endpoints use the error shape in [Error handling](https://code.salaxy.com/reference/errors.md).

## The response

A problem details response has `Content-Type: application/problem+json` and this body:

```json
{
  "type": "https://code.salaxy.com/problems/validation-failed",
  "status": 422,
  "title": "The payment channel config is not valid.",
  "errors": {
    "debitAccount.iban": [ "The IBAN is not valid." ],
    "data.agreementId": [ "Required." ]
  }
}
```

| Field | Notes |
|---|---|
| `type` | The problem type. **Branch on this URI**, or on the status — never on the text. |
| `status` | The HTTP status code, the same as the response's. |
| `title` | A short summary, the same for every occurrence of the type. |
| `detail` | An explanation of this occurrence. Can be missing. |
| `errors` | `validation-failed` only: the messages per field, keyed by the field's path in the request body, for example `data.agreementId`. |

`title`, `detail` and the messages in `errors` follow the `Accept-Language` request header: `fi` or `en`. The language is Finnish when the header is missing or names neither. `Content-Language` names the language of the response.

`401` and `403` are never problem details. They come from the authentication, as on every endpoint. See [Error handling](https://code.salaxy.com/reference/errors.md).

## Types

| Type | Status | Meaning |
|---|---|---|
| [`not-found`](https://code.salaxy.com/problems/not-found.md) | 404 | The resource does not exist. |
| [`channel-not-available`](https://code.salaxy.com/problems/channel-not-available.md) | 409 | The payment channel is not available to the company. |
| [`concurrent-change`](https://code.salaxy.com/problems/concurrent-change.md) | 409 | Concurrent changes kept the write from saving. Nothing was saved. |
| [`precondition-failed`](https://code.salaxy.com/problems/precondition-failed.md) | 412 | `If-Match` or `If-None-Match` does not hold. |
| [`unsupported-media-type`](https://code.salaxy.com/problems/unsupported-media-type.md) | 415 | The request body has the wrong content type. |
| [`validation-failed`](https://code.salaxy.com/problems/validation-failed.md) | 422 | The request body is not valid; `errors` lists the messages per field. |
| [`internal-error`](https://code.salaxy.com/problems/internal-error.md) | 500 | An unexpected error in Salaxy. |
