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

# Find lowest or highest price periods by specifying required duration of time

> For example, you can find the lowest-priced 5 hours within a given period of time. The slot may be split into multiple segments.



## OpenAPI

````yaml api-reference/zero/flatpeak-api-spec-zero.json GET /slots/time/{id}
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:
  /slots/time/{id}:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Flatpeak Location ID
    get:
      tags:
        - Slots
      summary: >-
        Find lowest or highest price periods by specifying required duration of
        time
      description: >-
        For example, you can find the lowest-priced 5 hours within a given
        period of time. The slot may be split into multiple segments.
      operationId: get-slots-time
      parameters:
        - $ref: '#/components/parameters/start_time'
        - $ref: '#/components/parameters/end_time'
        - $ref: '#/components/parameters/direction'
        - $ref: '#/components/parameters/segment'
        - schema:
            type: number
          in: query
          name: duration
          description: >-
            Amount of time in minutes you need with lowest or highest (set
            segment=HIGH/LOW) tariff over requested period.
          required: true
      responses:
        '200':
          $ref: '#/components/responses/SlotTime'
        '400':
          description: Bad Request
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '422':
          $ref: '#/components/responses/422'
        '500':
          $ref: '#/components/responses/500'
      security:
        - bearerAuth: []
components:
  parameters:
    start_time:
      name: start_time
      in: query
      schema:
        type: string
        example: '2023-06-15T09:00:00Z'
      description: >-
        Time when data will start must be in RFC3339 format, e.g.,
        `2023-06-15T09:00:00Z` or with time offset, e.g.,
        `2023-06-15T08:00:00+01:00`. Use either Zulu time (UTC) or time offset;
        if time offsets differ, `end_time` takes priority. **When making a GET
        request, values with offsets must be URL-encoded**.
    end_time:
      name: end_time
      in: query
      required: true
      schema:
        type: string
        example: '2023-06-15T23:00:00Z'
      description: >-
        Time when data will end, in RFC3339 format, e.g. `2023-06-15T13:00:00Z`
        or with time offset, e.g. `2023-06-15T12:00:00+01:00`. Use either Zulu
        time (UTC) or time offset; if time offsets differ, `end_time` takes
        priority. The maximum period between start_time and end_time for a
        single request is 90 days. **When making a GET request, values with
        offsets must be URL-encoded**.
    direction:
      name: direction
      in: query
      schema:
        type: string
        example: IMPORT
        default: IMPORT
      description: >-
        Indicates direction you want to work with. Set to `IMPORT` or `EXPORT`.
        Defaults to `IMPORT`.
    segment:
      name: segment
      in: query
      required: true
      schema:
        type: string
        example: LOW
      description: >-
        Set to `HIGH` to get the most expensive rate segment and to `LOW` to get
        the cheapest segment.
  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: {}
    '404':
      description: 404 response
      content:
        application/json:
          schema:
            type: object
            x-examples:
              Example:
                message: Not Found
            properties:
              message:
                type: string
                example: Not Found
          examples: {}
    '422':
      description: 412 Data not available
      content:
        application/json:
          schema:
            type: object
            x-examples:
              Example:
                object: error
                type: api_error
                live_mode: false
                time_created: '2022-01-24T14:15:22.003'
                code: country_code_missing
                message: Country code is required
            properties:
              message:
                type: string
                example: Connect is processing link to tariff source.
    '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: {}
    SlotTime:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SlotTime'
  schemas:
    SlotTime:
      type: object
      x-stoplight:
        id: r894wd71k1f6u
      x-examples: {}
      x-tags:
        - Rates
      title: SlotTime
      description: This object is a container for tariff slots response.
      properties:
        id:
          type: string
          description: Flatpeak unique object `id`.
          example: sta_65e42cdd73e9f861edda35d7
        object:
          type: string
          description: |-

            Represents the object's type.
          example: slot_time
        live_mode:
          type: boolean
          description: >-
            Has the value `true` if the object exists in live mode or the value
            false if the object exists in test mode.
        location_id:
          type: string
          description: The unique Flatpeak ID of the location.
          x-stoplight:
            id: 0grw6kx1kien5
          example: loc_65e42ce4d3b813479b252160
        location_timezone:
          type: string
          description: >-
            The timezone at the location, in 'tz database format'. I.e.
            'Europe/Berlin'.
          x-stoplight:
            id: qew0bifiwrkx7
          example: Europe/London
        currency_code:
          type: string
          description: Currency at the location in ISO 4217.
          x-stoplight:
            id: aomadeld01p2u
          example: EUR
        direction:
          type: string
          description: Direction of tariff. Supported options are `IMPORT` and `EXPORT`.
          x-stoplight:
            id: nwrbo35d5kqyt
          example: IMPORT
        next_update:
          type: string
          description: >-
            Time when we recommend fetching new rates. In the format of the
            request, e.g. UTC or time-offset.
          example: '2023-06-18T23:00:00Z'
        request:
          type: object
          x-stoplight:
            id: ufwxiuviuite9
          description: Your original request.
          required:
            - direction
            - segment
            - duration
            - start_time
            - end_time
          properties:
            direction:
              type: string
              x-stoplight:
                id: j0dqv9394h193
              description: Indicates tariff direction you requested.
              example: IMPORT
            segment:
              type: string
              x-stoplight:
                id: 580cbvdtc49k7
              example: LOW
              description: Indicates HIGH or LOW segment that was requested.
            duration:
              type: number
              x-stoplight:
                id: 7v6itfcq1y44r
              example: 60
              description: Indicates the amount of time in minutes that was requested.
            start_time:
              type: string
              x-stoplight:
                id: weunc52x0el1a
              example: '2022-05-24T14:15:22Z'
              description: >-
                Time when data will start. In the format of the request, e.g.
                UTC or time-offset.
            end_time:
              type: string
              x-stoplight:
                id: 1edb75l8i8e1y
              description: >-
                Time when data will end. In the format of the request, e.g. UTC
                or time-offset.
              example: '2022-05-24T16:15:22Z'
        data:
          type: array
          description: Slots response data.
          items:
            type: object
            x-stoplight:
              id: atpz6bpok2p95
            properties:
              start_time:
                type: string
                x-stoplight:
                  id: zgvxy5p88qlr1
                description: >-
                  Time when slot period begins, in timezone of the original
                  request.
                example: '2024-05-20T00:00:00Z'
              end_time:
                type: string
                x-stoplight:
                  id: qeowyba4oeg0n
                description: >-
                  Time when slot period ends, in timezone of the original
                  request.
                example: '2024-05-20T05:30:00Z'
              tariff:
                type: object
                x-stoplight:
                  id: 46fm9lyt6zgpx
                description: The tariff slots object.
                required:
                  - rate_avg
                  - confidence
                properties:
                  rate_avg:
                    type: number
                    x-stoplight:
                      id: l3web5o7pqcys
                    description: Average tariff rate in the slot, in large currency units.
                    example: 3.221
                  confidence:
                    type: number
                    x-stoplight:
                      id: vfh0oev33t7tc
                    description: >-
                      Estimated confidence of data where '1' is 100% accurate
                      and 0.1 is 10% accurate.
                    example: 1
            required:
              - start_time
              - end_time
              - tariff
        time_created:
          type: string
          description: Time when this response was calculated. In UTC.
          format: date-time
          example: '2024-05-23T15:14:22Z'
        account_id:
          type: string
          x-stoplight:
            id: js64f97p2gpks
          example: acc_661677911f2197045e6cf1b1
          description: Flatpeak account ID.
      required:
        - id
        - object
        - live_mode
        - location_id
        - location_timezone
        - currency_code
        - direction
        - next_update
        - request
        - data
        - 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.

````