# Server API: resource control

Source: https://docs.neode.sk/development/api-reference/server-resource-control/
Last updated: 2026-12-03

> 7 operations. What devices may use: USB storage, optical drives, monitors, disks and usage limits, per device and as the server's default.

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](https://docs.neode.sk/development/api.md#signing-in).

What devices may use: USB storage, optical drives, monitors, disks and usage limits, per device and as the server's default. The console's Resource control page passes its calls on to these routes.

## GET /api/devices/{id}/resources

Show the resource rules a device follows.

The device's own rule of each kind, else the default's. A device fetches the same through the console's GET /api/nd/resource-policy.

On the server API, port 21114. Needs `server.config`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The device's ID |

**200**: Done (`application/json`)

| Field | Type | Required | What it is |
|---|---|---|---|
| `device_id` | string | yes |  |
| `policy` | [ResourceRules](https://docs.neode.sk/development/api-reference/schemas.md#resourcerules) or null | yes | null when neither the device nor the default has a rule |
| `sources` | object | yes | Per kind, whose rule it is |
| `updated_at` | string or null (date-time) | yes | When the latest of these rules was saved, RFC 3339; null without rules |

| 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 |

## POST /api/devices/{id}/resources/{kind}

Set a device's resource rule of one kind.

Replaces the device's rule of that kind. The body has the fields of the kind in ResourceRules.

On the server API, port 21114. Needs `server.config`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The device's ID |
| `kind` | path | string, one of `usb`, `optical`, `monitors`, `disks`, `quotas` | yes | The kind of rule |

Request body, `application/json`:

The rule: one of the objects of ResourceRules

Object.

**200**: Done (`application/json`)

| Field | Type | Required | What it is |
|---|---|---|---|
| `success` | `true` | yes |  |
| `device_id` | string | yes |  |
| `kind` | string | yes |  |
| `rule` | object | yes | The rule as stored, with every field |

| Error | When |
|---|---|
| 400 | The body is no JSON object, names a field the kind doesn't have, or a value is not valid |
| 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 or kind of rule |
| 413 | The body is larger than 65,536 bytes |

## DELETE /api/devices/{id}/resources/{kind}

Hand one kind of a device's resource rules back to the default.

Removes the device's own rule of that kind, so it follows the server's default rule of the kind again (or none). Answers the rules the device follows afterwards, as GET /api/devices/{id}/resources does. A device without its own rule of the kind gets the same answer, and nothing goes to the audit log.

On the server API, port 21114. Needs `server.config`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The device's ID |
| `kind` | path | string, one of `usb`, `optical`, `monitors`, `disks`, `quotas` | yes | The kind of rule |

**200**: Done (`application/json`)

| Field | Type | Required | What it is |
|---|---|---|---|
| `device_id` | string | yes |  |
| `policy` | [ResourceRules](https://docs.neode.sk/development/api-reference/schemas.md#resourcerules) or null | yes | null when neither the device nor the default has a rule |
| `sources` | object | yes | Per kind, whose rule it is |
| `updated_at` | string or null (date-time) | yes | When the latest of these rules was saved, RFC 3339; null without rules |

| 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 or kind of rule |

## POST /api/devices/{id}/resources/report

Keep a device's report on the resource rules it follows.

What the device says per kind about the rules it fetched: it follows the rule (compliant), follows part of it (partial), doesn't follow it (noncompliant), or can't on its system (unsupported). Replaces the device's last report. A device sends it through the console's POST /api/nd/resource-policy/report.

On the server API, port 21114. Needs `server.config`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The device's ID |

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `updated_at` | string (date-time) | updated_at of the rules the device applied, as GET /api/devices/{id}/resources answered it. A report counts only while it matches the rules the device follows now.; at most 64 characters |
| `kinds` | object | Per kind of rule |

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `device_id` | string | yes |

| Error | When |
|---|---|
| 400 | The body is no report, names an unknown kind or state, or a detail is too long |
| 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 |
| 413 | The body is larger than 65,536 bytes |

## GET /api/org/default/resource-policy

Show the default resource rules.

The rules a device follows for each kind it has no rule of its own for.

On the server API, port 21114. Needs `server.config`.

**200**: Done (`application/json`)

| Field | Type | Required | What it is |
|---|---|---|---|
| `policy` | [ResourceRules](https://docs.neode.sk/development/api-reference/schemas.md#resourcerules) or null | yes | null when there is no default rule |
| `updated_at` | string or null (date-time) | yes |  |

| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |

## PUT /api/org/default/resource-policy

Set the default resource rules.

Replaces the whole default: a kind left out or null has no default rule afterwards.

On the server API, port 21114. Needs `server.config`.

Request body, `application/json`:

[ResourceRules](https://docs.neode.sk/development/api-reference/schemas.md#resourcerules).

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `policy` | [ResourceRules](https://docs.neode.sk/development/api-reference/schemas.md#resourcerules) or null | yes |
| `updated_at` | string or null (date-time) | yes |

| Error | When |
|---|---|
| 400 | The body is no JSON object, names an unknown kind, or a rule is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 413 | The body is larger than 65,536 bytes |

## GET /api/org/default/resource-policy/compliance

Count the devices with resource rules.

Of the devices the caller sees, how many follow a rule that limits something, their own or the default's. A rule that allows everything limits nothing. Of those, compliant follow every such rule by their last report, non_compliant break one (in part, not at all, or it isn't supported on their system), and unreported have not reported on the rules they follow now.

On the server API, port 21114. Needs `server.config`.

**200**: Done (`application/json`)

| Field | Type | Required | What it is |
|---|---|---|---|
| `total_devices` | integer | yes |  |
| `with_policy` | integer | yes |  |
| `no_policy` | integer | yes |  |
| `compliant` | integer | yes |  |
| `non_compliant` | integer | yes |  |
| `unreported` | integer | yes | Devices with rules that have not reported on the rules they follow now |
| `compliance_percent` | integer | yes | compliant in percent of with_policy |
| `categories` | object | yes |  |
| `categories.usb` | object |  |  |
| `categories.usb.enforced` | integer | yes | Devices with a rule of this kind that limits something |
| `categories.usb.total` | integer | yes |  |
| `categories.optical` | object |  |  |
| `categories.optical.enforced` | integer | yes | Devices with a rule of this kind that limits something |
| `categories.optical.total` | integer | yes |  |
| `categories.monitors` | object |  |  |
| `categories.monitors.enforced` | integer | yes | Devices with a rule of this kind that limits something |
| `categories.monitors.total` | integer | yes |  |
| `categories.disks` | object |  |  |
| `categories.disks.enforced` | integer | yes | Devices with a rule of this kind that limits something |
| `categories.disks.total` | integer | yes |  |
| `categories.quotas` | object |  |  |
| `categories.quotas.enforced` | integer | yes | Devices with a rule of this kind that limits something |
| `categories.quotas.total` | integer | yes |  |
| `devices` | object | yes | Per device with a report on the rules it follows now: the state of each kind that limits something |

| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
