hosting

PATCH /v1/sites/{siteId}/certificate

Change the site's "Always use HTTPS" (HSTS) switch.

All hosting endpoints

All developer docs →

Zinn®, our Viking, hammering at his anvil beside an API endpoint sending events to several listeners.

Authentication

Send an API key as a bearer token. The endpoint checks sites.panel_access, sites.view; a key without it is refused with 403, not 404.

This endpoint takes no organisation id. Your key already identifies the organisation it belongs to, and the response is scoped to it.

Try it

Replace anything in angle brackets with your own values, and the key placeholder with a key from your dashboard.

curl -X PATCH https://api.zinndigital.com/v1/sites/{siteId}/certificate \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "hsts_enabled": <boolean> }'

Signed in? The API console in your dashboard fills in your real organisation id and your own key, and runs the request against the live API so you can see the actual response. Open this endpoint in the API console

Details

P4-018, owner answer A074. Saves the switch and starts the write to the site's server; the header is only sent while the site's own certificate is in date, so turning it on for a site whose HTTPS is not working yet sends nothing until it is. Needs sites.panel_access. Audit-logged. P6e-014: also takes the policy the header sends (max-age, includeSubDomains, preload), and the same write carries the switch and policy to a CDN edge that writes its own header, on a zone the site owns.

Parameters

NameTypeRequiredWhat it is
siteId (path)UuidYesSite ID (UUIDv7).

Request body

NameTypeRequiredWhat it is
hsts_enabledbooleanYesTurn the "Always use HTTPS" signal (HSTS) on or off for this site.
hsts_max_ageintegerNoThe max-age in seconds; one of SiteCertificateStatus.hsts_max_age_choices.
hsts_include_subdomainsbooleanNoSend includeSubDomains.
hsts_preloadbooleanNoSend preload (needs includeSubDomains and a year's max-age).

Response

NameTypeRequiredWhat it is
site_idstringYes—
statestring<none, pending, issued, failed, retired>Yes⛔ none means nothing has been attempted, which is a DIFFERENT fact from failed. Collapsing them would leave a screen unable to tell a new site from a broken one.
scopestring<site, shared>Yesshared when one platform certificate for a registrable domain we own covers this site — the ordinary case for a preview hostname.
shared_suffixstringNoThe registrable domain a shared certificate covers. Empty when scope is site.
hostnamesstring[]YesRead back off the ISSUED artefact, never from what was requested — a CA that trimmed a name must not be reported as covering it.
coveredbooleanYesA certificate authority has signed a certificate for this site.
servingbooleanYes⛔ The box actually presents it. DIFFERENT from covered: a certificate that exists in Vault and is not installed serves nobody.
failure_reasonstringNo—
failure_detailstringNo—
not_afterstringNo—
installed_atstringNo—
environmentstringNo⛔ Travels because a staging certificate is trusted by NO browser. A screen showing one as simply "issued" would report green for a site every visitor sees a warning on.
sourcestring<, acme, cloudflare_origin_ca, uploaded>NoP4-021. Who issued the certificate: uploaded is the customer's own certificate (POST .../certificate/upload), which they renew; they are e-mailed 30, 14 and 7 days before it…
publicly_trustedbooleanNoP4-021. For an uploaded certificate: whether its chain verified against the public root store browsers use when it was uploaded. false (self-signed or a private CA) means…
wildcard_coveredbooleanNoWhether subdomains are covered. A wildcard needs DNS-01, which needs a TXT record in the zone, so a domain whose DNS we do not manage cannot have one.
hsts_enabledbooleanNoThe site's "Always use HTTPS" switch (HSTS, P4-018). When on, the site sends Strict-Transport-Security with the policy below (by default max-age=86400: one day, no…
hsts_max_ageintegerNoThe max-age the header sends, in seconds (one of hsts_max_age_choices).
hsts_include_subdomainsbooleanNoWhether the header carries includeSubDomains (every name under the site).
hsts_preloadbooleanNoWhether the header carries preload. ⚠️ Off by default: a preloaded name is hard-coded into browsers and takes months to remove. Needs includeSubDomains and a max-age of at…
hsts_max_age_choicesinteger[]NoThe max-age values a customer may choose, in seconds, shortest first.

Errors this endpoint can return

401 · 403 · 404 · 422