> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nox.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Patch Devices Battery Settings

> **Preview: not available yet.** This endpoint is documented ahead of its release and currently
answers `501 Not Implemented`. Its contract may still change before release.

Update the settings of a single battery, or of all batteries of a user. To update a single battery,
only the `device_id` needs to be provided. To update all batteries of a user, provide the
`user_id` instead. Omitted settings are left unchanged.


 You can change the following settings:

 * Enable/Disable steering optimizations. `flex_trading` is mutually exclusive with the other
optimizations. The other optimizations can be enabled together.
 If `flex_trading` is enabled, we disable all other optimizations.
 If any other optimization is enabled, we disable `flex_trading`.
 If all optimizations are disabled, NOX Energy leaves the battery untouched.
 `flex_trading` means that you steer the battery with the schedules you provide to NOX Energy
 (see `POST /v1/devices/battery/schedules`).
 If you are a supplier that has a nox control package integration with Nox Energy, you should not
 enable `flex_trading` but instead the other optimization options like:
 `imbalance_optimization` to optimize the battery to minimize imbalances based on the imbalance prices of the users country.
 `dynamic_tariff` means that we will optimize the battery based on the day-ahead market prices of the users country.
 `pv_self_consumption` to optimize the battery to maximize self-consumption of pv production.



## OpenAPI

````yaml /api-docs/battery/openapi-battery.json patch /v1/devices/battery/settings
openapi: 3.1.0
info:
  title: NOX Energy API - Battery
  description: >
    # Battery API Documentation


    This documentation shows only the endpoints available to battery users.


    **Preview:** these endpoints are documented ahead of their release and
    currently answer

    `501 Not Implemented`.


    ## Authentication


    1. Get your API key from [NOX Energy](mailto:support@nox.energy).

    2. Include the API key in your API calls with the header: `x-api-key:
    YOUR_API_KEY`.


    ## Access Level


    This documentation is specifically for **battery users** who have access to
    these endpoints.


    Base URL: [https://api.nox.energy](https://api.nox.energy)
  version: 1.0.0
servers:
  - url: https://api.nox.energy
    description: Production Server
security:
  - ApiKeyAuth: []
tags:
  - name: Asset Info
    description: API to get basic information about your assets.
  - name: Battery Control
    description: API for battery control specific endpoints.
  - name: User Management
    description: API endpoints to manage users and their data.
paths:
  /v1/devices/battery/settings:
    patch:
      tags:
        - User Management
      summary: Patch Devices Battery Settings
      description: >-
        **Preview: not available yet.** This endpoint is documented ahead of its
        release and currently

        answers `501 Not Implemented`. Its contract may still change before
        release.


        Update the settings of a single battery, or of all batteries of a user.
        To update a single battery,

        only the `device_id` needs to be provided. To update all batteries of a
        user, provide the

        `user_id` instead. Omitted settings are left unchanged.


         You can change the following settings:

         * Enable/Disable steering optimizations. `flex_trading` is mutually exclusive with the other
        optimizations. The other optimizations can be enabled together.
         If `flex_trading` is enabled, we disable all other optimizations.
         If any other optimization is enabled, we disable `flex_trading`.
         If all optimizations are disabled, NOX Energy leaves the battery untouched.
         `flex_trading` means that you steer the battery with the schedules you provide to NOX Energy
         (see `POST /v1/devices/battery/schedules`).
         If you are a supplier that has a nox control package integration with Nox Energy, you should not
         enable `flex_trading` but instead the other optimization options like:
         `imbalance_optimization` to optimize the battery to minimize imbalances based on the imbalance prices of the users country.
         `dynamic_tariff` means that we will optimize the battery based on the day-ahead market prices of the users country.
         `pv_self_consumption` to optimize the battery to maximize self-consumption of pv production.
      operationId: patch_devices_battery_settings_v1_devices_battery_settings_patch
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevicesBatterySettingsRequest'
            examples:
              nox_optimization:
                summary: Let NOX Energy optimize a battery
                description: >-
                  Example for a battery optimized on the day-ahead prices and
                  imbalance prices
                value:
                  device_id: e4da3b7f-bbce-4a45-9d2b-1c0e8f7a6b5c
                  optimization_settings:
                    pv_self_consumption: false
                    dynamic_tariff: true
                    flex_trading: false
                    imbalance_optimization: true
              flex_trading:
                summary: Steer all batteries of a user yourself
                description: >-
                  Example for enabling flex trading for all batteries of a user
                  with only a user_id
                value:
                  user_id: '1234'
                  optimization_settings:
                    flex_trading: true
              leave_untouched:
                summary: Leave a battery untouched
                description: >-
                  With all optimizations disabled, NOX Energy does not act on
                  the battery
                value:
                  device_id: e4da3b7f-bbce-4a45-9d2b-1c0e8f7a6b5c
                  optimization_settings:
                    pv_self_consumption: false
                    dynamic_tariff: false
                    flex_trading: false
                    imbalance_optimization: false
      responses:
        '204':
          description: No Content - Settings updated successfully
        '403':
          description: Your API key has no access to the battery features
          content:
            application/json:
              example:
                detail: Energy Supplier A is not authorized to access this feature.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '501':
          description: Not implemented yet
          content:
            application/json:
              example:
                detail: This endpoint is not available yet.
components:
  schemas:
    DevicesBatterySettingsRequest:
      properties:
        device_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Device Id
          description: Battery device ID to update settings for
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: >-
            Your own ID of the user, to update the settings of all their
            batteries
        optimization_settings:
          anyOf:
            - $ref: '#/components/schemas/BatteryOptimizationSettings'
            - type: 'null'
          description: >-
            Optimization settings for flex trading, dynamic tariff, PV
            self-consumption and imbalance optimization
      additionalProperties: false
      type: object
      title: DevicesBatterySettingsRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BatteryOptimizationSettings:
      properties:
        pv_self_consumption:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pv Self Consumption
          description: Enable/disable PV self-consumption optimization
        dynamic_tariff:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Dynamic Tariff
          description: Enable/disable dynamic tariff optimization
        flex_trading:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Flex Trading
          description: >-
            Enable/disable supplier flex trading. If `True`, the supplier steers
            the battery based on the schedules they provide to NOX Energy.
        imbalance_optimization:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Imbalance Optimization
          description: >-
            Enable/disable imbalance optimization. If `True`, the battery will
            be optimized to minimize imbalances based on the imbalance prices of
            the users country.
      additionalProperties: false
      type: object
      title: BatteryOptimizationSettings
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API Key authentication. Enter your API key in the format: YOUR_API_KEY'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.