import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"schedules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "stop",
"stop_mode": "delete_resources",
"preserve_state": true,
"schedule_kind": "once",
"run_at": "2023-11-07T05:31:56Z",
"cron_expression": "<string>",
"timezone": "<string>",
"enabled": true,
"next_run_at": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"last_run_status": "<string>",
"last_run_detail": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Create a cluster power schedule
The bearer twin of the portal’s power-schedule create (ankra cluster power-schedules create). Files a one-off (schedule_kind once, fires at run_at) or repeated (schedule_kind cron, fires per cron_expression in timezone) stop or start of a provider-managed cluster. The body is decoded and validated exactly like the portal route’s, and the response is the cluster’s refreshed schedule listing.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/power-schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"schedules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "stop",
"stop_mode": "delete_resources",
"preserve_state": true,
"schedule_kind": "once",
"run_at": "2023-11-07T05:31:56Z",
"cron_expression": "<string>",
"timezone": "<string>",
"enabled": true,
"next_run_at": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"last_run_status": "<string>",
"last_run_detail": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
The shared create/update body. Exactly one of run_at (schedule_kind once) or cron_expression (schedule_kind cron) applies. Updates are full replaces: enabled must be sent, stop_mode must be restated for a stop schedule, and timezone for a cron schedule.
stop, start once, cron Stop schedules only: delete_resources (the full teardown), scale_to_zero (park only the workers) or pause (power off and keep the servers; k3s on Hetzner, UpCloud and DigitalOcean, and AWS and Scaleway).
delete_resources, scale_to_zero, pause A delete_resources stop captures the cluster's state first on the providers that support it.
RFC 3339 timestamp in the future; required for schedule_kind once.
Standard 5-field cron expression (or an @-descriptor) without an embedded timezone; required for schedule_kind cron.
IANA timezone name.
Required on update.
The caller's written acceptance that an enabled scale_to_zero stop deletes the data persistent volume claims keep on a worker's own disk, at every stop. Required for such a stop on a cluster whose inventory shows node-local claims (GET .../power-schedules/node-local-storage answers consent_required); without it the write is refused with 409 naming the claims. Never implied.
Response
The cluster's schedule listing after the create.
Show child attributes
Show child attributes