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

# Update the schedule of a block

> Update the schedule of a block.

The schedule is represented as signed power-time pairs in kilowatts on a left-aligned 15-minute cadence. i.e., {"power": 100, "time": "2023-11-11T14:30:00Z"} represents an instruction to discharge at 100 kW between 2023-11-11T14:30:00 and 2023-11-11T14:45:00.

A block's schedule will be initialised with zero power instructions for every 15-minute window across its lifetime.

Only a wholesale block can have its schedule updated in this way. The market utilisation of blocks can be monitored through the `blockMetadata` field on a virtual-asset.

The supplied schedule must be compatible with the existing schedule. i.e. it must only include time-power pairs corresponding to existing time-power pairs, which can be viewed through the .../virtual-assets/{virtualAssetID}/blocks/{blockID} [get] route.

If the supplied schedule would cause the projected state of energy of the virtual-asset to go beyond allowed limits, then the entire update may be rejected.

The current projected state of energy and allowed limits can be monitored through the `.../virtual-assets/{virtualAssetID}/operational [get]` route.

Schedule updates must be posted before gate closure for the concerned delivery period. For example, updates for the 12:15:00 to 12:30:00 trading window cannot be posted after 12:10:00 for an asset with a 5m gate closure.

Schedules may be subject to validation and adjustment. If such adjustments are made, they will be visible on the `.../virtual-assets/{{virtualAssetID}}/adjustments [get]` route.



## OpenAPI

````yaml https://api.sandbox.trlyr.com/docs/doc.json put /organisations/{organisationID}/virtual-assets/{virtualAssetID}/blocks/{blockID}
openapi: 3.1.0
info:
  description: >
    This API allows clients to manage virtual-assets and blocks on the terralayr
    system.


    A virtual asset is a virtual battery, it has static parameters that dictate
    how much power it can import / export, how much energy it can store, and how
    efficiently it charges / discharges. It also has a state of charge which
    changes as the virtual asset exports and imports power.


    A block represents a slice of the power capacity of a virtual asset over
    time, and has a schedule which can be updated to control what the
    virtual-asset will do.


    Virtual assets should be kept balanced: you should manage the schedule such
    that the such that state of charge at the end of its lifetime is 50%. It is
    possible to submit schedules that do not end at 50%, but the response will
    include information about how much imbalance is left.


    ### Authorization


    All the underneath requests require a Bearer-type `Authorization` Header
    i.e. in the form : `Authorization: Bearer <YOUR_TOKEN>`.


    To retrieve a valid token you must log in to our system using a
    password-username authentication as follows:


    ```

    POST https://api.sandbox.trlyr.com/auth/public/authenticate

    ```


    with the following JSON body:


    ```

    {
        "username": "YOUR_USERNAME",
        "password": "YOUR_PASSWORD"
    }

    ```


    Your username and password are the ones you created after receiving an
    invitation to join your organisation.


    You should receive a JSON response body from which you can extract your
    token under `access_token`.


    If you have any questions, don't hesitate to contact our account manager at
    the following address: support@trlyr.com.
  title: terralayr API
  version: 1.11.3
servers:
  - description: Production API
    url: https://api.trlyr.com
  - description: Sandbox API
    url: https://api.sandbox.trlyr.com
security: []
tags:
  - name: virtual-assets
  - name: afrr
  - name: fcr
  - name: ancillary
  - name: blocks
externalDocs:
  description: ''
  url: ''
paths:
  /organisations/{organisationID}/virtual-assets/{virtualAssetID}/blocks/{blockID}:
    put:
      tags:
        - blocks
      summary: Update the schedule of a block
      description: >-
        Update the schedule of a block.


        The schedule is represented as signed power-time pairs in kilowatts on a
        left-aligned 15-minute cadence. i.e., {"power": 100, "time":
        "2023-11-11T14:30:00Z"} represents an instruction to discharge at 100 kW
        between 2023-11-11T14:30:00 and 2023-11-11T14:45:00.


        A block's schedule will be initialised with zero power instructions for
        every 15-minute window across its lifetime.


        Only a wholesale block can have its schedule updated in this way. The
        market utilisation of blocks can be monitored through the
        `blockMetadata` field on a virtual-asset.


        The supplied schedule must be compatible with the existing schedule.
        i.e. it must only include time-power pairs corresponding to existing
        time-power pairs, which can be viewed through the
        .../virtual-assets/{virtualAssetID}/blocks/{blockID} [get] route.


        If the supplied schedule would cause the projected state of energy of
        the virtual-asset to go beyond allowed limits, then the entire update
        may be rejected.


        The current projected state of energy and allowed limits can be
        monitored through the `.../virtual-assets/{virtualAssetID}/operational
        [get]` route.


        Schedule updates must be posted before gate closure for the concerned
        delivery period. For example, updates for the 12:15:00 to 12:30:00
        trading window cannot be posted after 12:10:00 for an asset with a 5m
        gate closure.


        Schedules may be subject to validation and adjustment. If such
        adjustments are made, they will be visible on the
        `.../virtual-assets/{{virtualAssetID}}/adjustments [get]` route.
      parameters:
        - description: Access token
          in: header
          name: Authorization
          required: true
          schema:
            default: Bearer <access token value>
            type: string
        - description: Organisation ID
          in: path
          name: organisationID
          required: true
          schema:
            type: string
        - description: Virtual Asset ID
          in: path
          name: virtualAssetID
          required: true
          schema:
            type: string
        - description: Block ID
          in: path
          name: blockID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockUpdate'
              description: Block update
              summary: blockUpdate
        description: Block update
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Block'
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FailedValidationResponseBody'
          description: Conflict
        '500':
          description: Internal Server Error
components:
  schemas:
    BlockUpdate:
      properties:
        schedule:
          items:
            $ref: '#/components/schemas/InstructionUpdate'
          type: array
          uniqueItems: false
      required:
        - schedule
      type: object
    Block:
      properties:
        end:
          example: '2023-11-12T00:00:00Z'
          format: dateTime
          type: string
        id:
          example: 11111111-1111-1111-1111-111111111111
          format: uuid
          type: string
        powerCapacity:
          items:
            $ref: '#/components/schemas/PowerCapacityPoint'
          type: array
          uniqueItems: false
        ratedChargePower:
          example: 1000
          format: float
          type: number
        ratedDischargePower:
          example: 1000
          format: float
          type: number
        schedule:
          items:
            $ref: '#/components/schemas/InstructionPoint'
          type: array
          uniqueItems: false
        start:
          example: '2023-11-11T00:00:00Z'
          format: dateTime
          type: string
        unitsPower:
          example: kW
          type: string
      type: object
    FailedValidationResponseBody:
      properties:
        error:
          type: string
        requiredAdjustments:
          items:
            $ref: '#/components/schemas/AdjustmentPointBody'
          type: array
          uniqueItems: false
      required:
        - error
      type: object
    InstructionUpdate:
      properties:
        power:
          example: 380
          format: float
          type: number
        time:
          example: '2023-11-11T14:30:00Z'
          format: dateTime
          type: string
      required:
        - power
        - time
      type: object
    PowerCapacityPoint:
      properties:
        chargePowerCapacity:
          example: 380
          format: float
          type: number
        dischargePowerCapacity:
          example: 380
          format: float
          type: number
        ratedChargePowerCapacity:
          example: 380
          format: float
          type: number
        ratedDischargePowerCapacity:
          example: 380
          format: float
          type: number
        time:
          example: '2023-11-11T14:30:00Z'
          format: dateTime
          type: string
      required:
        - chargePowerCapacity
        - dischargePowerCapacity
        - ratedChargePowerCapacity
        - ratedDischargePowerCapacity
        - time
      type: object
    InstructionPoint:
      properties:
        power:
          example: 380
          format: float
          type: number
        time:
          example: '2023-11-11T14:30:00Z'
          format: dateTime
          type: string
      required:
        - power
        - time
      type: object
    AdjustmentPointBody:
      properties:
        acceptedSchedule:
          example: 480
          format: float
          type: number
        adjustedSchedule:
          example: 380
          format: float
          type: number
        reason:
          example: STATE_OF_ENERGY_BOUNDARIES
          type: string
        timestamp:
          example: '2023-11-11T14:30:00Z'
          format: dateTime
          type: string
      required:
        - acceptedSchedule
        - adjustedSchedule
        - reason
        - timestamp
      type: object

````