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

# Create consumption or export schedule for a given duration of time, speed of transfer and amount of energy required

> Creates an import, export or a combined import/export schedule for a set of devices at a location you specify. Optimised by capabilities of your equipment, energy cost and carbon footprint.



## OpenAPI

````yaml api-reference/zero/flatpeak-api-spec-zero.json POST /schedules
openapi: 3.0.3
info:
  description: Flatpeak API
  version: 2024-08-24.zero
  title: Flatpeak API
  termsOfService: https://flatpeak.com/legal
  contact:
    name: Technical Support
    email: support@flatpeak.com
    url: https://flatpeak.com/contact
  license:
    name: Apache 2.0
    url: https://flatpeak.com/legal
servers:
  - url: https://api.flatpeak.com
    description: Location
security: []
tags:
  - name: Consumption
    description: Consumption operations
  - name: Customers
    description: Customer operations
  - name: Devices
    description: Device operations
  - name: Meters
    description: Meter readings operations
  - name: Events
    description: Events operations
  - name: Login
    description: Bearer auth token operations
  - name: Connect
    description: Connect operations
  - name: Locations
    description: Location operations
  - name: Rates
    description: Rates operations
  - name: Costs
    description: Consumption cost calculations
  - name: Schedules
    description: Consumption schedules
  - name: Tariffs
    description: Tariff operations
  - name: Slots
    description: Slots operations
externalDocs:
  description: Location documentation
  url: https://docs.flatpeak.com
paths:
  /schedules:
    parameters: []
    post:
      tags:
        - Schedules
      summary: >-
        Create consumption or export schedule for a given duration of time,
        speed of transfer and amount of energy required
      description: >-
        Creates an import, export or a combined import/export schedule for a set
        of devices at a location you specify. Optimised by capabilities of your
        equipment, energy cost and carbon footprint.
      operationId: create-a-schedule
      parameters: []
      requestBody:
        $ref: '#/components/requestBodies/ScheduleCreate'
      responses:
        '200':
          $ref: '#/components/responses/Schedule'
        '403':
          $ref: '#/components/responses/403'
        '500':
          $ref: '#/components/responses/500'
      security:
        - bearerAuth: []
components:
  requestBodies:
    ScheduleCreate:
      content:
        application/json:
          schema:
            type: object
            properties:
              location_id:
                type: string
                x-stoplight:
                  id: yv0f1i184k6wm
                description: >-
                  Flatpeak location ID for which you want to generate the
                  schedule.
                example: loc_641b90b758fb8e6293716e40
              max_power:
                type: object
                x-stoplight:
                  id: y3pbpnfhj3jsh
                description: Maximum speed of power transfer for that location.
                required:
                  - units
                  - value
                properties:
                  units:
                    type: string
                    x-stoplight:
                      id: hsmyjb54l587w
                    description: >-
                      Units of measure of power transfer. Supported value is `W`
                      and `KW.`
                    example: W
                  value:
                    type: number
                    x-stoplight:
                      id: njaeburreq4f4
                    description: Speed power transfer is power.units.
                    example: 14000
              shaving_threshold:
                type: object
                x-stoplight:
                  id: qn8dwomlprei4
                description: >-
                  Tariff cap. Specifies up to what price you are willing to pay
                  to buy (or, in reverse, sell) energy.
                properties:
                  relative:
                    type: number
                    x-stoplight:
                      id: e60ay0bm8ui6x
                    example: 0.83
                    description: >-
                      Relative tariff cap. Where the highest tariff over the
                      requested period is 1 and the lowest is 0.01, provide the
                      value up to which you are willing to buy energy.
                  absolute:
                    type: number
                    x-stoplight:
                      id: avmrm8hdz5z4w
                    example: 0.123
                    description: >-
                      Absolute tariff cap in local currency. Overrides
                      `relative` value if provided.
              data:
                type: array
                x-stoplight:
                  id: szqweosyctojp
                description: This object that contains device schedule requests.
                items:
                  type: object
                  x-stoplight:
                    id: 7vj4cdqnpnw9w
                  properties:
                    device_id:
                      type: string
                      example: dev_65e6d8334c8d715963d99db3
                      description: Flatpeak device ID.
                    direction:
                      type: string
                      description: >-
                        Indicates direction you want to work with. Set to
                        `IMPORT` or `EXPORT`. Defaults to `IMPORT`.
                      example: IMPORT
                    start_time:
                      type: string
                      description: >-
                        Time when transfer of energy may begin. In RFC3339
                        format e.g. `2023-06-15T09:00:00Z` or with time-offset,
                        e.g. `2023-06-15T08:00:00+01:00`.
                      example: '2022-02-01T20:14:00Z'
                      format: date-time
                    end_time:
                      type: string
                      description: >-
                        Time when transfer of energy must be completed. In
                        RFC3339 format e.g. `2023-06-15T11:00:00Z` or with
                        time-offset, e.g. `2023-06-15T10:00:00+01:00`.
                      example: '2022-02-02T06:00:00Z'
                      format: date-time
                    max_power:
                      type: object
                      description: Requested speed of power transfer.
                      x-stoplight:
                        id: 46lqduh7dq5pz
                      properties:
                        units:
                          type: string
                          description: >-
                            Units of measure of power transfer. Supported values
                            are `W` and `KW`.
                          example: W
                        value:
                          type: number
                          example: 7000
                          description: Speed power transfer is power.units.
                    energy:
                      type: object
                      description: Energy requirement envelope.
                      required:
                        - units
                        - value
                      properties:
                        units:
                          type: string
                          example: WH
                          description: Units of measure, supported values are `WH`, `KWH`.
                        value:
                          type: number
                          description: Amount of energy required.
                          example: 24500
                          x-stoplight:
                            id: 6giwzzw08m8a8
                  required:
                    - device_id
                    - direction
                    - start_time
                    - end_time
                    - energy
            required:
              - location_id
              - max_power
  responses:
    '403':
      description: 403 bad credentials
      content:
        application/json:
          schema:
            type: object
            x-examples:
              Example:
                message: Bad credentials
            properties:
              message:
                type: string
                example: Bad credentials
          examples: {}
    '500':
      description: 500 error
      content:
        application/json:
          schema:
            type: object
            x-examples:
              '':
                message: Internal Server Error
            properties:
              message:
                type: string
                example: Internal Server Error
          examples: {}
    Schedule:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Schedule'
  schemas:
    Schedule:
      title: Schedule
      x-stoplight:
        id: dxhhdmv2uci0h
      type: object
      properties:
        id:
          type: string
          example: sch_65ea3fb185c1541f247c251e
          description: Flatpeak schedule id.
        object:
          type: string
          example: schedule
          description: Represents the object’s type.
        live_mode:
          type: boolean
          example: true
          description: >-
            Has the value true if the object exists in live mode or the value
            false if the object exists in test mode.
          x-stoplight:
            id: sazzj8q7gapwj
        location_id:
          type: string
          example: loc_641b90b758fb8e6293716e40
          description: Flatpeak location ID where this schedule applies.
        location_timezone:
          type: string
          example: Europe/London
          description: >-
            The timezone at the location, in 'tz database format'. I.e.
            'Europe/Berlin'.
          x-stoplight:
            id: zhic4kz3pwaul
        currency_code:
          type: string
          example: GBP
          description: >-
            Currency code for cost of energy measure. Always returned in large
            currency units.
        max_power:
          type: object
          description: Maximum speed of power transfer for that location.
          x-stoplight:
            id: x7rg6lrx1e2e6
          required:
            - units
            - value
          properties:
            units:
              type: string
              x-stoplight:
                id: bqelc1zmpnqgs
              example: W
              description: >-
                Units of measure of power transfer. Supported value is `W` and
                `KW.`
            value:
              type: number
              x-stoplight:
                id: h0cky74vykf0z
              example: 14000
              description: Speed power transfer is power.units.
        shaving_threshold:
          type: object
          description: >-
            Tariff cap. Specifies up to what price you are willing to pay to buy
            (or, in reverse, sell) energy.
          x-stoplight:
            id: x7rg6lrx1e2e6
          properties:
            relative:
              type: number
              x-stoplight:
                id: bqelc1zmpnqgs
              example: 0.83
              description: >-
                Relative tariff cap. Where the highest tariff over the requested
                period is 1 and the lowest is 0.01, provide the value up to
                which you are willing to buy energy. Defaults to 1.
            absolute:
              type: number
              x-stoplight:
                id: bqelc1zmpnqgs
              example: 0.123
              description: >-
                Absolute tariff cap in local currency using *large* units.
                Defaults to unlimited if no value is provided. Overrides
                `relative` value if provided.
        tariff:
          type: object
          description: Monetary cost of energy in the schedule.
          x-stoplight:
            id: x7rg6lrx1e2e6
          required:
            - value
            - confidence
          properties:
            value:
              type: number
              x-stoplight:
                id: h0cky74vykf0z
              example: 928.372
              description: Monetary energy cost in *large* currency units.
            confidence:
              type: number
              x-stoplight:
                id: bqelc1zmpnqgs
              description: >-
                Estimated confidence of data where '1' is 100% accurate and 0.1
                is 10% accurate.
              example: 1
        savings:
          type: object
          x-stoplight:
            id: x7rg6lrx1e2e6
          description: >-
            Savings provided by the schedule by applying (1) tariff shaving and
            (2) tariff-based optimisation. The shaving is applied first.
          required:
            - value
            - percentage
          properties:
            value:
              type: number
              x-stoplight:
                id: jov5sjlwe4wbj
              example: 0.0239
              description: Amount of money, in *large* currency units saved.
            percentage:
              type: number
              x-stoplight:
                id: 0psk6zhf1rh2c
              example: 1.34
              description: Percentage of cost saved.
        data:
          type: array
          description: This object that contains device schedules.
          items:
            type: object
            properties:
              device_id:
                type: string
                example: dev_664525107c44d88a37ca1ad7
                description: Flatpeak device ID.
              direction:
                type: string
                example: IMPORT
              start_time:
                type: string
                format: date-time
                example: '2022-02-01T20:14:00Z'
                description: >-
                  Time when energy transfer can begin, in timezone of the
                  original request.
              end_time:
                type: string
                format: date-time
                example: '2022-02-02T06:00:00Z'
                description: >-
                  Time when energy transfer must be completed, in timezone of
                  the original request.
              max_power:
                type: object
                description: Requested speed of power transfer.
                x-stoplight:
                  id: kua0fgzag04e0
                properties:
                  units:
                    type: string
                    example: W
                    description: >-
                      Units of measure of power transfer. Supported value is `W`
                      and `KW.`
                  value:
                    type: number
                    example: 7000
                    description: Speed power transfer is power.units.
              energy:
                type: object
                description: Amount of energy required.
                required:
                  - units
                  - value
                properties:
                  units:
                    type: string
                    example: WH
                    description: >-
                      Units of energy measure. Supported values are `WH` and
                      `KWH`.
                  value:
                    type: number
                    x-stoplight:
                      id: pqpe7b3b0o4gr
                    description: Amount of energy to be transferred.
                    example: 34000
              tariff:
                type: object
                description: Monetary value of energy.
                required:
                  - value
                  - confidence
                properties:
                  value:
                    type: number
                    example: 928.372
                    description: Monetary value in *large* currency units.
                  confidence:
                    type: number
                    description: >-
                      Estimated confidence of data where '1' is 100% accurate
                      and 0.1 is 10% accurate.
                    example: 1
              savings:
                type: object
                x-stoplight:
                  id: x7rg6lrx1e2e6
                description: >-
                  Savings provided by the schedule by applying (1) tariff
                  shaving and (2) tariff-based optimisation. The shaving is
                  applied first.
                required:
                  - value
                  - percentage
                properties:
                  value:
                    type: number
                    x-stoplight:
                      id: dd2n6dnfkaf0z
                    example: 0.2375
                    description: Amount of money, in *large* currency units saved.
                  percentage:
                    type: number
                    x-stoplight:
                      id: 8rwcpg1m35ndj
                    example: 0.11
                    description: Percentage of cost saved.
              schedule:
                type: array
                description: Core schedule object.
                items:
                  type: object
                  properties:
                    start_time:
                      type: string
                      format: date-time
                      example: '2022-02-02T02:00:00Z'
                      description: >-
                        Time when energy transfer must start, in timezone of the
                        original request.
                    end_time:
                      type: string
                      example: '2022-02-02T04:30:00Z'
                      format: date-time
                      description: >-
                        Time when energy transfer must end, in timezone of the
                        original request.
                    power:
                      type: object
                      description: Speed of power transfer.
                      required:
                        - units
                        - value
                      properties:
                        units:
                          type: string
                          example: W
                          description: Units of measure of power transfer.
                        value:
                          type: number
                          example: 11000
                          description: Speed power transfer is power.units.
                  required:
                    - start_time
                    - end_time
                    - power
            required:
              - device_id
              - direction
              - start_time
              - end_time
              - energy
              - tariff
              - savings
              - schedule
        time_created:
          type: string
          format: date-time
          example: '2022-01-24T14:15:22Z'
          description: Time when this object was created, in UTC.
        account_id:
          type: string
          x-stoplight:
            id: 1w3rwbg8008rk
          example: acc_661677911f2197045e6cf1b1
          description: Flatpeak account ID.
      required:
        - id
        - object
        - live_mode
        - location_id
        - location_timezone
        - currency_code
        - max_power
        - tariff
        - savings
        - time_created
        - account_id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authenticate with `bearer_token` you obtained from
        [/login](/api-reference/zero/login/create-a-bearer-token) endpoint.

````