> ## 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 a schedule using an energy amount

When you know the amount of energy your device needs, call the [schedule-by-amount](/api-reference/anode/schedules/schedule-by-amount) endpoint.

Flatpeak uses the Location’s tariff and, when a PV array is present, a local solar generation forecast to determine the most cost-efficient time slots for energy consumption or export.

<CodeGroup>
  ```json Request example theme={"system"}
  curl --request POST \
    --url https://api.flatpeak.com/schedules/amount/loc_641b90b758fb8e6293716e40 \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
    "max_power": {
      "units": "KW",
      "value": 7000
    },
    "shaving_threshold": {
      "relative": 0.83,
      "absolute": 0.123
    },
    "data": [
      {
        "device_id": "dev_65e6d8334c8d715963d99db3",
        "tariff_direction": "IMPORT",
        "start_time": "2023-06-15T11:00:00Z",
        "end_time": "2023-06-16T11:00:00Z",
        "max_power": {
          "units": "W",
          "value": 7000
        },
        "energy": {
          "units": "KWH",
          "value": 37.2
        }
      }
    ]
  }'
  ```

  ```json Response example (truncated) theme={"system"}
  {
    "id": "sae_65ea3fb185c1541f247c251e",
    "object": "schedule_amount",
    "live_mode": true,
    "location_id": "loc_641b90b758fb8e6293716e40",
    "location_timezone": "Europe/London",
    "currency_code": "GBP",
    "max_power": {
      "units": "W",
      "value": 14000
    },
    "cost": {
      "value": 928.372,
      "confidence": 1
    },
    "savings": {
      "value": 3.0239,
      "percentage": 28.34
    },
    "data": [
      {
        "device_id": "dev_664525107c44d88a37ca1ad7",
        "tariff_direction": "IMPORT",
        "start_time": "2023-06-15T13:33:00Z",
        "end_time": "2023-06-16T04:00:00Z",
        "max_power": {
          "units": "W",
          "value": 7000
        },
        "energy": {
          "units": "WH",
          "value": 34000
        },
        "cost": {
          "value": 14.372,
          "confidence": 1
        },
        "savings": {
          "value": 3.0239,
          "percentage": 28.34
        },
        "schedule": [
          {
            "start_time": "2023-06-15T13:33:00Z",
            "end_time": "2023-06-15T18:30:00Z",
            "power": {
              "units": "W",
              "value": 7000
            }
          }
        ]
      }
    ]
  }
  ```
</CodeGroup>

<Tip>This endpoint is designed for both simple and very complex multi-device use cases - please contact [support](https://dashboard.flatpeak.com/#support) if you need assistance with the design of your implementation.</Tip>
