# at.happyproto.admin.listHosts

> Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listHosts)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listHosts/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listHosts/examples)

## Definitions

### `at.happyproto.admin.listHosts#host`

**Type**: `object`

A host. Never carries its addresses or agent certificate.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cpuMillis` | `integer` | Yes |  |
| `diskGb` | `integer` | Yes |  |
| `freeDiskGb` | `integer` | No | diskGb less reservedDiskGb. Negative when the host is over-committed. |
| `freeMemoryMb` | `integer` | No | memoryMb less reservedMemoryMb. Negative when the host is over-committed. |
| `id` | `string` | Yes | A UUID. |
| `lastSeenAt` | `string` (datetime) | No | When its agent last answered. Absent if it never has. |
| `memoryMb` | `integer` | Yes |  |
| `name` | `string` | Yes |  |
| `placeablePlans` | `array` | No | Plans open for new instances that fit in this host's free memory and disk, smallest first. Empty unless the host is active. |
| `reservedDiskGb` | `integer` | Yes | Disk held by the plans of instances placed here and not yet purged. A deleted instance keeps its disk through its recovery window. |
| `reservedMemoryMb` | `integer` | Yes | Memory those instances' plans hold. |
| `state` | `string` | Yes |  |
| `tenantCount` | `integer` | Yes | Instances placed here and not deleted. |

### `at.happyproto.admin.listHosts`

**Type**: `query`

Every host, with what its tenants hold. Staff only.

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hosts` | `array` | Yes |  |
| `unplaceablePlans` | `array` | No | Plans open for new instances that fit on no active host, smallest first. A new instance on one of these fails with NoCapacity. Absent from a provisioner that does not report it. |

#### Errors

- **AuthRequired**: This endpoint requires an authenticated caller.
- **Forbidden**: The caller is not HappyProto staff, or the provisioner does not treat them as staff.
- **InvalidRequest**: The provisioner refused the request as malformed. Not expected from this read; declared because every provisioner refusal is mapped the same way.
- **NotFound**: Passed through from the provisioner.
- **InvalidSlug**: Passed through from the provisioner.
- **SlugTaken**: Passed through from the provisioner.
- **NotEntitled**: Passed through from the provisioner.
- **InstanceLimit**: Passed through from the provisioner.
- **NoCapacity**: Passed through from the provisioner.
- **OperationInProgress**: Passed through from the provisioner.
- **Upstream**: The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "host": {
      "description": "A host. Never carries its addresses or agent certificate.",
      "properties": {
        "cpuMillis": {
          "type": "integer"
        },
        "diskGb": {
          "type": "integer"
        },
        "freeDiskGb": {
          "description": "diskGb less reservedDiskGb. Negative when the host is over-committed.",
          "type": "integer"
        },
        "freeMemoryMb": {
          "description": "memoryMb less reservedMemoryMb. Negative when the host is over-committed.",
          "type": "integer"
        },
        "id": {
          "description": "A UUID.",
          "type": "string"
        },
        "lastSeenAt": {
          "description": "When its agent last answered. Absent if it never has.",
          "format": "datetime",
          "type": "string"
        },
        "memoryMb": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "placeablePlans": {
          "description": "Plans open for new instances that fit in this host's free memory and disk, smallest first. Empty unless the host is active.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reservedDiskGb": {
          "description": "Disk held by the plans of instances placed here and not yet purged. A deleted instance keeps its disk through its recovery window.",
          "type": "integer"
        },
        "reservedMemoryMb": {
          "description": "Memory those instances' plans hold.",
          "type": "integer"
        },
        "state": {
          "knownValues": [
            "active",
            "draining",
            "degraded",
            "retired"
          ],
          "type": "string"
        },
        "tenantCount": {
          "description": "Instances placed here and not deleted.",
          "type": "integer"
        }
      },
      "required": [
        "id",
        "name",
        "state",
        "memoryMb",
        "cpuMillis",
        "diskGb",
        "tenantCount",
        "reservedMemoryMb",
        "reservedDiskGb"
      ],
      "type": "object"
    },
    "main": {
      "description": "Every host, with what its tenants hold. Staff only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not HappyProto staff, or the provisioner does not treat them as staff.",
          "name": "Forbidden"
        },
        {
          "description": "The provisioner refused the request as malformed. Not expected from this read; declared because every provisioner refusal is mapped the same way.",
          "name": "InvalidRequest"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "OperationInProgress"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.",
          "name": "Upstream"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "hosts": {
              "items": {
                "ref": "#host",
                "type": "ref"
              },
              "type": "array"
            },
            "unplaceablePlans": {
              "description": "Plans open for new instances that fit on no active host, smallest first. A new instance on one of these fails with NoCapacity. Absent from a provisioner that does not report it.",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "hosts"
          ],
          "type": "object"
        }
      },
      "type": "query"
    }
  },
  "id": "at.happyproto.admin.listHosts",
  "lexicon": 1
}
```
