Get a check's SSL certificate
const url = 'https://app.tunnelhq.com/api/v1/servers/srv_42/certificate';const options = {method: 'GET', headers: {'X-Project-Id': 'prj_12', 'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://app.tunnelhq.com/api/v1/servers/srv_42/certificate \ --header 'X-API-Key: <X-API-Key>' \ --header 'X-Project-Id: prj_12'A website or keyword check’s SSL certificate, as the SSL certificate panel on the check’s page shows it.
Any role in the project can call it. A tunnel, or any other kind of check, is refused with 404.
stateisvalid,soon(inside the alert window: 14 days, or the check’s expiry alert when that’s longer),expired,invalid(not trusted, or not for the check’s host), orunread(no connection over HTTPS yet).problemsays why in a few words, such asSelf signed,Incomplete chain,Untrusted root, orNot for shop.example.com.certificateis what the check’s last successful connection saw. It’snulluntil one is read.days_leftcounts down tonot_afterfrom now.- Each of
checkshasok:true,false, ornullwhen it can’t be told. alert_daysis the check’s expiry alert,0when it’s off. Change it withssl_expirationonPUT /servers/:id.ignores_tlsistruewhen the check stays up with a bad certificate.domainis the domain’s registration when the check watches it, andnullotherwise.
The answer never holds the check’s address, its headers, body, or login, or a client certificate or key.
Need an API key? See Getting an API key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”The monitor, as srv_42 or 42.
Example
srv_42Header Parameters
Section titled “Header Parameters”The project, as prj_12 or 12. A workspace key can only reach its own workspace’s projects.
Example
prj_12Responses
Section titled “ Responses ”The check’s certificate.
object
The host the certificate must cover.
Why it is expired or invalid, in a few words. null otherwise.
How often the check runs, in seconds. It reads the certificate on every run.
Days before expiry that the alert opens. 0 is off.
true when the alert also reminds 7 days and 1 day before expiry.
true when the check stays up with an invalid or expired certificate.
What the check’s last successful connection saw. null until one is read.
object
Whole days until not_after. Negative once it has passed.
The hostnames it covers.
Its common name.
The certificate, then each issuer up to the root, as far as the check saw them.
object
Always null for a check. A server’s certificate fills it.
When TunnelHQ first saw this certificate.
object
null when it can’t be told.
hostname only: the hosts it must cover.
hostname only: the hosts it doesn’t cover.
trusted only: why it isn’t trusted.
The domain’s registration, when the check watches it.
object
Example
{ "host": "shop.example.com", "state": "soon", "problem": null, "every_sec": 60, "alert_days": 14, "reminders": true, "ignores_tls": false, "certificate": { "not_after": "2026-11-25T22:56:00.000Z", "not_before": "2026-08-27T22:56:00.000Z", "days_left": 12, "names": [ "shop.example.com", "www.shop.example.com" ], "subject": "shop.example.com", "issuer": "R11 · Let's Encrypt", "serial": "04:A1:7E:3B:9C:52:D0:18:6F", "key": "ECDSA P-256", "signature": "RSA with SHA-256", "tls_version": "TLS 1.3", "chain": [ { "name": "shop.example.com", "issuer": "R11", "not_after": "2026-11-25T22:56:00.000Z" }, { "name": "R11", "issuer": "ISRG Root X1", "not_after": "2027-03-12T23:59:59.000Z" } ], "renewed_on_disk": null, "trusted": true, "trust_problem": null, "first_seen": "2026-08-28T06:10:00.000Z", "checks": [ { "key": "validity", "ok": true }, { "key": "hostname", "ok": true, "hosts": [ "shop.example.com" ], "uncovered": [] }, { "key": "trusted", "ok": true, "problem": null }, { "key": "chain", "ok": true }, { "key": "tls", "ok": true }, { "key": "strength", "ok": true } ] }, "domain": { "domain": "example.com", "expires_at": "2027-08-13T04:00:00.000Z", "days_left": 273, "alert_days": 30 }}Headers
Section titled “Headers”Requests the workspace’s plan allows per minute.
Requests left in the current minute.
Unix time, in seconds, when the current minute ends.
The monitor ID isn’t valid, or the X-Project-Id header is missing or malformed.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 400, "message": "Invalid server ID"}{ "error": true, "code": 400, "message": "X-Project-Id header is required (e.g. prj_1 or numeric id)"}The API key is missing, wrong, expired, switched off, or no longer valid.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 401, "message": "API key is required. Provide X-API-Key header or Authorization: Bearer <key>"}{ "error": true, "code": 401, "message": "Invalid or expired API key"}{ "error": true, "code": 401, "message": "API key has expired"}{ "error": true, "code": 401, "message": "API key owner account is inactive"}{ "error": true, "code": 401, "message": "This API key's workspace access has been removed"}The key can’t reach this project.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 403, "message": "This API key is scoped to a different organization"}{ "error": true, "code": 403, "message": "You do not have access to this project"}There’s no such monitor in the project, or it isn’t a website or keyword check on https://.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 404, "message": "Server not found"}{ "error": true, "code": 404, "message": "A tunnel has no certificate here: only a website or keyword check on https:// has one."}{ "error": true, "code": 404, "message": "Only a website or keyword check on https:// has a certificate."}A usage limit was reached, or this IP address made too many requests with a wrong key.
Usage limits are per workspace and plan: per minute (Retry-After: 60), per day
(Retry-After: 3600), and per month (no Retry-After). They use their own body shape.
An IP address may send 10 wrong keys a minute; one more is allowed every 6 seconds. While
that allowance is used up, every request from the address is refused, even one with a
valid key.
object
Seconds to wait. Absent for the monthly limit.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": "Rate limit exceeded", "message": "Per-minute limit of 60 requests exceeded", "retry_after": 60}{ "error": "Daily limit exceeded", "message": "Daily limit of 25000 requests exceeded", "retry_after": 3600}{ "error": "Monthly limit exceeded", "message": "Monthly limit of 250000 requests exceeded"}{ "error": true, "code": 429, "message": "Too many failed API key attempts from this address. Wait a few seconds and try again.", "retry_after": 6}Headers
Section titled “Headers”Seconds to wait. 60 for the per-minute limit, 3600 for the daily limit, 6 after wrong keys. Absent for the monthly limit.
Something failed on TunnelHQ’s side.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true, "code": 500, "message": "Internal server error"}