Search the docs
Menu
Updated Edit on GitHub

Server API: fleet

Copy as Markdown

These routes are on the server API, port 21114 (21121 in Docker). They take an API key in X-API-Key or a sign-in token; see The HTTP API.

Fleet management on the server API: resources of organizations, tasks that run on devices, workflows and compliance scans. The console's Fleet page passes its calls on to these routes.

GET /api/fleet/compliance

List the compliance state of devices.

Lists the devices the caller sees with the result of their last compliance scan. A caller held to one organization gets an empty list for the filter of another.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type What it is
org_id query string Only the devices of this organization; without it every organization the caller is a member of

200: Done (application/json)

Field Type Required What it is
success true yes
devices array of object yes
devices[].id string
devices[].device_id string
devices[].org_id string
devices[].hostname string
devices[].os string
devices[].platform string
devices[].score integer or null Percent of checks passed, null before the first scan
devices[].issues integer or null Failed checks, null before the first scan
devices[].last_scan string "" before the first scan
devices[].status string pending, ok or error; "" when no scan was asked for
Error When
401 No credential, or one that is not valid
403 The account may not do this, or not a member of this organization
404 There is no such organization

GET /api/fleet/compliance/{deviceId}

Show a device's last compliance scan.

checks and software are empty before the first scan.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
deviceId path string yes The device's ID

200: Done (application/json)

Field Type Required What it is
success true yes
id string
device_id string
hostname string
os string
score integer or null
issues integer or null
last_scan string "" before the first scan
status string pending, ok or error; "" when no scan was asked for
checks array of object
checks[].key string
checks[].ok boolean
checks[].detail string
checks[].fixable boolean
software array of object
software[].name string
software[].version string
software[].publisher string
Error When
401 No credential, or one that is not valid
403 The account may not do this, or the device is not in the caller's organization or scope
404 There is no such device (error device_not_found)

POST /api/fleet/compliance/{deviceId}/remediate

Fix what a device can fix, then scan it.

Queues a scan that first fixes the failed checks the device can fix. The result comes in when the device answers.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
deviceId path string yes The device's ID

202: The scan is queued (application/json)

Field Type Required
success true yes
accepted true yes
command_id integer yes
device_id string yes
Error When
401 No credential, or one that is not valid
403 The account may not do this, or the device is not in the caller's scope, or is NeoDesk Companion (error support_agent_restricted)
404 There is no such device (error device_not_found)
500 The command could not be queued (error command_queue_failed)

POST /api/fleet/compliance/{deviceId}/scan

Ask a device for a compliance scan.

Queues the scan for the device; the result comes in when the device answers.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
deviceId path string yes The device's ID

202: The scan is queued (application/json)

Field Type Required
success true yes
accepted true yes
command_id integer yes
device_id string yes
Error When
401 No credential, or one that is not valid
403 The account may not do this, or the device is not in the caller's scope, or is NeoDesk Companion (error support_agent_restricted)
404 There is no such device (error device_not_found)
500 The command could not be queued (error command_queue_failed)

GET /api/fleet/resources/{orgId}

List an organization's resources.

devices counts the organization's devices that get each resource, applied those whose last list they applied. The caller must be a member of the organization, unless a super admin or global admin.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
orgId path string yes The organization's ID

200: Done (application/json)

Field Type Required
success true yes
resources array of FleetResource and object yes
Error When
401 No credential, or one that is not valid
403 The account may not do this, or not a member of this organization
404 There is no such organization

POST /api/fleet/resources/{orgId}

Add a resource to an organization.

Sends every device of the organization whose resource list changed its new list. The caller must be a member of the organization, unless a super admin or global admin.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
orgId path string yes The organization's ID

Request body, application/json:

Field Type Required What it is
name string yes at most 120 characters
type string, one of printer, network_drive, dns, vpn, proxy yes
address string yes value is read when address is not given; at most 1024 characters
scope string, one of org, group, device org when not given
scope_value string For group the device group names, for device the device IDs of the organization, separated by commas; at most 1024 characters
active boolean or integer or string true when not given

201: Created (application/json)

Field Type Required What it is
success true yes
id integer yes
resource FleetResource yes
queued integer yes How many devices were sent their new list
Error When
400 The body is no JSON object, or a field is missing or not valid
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such organization

PUT /api/fleet/resources/{orgId}/{resourceId}

Change a resource of an organization.

Changes the fields the body has and sends the devices whose resource list changed their new list. The caller must be a member of the organization, unless a super admin or global admin.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
orgId path string yes The organization's ID
resourceId path integer yes The resource's ID; at least 1

Request body, application/json:

Field Type What it is
name string at most 120 characters
type string, one of printer, network_drive, dns, vpn, proxy
address string value is read when address is not given; at most 1024 characters
scope string, one of org, group, device org when not given
scope_value string For group the device group names, for device the device IDs of the organization, separated by commas; at most 1024 characters
active boolean or integer or string

200: Done (application/json)

Field Type Required
success true yes
id integer yes
resource FleetResource yes
queued integer yes
Error When
400 The body is no JSON object, or a field is not valid
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such resource in the organization

DELETE /api/fleet/resources/{orgId}/{resourceId}

Delete a resource of an organization.

The devices that had it are sent their new list. The caller must be a member of the organization, unless a super admin or global admin.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
orgId path string yes The organization's ID
resourceId path integer yes The resource's ID; at least 1

200: Done (application/json)

Field Type Required
success true yes
queued integer yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such resource in the organization

GET /api/fleet/tasks

List fleet tasks.

Lists the tasks the caller sees: of its organization, or of no organization and of the organizations it is a member of. A caller held to one organization gets an empty list for the filter of another.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type What it is
org_id query string Only the tasks of this organization
status query string Only the tasks in this state
device_id query string Only the tasks that run on this device

200: Done (application/json)

Field Type Required
success true yes
tasks array of FleetTask yes
Error When
400 A filter is not one valid text
401 No credential, or one that is not valid
403 The account may not do this, or not a member of the organization of the filter

POST /api/fleet/tasks

Create a fleet task.

An immediate task is sent to its devices at once; a once or cron task waits for its time. NeoDesk Companion devices take no fleet tasks. The task is created by the caller.

On the server API, port 21114. Needs org.manage_devices.

Request body, application/json:

Field Type Required What it is
name string yes at most 120 characters
type string, one of script, restart, update, install, file_deploy, registry yes task_type is read when type is not given
targets string yes Device IDs and device group names, at most 500, separated by commas, semicolons or line breaks (or spaces when there are none); device_id is read when targets is not given; at most 8192 characters
schedule_type string, one of immediate, once, cron immediate when not given
schedule_value string For once an RFC 3339 time or a date and time in the server's time zone; for cron a cron expression. cron is read when not given
script string What the task runs, at most 32 kB: the script for script and registry, a package name or https installer address for install, {"url": "https://...", "path": "<absolute path>", "sha256": "<optional>"} for file_deploy. payload is read when not given
retries integer or string default 0, at least 0, at most 3
timeout_seconds integer or string Seconds; default 300, at least 10, at most 3600
hold_alerts boolean Types update, install, restart and script: the console holds the alerts of the devices each run reaches, whatever started the run
hold_grace_minutes integer The grace time of the window in minutes; the console's default (15) unless set; at least 0, at most 1440

201: Created (application/json)

Field Type Required What it is
success true yes
id integer yes
task FleetTask yes
devices array of string yes The device IDs the targets resolved to
queued integer yes How many devices the task was sent to now
skipped array of string yes Devices left out
Error When
400 The body is no JSON object, a field is missing or not valid, or the devices or groups are unknown (code unknown_targets, with names) or have no devices (code no_devices)
401 No credential, or one that is not valid
403 The account may not do this, or a device is NeoDesk Companion (code support_agent_restricted)

GET /api/fleet/tasks/{taskId}

Show a fleet task with its runs.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required
success true yes
task FleetTask yes
runs array of FleetRun yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it

PUT /api/fleet/tasks/{taskId}

Change a fleet task.

Changes the fields the body has, with the checks of the create. It does not run the task.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

Request body, application/json:

Field Type What it is
name string at most 120 characters
type string, one of script, restart, update, install, file_deploy, registry task_type is read when type is not given
targets string Device IDs and device group names, at most 500, separated by commas, semicolons or line breaks (or spaces when there are none); device_id is read when targets is not given; at most 8192 characters
schedule_type string, one of immediate, once, cron immediate when not given
schedule_value string For once an RFC 3339 time or a date and time in the server's time zone; for cron a cron expression. cron is read when not given
script string What the task runs, at most 32 kB: the script for script and registry, a package name or https installer address for install, {"url": "https://...", "path": "<absolute path>", "sha256": "<optional>"} for file_deploy. payload is read when not given
retries integer or string at least 0, at most 3
timeout_seconds integer or string Seconds; at least 10, at most 3600
hold_alerts boolean Types update, install, restart and script: the console holds the alerts of the devices each run reaches, whatever started the run
hold_grace_minutes integer The grace time of the window in minutes; the console's default (15) unless set; at least 0, at most 1440

200: Done (application/json)

Field Type Required
success true yes
id integer yes
task FleetTask yes
Error When
400 The body is no JSON object, a field is not valid, or the devices or groups are unknown (code unknown_targets, with names) or have no devices (code no_devices)
401 No credential, or one that is not valid
403 The account may not do this, or a device is NeoDesk Companion
404 There is no such task, or the caller does not see it

DELETE /api/fleet/tasks/{taskId}

Delete a fleet task.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required
success true yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it

GET /api/fleet/tasks/{taskId}/output

Show a fleet task's output on each device.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required What it is
success true yes
task_id integer yes
status string yes
batch integer yes
last_run string
next_run string
output string yes All devices' output as one text: a line per device with its state, then what it printed
runs array of FleetRun yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it

POST /api/fleet/tasks/{taskId}/retry

Run a fleet task again on the devices where it failed.

Sends the task again to the devices whose run failed or timed out, NeoDesk Companion devices left out.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required What it is
success true yes
queued integer yes
status string yes The task's state now
Error When
400 No failed or timed out runs to try again
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it

POST /api/fleet/tasks/{taskId}/run

Run a fleet task now.

Starts the task once now on the devices it names, outside its schedule. Its schedule stays as it is. A device that is a NeoDesk Companion is left out.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required What it is
success true yes
queued integer yes How many devices got the task
skipped array of string yes Devices left out: NeoDesk Companion devices, and devices that have not finished an earlier run
status string yes The task's state now
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it
409 The task is still running

POST /api/fleet/tasks/{taskId}/cancel

Cancel the run of a fleet task.

Cancels the open runs of the task's last run: a device that has not started it skips it, and the answer of a device that has is not taken. The runs and the task show as cancelled.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
taskId path integer yes The task's ID; at least 1

200: Done (application/json)

Field Type Required What it is
success true yes
cancelled integer yes How many devices' runs were cancelled
status string yes The task's state now: cancelled
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such task, or the caller does not see it
409 The task is not running

GET /api/fleet/workflows

List fleet workflows.

Lists the workflows the caller sees, without their steps.

On the server API, port 21114. Needs org.manage_devices.

200: Done (application/json)

Field Type Required What it is
success true yes
workflows array of object yes
workflows[].id integer
workflows[].name string
workflows[].created_by string
workflows[].created_at string (date-time)
workflows[].updated_at string (date-time)
workflows[].steps integer How many steps the workflow has
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission

POST /api/fleet/workflows

Create a fleet workflow.

On the server API, port 21114. Needs org.manage_devices.

Request body, application/json:

FleetWorkflowBody and object.

201: Created (application/json)

Field Type Required
success true yes
id integer yes
data FleetWorkflow yes
Error When
400 The body is no JSON object, the name is missing or too long, or the steps can't be saved
401 No credential, or one that is not valid
403 The credential's role lacks the permission

GET /api/fleet/workflows/{workflowId}

Show a fleet workflow with its steps.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
workflowId path integer yes The workflow's ID; at least 1

200: Done (application/json)

Field Type Required
success true yes
data FleetWorkflow yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such workflow, or the caller does not see it

PUT /api/fleet/workflows/{workflowId}

Change a fleet workflow.

Changes the name, the steps or the connections the body has.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
workflowId path integer yes The workflow's ID; at least 1

Request body, application/json:

FleetWorkflowBody.

200: Done (application/json)

Field Type Required
success true yes
id integer yes
data FleetWorkflow yes
Error When
400 The body is no JSON object, the name is not valid, or the steps can't be saved
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such workflow, or the caller does not see it

DELETE /api/fleet/workflows/{workflowId}

Delete a fleet workflow.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
workflowId path integer yes The workflow's ID; at least 1

200: Done (application/json)

Field Type Required
success true yes
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such workflow, or the caller does not see it

POST /api/fleet/workflows/{workflowId}/execute

Run a fleet workflow, or try it with dry_run.

Walks the workflow from its triggers and creates a task for each action on the devices left at that step. With dry_run it only says what it would run. The steps of the body count when it has nodes; otherwise the saved ones do. A run of a saved workflow goes into its history.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
workflowId path string yes The workflow's ID, or draft for a workflow that was never saved

Request body, application/json:

Field Type Required What it is
dry_run boolean default false
name string The name of a draft
nodes array of object
nodes[].id string or number yes
nodes[].type string, one of action_file_deploy, action_install, action_message, action_restart, action_script, cond_os, cond_threshold, cond_time_window, result_alert, result_chain, result_log, transform_delay, transform_filter, transform_parse, trigger_event, trigger_manual, trigger_schedule yes
nodes[].label string
nodes[].config object The step's settings, such as targets and cron of a trigger
connections array of object
connections[].from string or number yes A step's id
connections[].to string or number yes A step's id; never a trigger

200: Done (application/json)

Field Type Required What it is
success true yes
dry_run boolean yes
output string yes What the run did or would do, a line per step
tasks array of integer yes The IDs of the tasks created
problems array of string yes What is wrong with the workflow; a dry run lists them here
Error When
400 The body is no JSON object, the steps can't be read, or a run that is not dry found problems (then with output and problems)
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such workflow, or the caller does not see it

GET /api/fleet/workflows/{workflowId}/history

Show a fleet workflow's last 50 runs.

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
workflowId path integer yes The workflow's ID; at least 1

200: Done (application/json)

Field Type Required What it is
success true yes
history array of object yes
history[].id integer
history[].workflow_id integer
history[].dry_run boolean
history[].status string, one of ok, problems
history[].output string
history[].tasks array of integer The IDs of the tasks the run created
history[].started_by string Who ran it; schedule:<creator> for a scheduled run
history[].created_at string (date-time)
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such workflow, or the caller does not see it

Type to search pages, sections, commands and settings.