## GET /api/v2/vps/{id}/mail-relay

**Get VPS mail-relay status**

Return mail-relay verification data and delivery/security insights for the VPS primary IP. If `dnsRecord` is present, add it as a TXT record on the sender domain to verify relay ownership; `insightsStatus` explains whether live insight data is available.

### Related Endpoints

- `GET /api/v2/vps/{id}`: Get VPS details
- `GET /api/v2/vps/{id}/iso`: List VPS ISO media
- `GET /api/v2/vps/{id}/disks`: List VPS disks

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scope: `read:vm`

### Parameters

- `id` (path, string, required): Public VPS ID. Get it from GET /api/v2/vps `data[].id`. Do not invent this value; use the exact ID returned by the referenced API response. Example: `vps_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Example

```bash
curl -X GET "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/mail-relay" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

### Response Schema

- `ip` (string,null, required) Example: `203.0.113.10`
- `token` (string,null, required) Example: `h_MjAzLjAuMTEzLjEw_example`
- `dnsRecord` (string,null, required) Example: `_hostup.yourdomain.com TXT "v=mc1 auth=h_MjAzLjAuMTEzLjEw_example"`
- `insightsStatus` (string, required) Example: `available`
  Allowed values: available, missing_ip, not_configured, rate_limited, unavailable
- `policyDisposition` (string,null, required) Example: `none`
- `alertTotal` (integer, required) Example: `1`
- `alertBuckets` (array<object>, required)
- `alertBuckets[].date` (string, required) Example: `2026-04-27`
- `alertBuckets[].count` (integer, required) Example: `1`
- `alerts` (array<object>, required)
- `alerts[].conditionName` (string, required) Example: `Spam detected`
- `alerts[].description` (string,null, required) Example: `Message blocked as spam`
- `alerts[].envelopeSender` (string,null, required) Example: `sender@example.com`
- `alerts[].reason` (object, required)
- `alerts[].reason.code` (string, required) Example: `CS`
  Allowed values: CSR, ESA, CS, INVALID_FROM_HEADER, BFD, TCR, UNKNOWN
- `alerts[].reason.title` (string, required) Example: `Message blocked as spam`
- `alerts[].reason.description` (string, required) Example: `This individual message matched spam filtering.`
- `alerts[].reason.actions` (array<string>, required)
- `alerts[].timestamp` (string, required) Example: `2026-04-27T12:00:00.000Z`
- `recentBlocks` (array<object>, required)
- `recentBlocks[].timestamp` (string, required) Example: `2026-04-27T12:00:00.000Z`
- `recentBlocks[].sender` (string,null, required) Example: `sender@example.com`
- `recentBlocks[].recipientDomain` (string,null, required) Example: `example.net`
- `recentBlocks[].responseCode` (string,null, required) Example: `550`
- `recentBlocks[].responseMessage` (string,null, required) Example: `Message rejected`
- `recentBlocks[].lastCommand` (string,null, required) Example: `DATA`
- `recentBlocks[].reason` (object, required)
- `recentBlocks[].reason.code` (string, required) Example: `CS`
  Allowed values: CSR, ESA, CS, INVALID_FROM_HEADER, BFD, TCR, UNKNOWN
- `recentBlocks[].reason.title` (string, required) Example: `Message blocked as spam`
- `recentBlocks[].reason.description` (string, required) Example: `This individual message matched spam filtering.`
- `recentBlocks[].reason.actions` (array<string>, required)
- `recentBlocks[].spamDisposition` (string, required) Example: `QUARANTINE`
- `recentBlocks[].virusDisposition` (string, required) Example: `CLEAN`
- `recentBlocks[].remediationOption` (string,null, required) Example: `Review sender authentication`
- `deliverySummary` (object, required)
- `deliverySummary.delivered` (number,null, required) Example: `120`
- `deliverySummary.blocked` (number,null, required) Example: `1`
- `deliverySummary.rejected` (number,null, required) Example: `0`
- `deliverySummary.deferred` (number,null, required) Example: `2`
- `windowDays` (integer, required) Example: `7`
- `refreshedAt` (string,null, required) Example: `2026-04-27T12:00:00.000Z`

### Responses

#### 200 - Mail-relay status.
```json
{
  "ip": "203.0.113.10",
  "token": "h_MjAzLjAuMTEzLjEw_example",
  "dnsRecord": "_hostup.yourdomain.com TXT \"v=mc1 auth=h_MjAzLjAuMTEzLjEw_example\"",
  "insightsStatus": "available",
  "policyDisposition": "Sender was accepted by policy.",
  "alertTotal": 0,
  "alertBuckets": [
    {
      "date": "2026-04-27",
      "count": 0
    }
  ],
  "alerts": [],
  "recentBlocks": [],
  "deliverySummary": {
    "delivered": null,
    "blocked": null,
    "rejected": null,
    "deferred": null
  },
  "windowDays": 7,
  "refreshedAt": "2026-04-27T12:00:00.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 body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/items/0/domainName",
      "detail": "`domainName` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 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.
```json
{
  "type": "https://developer.hostup.se/errors/not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "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": "Too many requests. Retry after the limit resets.",
  "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"
}
```
