Create a new policy

post
/policies

https://console.automox.com/api/policies/{id}
Request
Response
Request
Path Parameters
id
optional
integer
Policy ID for the specified policy
Headers
Content-Type: application/json
required
string
Specify json as the content type for body parameters
Authorization: Bearer
required
string
Your Automox API Key for authentication Format: Authorization: Bearer your_automox_api_key
Query Parameters
o
required
integer
Organization ID for the specified policy
Body Parameters
custom_pending_reboot_notification_message
optional
string
Custom reboot message
custom_pending_reboot_notification_message_mac
optional
string
The custom reboot message for macOS, which overrides custom_pending_reboot_notification_message string, if provided.
custom_pending_reboot_notification_max_delays
optional
integer
Maximum number of ties a user is allowed to defer the reboot. The default is 0.
custom_pending_reboot_notification_deferment_periods
optional
integer
The time period options available to defer a reboot for each deferral selection. Default values: 1, 4, 8
notify_deferred_reboot_user
optional
boolean
If true, this shows a post-install reboot notification message, if notify_reboot_deferred is also true. If notify_reboot_deferred is false or null, this will sync with the existing notify_reboot_user parameter.
notify_user_message_timeout (Optional)
optional
integer
The amount of time a patch notification appears before timing out and closing. Min: 15 min. Max: 480 min. Default is 15 minutes.
notify_deferred_reboot_user_message_timeout (Optional)
optional
integer
The amount of time a deferrable reboot notification message appears before timing out and closing. Min: 15 min. Max: 480 min. Default is 15 minutes.
notify_user_auto_deferral_enabled (Optional)
optional
boolean
If a patch notification times out, apply the highest configured patch deferral.
notify_deferred_reboot_user_auto_deferral_enabled (Optional)
optional
boolean
If a reboot notification times out, apply the highest configured reboot deferral.
name
required
string
Name of the policy
policy_type_name
required
string
Name for the policy type. Possible values: patch: Patch Policy custom: Worklet (formerly Custom Policy) required_software: Required Software Policy
organization_id
required
string
Organization ID for the specified policy
schedule_days
required
integer
Decimal value of binary day schedule See Note: Schedules
schedule_weeks_of_month
required
integer
Decimal value of binary week schedule See Note: Schedules
schedule_months
required
integer
Decimal value of binary month schedule See Note: Schedules
schedule_time
required
string
Scheduled time for automatic policy execution Format: "hh:mm"
notes
required
string
Policy notes
server_groups
optional
array
Integer array Server groups to link with the policy See Example Body
configuration
required
object
Configuration is a full object containing all of the following parameters See Example Body
auto_patch
optional
boolean
Enable or Disable automatic execution of the policy
auto_reboot
optional
boolean
Enable or Disable automatic reboots following policy execution
notify_user
required
boolean
Display notification 15 minutes before patching
notify_reboot_user
optional
boolean
Display modified notification 15 minutes before patching. This message should inform the user that a reboot will follow patching actions
missed_patch_window
optional
boolean
Enable or Disable Missed Patch Window setting
patch_rule
optional
string
Use only with Patch Policy. Possible values: all: Patch All filter: Patch All Except or Patch Only or Patch by Severity manual: Manually Approve advanced: Advanced Patch Policy (beta)
filter_type
optional
string
Use only with patch_rule of filter. Possible values: exclude: Patch All Except include: Patch Only severity: Patch by Severity
filters
optional
array
String array. Use only with filter_type of exclude or include. Use (*) for wildcard. See Example Body
severity_filter
optional
array
String array. Use only with filter_type of severity. Defines severity ratings to include in patching Format: ["low","medium","high","critical","none","unknown"]
advanced_filter
optional
array
Object array. Include one object per advanced filter line. See Note: Advanced Filter
include_optional
optional
boolean
Enable or disable inclusion of optional Windows patches for this policy NOTE: Will default to false if not included.
custom_notification_max_delays
optional
integer
Number of deferral chances before patching is forced.
custom_notification_deferment_periods
optional
array
Integer array: Deferral time periods (hours) that users can choose from. Include up to 3. All 3 must be distinct with a maximum of 24 Format: [1, 4, 8]
custom_notification_patch_message
optional
string
Message to display before a non-rebooting patch policy executes on a Windows device Maximum 125 characters
custom_notification_reboot_message
optional
string
Message to display before a rebooting patch policy executes on a Windows device. Reboot will follow patching actions. Maximum 125 characters
custom_notification_patch_message_mac
optional
string
Message to display before a non-rebooting patch policy executes on a macOS device. Maximum 70 characters
custom_notification_reboot_message_mac
optional
string
Message to display before a rebooting patch policy executes on a macOS device. Reboot will follow patching actions. Maximum 70 characters
Response
201: Created
Policy was successfully created. No content shown.

Example JSON Patch Policy Object Body

{
"name": "Modified Name",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"auto_reboot": true,
"notify_reboot_user": true,
"notify_user": true,
"missed_patch_window": true,
"patch_rule": "advanced",
"filters": ["*KB2267602*","*Exclude This Too*"],
"severity_filter": ["low","medium","high","critical","none","unknown"],
"include_optional": false,
"custom_notification_patch_message": "MODIFIED Notification Text before normal patch - Windows - Max 125 Char",
"custom_notification_reboot_message": "Notification Text before reboot patch - Windows - Max 125 Char",
"custom_notification_patch_message_mac": "Notification Text before normal patch - Mac - Max 70 Char",
"custom_notification_reboot_message_mac": "Notification Text before reboot patch - Mac - Max 70 Char",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [1, 4, 8],
"advanced_filter": [
{
"left": "patch-source",
"right": "windowsupdate",
"condition": "is"
},
{
"left": "severity",
"right": "medium",
"condition": "greater-than-or-equal-to"
}
]
},
"schedule_days": 146,
"schedule_weeks_of_month": 42,
"schedule_months": 4162,
"schedule_time": "01:00",
"notes": "Patch every Mon,Thu,Fri\n1st,3rd,5th Week\nJan,Jun,Dec",
"create_time": "2019-09-20T21:16:34+0000",
"server_groups": [23500]
}'

This example show each filter type included. Include and Exclude will use "filters". Severity will use "severity_filter". Advanced will use "advanced_filter".

Note: Schedules

Policy schedules are the decimal value of a binary representation of True/False for each day/week/month.

Example days per week:

For scheduling days of the week there will be 7 digits with a trailing zero to mark the end. This starts on Sunday and ends on Monday. 1 represents ON and 0 represents OFF for each day of the week.

Sun|Sat|Fri|Thu|Wed|Tue|Mon|TrailingZero

Every Day: 11111110 = 254

Mon/Wed/Fri only: 00101010 = 42

Example weeks per month:

Weeks are scheduled similarly to days, except there are 5 digits with a trailing zero. This starts on the 5th week of the month and ends with the 1st week of the month.

5th|4th|3rd|2nd|1st|TrailingZero

Every Week: 111110 = 62

2nd/4th weeks only: 010100 = 20

Example months per year:

Months continue the trend with 12 digits with a trailing zero. Starting with December and ending with January.

Dec|Nov|Oct|Sep|Aug|Jul|Jun|May|Apr|Mar|Feb|Jan|TrailingZero

Every Month: 1111111111110 = 8190

Mar/Jun/Sep/Dec = 1001001001000 = 4680

Note: Advanced Filter

The following filter parameters are valid for advanced filters. Anything else will return a 400.

Left Values

Condition Values

Right Values

display-name

"contains", "does-not-contain"

text string

severity

"is", "is-not", "less-than-or-equal-to", "greater-than-or-equal-to"

"other", "none", "low", "medium", "high", "critical"

patch-source

“is", "is-not"

"windowsupdate", "opera", "mozilla", "adobe", "oracle", "apple", "microsoft"

patch-os

“is", "is-not"

"windows", "mac", "linux"

type

“is", "is-not"

“upgrades", "updates", "update-rollups", "service-packs", "security-updates", "tools", "guidance", "feature-packs", "developer-kits", "definition-updates", "critical-updates", "connectors", "application"

Example Requests

cURL
Python http.client
Python requests
C#
PowerShell
cURL
curl --location --request POST 'https://console.automox.com/api/policies?o=0000' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_api_key_goes_here' \
--data-raw '{
"name": "My New Patch All",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"patch_rule": "all",
"auto_reboot": true,
"filter_type": "all",
"notify_user": true,
"evaluation_code": null,
"include_optional": false,
"remediation_code": null,
"installation_code": null,
"notify_reboot_user": true,
"notify_deferred_reboot_user": true,
"custom_notification_max_delays": 3,
"custom_notification_patch_message": "System Update: An important update will be installed.",
"custom_notification_reboot_message": "An important update will be installed; reboot may be required.",
"custom_notification_deferment_periods": [
1,
4,
8
],
"custom_notification_patch_message_mac": "System Update: An important update will be installed.",
"custom_notification_reboot_message_mac": "An important update will be installed; reboot may be required.",
"custom_pending_reboot_notification_message": "Updates require reboot: Please save your work.",
"notify_user_message_timeout": 120,
"notify_user_auto_deferral_enabled": false,
"notify_deferred_reboot_user_message_timeout": 120,
"notify_deferred_reboot_user_auto_deferral_enabled": true,
"custom_pending_reboot_notification_max_delays": 3,
"custom_pending_reboot_notification_message_mac": "Updates require reboot: Please save your work.",
"custom_pending_reboot_notification_deferment_periods": [
1,
4,
8
]
},
"schedule_days": 254,
"schedule_weeks_of_month": 62,
"schedule_months": 8190,
"schedule_time": "06:00",
"notes": ""
}'
Python http.client
import http.client
import json
conn = http.client.HTTPSConnection("console.automox.com")
payload = json.dumps({
"name": "My New Patch All",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": False,
"patch_rule": "all",
"auto_reboot": True,
"filter_type": "all",
"notify_user": True,
"evaluation_code": None,
"include_optional": False,
"remediation_code": None,
"installation_code": None,
"notify_reboot_user": True,
"notify_deferred_reboot_user": True,
"custom_notification_max_delays": 3,
"custom_notification_patch_message": "System Update: An important update will be installed.",
"custom_notification_reboot_message": "An important update will be installed; reboot may be required.",
"custom_notification_deferment_periods": [
1,
4,
8
],
"custom_notification_patch_message_mac": "System Update: An important update will be installed.",
"custom_notification_reboot_message_mac": "An important update will be installed; reboot may be required.",
"custom_pending_reboot_notification_message": "Updates require reboot: Please save your work.",
"notify_user_message_timeout": 120,
"notify_user_auto_deferral_enabled": False,
"notify_deferred_reboot_user_message_timeout": 120,
"notify_deferred_reboot_user_auto_deferral_enabled": True,
"custom_pending_reboot_notification_max_delays": 3,
"custom_pending_reboot_notification_message_mac": "Updates require reboot: Please save your work.",
"custom_pending_reboot_notification_deferment_periods": [
1,
4,
8
]
},
"schedule_days": 254,
"schedule_weeks_of_month": 62,
"schedule_months": 8190,
"schedule_time": "06:00",
"notes": ""
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_api_key_goes_here>'
}
conn.request("POST", "/api/policies?o=0000", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Python requests
import requests
import json
url = "https://console.automox.com/api/policies?o=0000"
payload = json.dumps({
"name": "My New Patch All",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": False,
"patch_rule": "all",
"auto_reboot": True,
"filter_type": "all",
"notify_user": True,
"evaluation_code": None,
"include_optional": False,
"remediation_code": None,
"installation_code": None,
"notify_reboot_user": True,
"notify_deferred_reboot_user": True,
"custom_notification_max_delays": 3,
"custom_notification_patch_message": "System Update: An important update will be installed.",
"custom_notification_reboot_message": "An important update will be installed; reboot may be required.",
"custom_notification_deferment_periods": [
1,
4,
8
],
"custom_notification_patch_message_mac": "System Update: An important update will be installed.",
"custom_notification_reboot_message_mac": "An important update will be installed; reboot may be required.",
"custom_pending_reboot_notification_message": "Updates require reboot: Please save your work.",
"notify_user_message_timeout": 120,
"notify_user_auto_deferral_enabled": False,
"notify_deferred_reboot_user_message_timeout": 120,
"notify_deferred_reboot_user_auto_deferral_enabled": True,
"custom_pending_reboot_notification_max_delays": 3,
"custom_pending_reboot_notification_message_mac": "Updates require reboot: Please save your work.",
"custom_pending_reboot_notification_deferment_periods": [
1,
4,
8
]
},
"schedule_days": 254,
"schedule_weeks_of_month": 62,
"schedule_months": 8190,
"schedule_time": "06:00",
"notes": ""
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_api_key_goes_here>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
C#
var client = new RestClient("https://console.automox.com/api/policies?o=0000");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer <your_api_key_goes_here>");
request.AddParameter("application/json", "{\n \"name\": \"My New Patch All\",\n \"policy_type_name\": \"patch\",\n \"organization_id\": 0000,\n \"configuration\": {\n \"auto_patch\": false,\n \"patch_rule\": \"all\",\n \"auto_reboot\": true,\n \"filter_type\": \"all\",\n \"notify_user\": true,\n \"evaluation_code\": null,\n \"include_optional\": false,\n \"remediation_code\": null,\n \"installation_code\": null,\n \"notify_reboot_user\": true,\n \"notify_deferred_reboot_user\": true,\n \"custom_notification_max_delays\": 3,\n \"custom_notification_patch_message\": \"System Update: An important update will be installed.\",\n \"custom_notification_reboot_message\": \"An important update will be installed; reboot may be required.\",\n \"custom_notification_deferment_periods\": [\n 1,\n 4,\n 8\n ],\n \"custom_notification_patch_message_mac\": \"System Update: An important update will be installed.\",\n \"custom_notification_reboot_message_mac\": \"An important update will be installed; reboot may be required.\",\n \"custom_pending_reboot_notification_message\": \"Updates require reboot: Please save your work.\",\n \"notify_user_message_timeout\": 120,\n \"notify_user_auto_deferral_enabled\": false,\n \"notify_deferred_reboot_user_message_timeout\": 120,\n \"notify_deferred_reboot_user_auto_deferral_enabled\": true,\n \"custom_pending_reboot_notification_max_delays\": 3,\n \"custom_pending_reboot_notification_message_mac\": \"Updates require reboot: Please save your work.\",\n \"custom_pending_reboot_notification_deferment_periods\": [\n 1,\n 4,\n 8\n ]\n },\n \"schedule_days\": 254,\n \"schedule_weeks_of_month\": 62,\n \"schedule_months\": 8190,\n \"schedule_time\": \"06:00\",\n \"notes\": \"\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
PowerShell
$apiKey = 'your_automox_api_key'
$headers = @{
"Authorization" = "Bearer $apiKey"
"Content-Type" = "application/json"
}
$url = "https://console.automox.com/api/policies/12345?o=0000"
$body = @"
{
"name": "API Created",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"auto_reboot": true,
"notify_reboot_user": true,
"notify_user": true,
"missed_patch_window": true,
"patch_rule": "advanced",
"filters": ["*KB2267602*","*Exclude This Too*"],
"severity_filter": ["low","medium","high","critical","none","unknown"],
"include_optional": true,
"custom_notification_patch_message": "Notification Text before normal patch - Windows - Max 125 Char",
"custom_notification_reboot_message": "Notification Text before reboot patch - Windows - Max 125 Char",
"custom_notification_patch_message_mac": "Notification Text before normal patch - Mac - Max 70 Char",
"custom_notification_reboot_message_mac": "Notification Text before reboot patch - Mac - Max 70 Char",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [1, 4, 8],
"notify_user_message_timeout": 120,
"notify_user_auto_deferral_enabled": false,
"notify_deferred_reboot_user_message_timeout": 120,
"notify_deferred_reboot_user_auto_deferral_enabled": true,
"advanced_filter": [
{
"left": "patch-source",
"right": "windowsupdate",
"condition": "is"
},
{
"left": "severity",
"right": "medium",
"condition": "greater-than-or-equal-to"
}
]
},
"schedule_days": 146,
"schedule_weeks_of_month": 42,
"schedule_months": 4162,
"schedule_time": "01:00",
"notes": "Patch every Mon,Thu,Fri\n1st,3rd,5th Week\nJan,Jun,Dec",
"server_groups": [23500]
}
"@
Invoke-WebRequest -Method Post -Uri $url -Headers $headers -Body $body