---
title: "Servers API"
description: "This API reference covers Alpacon server management. Learn how to list, register, update, and delete servers, and how to upgrade or restart a server's agent."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# Servers

**Endpoint**: `/api/servers/servers/`

Manage servers registered in your Alpacon workspace.

Read a server's agent version from the `version` field of [Get server](#get-server), or filter the list with the `version` parameter.

  
    ## List servers

    Retrieve a paginated list of servers.

    ### Request

    ```http
    GET /api/servers/servers/
    ```

    ### Query parameters

    | Parameter | Type | Description |
    |-----------|------|-------------|
    | `name` | string | Filter by server name |
    | `version` | string | Filter by agent version |
    | `enabled` | boolean | Filter by enabled status |
    | `commissioned` | boolean | Filter by commissioned status |
    | `owner` | string | Filter by owner username |
    | `groups` | UUID | Filter by group ID |
    | `rules` | UUID | Filter by alert rule ID. Repeat the parameter to OR multiple rules; an unknown ID returns `400` |
    | `has_rules` | boolean | `true` for servers with at least one performance rule attached, `false` for servers with none. Counts only performance rules: the core disk-usage default rule doesn't count as attached. It's a core signal on every plan, not a performance-monitoring gap—normally watching just the agent's own volume, every volume as a fallback when the agent doesn't identify one—so a server whose only rule is the core disk rule is returned by `has_rules=false`. An override that disables a rule (`enabled=false`) doesn't count as detached—see [rule overrides](/reference/api/metrics/rule-overrides/). The same parameter also works on [`GET /api/metrics/latest/`](/reference/api/metrics/latest/) |
    | `exclude_group` | UUID | Exclude servers in this group |
    | `is_connected` | boolean | Filter by connection status |
    | `starred` | boolean | Filter by starred status |
    | `status_code` | string | Filter by [server status](#server-status) code: `ok`, `warn`, or `error` |
    | `search` | string | Search across name, version, IP, owner, and group names |
    | `ordering` | string | Sort order (e.g., `name`, `-load`, `starred`). Default: `starred`, then `name` |
    | `page` | integer | Page number |
    | `page_size` | integer | Results per page (default: 15, max: 100) |

    ### Response

    ```json
    {
      "count": 25,
      "current": 1,
      "next": 2,
      "previous": null,
      "last": 2,
      "results": [
        {
          "id": "7e3984de-49ab-4cc6-bcdf-21fbd35858b8",
          "name": "web-server-01",
          "remote_ip": "203.0.113.10",
          "is_root": true,
          "is_connected": true,
          "commissioned": true,
          "starred": true,
          "platform": "debian",
          "cpu_physical_cores": 4,
          "cpu_logical_cores": 8,
          "cpu_type": "x86_64",
          "physical_memory": 8589934592,
          "os_name": "Ubuntu",
          "os_version": "22.04",
          "load": 0.45,
          "boot_time": "2024-01-10T08:00:00Z",
          "owner": {
            "id": "a540bf0f-8b37-4f03-8546-dd71c6b03329",
            "name": "admin",
            "email": "admin@example.com"
          },
          "groups": [
            "b651cf10-9c48-4a14-9657-ee82d7c14430"
          ],
          "rules": [
            "3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40",
            "9d4e1a72-5c38-4b0f-a6e1-c27f03b8d915"
          ],
          "status": {
            "code": "warn",
            "alerts": [
              {
                "id": "5b1f0c7e-2d4a-4f3b-9e81-6a2c9d0e4b17",
                "severity": "warning",
                "title": "Disk usage 82% on /",
                "rule": "3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40",
                "opened_at": "2024-01-20T14:05:00Z"
              }
            ],
            "count": 1,
            "updated_at": "2024-01-20T14:05:00Z"
          },
          "agent_upgrade_policy": "manual",
          "agent_upgrade_available": true,
          "disconnected_at": null,
          "version": "3.2.1",
          "pam_version": "3.2.1",
          "sudo_policy_unenforced": false,
          "package_manager": "apt",
          "firewall_managed_by_alpacon": false,
          "tunnel_enabled": false,
          "editor_enabled": false,
          "editor_initialized": false,
          "offline_alert_enabled": true,
          "alerts_muted_until": null,
          "alerts_mute_reason": "",
          "tags": {},
          "permissions": {
            "update": true,
            "delete": true
          },
          "coverage_state": "covered",
          "open_alert": {
            "id": "5b1f0c7e-2d4a-4f3b-9e81-6a2c9d0e4b17",
            "severity": "warning",
            "title": "Disk usage 82% on /",
            "alert_type": "metric_threshold",
            "rule": "3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40",
            "target": "disk-usage",
            "operator": "gte",
            "condition": "threshold",
            "opened_at": "2024-01-20T14:05:00Z"
          },
          "open_alert_count": 1
        }
      ]
    }
    ```

    ### Example

    ```bash
    curl -X GET "https://your-workspace.us1.alpacon.io/api/servers/servers/?is_connected=true&ordering=-load" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\""
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Get server

    Retrieve detailed information about a specific server. The response adds fields such as `uptime`, `last_connectivity`, `started_at`, `added_at`, `updated_at`, `last_disconnect`, and `maintainers` to the list view. It also includes `starred` and `status`, with up to 10 alerts in `status.alerts`.

    ### Request

    ```http
    GET /api/servers/servers/{server_id}/
    ```

    ### Path parameters

    | Parameter | Type | Required | Description |
    |-----------|------|----------|-------------|
    | `server_id` | UUID | Yes | Server ID |

    ### Response

    ```json
    {
      "id": "7e3984de-49ab-4cc6-bcdf-21fbd35858b8",
      "name": "web-server-01",
      "remote_ip": "203.0.113.10",
      "is_root": true,
      "is_connected": true,
      "commissioned": true,
      "starred": true,
      "platform": "debian",
      "cpu_physical_cores": 4,
      "cpu_logical_cores": 8,
      "cpu_type": "x86_64",
      "physical_memory": 8589934592,
      "os_name": "Ubuntu",
      "os_version": "22.04",
      "load": 0.45,
      "boot_time": "2024-01-10T08:00:00Z",
      "version": "3.2.1",
      "uptime": 864000,
      "last_connectivity": "2024-01-20T15:30:00Z",
      "started_at": "2024-01-10T08:00:00Z",
      "added_at": "2023-06-15T12:00:00Z",
      "updated_at": "2024-01-20T15:30:00Z",
      "owner": {
        "id": "a540bf0f-8b37-4f03-8546-dd71c6b03329",
        "name": "admin",
        "email": "admin@example.com"
      },
      "groups": [
        "b651cf10-9c48-4a14-9657-ee82d7c14430"
      ],
      "rules": [
        "3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40",
        "9d4e1a72-5c38-4b0f-a6e1-c27f03b8d915"
      ],
      "status": {
        "code": "ok",
        "alerts": [],
        "count": 0,
        "updated_at": "2024-01-19T09:12:00Z"
      },
      "offline_alert_enabled": true,
      "agent_upgrade_policy": "manual",
      "agent_upgrade_available": true,
      "pam_version": "3.2.1",
      "sudo_policy_unenforced": false,
      "package_manager": "apt",
      "firewall_managed_by_alpacon": false,
      "tunnel_enabled": false,
      "editor_enabled": false,
      "editor_initialized": false,
      "alerts_muted_until": null,
      "alerts_mute_reason": "",
      "agent_upgrade_failure": null,
      "tags": {},
      "permissions": {
        "update": true,
        "delete": true
      },
      "last_disconnect": null,
      "maintainers": []
    }
    ```

    `offline_alert_enabled` (boolean, default `true`) controls whether Alpacon raises the [offline alert](/use/servers/monitor/#offline-alert) for this server. See [Update server](#update-server) for who can change it.

    `agent_upgrade_policy` (string, read-only) is `latest`, `n_minus_1`, or `manual`: the workspace's [agent update policy](/use/workspace/settings/agent-updates/), the same for every server in the workspace. Under `manual`, a server manager can start an agent upgrade from the [Agent card](/use/servers/manage/#agent-card) or with the [`upgrade_agent` action](#agent-actions); under `latest` or `n_minus_1`, Alpacon upgrades the agent inside the workspace's maintenance window and no upgrade button is shown.

    `agent_upgrade_available` (boolean, read-only) says whether a newer release is available for this agent. It's `false` only when the agent already runs the latest release or a newer one, where `upgrade_agent` is refused with `server_agent_upgrade_not_needed` unless you pass `reinstall`, and `true` otherwise. It doesn't promise the action will be accepted: the server can still be disconnected, busy, or already upgrading by the time you call it, so handle those errors too.

    Both fields also appear in each result of [List servers](#list-servers). For this server's past upgrades, see [Agent upgrades](/reference/api/servers/agent-upgrades/).

    ### Example

    ```bash
    curl -X GET "https://your-workspace.us1.alpacon.io/api/servers/servers/7e3984de-49ab-4cc6-bcdf-21fbd35858b8/" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\""
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Collection profile

    See what this server actually collects: whether the Metrics extension is on for the workspace, which metrics this server collects and how often, when each metric last arrived, and which metrics this server doesn't collect and why.

    ### Request

    ```http
    GET /api/servers/servers/{server_id}/collection-profile/
    ```

    ### Path parameters

    | Parameter | Type | Required | Description |
    |-----------|------|----------|-------------|
    | `server_id` | UUID | Yes | Server ID |

    ### Response

    ```json
    {
      "enabled": true,
      "core": [
        {
          "name": "disk-usage",
          "interval_s": 60,
          "last_sample_at": "2026-09-12T02:14:05Z",
          "collected": true,
          "scope": null,
          "reason": null,
          "latest": [
            {
              "device": "/dev/sda1",
              "mount_point": "/",
              "used_percent": 91.5,
              "used": 98247376896,
              "total": 107374182400,
              "sampled_at": "2026-09-12T02:14:05Z",
              "agent_volume": true
            }
          ]
        }
      ],
      "metrics": [
        {
          "name": "cpu",
          "interval_s": 60,
          "last_sample_at": "2026-09-12T02:21:05Z",
          "collected": true,
          "scope": null,
          "reason": null,
          "retention_days": 31
        }
      ],
      "not_collected": []
    }
    ```

    This example is from a workspace with the Metrics extension on, so `not_collected` is empty. With the extension off—or on a plan that can't enable it—`metrics` is empty instead, and every family it would add shows up in `not_collected`, with `reason` set to `extension_not_enabled` or `plan_floor`.

    | Field | Type | Description |
    |-------|------|-------------|
    | `enabled` | boolean | Whether the Metrics extension is on for this workspace |
    | `core[]` | array | Metrics every plan collects for this server |
    | `metrics[]` | array | Metrics the Metrics extension adds; empty whenever `enabled` is `false` |
    | `core[].name`, `metrics[].name` | string | Metric name: `cpu`, `memory`, `disk-usage`, `disk-io`, or `net` |
    | `core[].interval_s`, `metrics[].interval_s` | integer | Seconds between collections |
    | `core[].last_sample_at`, `metrics[].last_sample_at` | string (date-time) or `null` | When this server last reported this metric; `null` if it never has |
    | `core[].collected`, `metrics[].collected` | boolean | Always `true` for an entry in `core` or `metrics` |
    | `core[].scope`, `metrics[].scope` | string or `null` | Reserved for a future coverage narrowing; always `null` today |
    | `core[].reason`, `metrics[].reason` | string or `null` | Always `null` for an entry in `core` or `metrics` |
    | `metrics[].retention_days` | integer or `null` | How far back this metric can be queried on the workspace's plan, in days. Not present on `core[]` entries |
    | `core[].latest[]` | array | Only on the `disk-usage` entry in `core[]`, on every plan and whether or not the Metrics extension is on. The newest reading for each volume this server's disk alert is watching: just the agent's own volume when the agent reports which one that is, every volume otherwise, and an empty array when no sample has arrived yet |
    | `core[].latest[].device` | string | Device name |
    | `core[].latest[].mount_point` | string or `null` | Mount point |
    | `core[].latest[].used_percent` | number | Percentage of the volume in use, as the agent reported it |
    | `core[].latest[].used` | integer | Bytes in use |
    | `core[].latest[].total` | integer | Volume size in bytes |
    | `core[].latest[].sampled_at` | string (date-time) | When the agent took this reading |
    | `core[].latest[].agent_volume` | boolean | Whether the agent named this volume as the one holding its own data directory. `false` on every entry from an agent that predates this flag, which is why every volume is listed in that case |
    | `not_collected[]` | array | Metrics this server doesn't collect |
    | `not_collected[].name` | string | Metric name |
    | `not_collected[].reason` | string | `plan_floor` (the workspace's plan can't enable the Metrics extension) or `extension_not_enabled` (an admin hasn't turned it on) |
    | `not_collected[].unlocked_by` | string | Which extension would start this collection—always `metrics` today |

    A metric named in both `core` and `metrics`—`disk-usage` today—is reported once, in `core`, at whichever interval is finer.

    Required scope: [`server:collection_profile`](/reference/scopes/#server-collection_profile). Unlike other metrics endpoints, this one isn't gated by the Metrics extension itself—a server that collects nothing is exactly what this endpoint is for telling you.

    ### Example

    ```bash
    curl -X GET "https://your-workspace.us1.alpacon.io/api/servers/servers/7e3984de-49ab-4cc6-bcdf-21fbd35858b8/collection-profile/" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\""
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Agent actions

    Upgrade or restart the server's agent, install its PAM module, or ask it to refresh the server's system information.

    ### Request

    ```http
    POST /api/servers/servers/{server_id}/actions/
    ```

    ### Path parameters

    | Parameter | Type | Required | Description |
    |-----------|------|----------|-------------|
    | `server_id` | UUID | Yes | Server ID |

    ### Request body

    ```json
    {
      "action": "upgrade_agent"
    }
    ```

    ### Parameters

    | Field | Type | Required | Description |
    |-------|------|----------|-------------|
    | `action` | string | Yes | `upgrade_agent`, `restart_agent`, `install_pam`, or `update_information` |
    | `force` | boolean | No | `upgrade_agent` and `restart_agent` only: run the action even while the server has an open Websh or WebFTP session or a command in progress. Default `false` |
    | `reinstall` | boolean | No | `upgrade_agent` only: reinstall the latest release on an agent that already runs it. Without it, such an agent is refused with `server_agent_upgrade_not_needed`. It never installs an older release. Default `false` |

    The server must be connected and fully registered.

    `upgrade_agent` moves the agent to the latest release and never to an older one: an agent already on the latest release, or on a newer one, is refused with `server_agent_upgrade_not_needed` (check [`agent_upgrade_available`](#get-server) first). While an upgrade is already in progress on the server, the request is refused with `409` and `server_agent_upgrade_in_progress`, and nothing changes; try again after it finishes. A pending automatic upgrade that hasn't reached the agent yet is withdrawn, recorded as `refused`, and replaced by this one. Each upgrade is recorded in [Agent upgrades](/reference/api/servers/agent-upgrades/).

    `install_pam` installs the `alpamon-pam` package as root through the host's package manager (`apt`, `yum`, or `zypper`; on `apt` it runs `apt-get update` first), the same command **Sudo through Alpacon** sends to every connected server when it's turned on ([Access rules](/use/policies/server-access/)). Use it on a host provisioned with alpamon alone, such as an IaC install that never named `alpamon-pam`; alpamon's package only recommends it. A host already on the current version is left as it is, and an older version is upgraded: the action never reinstalls, so it doesn't bring back a removed `/etc/sudoers.d/alpacon`. The install leaves live sessions alone, so `force` doesn't apply. It needs **Sudo through Alpacon** turned on: while the setting is off, or the deployment can't complete MFA step-up, the request is refused with `server_pam_install_requires_sudo_with_mfa`, since the module would send every sudo on the host to a server that refuses them all. A host with no package path for `alpamon-pam` (macOS, Windows, or a package manager Alpacon doesn't drive) is refused with `server_pam_install_unsupported`. While an install is still pending on the server, the request is refused with `409` and `server_pam_install_in_progress`; try again after it finishes.

    ### Response

    `201 Created`, with the command Alpacon queued for the agent, in the same shape as the [Commands API](/reference/api/commands/).

    ### Example

    ```bash
    curl -X POST "https://your-workspace.us1.alpacon.io/api/servers/servers/7e3984de-49ab-4cc6-bcdf-21fbd35858b8/actions/" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\"" \
      -H "Content-Type: application/json" \
      -d '{"action": "upgrade_agent"}'
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Create server

    Register a new server in your workspace. The response contains installation instructions and a guide; the installation script includes the generated key. Default alert rules are added automatically.

    ### Request

    ```http
    POST /api/servers/servers/
    ```

    ### Request body

    ```json
    {
      "name": "web-server-02",
      "platform": "debian",
      "groups": ["b651cf10-9c48-4a14-9657-ee82d7c14430"],
      "rules": ["3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40"]
    }
    ```

    ### Parameters

    | Field | Type | Required | Description |
    |-------|------|----------|-------------|
    | `name` | string | Yes | Server name (slug format, max 64 characters). Disallowed names: `close`, `desc`, `describe`, `force-close`, `invite`, `join`, `list`, `localhost`, `ls`, `null`, `share`, `watch` |
    | `platform` | string | Yes | Target OS: `debian`, `rhel`, `suse`, `darwin`, or `windows`. Write-only. The response carries an install script and guide only for `debian`, `rhel` and `suse`; for `darwin` and `windows` they come back empty. For openSUSE and SLES, the server's `platform` field reads `rhel` once the agent connects |
    | `groups` | array[UUID] | No | Group IDs to assign |
    | `rules` | array[UUID] | No | Alert rule IDs to assign |

    ### Response

    ```json
    {
      "id": "8f4985df-50bc-42e5-b827-32fcc46959a2",
      "name": "web-server-02",
      "instruction_1": "curl -fsSL https://your-workspace.us1.alpacon.io/api/servers/installers/30f1df83-095b-454c-a6df-abd62f0a8820/ | sudo -EH bash",
      "instruction_2": "<installation script>",
      "groups": [
        "b651cf10-9c48-4a14-9657-ee82d7c14430"
      ],
      "guide": "<installation guide>",
      "tags": {}
    }
    ```

    The example abbreviates `instruction_2` and `guide`; use the complete values in the response when installing the agent. The `key` field is not returned separately.

    ### Example

    ```bash
    curl -X POST "https://your-workspace.us1.alpacon.io/api/servers/servers/" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\"" \
      -H "Content-Type: application/json" \
      -d '{"name": "web-server-02", "platform": "debian"}'
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Update server

    Update server properties. Supports partial updates via `PATCH`.

    ### Request

    ```http
    PATCH /api/servers/servers/{server_id}/
    ```

    ### Path parameters

    | Parameter | Type | Required | Description |
    |-----------|------|----------|-------------|
    | `server_id` | UUID | Yes | Server ID |

    ### Request body

    ```json
    {
      "name": "web-server-01-updated",
      "owner": "a540bf0f-8b37-4f03-8546-dd71c6b03329",
      "groups": [
        "b651cf10-9c48-4a14-9657-ee82d7c14430"
      ],
      "rules": ["3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40", "e6a0b4d3-2f91-4c7a-8b5e-74d1c9a30e28"]
    }
    ```

    ### Parameters

    | Field | Type | Required | Description |
    |-------|------|----------|-------------|
    | `name` | string | No | New server name (slug format, max 64 characters) |
    | `owner` | UUID | No | New owner user ID |
    | `groups` | array[UUID] | No | Group IDs to assign |
    | `rules` | array[UUID] | No | Alert rule IDs to assign |
    | `tunnel_enabled` | boolean | No | Enable Tunnel when the server meets its requirements |
    | `editor_enabled` | boolean | No | Enable Editor when the server meets its requirements |
    | `offline_alert_enabled` | boolean | No | Whether Alpacon raises the [offline alert](/use/servers/monitor/#offline-alert) for this server. Default `true` |
    | `tags` | object | No | Key-value tags for server classification |

    > `offline_alert_enabled` can only be changed by a user who can manage the server.

    ### Response

    Returns `id`, `name`, `remote_ip`, `owner`, `groups`, `rules`, `tunnel_enabled`, `editor_enabled`, `offline_alert_enabled`, and `tags`. The update response has fewer fields than [Get server](#get-server).

    ```json
    {
      "id": "7e3984de-49ab-4cc6-bcdf-21fbd35858b8",
      "name": "web-server-01-updated",
      "remote_ip": "203.0.113.10",
      "owner": {
        "id": "a540bf0f-8b37-4f03-8546-dd71c6b03329",
        "name": "admin",
        "email": "admin@example.com"
      },
      "groups": ["b651cf10-9c48-4a14-9657-ee82d7c14430"],
      "rules": ["3f2b8c1e-7a4d-4e6b-9c05-1d8e2a7b6f40"],
      "tunnel_enabled": false,
      "editor_enabled": false,
      "offline_alert_enabled": true,
      "tags": {}
    }
    ```

    ### Example

    ```bash
    curl -X PATCH "https://your-workspace.us1.alpacon.io/api/servers/servers/7e3984de-49ab-4cc6-bcdf-21fbd35858b8/" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\"" \
      -H "Content-Type: application/json" \
      -d '{"name": "web-server-01-updated", "owner": "a540bf0f-8b37-4f03-8546-dd71c6b03329"}'
    ```
  </Tabs.Tab>

  <Tabs.Tab>
    ## Delete server

    Remove a server from your workspace. A connected server requires `?auto=true` to request agent removal. A disconnected server can be deleted without it.

    ### Request

    ```http
    DELETE /api/servers/servers/{server_id}/
    ```

    ### Path parameters

    | Parameter | Type | Required | Description |
    |-----------|------|----------|-------------|
    | `server_id` | UUID | Yes | Server ID |

    ### Query parameters

    | Parameter | Type | Description |
    |-----------|------|-------------|
    | `auto` | boolean | When `true` on a connected server, requests agent removal. Defaults to `false` |
    | `purge_provisioned_accounts` | boolean | With `auto=true` on a connected server, also removes OS accounts and groups Alpacon provisioned before the agent exits. Ignored when disconnected. Defaults to `false` |

    ### Response

    A connected server with `auto=true` returns `200 OK` after the removal request. A connected server without `auto=true` returns `400` with `server_cannot_be_deleted`. A disconnected server returns `204 No Content`; a deletion blocked by related records can also return `400` with `server_cannot_be_deleted`.

    ### Example

    ```bash
    curl -X DELETE "https://your-workspace.us1.alpacon.io/api/servers/servers/7e3984de-49ab-4cc6-bcdf-21fbd35858b8/?auto=true" \
      -H "Authorization: token=\"alpat-xxxxxxxxxxxxxxxxxx\""
    ```

    The example targets a connected server and returns `200 OK`. For a disconnected server, omit `auto` and expect `204 No Content`.
  </Tabs.Tab>
</Tabs>

## Server status

`status` summarizes the metric alerts open on a server. List and detail responses both return it.

| Field | Type | Description |
|-------|------|-------------|
| `code` | string | `error` while a critical alert is open, `warn` while only warnings are open, `ok` otherwise |
| `alerts` | array | The open critical and warning alerts, critical first and then oldest first. At most 5 in a list response and 10 in a detail response |
| `alerts[].id` | UUID | The open alert |
| `alerts[].severity` | string | `critical` or `warning` |
| `alerts[].title` | string | The alert's title, in the language saved in the requesting user's settings (the same rule as the alert list). A request with no user gets the deployment's default language |
| `alerts[].rule` | UUID \| null | The alert rule that raised the alert. `null` when the rule has been deleted |
| `alerts[].opened_at` | datetime | When the alert opened |
| `count` | integer | How many critical and warning alerts are open, including any beyond those listed in `alerts` |
| `updated_at` | datetime | When the status last changed, not when it was last checked |

- **When it changes.** The status updates as soon as an alert opens or resolves, and when a change to a rule's severity changes the severity of an alert already open. It doesn't wait for the agent's next report.
- **Titles are a snapshot.** `alerts[].title` is the title from when the alert opened or last changed state. An update that only changes the measured value doesn't rewrite it; the [alerts API](/reference/api/alerts/) shows the latest value.
- **Metrics extension off.** When the workspace's metrics extension is off, `code`, `count`, `alerts`, and the `status_code` filter all count only the alerts of the core disk-usage rule, as the alert list does.
- **`null` status.** `status` is `null` for a server whose status has not been computed yet.
- **Connection is separate.** The status doesn't say whether the server is connected. Read `is_connected` for that.

## Error responses

| Status | Error code | Description |
|--------|------------|-------------|
| 400 | `server_cannot_be_deleted` | Server is still connected without `auto=true`, or related records prevent deletion. For a connected server, request agent removal or wait for it to finish |
| 400 | `server_invalid_name` | Server name is invalid or disallowed |
| 400 | `server_not_connected` | Agent action on a server that isn't connected right now |
| 400 | `server_not_commissioned` | Agent action on a server whose installation isn't finished |
| 400 | `server_busy_with_user_work` | `upgrade_agent` or `restart_agent` while the server has an open Websh or WebFTP session or a command in progress; retry when it's idle, or pass `force` |
| 400 | `server_agent_upgrade_not_needed` | `upgrade_agent` on an agent already on the latest release or a newer one; pass `reinstall` to reinstall the latest release on an agent that runs it |
| 400 | `server_pam_install_unsupported` | `install_pam` on a host with no package path for `alpamon-pam`: macOS, Windows, or a package manager Alpacon doesn't drive |
| 400 | `server_pam_install_requires_sudo_with_mfa` | `install_pam` while the workspace's **Sudo through Alpacon** is off, or the deployment can't complete MFA step-up; turn the setting on first |
| 409 | `server_agent_upgrade_in_progress` | An agent upgrade is already in progress on this server; try again after it finishes |
| 409 | `server_pam_install_in_progress` | An `alpamon-pam` install is already pending on this server; try again after it finishes |
| 401 | `auth_token_missing` | Invalid or missing authentication. See [authentication](/reference/api/#authentication) for the other `401` codes |
| 403 | `permission_denied` | Insufficient permissions to write this server (not the owner, and not a group owner or manager) |
| 403 | `api_token_scope_missing` | The API or service token doesn't hold the `server:<action>` scope this request needs |
| 404 | `api_not_found` | Server not found |

Source: https://docs.alpacax.com/reference/api/servers/servers/
