hosting
PATCH /v1/sites/{siteId}/certificate
Change the site's "Always use HTTPS" (HSTS) switch.
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
| Name | Type | Required | What it is |
|---|---|---|---|
siteId (path) | Uuid | Yes | Site ID (UUIDv7). |
Request body
| Name | Type | Required | What it is |
|---|---|---|---|
hsts_enabled | boolean | Yes | Turn the "Always use HTTPS" signal (HSTS) on or off for this site. |
hsts_max_age | integer | No | The max-age in seconds; one of SiteCertificateStatus.hsts_max_age_choices. |
hsts_include_subdomains | boolean | No | Send includeSubDomains. |
hsts_preload | boolean | No | Send preload (needs includeSubDomains and a year's max-age). |
Response
| Name | Type | Required | What it is |
|---|---|---|---|
site_id | string | Yes | — |
state | string<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. |
scope | string<site, shared> | Yes | shared when one platform certificate for a registrable domain we own covers this site — the ordinary case for a preview hostname. |
shared_suffix | string | No | The registrable domain a shared certificate covers. Empty when scope is site. |
hostnames | string[] | Yes | Read back off the ISSUED artefact, never from what was requested — a CA that trimmed a name must not be reported as covering it. |
covered | boolean | Yes | A certificate authority has signed a certificate for this site. |
serving | boolean | Yes | ⛔ The box actually presents it. DIFFERENT from covered: a certificate that exists in Vault and is not installed serves nobody. |
failure_reason | string | No | — |
failure_detail | string | No | — |
not_after | string | No | — |
installed_at | string | No | — |
environment | string | No | ⛔ 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. |
source | string<, acme, cloudflare_origin_ca, uploaded> | No | P4-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_trusted | boolean | No | P4-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_covered | boolean | No | Whether 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_enabled | boolean | No | The 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_age | integer | No | The max-age the header sends, in seconds (one of hsts_max_age_choices). |
hsts_include_subdomains | boolean | No | Whether the header carries includeSubDomains (every name under the site). |
hsts_preload | boolean | No | Whether 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_choices | integer[] | No | The max-age values a customer may choose, in seconds, shortest first. |
Errors this endpoint can return
401 · 403 · 404 · 422