{"openapi":"3.1.0","info":{"title":"Level v2 REST API","version":"v2"},"tags":[{"name":"Devices","description":"Devices with the Level agent installed."},{"name":"Groups","description":"The group hierachy that contains devices."},{"name":"Alerts","description":"Alerts generated by monitoring devices."},{"name":"Automations","description":"Operations on automations."},{"name":"Tags","description":"Tags that can be applied to devices."},{"name":"Custom Fields","description":"Custom fields that can have values assigned to them."},{"name":"Custom Field Values","description":"Values assigned to custom fields for the organization, groups, and devices."}],"paths":{"/v2/alerts":{"get":{"summary":"List alerts","tags":["Alerts"],"operationId":"listAlerts","security":[{"api_key":[]}],"description":"Returns a list of your alerts.","parameters":[{"name":"device_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include alerts for the specified device_id."},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","resolved"]},"description":"Filter to only include alerts with the given status."},{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/alert"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}}}}},"/v2/alerts/{id}":{"get":{"summary":"Show alert","tags":["Alerts"],"operationId":"showAlert","security":[{"api_key":[]}],"description":"Retrieves the details of an existing alert.","parameters":[{"name":"id","in":"path","description":"The ID of the alert to retrieve.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/alert"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}}}},"/v2/alerts/{id}/resolve":{"post":{"summary":"Resolve alert","tags":["Alerts"],"operationId":"resolveAlert","security":[{"api_key":[]}],"description":"Resolves an active alert. If the alert is already resolved, this is a no-op and returns the alert as-is.","parameters":[{"name":"id","in":"path","description":"The ID of the alert to resolve.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/alert"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}}}},"/v2/custom_field_values":{"get":{"summary":"List custom field values","tags":["Custom Field Values"],"operationId":"listCustomFieldValues","security":[{"api_key":[]}],"description":"Returns a list of custom field values for the organization, groups, or devices.","parameters":[{"name":"assigned_to_id","in":"query","required":false,"schema":{"type":"string","nullable":true},"description":"Filter to only include custom field values for the specified object. If not provided, global custom field values for the organization are returned. Otherwise, the ID should represent a group or device whose assigned custom field values will be returned."},{"name":"custom_field_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include the value for the specified custom field."},{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/custom_field_value"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}}}},"patch":{"summary":"Update custom field value","tags":["Custom Field Values"],"operationId":"updateCustomFieldValue","security":[{"api_key":[]}],"description":"Set a custom field value for the organization, group, or device.","parameters":[],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/custom_field_value"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_id","value"],"properties":{"custom_field_id":{"type":"string","description":"The ID of the custom field to set the value for."},"assigned_to_id":{"type":"string","nullable":true,"description":"The ID of the object to set the value for. If not provided, the value will be set globally for the organization. Otherwise, the ID should represent a group or device whose custom field value will be set."},"value":{"type":"string","description":"The value to set for the custom field."},"force":{"type":"boolean","description":"When 'force' is true, the provided value will override any custom field values that are set for descendants of the assigned_to_id. Otherwise, the value will be set only for the assigned_to_id and any descendants that don't have an explicit custom field value set."}}}}},"required":true}},"delete":{"summary":"Delete custom field value","tags":["Custom Field Values"],"operationId":"deleteCustomFieldValue","security":[{"api_key":[]}],"description":"Deletes a custom field value for the organization, group, or device.","parameters":[],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custom_field_id"],"properties":{"custom_field_id":{"type":"string","description":"The ID of the custom field to delete the value for."},"assigned_to_id":{"type":"string","nullable":true,"description":"The ID of the object to delete the value for. If not provided, the value will be deleted globally for the organization. Otherwise, the ID should represent a group or device whose custom field value will be deleted."},"force":{"type":"boolean","description":"When 'force' is true, the value will be deleted for all descendants of the assigned_to_id. Otherwise, the value will be deleted only for the assigned_to_id and any descendants that don't have an explicit custom field value set."}}}}},"required":true}}},"/v2/custom_fields":{"get":{"summary":"List custom fields","tags":["Custom Fields"],"operationId":"listCustomFields","security":[{"api_key":[]}],"description":"Returns a list of custom fields.","parameters":[{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/custom_field"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}}}},"post":{"summary":"Create custom field","tags":["Custom Fields"],"operationId":"createCustomField","security":[{"api_key":[]}],"description":"Creates a custom field.","parameters":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/custom_field"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Region","description":"The name of the custom field."},"admin_only":{"type":"boolean","example":false,"description":"When 'admin_only' is true, this field's value can only be viewed or edited by an admin."}}}}},"required":true}}},"/v2/custom_fields/{id}":{"get":{"summary":"Show custom field","tags":["Custom Fields"],"operationId":"showCustomField","security":[{"api_key":[]}],"description":"Retrieves the details of an existing custom field.","parameters":[{"name":"id","in":"path","description":"The ID of the custom field.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/custom_field"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}}},"patch":{"summary":"Update custom field","tags":["Custom Fields"],"operationId":"updateCustomField","security":[{"api_key":[]}],"description":"Updates a custom field.","parameters":[{"name":"id","in":"path","description":"The ID of the custom field.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/custom_field"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"Region","description":"The name of the custom field."},"admin_only":{"type":"boolean","example":false,"description":"When 'admin_only' is true, this field's value can only be viewed or edited by an admin."}}}}},"required":true}},"delete":{"summary":"Delete custom field","tags":["Custom Fields"],"operationId":"deleteCustomField","security":[{"api_key":[]}],"description":"Deletes a custom field.","parameters":[{"name":"id","in":"path","description":"The ID of the custom field.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v2/devices":{"get":{"summary":"List devices","tags":["Devices"],"operationId":"listDevices","security":[{"api_key":[]}],"description":"Returns a list of your devices.","parameters":[{"name":"group_id","in":"query","required":false,"schema":{"type":"string","nullable":true},"description":"Filter to only include devices with the given parent group id. If not provided, all devices are returned. If 'null' is provided, only devices without a parent group are returned."},{"name":"ancestor_group_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include devices with the given group id as an ancestor."},{"name":"tag_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include devices that have the specified tag."},{"name":"hostname","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include devices with the specified hostname."},{"name":"serial_number","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include devices with the specified serial number."},{"name":"include_operating_system","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed operating system information in the response."},{"name":"include_cpus","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed CPU information in the response."},{"name":"include_memory","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed memory information in the response."},{"name":"include_disks","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed disk and disk partitioninformation in the response."},{"name":"include_network_interfaces","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed network interface information in the response."},{"name":"include_motherboard","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include motherboard information in the response."},{"name":"include_security","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed security information in the response."},{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/device"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}}}}},"/v2/devices/{id}":{"get":{"summary":"Show device","tags":["Devices"],"operationId":"showDevice","security":[{"api_key":[]}],"description":"Retrieves the details of an existing device.","parameters":[{"name":"id","in":"path","description":"The ID of the device to retrieve.","required":true,"schema":{"type":"string"}},{"name":"include_operating_system","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed operating system information in the response."},{"name":"include_cpus","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed CPU information in the response."},{"name":"include_memory","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed memory information in the response."},{"name":"include_disks","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed disk and disk partitioninformation in the response."},{"name":"include_network_interfaces","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed network interface information in the response."},{"name":"include_motherboard","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include motherboard information in the response."},{"name":"include_security","in":"query","required":false,"schema":{"type":"boolean"},"description":"Include detailed security information in the response."}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/device"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}}},"delete":{"summary":"Delete device","tags":["Devices"],"operationId":"deleteDevice","security":[{"api_key":[]}],"description":"Deletes the specified device.","parameters":[{"name":"id","in":"path","description":"The ID of the device to delete.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}},"patch":{"summary":"Update device","tags":["Devices"],"operationId":"updateDevice","security":[{"api_key":[]}],"description":"Updates the specified device.","parameters":[{"name":"id","in":"path","description":"The ID of the device to update.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/device"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the device."},"notes":{"type":"string","description":"The notes for the device."},"group_id":{"type":"string","nullable":true,"description":"The ID of the group to assign the device to. If null, the device will be removed from its current group."}}}}},"required":true}}},"/v2/groups/{id}/devices":{"post":{"summary":"Assign devices to group","tags":["Groups"],"operationId":"assignGroupDevices","security":[{"api_key":[]}],"description":"Assigns the specified devices to the given group.","parameters":[{"name":"id","in":"path","description":"ID of the group.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Assigned","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"$ref":"#/components/schemas/group"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["device_ids"],"properties":{"device_ids":{"type":"array","items":{"type":"string"},"description":"An array of device IDs to assign to the group."}}}}},"required":true}},"delete":{"summary":"Remove devices from group","tags":["Groups"],"operationId":"removeGroupDevices","security":[{"api_key":[]}],"description":"Removes the specified devices from the group.","parameters":[{"name":"id","in":"path","description":"ID of the group.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Removed"},"401":{"description":"Unauthorized"},"422":{"description":"Unprocessable entity"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["device_ids"],"properties":{"device_ids":{"type":"array","items":{"type":"string"},"description":"An array of device IDs to remove from the group."}}}}},"required":true}}},"/v2/groups":{"get":{"summary":"List groups","tags":["Groups"],"operationId":"listGroups","security":[{"api_key":[]}],"description":"Returns a list of your groups.","parameters":[{"name":"parent_id","in":"query","required":false,"schema":{"type":"string","nullable":true},"description":"Filter to only include groups with the given parent id. If not provided, all groups are returned. If 'null' is provided, only root groups are returned."},{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/group"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}}}},"post":{"summary":"Create group","tags":["Groups"],"operationId":"createGroup","security":[{"api_key":[]}],"description":"Creates a new group.","parameters":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/group"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Servers","description":"The name of the group."},"parent_id":{"type":"string","nullable":true,"description":"The parent group ID. If not provided, or null, a root group will be created."}}}}},"required":true}}},"/v2/groups/{id}":{"get":{"summary":"Show group","tags":["Groups"],"operationId":"showGroup","security":[{"api_key":[]}],"description":"Retrieves the details of an existing group.","parameters":[{"name":"id","in":"path","description":"The ID of the group to retrieve.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/group"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}}},"patch":{"summary":"Update group","tags":["Groups"],"operationId":"updateGroup","security":[{"api_key":[]}],"description":"Updates an existing group.","parameters":[{"name":"id","in":"path","description":"The ID of the group to update.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/group"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"Renamed Group","description":"The name of the group."},"parent_id":{"type":"string","nullable":true,"description":"The parent group ID. If not provided, or null, the group will be moved to the root level."}}}}},"required":true}},"delete":{"summary":"Delete group","tags":["Groups"],"operationId":"deleteGroup","security":[{"api_key":[]}],"description":"Deletes an existing group.","parameters":[{"name":"id","in":"path","description":"The ID of the group to delete.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v2/tags/{id}/devices":{"post":{"summary":"Tag devices","tags":["Tags"],"operationId":"tagDevices","security":[{"api_key":[]}],"description":"Applies a tag to the provided devices.","parameters":[{"name":"id","in":"path","description":"ID of the tag to apply.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tagged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/tag"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["device_ids"],"properties":{"device_ids":{"type":"array","items":{"type":"string"},"description":"An array of device IDs to tag."}}}}},"required":true}},"delete":{"summary":"Remove tag from devices","tags":["Tags"],"operationId":"removeTagFromDevices","security":[{"api_key":[]}],"description":"Removes a tag from the provided devices.","parameters":[{"name":"id","in":"path","description":"ID of the tag to remove.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Removed"},"401":{"description":"Unauthorized"},"422":{"description":"Unprocessable entity"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["device_ids"],"properties":{"device_ids":{"type":"array","items":{"type":"string"},"description":"An array of device IDs to remove the tag from."}}}}},"required":true}}},"/v2/tags":{"get":{"summary":"List tags","tags":["Tags"],"operationId":"listTags","security":[{"api_key":[]}],"description":"Returns a list of tags.","parameters":[{"name":"device_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to only include tags for the specified device. If not provided, all tags are returned."},{"name":"limit","in":"query","required":false,"schema":{"$ref":"#/components/schemas/limit"}},{"name":"starting_after","in":"query","required":false,"schema":{"$ref":"#/components/schemas/starting_after"}},{"name":"ending_before","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ending_before"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/tag"}},"has_more":{"$ref":"#/components/schemas/has_more"}}}}}}}},"post":{"summary":"Create tag","tags":["Tags"],"operationId":"createTag","security":[{"api_key":[]}],"description":"Creates a new tag.","parameters":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/tag"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"The tag name."}}}}},"required":true}}},"/v2/tags/{id}":{"get":{"summary":"Show tag","tags":["Tags"],"operationId":"showTag","security":[{"api_key":[]}],"description":"Retrieves a tag.","parameters":[{"name":"id","in":"path","description":"The ID of the tag to retrieve.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/tag"}}}}}},"patch":{"summary":"Update tag","tags":["Tags"],"operationId":"updateTag","security":[{"api_key":[]}],"description":"Updates an existing tag.","parameters":[{"name":"id","in":"path","description":"The ID of the tag to update.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/tag"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the tag."}}}}},"required":true}},"delete":{"summary":"Delete tag","tags":["Tags"],"operationId":"deleteTag","security":[{"api_key":[]}],"description":"Deletes a tag.","parameters":[{"name":"id","in":"path","description":"The ID of the tag to delete.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v2/automations/webhooks/{token}":{"post":{"summary":"Trigger webhook","tags":["Automations"],"operationId":"triggerWebhook","security":[{"api_key":[]}],"description":"Triggers an automation via a webhook.","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"},"description":"The token of the webhook to trigger."}],"responses":{"200":{"description":"Example response"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Bad request"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Access denied"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Record not found"}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"device_ids":{"type":"array","items":{"type":"string"},"description":"Trigger the automation for the specified devices. Conditions on the trigger will still be applied."}},"additionalProperties":{"type":"string","description":"Additional parameters can be mapped to variables if configured on the webhook trigger."},"example":{"device_ids":["Z2lkOi8vYXBwL0RldmljZS8x"],"email":"user@example.com","count":"42"}}}}}}}},"webhooks":{"alert_active":{"post":{"summary":"Alert Active Webhook","description":"Sent when an alert becomes active","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/alert_webhook_event"}}}}}},"alert_resolved":{"post":{"summary":"Alert Resolved Webhook","description":"Sent when an alert is resolved","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/alert_webhook_event"}}}}}},"device_created":{"post":{"summary":"Device Created Webhook","description":"Sent when a device is created","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/device_webhook_event"}}}}}},"device_updated":{"post":{"summary":"Device Updated Webhook","description":"Sent when a device is updated","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/device_webhook_event"}}}}}},"device_deleted":{"post":{"summary":"Device Deleted Webhook","description":"Sent when a device is deleted","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/device_webhook_event"}}}}}},"group_created":{"post":{"summary":"Group Created Webhook","description":"Sent when a group is created","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/group_webhook_event"}}}}}},"group_updated":{"post":{"summary":"Group Updated Webhook","description":"Sent when a group is updated","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/group_webhook_event"}}}}}},"group_deleted":{"post":{"summary":"Group Deleted Webhook","description":"Sent when a group is deleted","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/group_webhook_event"}}}}}}},"servers":[{"url":"https://api.level.io"}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"limit":{"type":"string","example":"20","description":"A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.\n"},"starting_after":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlLzE","description":"A cursor for use in pagination. starting_after is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with ID '1234', your subsequent call can include 'starting_after=1234' in order to fetch the next page of the list."},"ending_before":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlLzIx","description":"A cursor for use in pagination. ending_before is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with ID '1234', your subsequent call can include 'ending_before=1234' in order to fetch the previous page of the list."},"group":{"type":"object","properties":{"id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlR3JvdXAvMQ","description":"The ID of the group."},"parent_id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlR3JvdXAvMQ","nullable":true,"description":"The ID of the group's parent group."},"child_ids":{"type":"array","example":["Z2lkOi8vbGV2ZWwvRGV2aWNlR3JvdXAvMQ","Z2lkOi8vbGV2ZWwvRGV2aWNlR3JvdXAvMw"],"items":{"type":"string"},"description":"The IDs of the group's direct children."},"name":{"type":"string","example":"First Floor","description":"The name of the group."},"device_count":{"type":"integer","example":10,"description":"A count of devices assigned to this group."},"descendent_device_count":{"type":"integer","example":100,"description":"A count of devices in the full heiracrchy of this group."}},"required":["id","name","child_ids","device_count","descendent_device_count"]},"device":{"type":"object","properties":{"id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlLzE","description":"The ID of the device."},"hostname":{"type":"string","example":"level-device-1","description":"The hostname of the device."},"nickname":{"type":"string","nullable":true,"example":"Level's Device","description":"The nickname of the device."},"role":{"type":"string","nullable":true,"enum":["workstation","server","domain_controller"],"example":"workstation","description":"The role of the device."},"group_id":{"type":"string","nullable":true,"example":"Z2lkOi8vbGV2ZWwvRGV2aWNlR3JvdXAvMQ","description":"The ID of the group the device is assigned to."},"tags":{"type":"array","items":{"type":"string"},"example":["exchange","nginx"],"description":"The names of the tags applied to the device."},"flag":{"type":"string","nullable":true,"example":"broken","description":"The active flag on the device."},"maintenance_mode":{"type":"boolean","example":true,"description":"Indicates if the device is in maintenance mode."},"online":{"type":"boolean","example":true,"description":"Indicates if the device is online."},"notes":{"type":"string","nullable":true,"example":"This device is located in the server room.","description":"User-created notes about the device."},"manufacturer":{"type":"string","nullable":true,"example":"Dell","description":"The manufacturer of the device."},"model":{"type":"string","nullable":true,"example":"OptiPlex 5070","description":"The model of the device."},"architecture":{"type":"string","nullable":true,"example":"amd64","description":"The architecture of the system."},"serial_number":{"type":"string","nullable":true,"example":"1A2F3G4H","description":"The manufacturer's serial number."},"total_memory":{"type":"integer","nullable":true,"example":1073741824,"description":"The total memory of the device in bytes."},"memory_slots":{"type":"integer","nullable":true,"example":4,"description":"The total number of memory slots on the device."},"cpu_cores":{"type":"integer","nullable":true,"example":6,"description":"The number of CPU cores on the device."},"last_logged_in_user":{"type":"string","nullable":true,"example":"jdoe","description":"The last user logged in to the device."},"last_reboot_time":{"type":"string","format":"date-time","nullable":true,"example":"2025-01-01T01:00:00.000Z","description":"The last time the device was rebooted."},"last_seen_at":{"type":"string","format":"date-time","nullable":true,"example":"2025-01-01T01:00:00.000Z","description":"The last time the device was seen. Returns the current time if the device is online."},"city":{"type":"string","nullable":true,"example":"Asheville","description":"The city the device is located in."},"country":{"type":"string","nullable":true,"example":"United States","description":"The country the device is located in."},"security_score":{"type":"integer","nullable":true,"example":90,"description":"The security score of the device."},"platform":{"type":"string","nullable":true,"enum":["Windows","Mac","Linux"],"example":"Windows","description":"The operating system platform of the device."},"operating_system":{"type":"object","properties":{"full_operating_system":{"type":"string","nullable":true,"example":"Windows 10","description":"The full operating system of the device."},"major_version":{"type":"string","nullable":true,"example":"10.0","description":"The major version of the operating system."},"minor_version":{"type":"string","nullable":true,"example":"10.0.19045.5247","description":"The minor version of the operating system."},"architecture":{"type":"string","nullable":true,"example":"64-bit","description":"The architecture of the operating system."},"install_date":{"type":"string","format":"date-time","nullable":true,"example":"2020-01-01T01:00:00.000Z","description":"The install date of the operating system in UTC."},"end_of_life":{"type":"boolean","example":true,"description":"Indicates if the operating system is end of life."}}},"cpus":{"type":"array","items":{"type":"object","properties":{"model":{"type":"string","example":"Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz","description":"The model of the CPU."},"clock_speed":{"type":"integer","example":3000,"description":"The clock speed of the CPU in MHz."},"cores":{"type":"integer","example":6,"description":"The number of cores on the CPU."}}},"description":"The CPUs on the device."},"memory":{"type":"array","items":{"type":"object","properties":{"location":{"type":"string","example":"BANK 0","description":"The location of the memory."},"manufacturer":{"type":"string","example":"Micron","description":"The manufacturer of the memory."},"memory_type":{"type":"string","example":"DDR4","description":"The type of the memory."},"clock_speed":{"type":"integer","example":2666,"description":"The clock speed of the memory in MHz."},"size":{"type":"integer","example":1073741824,"description":"The size of the memory in bytes."},"serial_number":{"type":"string","example":"0000000","description":"The serial number of the memory."},"part_number":{"type":"string","example":"ABC-123","description":"The part number of the memory."},"form_factor":{"type":"string","example":"SODIMM","description":"The form factor of the memory."}}},"description":"The memory on the device."},"disks":{"type":"array","items":{"type":"object","properties":{"disk_type":{"type":"string","example":"SCSI","description":"The type of the disk."},"model":{"type":"string","example":"SCSI Disk Device","description":"The model of the disk."},"serial_number":{"type":"string","example":"123_456","description":"The serial number of the disk."},"size":{"type":"integer","example":128849011200,"description":"The size of the disk in bytes."}}},"description":"The disks on the device."},"disk_partitions":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","example":"Local Fixed Disk","description":"The label of the disk partition."},"mount_point":{"type":"string","example":"C:","description":"The mount point of the disk partition."},"encrypted":{"type":"boolean","example":false,"description":"Indicates if the disk partition is encrypted."},"primary":{"type":"boolean","example":true,"description":"Indicates if the disk partition is the primary partition."},"size":{"type":"integer","example":1073741824,"description":"The size of the disk partition in bytes."},"free_space":{"type":"integer","example":1073741824,"description":"The free space of the disk partition in bytes."},"file_system":{"type":"string","example":"NTFS","description":"The file system of the disk partition."}}},"description":"The disk partitions on the device."},"motherboard":{"type":"object","properties":{"manufacturer":{"type":"string","nullable":true,"example":"Dell Inc.","description":"The manufacturer of the motherboard."},"model":{"type":"string","nullable":true,"example":"0WWJRX","description":"The model of the motherboard."},"version":{"type":"string","nullable":true,"example":"A01","description":"The version of the motherboard."},"serial_number":{"type":"string","nullable":true,"example":"ABC1234","description":"The serial number of the motherboard."},"bios_version":{"type":"string","nullable":true,"example":"1.2.3","description":"The BIOS version of the motherboard."},"release_date":{"type":"string","format":"date-time","nullable":true,"example":"2024-01-01T00:00:00.000Z","description":"The BIOS release date."}},"description":"Motherboard information for the device."},"network_interfaces":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","example":"Microsoft Wi-Fi Direct Virtual Adapter","description":"The description of the network interface."},"interface":{"type":"string","example":"10","description":"The interface of the network interface."},"mac_address":{"type":"string","example":"00:00:00:00:00:00","description":"The MAC address of the network interface."},"ip_addresses":{"type":"array","items":{"type":"string"},"example":["192.168.1.1","192.168.1.2"],"description":"The IP addresses of the network interface."},"gateway":{"type":"string","nullable":true,"example":"192.168.1.1","description":"The IP address of the gateway."},"domain":{"type":"string","nullable":true,"example":"level.io","description":"The domain of the network interface."},"dhcp_server":{"type":"string","nullable":true,"example":"192.168.1.1","description":"The IP address of the DHCP server."},"dns_servers":{"type":"string","nullable":true,"example":"8.8.8.8","description":"The DNS servers of the network interface."},"label":{"type":"string","example":"interface 10","description":"The label of the network interface."}}},"description":"The network interfaces on the device."},"security":{"type":"object","description":"Security information for the device. Fields vary by platform.","properties":{"score":{"type":"integer","nullable":true,"example":90,"description":"The security score of the device."},"risk":{"type":"string","nullable":true,"enum":["very_high_risk","high_risk","moderate_risk","low_risk"],"example":"low_risk","description":"The risk category of the device."},"patch_compliance":{"type":"boolean","example":true,"description":"Indicates if the device is patch compliant."},"patch_security_risk":{"type":"string","enum":["up_to_date","warning","critical"],"example":"up_to_date","description":"The patch security risk level."},"os_end_of_life":{"type":"boolean","example":false,"description":"Indicates if the operating system is end of life."},"primary_partition_encrypted":{"type":"boolean","example":true,"description":"Indicates if the primary partition is encrypted."},"firewall_provider":{"type":"string","nullable":true,"example":"Windows Firewall","description":"The firewall provider. Available on Windows, Mac, and Linux."},"firewall_enabled":{"type":"boolean","nullable":true,"example":true,"description":"Indicates if the firewall is enabled. Available on Windows, Mac, and Linux."},"firewall_status":{"type":"string","nullable":true,"example":"good","description":"The firewall status. Available on Windows."},"antivirus_provider":{"type":"string","nullable":true,"example":"Windows Defender","description":"The antivirus provider. Available on Windows."},"antivirus_status":{"type":"string","nullable":true,"example":"good","description":"The antivirus status. Available on Windows."},"auto_update":{"type":"string","nullable":true,"description":"The auto update setting. Available on Windows."},"internet_settings":{"type":"string","nullable":true,"description":"The internet settings. Available on Windows."},"windows_security_center_service":{"type":"string","nullable":true,"description":"The Windows Security Center service status. Available on Windows."},"user_account_control_enabled":{"type":"boolean","nullable":true,"example":true,"description":"Indicates if User Account Control is enabled. Available on Windows."},"admin_accounts_count":{"type":"integer","nullable":true,"example":1,"description":"The number of admin accounts on the device. Available on Windows."},"stealth_enabled":{"type":"boolean","nullable":true,"example":false,"description":"Indicates if stealth mode is enabled. Available on Mac."},"gatekeeper_enabled":{"type":"boolean","nullable":true,"example":true,"description":"Indicates if Gatekeeper is enabled. Available on Mac."},"security_module_provider":{"type":"string","nullable":true,"example":"AppArmor","description":"The security module provider. Available on Linux."},"security_module_enabled":{"type":"boolean","nullable":true,"example":true,"description":"Indicates if the security module is enabled. Available on Linux."}}}}},"tag":{"type":"object","properties":{"id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvVGFnLzI","description":"The ID of the tag."},"name":{"type":"string","example":"NGINX","description":"The tag name."},"device_count":{"type":"integer","example":4,"description":"The number of devices with this tag."}},"required":["id","name","device_count"]},"custom_field":{"type":"object","properties":{"id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvQ3VzdG9tRmllbGQvMQ","description":"The ID of the custom field."},"name":{"type":"string","example":"Region","description":"The custom field's name."},"reference":{"type":"string","example":"cf_region","description":"How the field is referenced in automation scripts."},"admin_only":{"type":"boolean","example":false,"descriptions":"This field's value can only be viewed or edited by an account administrator."}},"required":["id","name","reference","admin_only"]},"custom_field_value":{"type":"object","properties":{"custom_field_id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvQ3VzdG9tRmllbGQvMQ","description":"The ID of the custom field this value is assigned to."},"custom_field_name":{"type":"string","example":"Region","description":"The name of the custom field this value is assigned to."},"assigned_to_id":{"type":"string","nullable":true,"example":"Z2lkOi8vbGV2ZWwvQ3VzdG9tRmllbGQvMQ","description":"The ID of the object this value is assigned to. If the ID is null then the value is globally assigned to the organization. Otherwise, the ID will represent a group or device that the value is assigned to."},"value":{"type":"string","nullable":true,"example":"West","description":"The value of the custom field for the assigned_to."}},"required":["custom_field_id","custom_field_name"]},"alert":{"type":"object","properties":{"id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvQWxlcnQvMQ","description":"The ID of the alert."},"device_id":{"type":"string","example":"Z2lkOi8vbGV2ZWwvRGV2aWNlLzE","description":"The ID of the device the alert is for."},"device_hostname":{"type":"string","example":"level-device-1","description":"The hostname of the device the alert is for."},"name":{"type":"string","example":"Low disk space","description":"The name of the alert."},"description":{"type":"string","example":"Disk free < 5.0%","description":"The description of the alert."},"payload":{"type":"string","nullable":true,"example":"4.37% (10.39 GB) remaining","description":"The payload of the alert."},"severity":{"type":"string","enum":["information","warning","critical","emergency"],"example":"critical","description":"The severity of the alert."},"is_resolved":{"type":"boolean","example":true,"description":"Indicates if the alert is resolved."},"started_at":{"type":"string","format":"date-time","example":"2024-01-01T01:00:00.000Z","description":"The start time of the alert in UTC."},"resolved_at":{"type":"string","format":"date-time","nullable":true,"example":"2024-01-01T01:00:00.000Z","description":"The time the alert was resolved in UTC."}},"required":["id","device_id","device_hostname","name","description","severity","is_resolved","started_at"]},"has_more":{"type":"boolean","example":true,"description":"Returns true if this list has another page of items after this one that can be fetched."},"alert_webhook_event":{"type":"object","description":"This object is sent to your webhook endpoint when an alert becomes active or is resolved.","properties":{"event_type":{"type":"string","description":"The type of event. For this webhook, either 'alert_active' or 'alert_resolved'."},"event_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000","description":"A unique ID for this event. Remains constant across retries."},"occurred_at":{"type":"string","format":"date-time","example":"2024-01-01T01:00:00.000Z","description":"When this event occurred."},"data":{"$ref":"#/components/schemas/alert"}},"required":["event_type","event_id","occurred_at","data"]},"device_webhook_event":{"type":"object","description":"This object is sent to your webhook endpoint when a device is created, updated, or deleted.","properties":{"event_type":{"type":"string","description":"The type of event. For this webhook, either 'device_created', 'device_updated', or 'device_deleted'."},"event_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000","description":"A unique ID for this event. Remains constant across retries."},"occurred_at":{"type":"string","format":"date-time","example":"2024-01-01T01:00:00.000Z","description":"When this event occurred."},"data":{"$ref":"#/components/schemas/device"}},"required":["event_type","event_id","occurred_at","data"]},"group_webhook_event":{"type":"object","description":"This object is sent to your webhook endpoint when a group is created, updated, or deleted.","properties":{"event_type":{"type":"string","description":"The type of event. For this webhook, either 'group_created', 'group_updated', or 'group_deleted'."},"event_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000","description":"A unique ID for this event. Remains constant across retries."},"occurred_at":{"type":"string","format":"date-time","example":"2024-01-01T01:00:00.000Z","description":"When this event occurred."},"data":{"$ref":"#/components/schemas/group"}},"required":["event_type","event_id","occurred_at","data"]}}}}