## GET /api/v2/vps/{id}/ssh-access

**List the SSH keys that can log in to a VPS**

Reads `~/.ssh/authorized_keys` of the login user on the running VPS and lists every public key in it. Keys added inside the VPS are included. Each line shows its OpenSSH options as `restrictions`. The key material and option values are not returned. The file is read through the guest agent. When it cannot be read, for example while the VPS is stopped, `available` is false, `entries` is empty and `unavailableReason` says why. Change the list with `PATCH /api/v2/vps/{id}/ssh-access`.

### Related Endpoints

- `PATCH /api/v2/vps/{id}/ssh-access`: Change the SSH keys that can log in to a VPS
- `GET /api/v2/vps/{id}`: Get a VPS
- `GET /api/v2/vps/{id}/iso`: List ISO images and CD/DVD drives

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scope: `read:vm`

### Parameters

- `id` (path, string, required): The VPS ID (`vps_…`). Example: `vps_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Example

```bash
curl "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/ssh-access" \
  -H "Authorization: Bearer $HOSTUP_API_KEY"
```

### Response Schema

- `available` (boolean, required): True when the file was read from the running VPS. When false, `entries` is empty and nothing can be changed. Example: `true`
- `unavailableReason` (string, required, nullable): Why the file could not be read. `vps_not_ready`: setup is not finished. `vm_not_running`: the VPS is stopped. `guest_exec_disabled`: commands inside the VPS are turned off. `guest_agent_unavailable`: the guest agent does not answer. `unsupported_guest`: the file could not be read from this operating system. Null when `available` is true. Example: `null`
  Allowed values: vps_not_ready, vm_not_running, guest_exec_disabled, guest_agent_unavailable, unsupported_guest
- `unavailableMessage` (string, required, nullable): A sentence you can show to a person. Null when `available` is true. Example: `null`
- `loginUser` (string, required): The user whose `~/.ssh/authorized_keys` was read. The VPS's default login user, usually `root`. Example: `root`
- `checkedAt` (string, required): When the file was read. Example: `2026-08-13T10:00:00.000Z`
- `revision` (string, required, nullable): Version of the file. Send it as `revision` to `PATCH`. Null when `available` is false. Example: `9b74c9897bac770ffc029102a200c5de6e2c7e1c4f2a3b8d0e5f6a7b8c9d0e1f`
- `entries` (array<object>, required): Every public key line in the file, including keys added inside the VPS.
- `entries[].id` (string, required): ID of this line in the file. It changes when the line or its position changes. Use it in `removeEntryIds`. Example: `ak_3f9a1c7e5b2d8a4c6e0f1b3d5a`
- `entries[].keyType` (string, required): Key algorithm. Example: `ssh-ed25519`
- `entries[].fingerprint` (string, required): SHA256 fingerprint of the public key. Example: `SHA256:exampleFingerprint`
- `entries[].comment` (string, required, nullable): Comment at the end of the key line. Example: `alex@laptop`
- `entries[].restricted` (boolean, required): True when the line has OpenSSH options that limit the key. Example: `false`
- `entries[].restrictions` (array<string>, required): The options on the line. `forced_command` is `command=`, `source_restricted` is `from=`, `expires` is `expiry-time=`, `restricted` is `restrict`. `custom_options` covers any other option. The values of the options are not returned. Example: `[]`
- `entries[].savedKeyId` (string, required, nullable): The saved SSH key on your account with the same public key. Null when the key is not saved on the account. Example: `ssh_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `entries[].savedKeyName` (string, required, nullable): Name of that saved key. Example: `Laptop`
- `savedKeys` (array<object>, required): The SSH keys saved on your account and whether each one is in the file.
- `savedKeys[].id` (string, required): Saved SSH key ID. Use it in `addSshKeyIds`. Example: `ssh_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `savedKeys[].name` (string, required): Name of the saved key. Example: `Laptop`
- `savedKeys[].fingerprint` (string, required, nullable): SHA256 fingerprint of the key. Example: `SHA256:exampleFingerprint`
- `savedKeys[].active` (boolean, required): True when the key is in the file now. Example: `true`
- `savedKeys[].activeEntryIds` (array<string>, required): The `entries[].id` values that hold this key. Example: `["ak_3f9a1c7e5b2d8a4c6e0f1b3d5a"]`

### Responses

#### 200 - The keys in the file or the reason it could not be read.
```json
{
  "available": true,
  "unavailableReason": null,
  "unavailableMessage": null,
  "loginUser": "root",
  "checkedAt": "2026-08-13T10:00:00.000Z",
  "revision": "9b74c9897bac770ffc029102a200c5de6e2c7e1c4f2a3b8d0e5f6a7b8c9d0e1f",
  "entries": [
    {
      "id": "ak_5b2d8a4c6e0f1b3d5a7c9e1f3a",
      "keyType": "ssh-ed25519",
      "fingerprint": "SHA256:exampleFingerprint",
      "comment": "alex@laptop",
      "restricted": false,
      "restrictions": [],
      "savedKeyId": "ssh_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "savedKeyName": "Laptop"
    },
    {
      "id": "ak_3f9a1c7e5b2d8a4c6e0f1b3d5a",
      "keyType": "ssh-ed25519",
      "fingerprint": "SHA256:exampleFingerprint",
      "comment": "deploy-bot",
      "restricted": true,
      "restrictions": [
        "forced_command",
        "pty_disabled",
        "port_forwarding_disabled"
      ],
      "savedKeyId": null,
      "savedKeyName": null
    }
  ],
  "savedKeys": [
    {
      "id": "ssh_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "name": "Laptop",
      "fingerprint": "SHA256:exampleFingerprint",
      "active": true,
      "activeEntryIds": [
        "ak_5b2d8a4c6e0f1b3d5a7c9e1f3a"
      ]
    }
  ]
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is invalid.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller; `code` is `vps_not_found`.
```json
{
  "type": "https://developer.hostup.se/errors/vps_not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "vps_not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
