Update a domain's CDN settings
PATCH /api/v2/domains/{id}/cdn
Change the CDN settings of a domain. Send only the groups and fields you want to change, in the shape GET /api/v2/domains/{id}/cdn returns: proxied, security, performance, cache, waf and geoRestriction. The domain must be active. proxied: true sends the domain’s traffic through the CDN. security.blockedCrawlers takes crawler IDs such as gptbot or baiduspider and blocks them before every other rule. waf.uaBlocklist and waf.ipBlocklist block user-agent text and IP ranges the same way. Each of these lists replaces the stored list. To turn off the country rules, send geoRestriction.mode: "off". A body without a supported setting returns 400 invalid_request. So does an invalid list entry, with a pointer to it in errors[]. The response is the updated CDN state, as the GET returns it. Setup steps such as prepare_nameservers are not settings. Send them to POST /api/v2/cdn/zones/{id} with the cdn_… ID from the response’s id.
Authentication: An API key with the scopes write:cdn and write:domains. About keys and scopes
Request
Path parameters
idstringrequireddom_…).Body
proxiedbooleansecurityobjectlevelstringoff, low, medium, high.sslModestringoff, flexible, full, strict.alwaysUseHttpsbooleanminTlsVersionstring1.0, 1.1, 1.2, 1.3.botProtectionbooleanblockBadCrawlersbooleanblockBadBotsbooleanwpLoginProtectionbooleanwpAdminChallengebooleanblockedCrawlersarray of string[] to clear the list. An unknown ID returns invalid_request with errors[].code unknown_crawler_id. More than 50 IDs return too_many_crawlers.performanceobjectearlyHintsbooleanalwaysOnlinebooleancacheobjectpurgeCachebooleanwafobjectskipEnabledbooleanchallengeGeoEnabledbooleanvisitorProfileModestringoff, challenge, block.ipAllowlistarray of stringuaAllowlistarray of stringpathAllowlistarray of stringuaBlocklistarray of string. _ / ( ) + : ; -. An entry that matches ordinary browser tokens returns invalid_request with errors[].code browser_user_agent_rejected.ipBlocklistarray of stringinvalid_request with errors[].code invalid_ip.geoRestrictionobjectmodestringoff, whitelist.additionalCountriesarray of stringExample
curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/cdn" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "proxied": true, "security": { "sslMode": "full", "alwaysUseHttps": true, "minTlsVersion": "1.2" } }'curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/cdn" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "waf": { "visitorProfileMode": "challenge" }, "geoRestriction": { "mode": "whitelist", "additionalCountries": [ "SE" ] } }'curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/cdn" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "security": { "blockedCrawlers": [ "gptbot", "claudebot", "meta-externalagent", "bytespider", "baiduspider", "yandex" ] }, "waf": { "uaBlocklist": [ "MegaIndex" ], "ipBlocklist": [ "198.51.100.0/24" ] } }'Responses
200 The domain’s CDN state after the change.
{ "id": "cdn_01hxa3b4c5d6e7f8g9h0j1k2m3", "domain": "example.com", "state": { "exists": true, "enabled": true, "status": "active", "reason": null }, "proxied": true, "cdn": { "enabled": true, "proxy": true }, "security": { "level": "medium", "sslMode": "full", "alwaysUseHttps": true, "minTlsVersion": "1.2", "botProtection": true, "blockBadCrawlers": true, "blockBadBots": true, "wpLoginProtection": true, "wpAdminChallenge": true, "blockedCrawlers": [] }, "performance": { "earlyHints": true, "alwaysOnline": true }, "cache": { "purgeCache": false }, "waf": { "skipEnabled": false, "challengeGeoEnabled": true, "visitorProfileMode": "challenge", "ipAllowlist": [ "192.0.2.10" ], "uaAllowlist": [ "Example-Monitor/1.0" ], "pathAllowlist": [ "/health" ], "uaBlocklist": [], "ipBlocklist": [] }, "geoRestriction": { "enabled": true, "whitelistCountries": [ "SE" ], "mode": "whitelist", "standardCountries": [], "additionalCountries": [ "SE" ], "combinedCountries": [ "SE" ] }, "activity": { "lastChangeDetectedAt": "2026-04-27T12:00:00.000Z", "lastCheckedAt": "2026-04-27T12:00:00.000Z", "settingsUpdatedAt": "2026-04-27T12:00:00.000Z" }, "actions": { "canEnableProxy": { "allowed": true, "reason": null }, "canIssueCertificate": { "allowed": true, "reason": null }, "canChangeMode": { "allowed": true, "reason": null }, "canActivate": { "allowed": false, "reason": "CDN is already active for this domain." }, "canDeactivate": { "allowed": true, "reason": null }, "canPreparePartial": { "allowed": true, "reason": null }, "canCheckPartial": { "allowed": false, "reason": "Prepare external DNS setup first." }, "canPrepareNameservers": { "allowed": false, "reason": "Hostup's nameservers already answer for this domain." } }, "records": null, "setup": { "mode": "full", "status": "active", "reason": null, "verification": null, "routing": [], "certificate": { "status": "active", "hosts": [ "example.com", "www.example.com" ] }, "checkedAt": "2026-04-27T12:00:00.000Z", "currentNameservers": [ "primary.ns.hostup.se", "secondary.ns.hostup.se" ], "expectedNameservers": [ "primary.ns.hostup.se", "secondary.ns.hostup.se" ], "registrarRelation": "hostup", "nameserverManagementUrl": "/domains/example.com?tab=nameservers" }}Response fields
setupobjectstatus and reason as returned. A prepared partial setup is not active until the verification, the routing and the HTTPS certificate are confirmed. Copy the DNS names and values as returned. Don’t build them yourself.modestringfull: the domain uses Hostup’s nameservers. partial: your own DNS stays authoritative and chosen hostnames are routed through the CDN. currentNameservers shows the nameservers seen now. One of full, partial, unknown.statusstringpending_… status names the next setup step. unavailable means the state could not be read. It does not mean that DNS or the certificate is wrong. One of not_configured, pending_verification, pending_routing, pending_certificate, active, unavailable.reasonstring or nullverificationobject or nullroutingarray of objectstatus: unsupported is not set up.hostnamestringcurrentOriginarray of objecttypestringA, AAAA, CNAME.valuestringrecordobject or nullALIAS only when your provider supports a flattened alias at the zone apex. Don’t replace an apex with a plain CNAME when that conflicts with the other records at the apex.statusstringpending, verified, unsupported, unknown.reasonstring or nullcertificateobjectstatusstringactive, pending, error, unknown.hostsarray of stringcheckedAtstring or nullcurrentNameserversarray of stringexpectedNameserversarray of stringregistrarRelationstringhostup, external, unknown.nameserverManagementUrlstring or nullexpectedNameservers at your registrar.idstringcdn_…).domainstringstateobjectexistsbooleanenabledbooleanstatusstringreasonstring or nullproxiedbooleancdnobjectenabledbooleanproxybooleansecurityobjectlevelstringoff, low, medium, high.sslModestringoff, flexible, full, strict.alwaysUseHttpsbooleanminTlsVersionstring1.0, 1.1, 1.2, 1.3.botProtectionbooleanblockBadCrawlersbooleanblockBadBotsbooleanwpLoginProtectionbooleanwpAdminChallengebooleanblockedCrawlersarray of stringbaiduspider, gptbot, claudebot, ahrefsbot. Lowercase IDs only. The crawler catalogue has the full list. Empty unless crawlers were chosen. Separate from blockBadCrawlers, the general check for bad crawlers.performanceobjectearlyHintsbooleanalwaysOnlinebooleancacheobjectpurgeCachebooleanwafobjectskipEnabledbooleanchallengeGeoEnabledbooleanvisitorProfileModestringchallenge: visitors from outside the allowed countries must pass a challenge. block: they are blocked. off: the visitor profile does nothing. One of off, challenge, block.ipAllowlistarray of stringuaAllowlistarray of stringpathAllowlistarray of stringuaBlocklistarray of stringMozilla, Chrome or bot, are rejected with invalid_request. They would block ordinary visitors.ipBlocklistarray of stringgeoRestrictionobjectenabledbooleanwhitelistCountriesarray of stringcombinedCountries instead.modestringoff: no country limit. whitelist: only the countries in combinedCountries are allowed. One of off, whitelist.standardCountriesarray of stringadditionalCountriesarray of stringstandardCountries.combinedCountriesarray of stringstandardCountries plus additionalCountries.activityobjectlastChangeDetectedAtstring or nulllastCheckedAtstring or nullsettingsUpdatedAtstring or nullactionsobjectcanEnableProxyobjectallowedbooleanreasonstring or nullcodestring or nullcanIssueCertificateobjectallowedbooleanreasonstring or nullcodestring or nullcanChangeModeobjectallowedbooleanreasonstring or nullcodestring or nullcanActivateobjectallowedbooleanreasonstring or nullcodestring or nullcanDeactivateobjectallowedbooleanreasonstring or nullcodestring or nullcanPreparePartialobjectallowedbooleanreasonstring or nullcodestring or nullcanCheckPartialobjectallowedbooleanreasonstring or nullcodestring or nullcanPrepareNameserversobjectprepare_nameservers to POST /api/v2/cdn/zones/{id}. Read the zone until this gate closes. Only then change the nameservers. Not allowed when the zone is already published, when it uses your own DNS or when readiness was not checked.allowedbooleanreasonstring or nullcodestring or nullrecordsarray of any or nullnull unless you send includeRecords=true. Then the proxied A, AAAA and CNAME records.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | The body has no supported setting or an entry is invalid. errors[] points to each invalid entry. |
| 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 is domain_not_found. |
| 409 | Conflict. code is account_suspended, or a route-specific blocker with its own recovery fields. |
| 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. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |