> ## 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 by setting a price limit

When you need to create a schedule based on an energy price threshold — for example, only consuming energy when the price is below €0.05/kWh — call the [schedule-by-limit](/api-reference/anode/schedules/schedule-by-limit) endpoint.

Flatpeak uses the Location’s tariff and, if a [PV array is present](/guides/schedule/solar-forecasts), the local solar generation forecast to identify all time slots that meet your specified price level (high or low).

You must specify either the `relative` or the `absolute` parameter when making the request:

<CodeGroup>
  ```json Request example theme={"system"}
  curl --request POST \
    --url https://api.flatpeak.com/schedules/limit/loc_641b90b758fb8e6293716e40 \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
    "start_time": "2023-06-15T18:43:00Z",
    "end_time": "2023-06-16T06:00:00Z",
    "tariff_direction": "IMPORT",
    "segment": "LOW",
    "relative": 0.1,
    "absolute": 0.05
  }'
  ```

  ```json Response example (truncated) theme={"system"}
  {
    "id": "spl_65e42cdd73e9f861edda35d7",
    "object": "schedule_limit",
    "live_mode": true,
    "location_id": "loc_65e42ce4d3b813479b252160",
    "location_timezone": "Europe/London",
    "currency_code": "EUR",
    "tariff_direction": "IMPORT",
    "duration": 184,
    "data": [
      {
        "start_time": "2023-06-15T22:30:00Z",
        "end_time": "2023-06-16T01:20:00Z",
        "price": {
          "average": 4.998,
          "confidence": 1
        }
      },
      {
        "start_time": "2023-06-16T04:00:00Z",
        "end_time": "2023-06-16T06:00:00Z",
        "price": {
          "average": 5.211,
          "confidence": 0.9
        }
      }
    ]
  }
  ```
</CodeGroup>
