# Update user notification preferences

Update the user's notification group opt-in state.
The `groups` object is treated as a partial map: only the keys you
include are modified. Keys you omit are left untouched. This means
clients only need to send the groups they want to change, and adding
new groups to the API in the future cannot accidentally clobber an
old client's silence on them.
`PATCH {}` and `PATCH {"groups": {}}` are valid no-ops. Unknown group
names produce a `400`.

Endpoint: PATCH /users/{user_id}/notification_preferences
Version: 2.0
Security: oauth2

## Path parameters:

  - `user_id` (string, required)
    The ID of the specific user to retrieve.

## Header parameters:

  - `EvEnergy-Version` (number)
    Specify the version of this endpoint to use.

## Request fields (application/json):

  - `groups` (object)
    Map of notification group name to opt-in state. Each group
corresponds to a category of push/email notifications:
- `charging_flow` — session lifecycle updates (plug-in, schedule, complete).
- `charging_issues` — errors and failures during a charging session.
- `charging_optimisation` — smart-charging schedule and savings updates.
- `deals_and_offers` — marketing offers (subject to the user's marketing consent).
- `power_supply_notifications` — grid / power-supply events (feature-flagged).
    Example: {"charging_flow":true,"charging_issues":true,"charging_optimisation":false,"deals_and_offers":false,"power_supply_notifications":false}

  - `groups.charging_flow` (boolean)

  - `groups.charging_issues` (boolean)

  - `groups.charging_optimisation` (boolean)

  - `groups.deals_and_offers` (boolean)

  - `groups.power_supply_notifications` (boolean)

## Response 200 fields (application/json):

  - `url` (string)
    Example: https://api.ev.energy/v2/users/user01HN2NJ9NMRZBXT1H6FT9N7735/notification_preferences

  - `groups` (object)
    Map of notification group name to opt-in state. Each group
corresponds to a category of push/email notifications:
- `charging_flow` — session lifecycle updates (plug-in, schedule, complete).
- `charging_issues` — errors and failures during a charging session.
- `charging_optimisation` — smart-charging schedule and savings updates.
- `deals_and_offers` — marketing offers (subject to the user's marketing consent).
- `power_supply_notifications` — grid / power-supply events (feature-flagged).
    Example: {"charging_flow":true,"charging_issues":true,"charging_optimisation":false,"deals_and_offers":false,"power_supply_notifications":false}

  - `groups.charging_flow` (boolean)

  - `groups.charging_issues` (boolean)

  - `groups.charging_optimisation` (boolean)

  - `groups.deals_and_offers` (boolean)

  - `groups.power_supply_notifications` (boolean)

## Response 400 fields (application/problem+json):

  - `type` (string)
    Example: https://api.ev.energy/v2/problems/example-problem/

  - `status` (number)
    Example: 400

  - `title` (string, required)
    Example: Short description

  - `detail` (string, required)
    Example: Long, more specific description.

  - `instance` (string)
    Example: https://api.ev.energy/v2/users/user01HN2P75GBNFRJPCZJXEFVXH5E

  - `notification` (object)
    Something that the user should be informed about.

  - `notification.id` (string, required)
    Unique identifier for the Notification
    Example: notf67O36PLTFDB57M0E5L33JZLGM0

  - `notification.url` (string, required)
    Example: https://api.ev.energy/notifications/notf67O36PLTFDB57M0E5L33JZLGM0

  - `notification.message_id` (string, required)
    Internal identifier for this notification type. E.g. 'ERR0023'

  - `notification.category` (string, required)
    Category of this notification type
    Enum: "ACTIONABLE", "SERVICE", "RETRY", "MARKETING", "INTERNAL"

  - `notification.event_time` (string, required)
    The timestamp of the event described by this notification

  - `notification.short_text_title` (string, required)
    Short title for the notification

  - `notification.short_text_body` (string, required)
    Short description of the event being notified

  - `notification.detail_page_title` (string, required)
    Title of a help page giving more information about this notification

  - `notification.detail_page_body` (string, required)
    Text of a help page giving more information about this notification

  - `notification.external_link` (string | null, required)
    URL of a web page giving further information about this notification

  - `notification.external_button_label` (string, required)
    Text to be displayed on a button leading to the external_link location

  - `notification.read_at` (string)
    When the user examined the contents of this notification

  - `notification.resolved_at` (string)
    When the problem associated with this notification was resolved

## Response 401 fields (application/problem+json):

  - `status` (number)
    Example: 401

  - `title` (string, required)
    Example: Unauthorized

  - `detail` (string, required)
    Example: Authentication credentials were not provided.

## Response 403 fields (application/problem+json):

  - `status` (number)
    Example: 403

  - `title` (string, required)
    Example: Forbidden

  - `detail` (string, required)
    Example: You do not have permission to perform this action.

## Response 404 fields (application/problem+json):

  - `status` (number)
    Example: 404

  - `title` (string, required)
    Example: Not found

  - `detail` (string, required)
    Example: Resource does not exist or cannot be accessed.

## Response 405 fields (application/problem+json):

  - `status` (number)
    Example: 405

  - `title` (string, required)
    Example: Method Not Allowed

  - `detail` (string, required)
    Example: Could not satisfy this HTTP method.

## Response 406 fields (application/problem+json):

  - `status` (number)
    Example: 406

  - `title` (string, required)
    Example: Not Acceptable

  - `detail` (string, required)
    Example: Could not satisfy the request Accept header.

## Response 429 fields (application/problem+json):

  - `type` (string)
    Example: https://api.ev.energy/v2/problems/example-problem/

  - `status` (number)
    Example: 400

  - `title` (string, required)
    Example: Short description

  - `detail` (string, required)
    Example: Long, more specific description.

  - `instance` (string)
    Example: https://api.ev.energy/v2/users/user01HN2P75GBNFRJPCZJXEFVXH5E

  - `notification` (object)
    Something that the user should be informed about.

  - `notification.id` (string, required)
    Unique identifier for the Notification
    Example: notf67O36PLTFDB57M0E5L33JZLGM0

  - `notification.url` (string, required)
    Example: https://api.ev.energy/notifications/notf67O36PLTFDB57M0E5L33JZLGM0

  - `notification.message_id` (string, required)
    Internal identifier for this notification type. E.g. 'ERR0023'

  - `notification.category` (string, required)
    Category of this notification type
    Enum: "ACTIONABLE", "SERVICE", "RETRY", "MARKETING", "INTERNAL"

  - `notification.event_time` (string, required)
    The timestamp of the event described by this notification

  - `notification.short_text_title` (string, required)
    Short title for the notification

  - `notification.short_text_body` (string, required)
    Short description of the event being notified

  - `notification.detail_page_title` (string, required)
    Title of a help page giving more information about this notification

  - `notification.detail_page_body` (string, required)
    Text of a help page giving more information about this notification

  - `notification.external_link` (string | null, required)
    URL of a web page giving further information about this notification

  - `notification.external_button_label` (string, required)
    Text to be displayed on a button leading to the external_link location

  - `notification.read_at` (string)
    When the user examined the contents of this notification

  - `notification.resolved_at` (string)
    When the problem associated with this notification was resolved

