## PATCH /api/v2/dns-zones/{id}/records/{recordId}

**Update DNS record proxying**

Partially update one DNS record's CDN proxy state. Get `id` from `GET /api/v2/domains/{id}/dns` `zone.id` or `GET /api/v2/dns-zones`, and get `recordId` from `records[].id`. This is the DNS-record surface for proxying; callers do not need to list or mutate CDN proxy-rule resources. The endpoint reads the DNS record before changing proxy state, so API-key callers need both `write:cdn` and `read:dns`. The record must be A, AAAA, or CNAME and CDN must be enabled for the zone.

### Related Endpoints

- `PUT /api/v2/dns-zones/{id}/records/{recordId}`: Update DNS record
- `DELETE /api/v2/dns-zones/{id}/records/{recordId}`: Delete DNS record
- `GET /api/v2/dns-zones/{id}/records`: List DNS zone records

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scopes: `write:cdn`, `read:dns`
- `Content-Type`: application/json

### Parameters

- `id` (path, string, required): Public DNS zone ID. Get it from GET /api/v2/dns-zones `data[].id`. Do not invent this value; use the exact ID returned by the referenced API response. Example: `zone_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `recordId` (path, string, required): Public DNS record ID. Get it from GET /api/v2/dns-zones/{id} `records[].id`. Do not invent this value; use the exact ID returned by the referenced API response. Example: `drr_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Body

- `proxied` (boolean, optional): Set to true to route this DNS record through CDN proxying, or false to keep it DNS-only. Valid only for proxy-capable A, AAAA, and CNAME records. Example: `true`

### Request Examples

#### Enable proxying

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/records/drr_01hxa3b4c5d6e7f8g9h0j1k2m3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "proxied": true
  }'
```

```json
{
  "proxied": true
}
```

#### Disable proxying

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/records/drr_01hxa3b4c5d6e7f8g9h0j1k2m3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "proxied": false
  }'
```

```json
{
  "proxied": false
}
```

### Response Schema

- `id` (string, optional) Example: `drr_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `type` (string, optional) Example: `TXT`
  Allowed values: A, AAAA, CNAME, ALIAS, MX, TXT, SRV, CAA, NS, TLSA
- `name` (string, optional) Example: `_dmarc.example.com`
- `value` (string, optional) Example: `v=DMARC1; p=none; rua=mailto:dmarc@example.com`
- `ttl` (integer, optional) Example: `3600`
- `priority` (integer,null, optional): Present only for MX and SRV records. `null` means the upstream DNS provider omitted priority for a priority-capable record. Example: `10`
- `weight` (integer,null, optional): Present only for SRV records. `null` means the upstream DNS provider omitted weight for an SRV record. Example: `5`
- `port` (integer,null, optional): Present only for SRV records. `null` means the upstream DNS provider omitted port for an SRV record. Example: `5060`
- `proxied` (boolean, optional): Present only on A, AAAA, and CNAME records when the CDN proxy state is known. Omitted for record types that cannot be proxied. Example: `false`
- `proxyReason` (string, optional): Present only when this proxy-capable record has a customer-facing reason that prevents changing the proxy state. Example: `Mail server records cannot be proxied because MX records depend on them.`
- `actions` (object, optional): Compact action gates for state that belongs to this DNS record. Present only when a server-side action gate is relevant to the record.
- `actions.canChangeProxy` (object, required)
- `actions.canChangeProxy.allowed` (boolean, required) Example: `true`
- `actions.canChangeProxy.reason` (string,null, required) Example: `null`
- `actions.canChangeProxy.code` (string,null, optional): Machine-readable reason code when an action is blocked. Example: `pending_order`
- `warnings` (array<object>, optional): Present on DNS write responses when the request succeeded but the resulting same-name record set deserves review, for example multiple A records, remaining AAAA records, or multiple MX records.
- `warnings[].code` (string, required) Example: `same_name_address_records`
  Allowed values: same_name_address_records, same_name_ipv6_records, same_name_mx_records
- `warnings[].severity` (string, required) Example: `warning`
  Allowed values: warning
- `warnings[].message` (string, required) Example: `There are now multiple A records for example.com. This is valid for some setups, but if the customer expected a replacement, remove the old A record explicitly.`
- `warnings[].records` (array<object>, required): Existing records that triggered the warning. The newly created or updated record is the main response object.
- `warnings[].records[].id` (string, required) Example: `drr_01hxa3b4c5d6e7f8g9h0j1k2m4`
- `warnings[].records[].type` (string, required) Example: `A`
- `warnings[].records[].name` (string, required) Example: `example.com`
- `warnings[].records[].value` (string, required) Example: `198.51.100.25`
- `warnings[].records[].priority` (integer,null, optional) Example: `10`

### Responses

#### 200 - Updated DNS record.
```json
{
  "id": "drr_01hxa3b4c5d6e7f8g9h0j1k2m4",
  "type": "A",
  "name": "www.example.com",
  "value": "203.0.113.10",
  "ttl": 3600,
  "proxied": true,
  "actions": {
    "canChangeProxy": {
      "allowed": true,
      "reason": null
    }
  }
}
```

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

#### 409 - The record cannot change proxy state right now.
```json
{
  "type": "https://developer.hostup.se/errors/dns_record_proxy_blocked",
  "title": "DNS record proxy change blocked",
  "status": 409,
  "detail": "Mail server records cannot be proxied because MX records depend on them.",
  "code": "dns_record_proxy_blocked",
  "instance": "/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/records/drr_01hxa3b4c5d6e7f8g9h0j1k2m4"
}
```

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