SSL Clock

SSL Clock REST API

Manage monitors and read certificate status from your own scripts. JSON over HTTPS.

Authentication

Create a key in Settings. It is shown once; we store only a hash. Send it as a bearer token:

curl -H "Authorization: Bearer sslc_..." https://www.sslclock.com/api/v1/monitors

Revoke a key in Settings at any time. Keys act on the account they were created in.

Rate limits

Keep to 60 requests per minute per key. Those headers are written only after the key is recognized: X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. A missing or unknown key returns 401 and does not set them. Over the limit the same call returns 429 with Retry-After and {"error": "rate_limited", "message": "..."}. Back off and retry that call.

Endpoints

MethodPathWhat it does
GET/api/v1/monitorsList monitors with current certificate status.
POST/api/v1/monitorsAdd a monitor. Body {"hostname": "example.com", "port": 443}. Port is optional; host:port and URLs work too. Returns 201, 402 over the plan limit, or 409 if it already exists.
GET/api/v1/monitors/{id}One monitor.
GET/api/v1/monitors/{id}/checksThe last 50 checks.
POST/api/v1/monitors/{id}/checkRun a check now and return the result.
DELETE/api/v1/monitors/{id}Remove a monitor. Returns 204.

Monitor object

{
  "id": "…", "hostname": "example.com", "port": 443, "paused": false,
  "status": "ok" | "problem" | "pending", "error_code": null,
  "days_remaining": 41, "valid_from": "…", "valid_to": "…",
  "issuer": "R11", "subject": "example.com",
  "chain_valid": true, "hostname_match": true,
  "last_checked_at": "…", "domain": "example.com", "domain_expires_at": "…",
  "created_at": "…"
}

What a script should store

Keep the monitor id, the hostname, the port, and the last status you acted on. The list body is {"data": [...], "plan", "limit", "planLimit", "bonusLimit"}. On that list, paused is true when the plan has paused the monitor. GET one monitor and POST check return paused: false even when the list would say true. days_remaining is the stored count until valid_to. chain_valid and hostname_match are true or false after a check has stored them, and null before that. issuer and subject are the names from the served certificate. domain and domain_expires_at come from the daily registration lookup for the registrable domain, which is a different clock from the certificate.

status is pending until the first check finishes, ok when the certificate reads clean, and problem when the check records an error. error_code names the problem. Read it before you open a ticket, because an expired certificate, a name mismatch, and a host that did not answer are different jobs.

Private and internal certificates are not supported. The check uses the public route to the hostname. A certificate that exists only inside a private network, on a laptop, or in a file you could paste, is outside what the API can see. Do not send a private key, a PKCS#12 bundle, or a PEM that contains a key. The API never accepts key material.

Adding hostnames from a deploy

POST one object per public hostname. A URL is accepted and reduced to a hostname and port, so https://example.com:8443/path becomes host example.com and port 8443. The path is not stored. Port defaults to 443 when you omit it. Use a separate monitor for each port you actually serve, such as mail.example.com on 993, because that certificate can differ from the website on 443.

The free checker is hostname-only and does not create these rows. It is a single public lookup with no key and no saved history. Use it when a person wants one reading and nothing saved. Use POST when the hostname should keep being checked and should be allowed to alert.

A create that returns 201 is a new monitor. A create that returns 409 means that hostname and port are already present. Idempotent bootstrap treats 409 as already done. A create that returns 402 means the plan has no room for another hostname. Stop the loop. Deleting a monitor that belongs to a retired environment frees a slot. A 401 means the bearer token is missing or revoked.

GET the collection when you need ids. GET one monitor when a human asks what the last check saw. GET checks returns up to the last 50 rows, each with checked_at, ok, error_code, days_remaining, issuer and valid_to. POST check runs a read now and returns the monitor object, not one of those rows. The route takes no JSON body. DELETE when the hostname is gone. A missing id returns 404 with {"error": "not_found"}.

How scheduled checks differ from POST check

The account schedule still runs if your script is quiet. POST check is an extra reading, not a replacement for reminders. Reminder days, chat channels, and webhook URLs are account settings. The API does not take a JSON body that edits those settings. Change them in Settings, then send a test from there before you depend on a channel.

Microsoft Teams, when you use it, posts through a channel webhook that only sends. Paste the webhook URL in Settings. Alerts post into that channel. Nothing typed back in Teams is delivered to the API, and the API has no method that replies into the channel. Slack works as an incoming webhook in that same send-only direction. Signed webhooks are the path for your own receiver.

Errors

The error field is one of unauthorized, invalid_json, invalid_hostname, plan_limit, duplicate, not_found or rate_limited. message is included for invalid_hostname, plan_limit, duplicate and rate_limited. A missing bearer token, and an unknown or revoked key, are HTTP 401 with unauthorized and a message. invalid_json and not_found are only {"error": "..."}.

invalid_hostname means the body was JSON but the name could not be used as a public host. Send a hostname, host:port, or a URL. The path is dropped. An omitted port is 443. invalid_json means the body was not JSON, and the status is 400. rate_limited matches HTTP 429. Wait for Retry-After, then retry that one call. Do not retry the whole import in a tight loop. not_found means the id is not on this account. Keys cannot read another account's monitors. There is no plan_required code on this API.

Signed webhooks

Add a webhook URL in Settings to receive alerts as JSON. Each POST has X-SSLClock-Event and X-SSLClock-Signature: t=<unix seconds>,v1=<hex>, where v1 is HMAC-SHA256 of t + "." + raw body with your signing secret. Reject requests older than five minutes. Events: certificate.expiring, certificate.error, certificate.changed, domain.expiring, ct.new_certificate and test.

// Node.js
const [t, v1] = sig.split(",").map((p) => p.split("=")[1]);
const ok = crypto.timingSafeEqual(
  Buffer.from(v1, "hex"),
  crypto.createHmac("sha256", secret).update(t + "." + rawBody).digest());

Verify the signature on the raw bytes, before you parse JSON. A re-serialized body will not match. Compare the digest in constant time. On success, branch on the event name. An expiring event is a planned reminder. An error event is breakage on the latest check. A changed event means the served certificate is not the one from the previous check. A domain event is the registration date, not the certificate date. A CT event means a newly logged certificate for a hostname you monitor. The test event is the button in Settings.

If your receiver is down, fix it and use GET checks to see what the last readings were. The API list is the current snapshot. It is not a replay log of every webhook you missed.

A small import shape

Read hostnames from the deploy inventory. Skip comments and empty lines. For each name, POST. On 201 or 409, continue. On 402, stop and report the plan limit. On 401, stop and rotate the key. On 429, sleep and retry that name once. After the loop, GET the collection and diff it against the inventory if you also delete retired names. Delete only ids you are sure belong to decommissioned hosts. A delete is immediate.

Store the key in the secret store the pipeline already uses. Do not print it in job logs. The prefix is enough to identify a key in Settings. The full secret is shown once at creation.

FAQ

Does the API read private or internal certificates?

No. Private and internal certificates are not supported. A monitor opens a public TLS connection to the hostname and port you stored. A name that is not reachable from the public internet cannot be checked.

Is the free checker the same as creating a monitor?

No. The free checker is hostname-only. You type a public hostname, see the certificate that answers, and nothing is stored. A monitor is an account record created with a key, and it is what sends later reminders.

What does HTTP 409 mean on create?

That hostname and port are already on the account. Treat 409 as success in a bootstrap script and continue with the next name. Use the list endpoint if you need the existing id.

How do chat alerts relate to the API?

Slack and Microsoft Teams are separate from the REST key. Teams posts through a channel webhook that only sends. You paste a webhook URL and alerts land in the channel. A reply in Teams does not call the API.

What should a webhook receiver reject?

Reject a body whose signature does not match, and reject a timestamp older than five minutes. Compute HMAC-SHA256 over the timestamp, a period, and the raw body, using the signing secret from Settings.