# SSL Certificate Monitor — Expiry & Trust Checks (`darknezz/ssl-certificate-monitor`) Actor

Check the TLS certificate of every host you own and get only what changed: days to expiry, issuer, SANs, and a straight answer on expired, expiring, untrusted, hostname-mismatch, refused or timeout.

- **URL**: https://apify.com/darknezz/ssl-certificate-monitor.md
- **Developed by:** [Oaida Adrian](https://apify.com/darknezz) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 certificate findings

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Monitor — expiry and trust, with change-only output

Checks the TLS certificate of every host you give it and reports what actually
needs attention: days to expiry, issuer, SANs, and a straight answer on whether
the certificate is expired, expiring, untrusted, issued for the wrong name — or
whether the host simply did not answer.

No API key, no proxy, no third-party service: one TLS handshake per host.

### Statuses

| status | meaning |
|---|---|
| `ok` | trusted, matches the hostname, more days left than the threshold |
| `expiring` | trusted and valid, but inside `expiringWithinDays` |
| `expired` | the certificate's `notAfter` has passed |
| `mismatch` | the certificate is for another name (or an IP that does not match) |
| `untrusted` | self-signed, unknown CA, or an incomplete chain |
| `refused` | TCP refused or reset, or a TLS handshake that is not a certificate problem |
| `timeout` | no TLS answer within the timeout |
| `dns` | the name does not resolve |

The last three are **not** certificate verdicts. A monitor that reports "expired"
when a host is down is inventing an outage — these stay separate so an alert means
something.

Every failure still carries facts: on `expired`, `mismatch` and `untrusted` the
actor re-reads the certificate unverified and publishes its issuer, SANs and real
`daysLeft`, so a row is never just a verdict with no evidence.

### Monitoring

Default `emit: "changes"`. The last status per host lives in a named key-value
store, so a later run emits only hosts that moved between bands — `ok` →
`expiring` on day 30, `expiring` → `expired`, a certificate rotated to a new
issuer, or a host that broke. `previousStatus` carries what it was.

Charging follows the same rule: one `certificate-change` event per row emitted, so
a quiet run that finds nothing costs nothing.

### Input

| field | default | notes |
|---|---|---|
| `hosts` | — | `example.com`, `https://example.com/path`, `example.com:8443` |
| `expiringWithinDays` | `30` | the band that counts as "expiring" |
| `emit` | `changes` | or `all` |
| `maxHosts` | `5000` | cap per run |

### Example row

```json
{
  "host": "wrong.host.badssl.com",
  "port": 443,
  "status": "mismatch",
  "daysLeft": 51,
  "expiresAt": "2026-12-27T23:59:59Z",
  "issuer": "Let's Encrypt",
  "san": ["*.badssl.com", "badssl.com"],
  "reason": "hostname mismatch, certificate is not valid for 'wrong.host.badssl.com'",
  "isChange": true,
  "previousStatus": "ok",
  "checkedAt": "2026-11-06T23:20:11Z"
}
```

### Pricing

Pay per event: **$0.005 per certificate finding** (`certificate-change`, the
primary event), plus a **$0.01 run-start fee** and Apify's standard platform
compute. The first run reports every host; later runs charge only for what
changed, so a daily check of a quiet 500-host list costs just the start fee.
100 findings cost about **$0.51** (100 x $0.005 + $0.01).

### Run it on a schedule

Save the task with your host list and schedule it daily. The first run reports
everything; every run after it reports only movement, which is the difference
between a scan and a monitor.

# Actor input Schema

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

Host names, URLs or host:port. Only the host and port are used.

## `expiringWithinDays` (type: `integer`):

A certificate with fewer days left than this is reported as 'expiring'.

## `emit` (type: `string`):

changes = only hosts whose status changed since the last run. all = every host, every run.

## `maxHosts` (type: `integer`):

Hard cap on hosts probed in one run.

## Actor input object example

```json
{
  "hosts": [
    "github.com",
    "https://example.com/path",
    "example.com:8443"
  ],
  "expiringWithinDays": 30,
  "emit": "changes",
  "maxHosts": 5000
}
```

# Actor output Schema

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

One row per host: status band, days left, issuer, SANs, and whether it changed.

## `summary` (type: `string`):

Counts per status for the run.

# 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": [
        "example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("darknezz/ssl-certificate-monitor").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": ["example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("darknezz/ssl-certificate-monitor").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": [
    "example.com"
  ]
}' |
apify call darknezz/ssl-certificate-monitor --silent --output-dataset

```

## MCP server setup

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

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/c6lJbAKahXMV9cgUR/builds/JccHs6G2wdxH1xrYL/openapi.json
