Set CDN proxying for a DNS record
PATCH /api/v2/dns-zones/{id}/records/{recordId}
Turns CDN proxying on or off for one A, AAAA or CNAME record. The body is { "proxied": true } or { "proxied": false } and nothing else. Use PUT /api/v2/dns-zones/{id}/records/{recordId} to change the record itself. The CDN proxy rule behind the record is created or updated for you.
Turning proxying on needs an active CDN on the zone. Some records cannot change their proxy state, for example mail and webmail names, nested subdomains and records an MX record points to. A refused change returns 409 dns_record_proxy_blocked. To check first, read the record from GET /api/v2/domains/{id}/dns. It takes the domain ID, not the zone ID, and needs read:domains and read:cdn besides read:dns. Each A, AAAA and CNAME record there carries proxied and actions.canChangeProxy. Without read:cdn those fields are left out.
Authentication: An API key with the scopes write:cdn and read:dns. About keys and scopes
Request
Path parameters
idstringrequiredGET /api/v2/dns-zones.recordIdstringrequiredGET /api/v2/dns-zones/{id}.Body
proxiedbooleanExample
curl -X PATCH "https://cloud.hostup.se/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/records/drr_01hxa3b4c5d6e7f8g9h0j1k2m3" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "proxied": true }'curl -X PATCH "https://cloud.hostup.se/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/records/drr_01hxa3b4c5d6e7f8g9h0j1k2m3" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "proxied": false }'Responses
200 The record with its new proxy state.
{ "id": "drr_01hxa3b4c5d6e7f8g9h0j1k2m4", "type": "A", "name": "www.example.com", "value": "192.0.2.10", "ttl": 3600, "proxied": true, "actions": { "canChangeProxy": { "allowed": true, "reason": null } }}Response fields
idstringtypestringA, AAAA, CNAME, ALIAS, MX, TXT, SRV, CAA, NS, TLSA, SOA.namestring_dmarc.example.com. The domain itself is example.com.valuestringttlintegerpriorityinteger or nullnull when the DNS server returned no priority.weightinteger or nullnull when the DNS server returned no weight.portinteger or nullnull when the DNS server returned no port.proxiedbooleanproxyReasonstringactionsobjectcanChangeProxyobjectallowedbooleanreasonstring or nullcodestring or nullwarningsarray of objectPOST /api/v2/dns-zones/{id}/records) when the record was added but the records with the same name need a look. Examples: several A records, AAAA records left over, several MX records.codestringsame_name_address_records, same_name_ipv6_records, same_name_mx_records.severitystringwarning.messagestringrecordsarray of objectidstringtypestringnamestringvaluestringpriorityinteger or nullErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code names the missing resource: dns_zone_not_found, dns_record_not_found. |
| 409 | This record cannot change its proxy state. detail says why. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 503 | The CDN proxy rule could not be read or changed right now. code is external_provider_failed. Nothing was changed. Some of these failures come with status 500 and the same code. Retry later. |