## GET /api/v2/vps/{id}/diagnostics/connectivity

**Check VPS reachability from the internet**

Test from the internet whether the VPS answers on common TCP ports. The test connects to the VPS's own primary IP address. You cannot point it at another host. By default it tests ports 22, 80, 443 and 3389. Pass `ports` to test other ports, up to 6. Each port is `open`, `closed` (the server refused the connection) or `no_response` (nothing answered within 3 seconds). `verdict` sums them up. `all_clear`: every port accepted a connection. `host_up_some_services_down`: some ports accepted a connection and others did not. `host_up_no_services`: no port accepted a connection. The server is up because it refused at least one. `network_unreachable`: nothing answered. The VPS may be off or failed to boot. A firewall may also drop everything. `no_public_ip`: the VPS has no address to test.

### Related Endpoints

- `GET /api/v2/vps/{id}`: Get a VPS
- `GET /api/v2/vps/{id}/iso`: List ISO images and CD/DVD drives
- `GET /api/v2/vps/{id}/disks`: List VPS disks

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scopes: `read:vm`, `read:network`

### Parameters

- `id` (path, string, required): The VPS ID (`vps_…`). Example: `vps_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `ports` (query, string): Comma-separated TCP ports to test, at most 6. Default `22,80,443,3389`. Values that are not ports are ignored. Example: `22,443`

### Request Example

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

### Response Schema

- `verdict` (string, required): Sum of the port results. Example: `host_up_some_services_down`
  Allowed values: all_clear, host_up_some_services_down, host_up_no_services, network_unreachable, no_public_ip
- `host` (string, required, nullable): The address that was tested. Null only with `no_public_ip`. Example: `192.0.2.10`
- `ports` (array<object>, required): One row per tested port.
- `ports[].port` (integer, required): TCP port. Example: `22`
- `ports[].verdict` (string, required): `open`: a service accepted the connection. `closed`: the server refused it. `no_response`: nothing answered. Example: `open`
  Allowed values: open, closed, no_response
- `ports[].detail` (string, required, nullable): Why there was no answer, for example `timeout`. Null for `open` and `closed`. Example: `null`
- `ports[].latencyMs` (number, required, nullable): Time to connect in milliseconds for an `open` port. Null otherwise. Example: `12`
- `ports[].label` (string, required, nullable): Common name of the port, for example `SSH`. Null for other ports. Example: `SSH`
- `checkedAt` (string, required): When the test ran. Example: `2026-08-02T15:04:05.000Z`

### Responses

#### 200 - Verdict and the result for each port.
```json
{
  "verdict": "host_up_some_services_down",
  "host": "192.0.2.10",
  "ports": [
    {
      "port": 3389,
      "verdict": "open",
      "detail": null,
      "latencyMs": 12,
      "label": "RDP (Windows remote desktop)"
    },
    {
      "port": 22,
      "verdict": "no_response",
      "detail": "timeout",
      "latencyMs": null,
      "label": "SSH"
    }
  ],
  "checkedAt": "2026-08-02T15:04:05.000Z"
}
```

#### 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"
}
```
