# SSL Certificate Expiry Checker & Monitor – TLS, HSTS, Headers (`friedl/ssl-certificate-checker`) Actor

Bulk SSL/TLS certificate checker: expiry date, days until expiration, issuer, SANs, chain, hostname match, self-signed, TLS version – plus HTTPS redirect and security headers (HSTS, CSP …) with an A–F grade. Schedule it as SSL expiry monitor: delta mode alerts before certificates expire.

- **URL**: https://apify.com/friedl/ssl-certificate-checker.md
- **Developed by:** [Friedrich K](https://apify.com/friedl) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.53 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SSL Certificate & Security Headers Checker – Expiry Monitor

Check the SSL/TLS certificates of hundreds of domains in one run and get warned before they expire. Optionally grade each site's HTTP security headers. No browser, very cheap.

- **Certificate:** valid from/to, **days remaining**, `expiresSoon` flag, issuer, common name, all SAN domains, serial number, SHA-256 fingerprint, key type and size
- **Validation:** trusted chain, hostname match, self-signed, expired – with the exact problem (`CERT_HAS_EXPIRED`, `ERR_TLS_CERT_ALTNAME_INVALID`, `DEPTH_ZERO_SELF_SIGNED_CERT` …)
- **Chain:** intermediate and root CAs with their expiry dates
- **Connection:** TLS version (TLSv1.2/1.3) and cipher
- **Security headers:** HSTS (max-age, includeSubDomains, preload), Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, missing headers, **grade A–F**, HTTP→HTTPS redirect
- **Delta mode:** schedule it daily and receive only hosts whose certificate, validity, expiry warning, error or header grade changed

### Use cases

- **SSL expiry monitoring** for all your domains and subdomains – with alerts via email, Slack or webhook through Apify integrations
- **Agencies and IT service providers:** check all client websites at once
- **Security reviews:** find weak TLS settings, missing HSTS or missing security headers
- **Sales:** spot websites with expired certificates or poor security grades

### Input example

```json
{
  "hosts": ["example.com", "shop.example.com", "mail.example.com:8443"],
  "warnDays": 21,
  "checkSecurityHeaders": true
}
```

For monitoring, add `"mode": "delta"` and create a daily schedule.

### Output (one item)

```json
{
  "host": "example.com",
  "port": 443,
  "valid": true,
  "authorizationError": null,
  "hostnameMatches": true,
  "daysRemaining": 64,
  "expiresSoon": false,
  "validFrom": "2026-08-15T00:00:00.000Z",
  "validTo": "2026-12-16T23:59:59.000Z",
  "issuer": "Let's Encrypt / R11",
  "subjectCN": "example.com",
  "subjectAltNames": ["example.com", "www.example.com"],
  "selfSigned": false,
  "protocol": "TLSv1.3",
  "cipher": "TLS_AES_256_GCM_SHA384",
  "keyType": "ec",
  "keyBits": 256,
  "chain": [{ "subject": "Let's Encrypt / R11", "issuer": "Internet Security Research Group / ISRG Root X1", "validTo": "2027-03-12T23:59:59.000Z" }],
  "error": null,
  "httpsStatus": 200,
  "httpRedirectsToHttps": true,
  "hsts": { "maxAge": 31536000, "includeSubDomains": true, "preload": false },
  "missingSecurityHeaders": ["permissions-policy"],
  "headersScore": 90,
  "headersGrade": "A",
  "fetchedAt": "2026-10-13T14:00:00.000Z"
}
```

Hosts that cannot be reached are returned with `valid: false` and `error` (e.g. `DNS_NOT_FOUND`, `CONNECTION_REFUSED`, `TIMEOUT`). In delta mode `daysRemaining` and the raw header values (`securityHeaders`, whose CSP nonces change on every request) are omitted so that only real changes are reported.

#### Header grade

Points: HSTS 25, Content-Security-Policy 25, X-Content-Type-Options 15, X-Frame-Options (or CSP `frame-ancestors`) 15, Referrer-Policy 10, Permissions-Policy 10. Grade A ≥ 90, B ≥ 75, C ≥ 60, D ≥ 45, otherwise F.

### Pricing

Pay per event: **USD 0.75 per 1,000 checked hosts** (event `result`), with lower prices on higher Apify subscription plans. There is no start fee. Users on the Apify Free plan are limited to 50 hosts per run.

### How it works and limits

- One TLS handshake per host (SNI = host name) and, with header checks enabled, one request to `https://host/` and one to `http://host/`. At most 1 request per second per host, 10 hosts in parallel.
- Certificates are read but not trusted blindly: `valid` is true only if the chain is trusted by Node.js' CA store, the host name matches and the certificate has not expired.
- Security headers are taken from the final response after redirects. If the certificate is invalid, the header check fails with `headersError`.
- Only technical certificate data is returned. Organisation and location fields of the certificate subject are not returned, and the issuer of self-signed certificates is omitted because it can name a person.

### Responsibility

Check hosts that you own or are allowed to test. The actor performs a normal TLS handshake and normal HTTP requests, like a browser visiting the homepage. This actor is not affiliated with any certificate authority or with the websites checked.

### Impressum / Legal notice

Anbieter dieses Actors (Angaben gemäß § 5 DDG) / Provider of this actor:

Friedrich Köhler\
Spatzenweg 7\
04720 Döbeln\
Deutschland\
E-Mail: actorcreater_010@web.de

# Actor input Schema

## `hosts` (type: `array`):

Domains, hosts or URLs, one per line (e.g. example.com, mail.example.com:8443 or https://example.com/page). Port 443 is used if none is given. Duplicates are removed.

## `warnDays` (type: `integer`):

Certificates that expire within this many days get expiresSoon = true.

## `checkSecurityHeaders` (type: `boolean`):

Also request https://host/ and http://host/ to grade the security headers (HSTS, CSP, X-Frame-Options …) and check the HTTP→HTTPS redirect.

## `timeoutSecs` (type: `integer`):

Hosts slower than this are reported with error TIMEOUT.

## `mode` (type: `string`):

'all' returns every host. 'delta' returns only hosts whose certificate, validity, expiry warning, error or header grade changed since the last run – schedule it daily as an SSL expiry monitor.

## `maxResults` (type: `integer`):

Maximum number of checked hosts (= charged events) per run. Users on the Apify Free plan are limited to 50 results per run.

## `deltaStateName` (type: `string`):

Name for the delta state, e.g. "ssl-monitor". Leave empty to derive it from the input.

## Actor input object example

```json
{
  "hosts": [
    "apify.com",
    "github.com",
    "expired.badssl.com"
  ],
  "warnDays": 30,
  "checkSecurityHeaders": true,
  "timeoutSecs": 15,
  "mode": "all",
  "maxResults": 10000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "hosts": [
        "apify.com",
        "github.com",
        "expired.badssl.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("friedl/ssl-certificate-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "hosts": [
        "apify.com",
        "github.com",
        "expired.badssl.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("friedl/ssl-certificate-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "hosts": [
    "apify.com",
    "github.com",
    "expired.badssl.com"
  ]
}' |
apify call friedl/ssl-certificate-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,friedl/ssl-certificate-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/81nUH7zjghZs7xPVo/builds/IXpAqld2oli2kAqWh/openapi.json
