Device rules
After 2026-10-R1, device rules tag, color, sort, and collect devices into views, and raise alerts, on the server.
Devices which match at least one rule carry kismet.device.base.rules:
| Field | Content |
|---|---|
kismet.device.rules.matched | Names of the rules the device matches |
kismet.device.rules.tags | Tags from the matching rules |
kismet.device.rules.color | Highlight color from the first matching rule with a color |
kismet.device.rules.excluded | Set when an exclude rule matches the device, which leaves it out of the default view (after 2026-10-R1) |
Each rule with a view makes a device view named rule-<name>, and device views can be ordered with a sort by passing rule_sort.
After 2026-10-R1, devices which no exclude rule matches make up the device view default.
Rules set over the API come after the rules from the Kismet config, and replace only the rules set earlier over the API.
Device rules
The device rules and sorts currently loaded, in order, and how they are evaluated.
| Field | Content |
|---|---|
kismet.devicerules.backend | jit when rules are compiled to native code, vm when they run in the bytecode interpreter, or none |
kismet.devicerules.jit_error | Why the rules aren’t using the JIT, when they aren’t |
kismet.devicerules.rules | The rules: kismet.devicerules.rule.name, .description, .source (the rule text), .tags, .color, .view (the rule-<name> view, when the rule has one), .alert, .live, .origin (the file and line the rule came from), and, after 2026-10-R1, .from_type and .from_name (what defined the rule, as in sources), .exclude (the rule leaves matching devices out of the default view), .enabled (false when the rule is switched off), .matching (how many devices matched the rule when last checked), and .recheck (seconds between checks of unchanged devices, for rules whose conditions change over time; 0 for other rules) |
| Baseline filters | After 2026-10-R1, baseline filters are listed with the rules, with .baseline (add or remove), .every (seconds between runs), .ephemeral, .expire (seconds, 0 for none), .baseline_active (false when device_rules_baseline is off), and what their runs have done: .last_run (time), .runs, .added, .removed, .expired, .held (devices held out of the baseline), and .over_limit (matches left for a later run by device_rules_baseline_max_changes). Their .matching is always 0 |
kismet.devicerules.sorts | The sorts: kismet.devicerules.sort.name, .source, .origin, and, after 2026-10-R1, .from_type and .from_name |
kismet.devicerules.api_rules | The rules text last set with set.cmd |
kismet.devicerules.api_save | Rules set with set.cmd are saved and loaded at startup (device_rules_api_save) |
kismet.devicerules.passes | Rule checks run so far |
kismet.devicerules.evaluated | Devices checked by those passes |
kismet.devicerules.last_pass_us | Duration of the last pass, in microseconds |
readonly/devices/rules/rules.json/devices/rules/rules.ekjson/devices/rules/rules.prettyjsonGET
POSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
fields
field simplification
OPTIONALKismet can reduce the amount of information being processed and returned by an API by simplifying the fields to only return the data needed by the caller.
You can read more about the field simplification API and how to use it here.
Device rules by source
The device rules and sorts currently loaded, grouped by what defined them, as the web UI’s Device rules window shows them.
kismet.devicerules.sources is a list of groups, in the order their first rule or sort comes in:
| Field | Content |
|---|---|
kismet.devicerules.source.type | file (a rules file or directory), config (device_rule= and device_sort= lines), plugin, or api |
kismet.devicerules.source.name | The rules file, the config file, the plugin name, or API |
kismet.devicerules.source.files | The files the group’s rules and sorts came from |
kismet.devicerules.source.rules | The group’s rules, in rule order, as in rules.json |
kismet.devicerules.source.sorts | The group’s sorts, as in rules.json |
kismet.devicerules.source.replaced | Notes on earlier rules and sorts of the same name which this group replaced |
readonly/devices/rules/sources.json/devices/rules/sources.ekjson/devices/rules/sources.prettyjsonGET
POSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
fields
field simplification
OPTIONALKismet can reduce the amount of information being processed and returned by an API by simplifying the fields to only return the data needed by the caller.
You can read more about the field simplification API and how to use it here.
Check rules
set.cmd would load them: after the
configured rules, replacing the rules set earlier over the API.admin/devices/rules/check.cmdPOSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
rules
string
REQUIREDRules, sorts, and (after 2026-10-R1) baseline filters, in the device rules language; at most 256KB.
Rules set over the API can’t include other files.
On success, {"ok": true, "backend": "jit" or "vm", "rules": [names], "sorts": [names], "replaced": [...]},
where replaced lists configured rules and sorts which these rules replace by name.
On an error in the rules, {"ok": false, "error": "...", "line": N, "col": N}.
Set rules
Replace the rules set over the API. They come after the rules from the Kismet config and replace only the rules set earlier over the API; a rule with the same name as a configured rule replaces it.
If any rule has an error, nothing changes. When device_rules_api_save=true, the rules are written
to device_rules_api_file and loaded again at startup. Rules which would make more than 256 views
in all are an error.
Devices are checked against the new rules on the next pass, and join or leave rule views and raise alerts as they start or stop matching.
admin/devices/rules/set.cmdPOSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
rules
string
REQUIREDRules and sorts, in the device rules language; at most 256KB. An empty string removes the rules set over the API.
On success, {"ok": true, "rules": N, "sorts": N, "backend": "jit" or "vm", "replaced": [...], "saved": true or false},
with save_error when saving the rules failed.
On an error in the rules, {"ok": false, "error": "...", "line": N, "col": N}.
Switch a rule off or on
Switch a loaded rule off or back on. A rule that’s off isn’t checked, and its tags, color, view,
alerts, and webhooks go with it; it’s still listed, with kismet.devicerules.rule.enabled false.
Rules switched off are saved to device_rules_disabled_file and stay off across restarts, and
after the rule set is replaced.
admin/devices/rules/enable.cmdPOSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
rule
string
REQUIREDRule name
enabled
boolean
REQUIREDfalse to switch the rule off, true to switch it back on
{"ok": true, "rule": "name", "enabled": true or false, "saved": true or false},
with save_error when saving the list of rules switched off failed.Test rules on a device
admin/devices/rules/test.cmdPOSTPARAMETERS
This endpoint takes additional parameters by using a `POST` request and supplying a
JSON document or json form variable.
You can find more information about API parameters here.
rules
string
REQUIREDRules to test, in the device rules language. Only these rules are tested, without the configured rules.
device
string
REQUIREDDevice key
On success, {"ok": true, "matches": {"rule name": true or false, ...}}.
On an error in the rules, {"ok": false, "error": "...", "line": N, "col": N}.