Set this battery's schedule
Set or replace the schedule on this battery. The schedule’s contents are device config, so they are written on the device itself rather than posted to a separate resource. The body is a non-empty slots array (each slot an at absolute-timestamp variant or a time wall-clock variant), an optional recurrence rule, and a schedule-level IANA timezone for time-variant slots. The route is published ahead of the scheduler; every call returns 501 until it lands.
curl --request PUT \
--url 'https://api.amps.ai/battery/device_abc123/schedule' \
--header 'x-api-key: amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'content-type: application/json' \
--data '{
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
]
}'const response = await fetch('https://api.amps.ai/battery/device_abc123/schedule', {
method: 'PUT',
headers: {
'x-api-key': 'amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx',
'content-type': 'application/json',
},
body: JSON.stringify({
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
]
}),
});
const data = await response.json();import requests
url = 'https://api.amps.ai/battery/device_abc123/schedule'
headers = {
'x-api-key': 'amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx',
'content-type': 'application/json',
}
payload = {
"timezone": "Europe/London",
"recurrence": {
"rule": "daily",
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent",
},
},
},
],
}
response = requests.put(url, headers=headers, json=payload)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.amps.ai/battery/{deviceId}/schedule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'timezone' => 'Europe/London',
'recurrence' => [
'rule' => 'daily'
],
'slots' => [
[
'time' => '00:30',
'duration' => 'PT5H',
'command' => 'charge',
'parameters' => [
'target' => [
'value' => 100,
'unit' => 'percent'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.amps.ai/battery/{deviceId}/schedule"
payload := strings.NewReader("{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.amps.ai/battery/{deviceId}/schedule")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amps.ai/battery/{deviceId}/schedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sched_abc123",
"deviceId": "device_abc123",
"deviceType": "battery",
"state": "active",
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
],
"updatedAt": "2026-06-01T12:00:00.000Z",
"nextFireAt": "2026-06-02T00:30:00.000Z"
}Authorizations
Path Parameters
The unique identifier for the battery device.
"device_abc123"
Body
The schedule to set on the device: a non-empty slots array, an optional recurrence, and an optional timezone (required for time-variant slots). No deviceId in the body; the device is the URL.
The body is of type string.
Response
Schedule set on the device.
curl --request PUT \
--url 'https://api.amps.ai/battery/device_abc123/schedule' \
--header 'x-api-key: amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'content-type: application/json' \
--data '{
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
]
}'const response = await fetch('https://api.amps.ai/battery/device_abc123/schedule', {
method: 'PUT',
headers: {
'x-api-key': 'amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx',
'content-type': 'application/json',
},
body: JSON.stringify({
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
]
}),
});
const data = await response.json();import requests
url = 'https://api.amps.ai/battery/device_abc123/schedule'
headers = {
'x-api-key': 'amps_sk_test_xxxxxxxxxxxxxxxxxxxxxxxx',
'content-type': 'application/json',
}
payload = {
"timezone": "Europe/London",
"recurrence": {
"rule": "daily",
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent",
},
},
},
],
}
response = requests.put(url, headers=headers, json=payload)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.amps.ai/battery/{deviceId}/schedule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'timezone' => 'Europe/London',
'recurrence' => [
'rule' => 'daily'
],
'slots' => [
[
'time' => '00:30',
'duration' => 'PT5H',
'command' => 'charge',
'parameters' => [
'target' => [
'value' => 100,
'unit' => 'percent'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.amps.ai/battery/{deviceId}/schedule"
payload := strings.NewReader("{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.amps.ai/battery/{deviceId}/schedule")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amps.ai/battery/{deviceId}/schedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timezone\": \"Europe/London\",\n \"recurrence\": {\n \"rule\": \"daily\"\n },\n \"slots\": [\n {\n \"time\": \"00:30\",\n \"duration\": \"PT5H\",\n \"command\": \"charge\",\n \"parameters\": {\n \"target\": {\n \"value\": 100,\n \"unit\": \"percent\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sched_abc123",
"deviceId": "device_abc123",
"deviceType": "battery",
"state": "active",
"timezone": "Europe/London",
"recurrence": {
"rule": "daily"
},
"slots": [
{
"time": "00:30",
"duration": "PT5H",
"command": "charge",
"parameters": {
"target": {
"value": 100,
"unit": "percent"
}
}
}
],
"updatedAt": "2026-06-01T12:00:00.000Z",
"nextFireAt": "2026-06-02T00:30:00.000Z"
}