Skip to main content
PUT
/
scripts
/
scheduled
/
{scheduledScriptId}
Update a Scheduled Script
curl --request PUT \
  --url https://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "make_backup": true,
  "description": "Nightly BGP peer maintenance (Updated)",
  "script": "/routing bgp peer enable [find name=peer1]",
  "sites": [
    "site_1AbCdEfGhIjKlMnOpQrStUv"
  ],
  "notify": [
    "auth0|5f9d4b3c2e1a0b006f8b4c5d",
    "auth0|6a0e5c4d3f2b1c007g9c5d6e"
  ],
  "test_site_id": "site_2Al5z3gXyY5f6Z7h8j9k0l1m"
}
'
import requests

url = "https://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}"

payload = {
    "make_backup": True,
    "description": "Nightly BGP peer maintenance (Updated)",
    "script": "/routing bgp peer enable [find name=peer1]",
    "sites": ["site_1AbCdEfGhIjKlMnOpQrStUv"],
    "notify": ["auth0|5f9d4b3c2e1a0b006f8b4c5d", "auth0|6a0e5c4d3f2b1c007g9c5d6e"],
    "test_site_id": "site_2Al5z3gXyY5f6Z7h8j9k0l1m"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    make_backup: true,
    description: 'Nightly BGP peer maintenance (Updated)',
    script: '/routing bgp peer enable [find name=peer1]',
    sites: ['site_1AbCdEfGhIjKlMnOpQrStUv'],
    notify: ['auth0|5f9d4b3c2e1a0b006f8b4c5d', 'auth0|6a0e5c4d3f2b1c007g9c5d6e'],
    test_site_id: 'site_2Al5z3gXyY5f6Z7h8j9k0l1m'
  })
};

fetch('https://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}",
  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([
    'make_backup' => true,
    'description' => 'Nightly BGP peer maintenance (Updated)',
    'script' => '/routing bgp peer enable [find name=peer1]',
    'sites' => [
        'site_1AbCdEfGhIjKlMnOpQrStUv'
    ],
    'notify' => [
        'auth0|5f9d4b3c2e1a0b006f8b4c5d',
        'auth0|6a0e5c4d3f2b1c007g9c5d6e'
    ],
    'test_site_id' => 'site_2Al5z3gXyY5f6Z7h8j9k0l1m'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$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://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}"

	payload := strings.NewReader("{\n  \"make_backup\": true,\n  \"description\": \"Nightly BGP peer maintenance (Updated)\",\n  \"script\": \"/routing bgp peer enable [find name=peer1]\",\n  \"sites\": [\n    \"site_1AbCdEfGhIjKlMnOpQrStUv\"\n  ],\n  \"notify\": [\n    \"auth0|5f9d4b3c2e1a0b006f8b4c5d\",\n    \"auth0|6a0e5c4d3f2b1c007g9c5d6e\"\n  ],\n  \"test_site_id\": \"site_2Al5z3gXyY5f6Z7h8j9k0l1m\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"make_backup\": true,\n  \"description\": \"Nightly BGP peer maintenance (Updated)\",\n  \"script\": \"/routing bgp peer enable [find name=peer1]\",\n  \"sites\": [\n    \"site_1AbCdEfGhIjKlMnOpQrStUv\"\n  ],\n  \"notify\": [\n    \"auth0|5f9d4b3c2e1a0b006f8b4c5d\",\n    \"auth0|6a0e5c4d3f2b1c007g9c5d6e\"\n  ],\n  \"test_site_id\": \"site_2Al5z3gXyY5f6Z7h8j9k0l1m\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://v1.api.altostrat.io/scripts/scheduled/{scheduledScriptId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"make_backup\": true,\n  \"description\": \"Nightly BGP peer maintenance (Updated)\",\n  \"script\": \"/routing bgp peer enable [find name=peer1]\",\n  \"sites\": [\n    \"site_1AbCdEfGhIjKlMnOpQrStUv\"\n  ],\n  \"notify\": [\n    \"auth0|5f9d4b3c2e1a0b006f8b4c5d\",\n    \"auth0|6a0e5c4d3f2b1c007g9c5d6e\"\n  ],\n  \"test_site_id\": \"site_2Al5z3gXyY5f6Z7h8j9k0l1m\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "018f5bda-4690-4432-8472-358b2734f19b",
  "created_by": "auth0|642b7f3b8b3b3e3e3e3e3e3e",
  "test_site_id": "site_2Al5z3gXyY5f6Z7h8j9k0l1m",
  "make_backup": true,
  "abort_if_offline": false,
  "description": "Weekly firewall rule update",
  "summary": "This script adds a firewall filter rule to drop input from a specific address list named \"blacklist\".",
  "script": "/ip firewall filter add action=drop chain=input src-address-list=blacklist",
  "status": "scheduled",
  "authorized_at": "2025-10-30T10:00:00.000000Z",
  "cancelled_at": null,
  "launch_at": "2025-11-01T02:00:00.000000Z",
  "t_minus": "in 2 days",
  "started_at": "2025-11-01T02:00:05.000000Z",
  "sites": [
    "site_1AbCdEfGhIjKlMnOpQrStUv"
  ],
  "notify": [
    "auth0|5f9d4b3c2e1a0b006f8b4c5d"
  ],
  "progress": {
    "completed": [
      "site_1AbCdEfGhIjKlMnOpQrStUv"
    ],
    "failed": [
      "site_2BcDeFgHiJkLmNoPqRsTuVw"
    ],
    "pending": [
      "site_3CdEfGhIjKlMnOpQrStUvWx"
    ]
  },
  "created_at": "2025-10-29T12:44:27.000000Z",
  "updated_at": "2025-10-29T13:05:00.000000Z"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}

Authorizations

Authorization
string
header
required

Altostrat SDX API uses JWT Bearer tokens for authentication. Obtain a token via the Authentication API and include it in the Authorization header as 'Bearer {token}'.

Path Parameters

scheduledScriptId
string<uuid>
required

The unique identifier for the scheduled script to update.

Example:

"018f5bda-4690-4432-8472-358b2734f19b"

Body

application/json
make_backup
boolean
required

If true, create a configuration backup before executing the script.

Example:

true

description
string
required

A human-readable name for the scheduled script.

Example:

"Nightly BGP peer maintenance (Updated)"

script
string
required

The full content of the MikroTik RouterOS script.

Example:

"/routing bgp peer enable [find name=peer1]"

sites
string<uuid>[]
required

An array of site IDs to target.

Example:
["site_1AbCdEfGhIjKlMnOpQrStUv"]
notify
string<uuid>[]
required

An array of user IDs to receive notifications.

Example:
[
  "auth0|5f9d4b3c2e1a0b006f8b4c5d",
  "auth0|6a0e5c4d3f2b1c007g9c5d6e"
]
test_site_id
string<uuid> | null

The unique identifier of the site designated for test runs.

Example:

"site_2Al5z3gXyY5f6Z7h8j9k0l1m"

Response

The scheduled script was updated successfully.

id
string<uuid>

The unique identifier for the scheduled script.

Example:

"018f5bda-4690-4432-8472-358b2734f19b"

created_by
string<uuid>

The user ID of the person who created the script schedule.

Example:

"auth0|642b7f3b8b3b3e3e3e3e3e3e"

test_site_id
string<uuid> | null

The unique identifier of the site designated for test runs.

Example:

"site_2Al5z3gXyY5f6Z7h8j9k0l1m"

make_backup
boolean

If true, a configuration backup will be created on each target device before the script is executed.

Example:

true

abort_if_offline
boolean

If true, the script execution will be aborted for a site if it is offline at launch time.

Example:

false

description
string

A human-readable name or description for the script schedule.

Example:

"Weekly firewall rule update"

summary
string | null

An AI-generated summary of the script's purpose.

Example:

"This script adds a firewall filter rule to drop input from a specific address list named \"blacklist\"."

script
string

The full content of the MikroTik RouterOS script to be executed.

Example:

"/ip firewall filter add action=drop chain=input src-address-list=blacklist"

status
enum<string>

The current status of the scheduled script.

Available options:
unauthorized,
scheduled,
launched,
cancelled
Example:

"scheduled"

authorized_at
string<date-time> | null

The timestamp when the script execution was authorized. Null if not yet authorized.

Example:

"2025-10-30T10:00:00.000000Z"

cancelled_at
string<date-time> | null

The timestamp when the script was cancelled.

Example:

null

launch_at
string<date-time>

The scheduled UTC date and time for the script to be executed.

Example:

"2025-11-01T02:00:00.000000Z"

t_minus
string | null

A human-readable countdown to the launch time.

Example:

"in 2 days"

started_at
string<date-time> | null

The timestamp when the script execution actually began.

Example:

"2025-11-01T02:00:05.000000Z"

sites
string<uuid>[]

A list of site IDs where the script will be executed.

notify
string<uuid>[]

A list of user IDs to notify about the script's progress and authorization requests.

progress
object

Represents the execution progress of a launched script across its target sites.

created_at
string<date-time>

The timestamp when the scheduled script was created.

Example:

"2025-10-29T12:44:27.000000Z"

updated_at
string<date-time>

The timestamp when the scheduled script was last updated.

Example:

"2025-10-29T13:05:00.000000Z"