> ## 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.

# Post Pv Control Flex

> Execute pv flex controls at the current time based on % of max capacity or amount of kW in production you want to lower 
of its current aggregated production across the whole supplier client base. If you provide an 
end_time with a 1 min granularit, we will revert the curtailed amount to it's original amount at that time.
If no end_time is given, we do not automatically revert back.
 When you execute flex on already curtailed devices, we will overwrite their current curtailment and
 scheduled end time with the new flex command you provided.
 

 Timestamp fields in UTC. 

 Time format examples: 
 * 2023-10-01T00:00:00Z
 
 * 2023-10-01T00:00:00 


 
 `control_type` can be set to `export_curtailment`, `production_curtailment` or `default`.
 
 * 100 % target_percentage means that we will enable full production on the full pv panel fleet again.
 
 * You can also provide a list of brands to filter on to fully turn off or on 
 curtailment for all devices of a specific brand with the `brand_filter` parameter.
 If no brands are provided, we will execute flex on all brands.

**NOTE**: 
 * The pv devices might need some time to react. If using end_time please provide end_time at
least 4 minutes in the future to ensure the device can react in time. Some may react slower than others.



## OpenAPI

````yaml /api-docs/pv/openapi-pv.json post /v1/devices/pv/flex
openapi: 3.1.0
info:
  title: NOX Energy API - PV
  description: >
    # PV API Documentation


    This documentation shows only the endpoints available to pv users.


    ## 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 **pv 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: User Management
    description: API endpoints to manage users and their data.
paths:
  /v1/devices/pv/flex:
    post:
      tags:
        - PV Control
      summary: Post Pv Control Flex
      description: >-
        Execute pv flex controls at the current time based on % of max capacity
        or amount of kW in production you want to lower 

        of its current aggregated production across the whole supplier client
        base. If you provide an 

        end_time with a 1 min granularit, we will revert the curtailed amount to
        it's original amount at that time.

        If no end_time is given, we do not automatically revert back.
         When you execute flex on already curtailed devices, we will overwrite their current curtailment and
         scheduled end time with the new flex command you provided.
         

         Timestamp fields in UTC. 

         Time format examples: 
         * 2023-10-01T00:00:00Z
         
         * 2023-10-01T00:00:00 


         
         `control_type` can be set to `export_curtailment`, `production_curtailment` or `default`.
         
         * 100 % target_percentage means that we will enable full production on the full pv panel fleet again.
         
         * You can also provide a list of brands to filter on to fully turn off or on 
         curtailment for all devices of a specific brand with the `brand_filter` parameter.
         If no brands are provided, we will execute flex on all brands.

        **NOTE**: 
         * The pv devices might need some time to react. If using end_time please provide end_time at
        least 4 minutes in the future to ensure the device can react in time.
        Some may react slower than others.
      operationId: post_pv_control_flex_v1_devices_pv_flex_post
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevicesPVFlexRequest'
            examples:
              flex_on_target:
                summary: Flex based on target in kW
                description: >-
                  Example for executing flex based on a target in kW to reduce
                  the production with.
                value:
                  target_kw: 2.5
              flex_on_percentage_capacity:
                summary: Flex based on % of max capacity
                description: >-
                  Example for executing flex based on a target in % of max
                  capacity to alter the production with.
                value:
                  target_percentage: 70
              flex_on_target_with_end_time:
                summary: Flex based on target in kW with an end time
                description: >-
                  Example for executing flex based on a target in kW to reduce
                  the production with.
                value:
                  target_kw: 10
                  end_time: '2025-10-01T00:00:00Z'
              flex_on_brand_filter:
                summary: Flex for 100 % or 0 % of max capacity for specific brands
                description: >-
                  Example for executing flex based on a target in % of max
                  capacity to alter the production with for specific brands.
                value:
                  target_percentage: 0
                  brand_filter:
                    - Sma
                    - Solis
      responses:
        '200':
          description: All controls accepted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevicesPVFlexResponse'
              example:
                meta:
                  energy_supplier: Energy Supplier A
        '400':
          description: Invalid request parameters
          content:
            application/json:
              example:
                detail: >-
                  None of the provided device_ids allow steering or are
                  compatible.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DevicesPVFlexRequest:
      properties:
        target_kw:
          anyOf:
            - type: number
            - type: 'null'
          title: Target Kw
          description: Target power in kW to reduce production with.
        target_percentage:
          anyOf:
            - type: number
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Target Percentage
          description: Target percentage of max capacity to reduce production with.
        end_time:
          anyOf:
            - type: string
            - type: 'null'
          title: End Time
          description: >-
            End time for the flex request in ISO 8601 format in UTC. If not
            provided, the flex request will be applied indefinitely until a new
            request is made.
        brand_filter:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Brand Filter
          description: >-
            Filter devices by brands. If not provided, all brands will be
            considered.
      type: object
      title: DevicesPVFlexRequest
    DevicesPVFlexResponse:
      properties:
        meta:
          $ref: '#/components/schemas/DevicesPVFlexMeta'
          description: Response metadata.
      type: object
      required:
        - meta
      title: DevicesPVFlexResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DevicesPVFlexMeta:
      properties:
        energy_supplier:
          type: string
          title: Energy Supplier
          description: The energy supplier associated with the PV flex request.
      type: object
      required:
        - energy_supplier
      title: DevicesPVFlexMeta
    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'

````