# Errors

> Error responses following RFC 9457 (Problem Details) and all stable error codes of the Ladehase API.

The API answers errors with a matching HTTP status and a body in `application/problem+json` format following RFC 9457:

```json
{
  "type": "https://www.ladehase.com/de/docs/fehler#invalid_state",
  "title": "Zustand passt nicht",
  "status": 409,
  "code": "invalid_state",
  "detail": "Die Sitzung ist bereits abgerechnet."
}
```

- `code` is stable and meant for programs. React to `code`, not to `title` or `detail`.
- `title` and `detail` are for humans, currently in German, and may change.
- `type` points to the matching section of this page.

## Codes

### `invalid_request`

Status 400. The request is invalid, for example a required field is missing or a value is out of range. `detail` names the field and the reason.

### `unauthorized`

Status 401. The API key is missing, invalid or revoked. See [Authentication](/en/docs/authentifizierung).

### `forbidden`

Status 403. The key or person may not perform this action.

### `not_found`

Status 404. The object does not exist or belongs to another organisation or the other mode (test or live).

### `conflict`

Status 409. The request conflicts with the current state, for example a session is already running on the connector.

### `invalid_state`

Status 409. The action is not possible in the current state, for example a refund before settlement. See [Sessions and states](/en/docs/sitzungen).

### `device_unavailable`

Status 409. The charge point is offline, locked, faulty or occupied.

### `device_error`

Status 502. The charging station or the manufacturer cloud did not execute a command. Try again later.

### `payment_error`

Status 409 or 502. The payment partner rejected the action or is not reachable.

### `integration_error`

Status 502. The connection to the manufacturer or payment partner is disrupted, for example because credentials expired. Check the connection in the dashboard.

### `not_supported`

Status 400 or 409. The feature is not supported for this manufacturer, device or payment partner.

### `idempotency_conflict`

Status 422. The same `Idempotency-Key` was used with different content. Use a new key for every new request.

### `idempotency_in_progress`

Status 409. A request with the same `Idempotency-Key` is still being processed. Wait briefly and retry.

### `rate_limited`

Status 429. Too many requests. The `Retry-After` header tells you how many seconds to wait.

### `internal_error`

Status 500. An unexpected error on our side. We are notified automatically. Retry with the same `Idempotency-Key`.

## Reacting correctly

- For `429`, `502` and `500`, a retry with increasing delay makes sense.
- For `400`, `401`, `403`, `404` and `422`, a retry changes nothing. Fix the request.
- For `409`, read the object again and decide based on its state.
