# SSL/TLS Certificate Check & Expiry Monitor (`centorprat/ssl-certificate-expiry-check`) Actor

Give it hosts or HTTPS URLs. For each it does a passive TLS handshake and reports the certificate: validity, days until expiry, issuer, subject, SANs and TLS version - with a signal (valid / expiring-soon / expired / invalid / unreachable). Schedule + webhook for expiry alerts. Keyless.

- **URL**: https://apify.com/centorprat/ssl-certificate-expiry-check.md
- **Developed by:** [Centor Prat](https://apify.com/centorprat) (community)
- **Categories:** Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.50 / 1,000 host checkeds

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/TLS Certificate Check & Expiry Monitor

**Know before a certificate expires — and spot broken ones.** Give it hosts or HTTPS URLs; for each it
does a passive TLS handshake (exactly what a browser does) and reports the certificate: **days until
expiry**, issuer, subject, SANs, TLS version — with a clear signal. Schedule it and point `webhookUrl` at
Slack/email (via Make/Zapier) to get an alert before a cert lapses. Keyless, agent-callable.

> 🔒 **Passive & read-only.** It only completes a standard TLS handshake and reads the presented
> certificate — no payloads, no probing, no scanning. An expiring cert is a reminder, not a vulnerability.

### ⚡ Why it's useful

An expired certificate takes a site or API down and throws scary browser warnings. This gives you the
**exact days remaining** across all your hosts in one call — and flags expired, self-signed, or
hostname-mismatched certs — so you renew on your schedule, not after an outage.

### 📋 What each report contains

| Field | Meaning |
|---|---|
| `signal` | `valid` / `expiring-soon` / `expiring-very-soon` / `expired` / `invalid-certificate` / `unreachable` |
| `daysUntilExpiry` | Days remaining until the certificate expires |
| `notAfter` / `notBefore` | Validity window |
| `issuer` | Certificate authority (e.g. Sectigo, Amazon, Let's Encrypt) |
| `subjectCommonName` / `subjectAltNames` | The certificate's subject and all covered domains |
| `tlsVersion` / `cipher` | Negotiated TLS version and cipher |
| `reason` | Why a cert is invalid/unreachable (e.g. "certificate has expired", "self-signed") |

### 📥 Input

```json
{ "hosts": ["github.com", "https://your-site.com", "mail.example.com:993"], "warnDays": 30, "criticalDays": 7 }
```

Set `onlyProblems: true` for scheduled alerting (returns just the hosts needing attention). Add `:port`
for non-443 services. One report per host.

### 📤 Example output (real run, trimmed)

```json
{ "host": "github.com", "signal": "expiring-soon", "daysUntilExpiry": 44,
  "notAfter": "Nov 29 23:59:59 2026 GMT", "issuer": "Sectigo Limited",
  "subjectAltNames": ["github.com", "www.github.com"], "tlsVersion": "TLSv1.3" }
```

In the same run `apify.com` returned `valid` (92 days), `expired.badssl.com` → `expired`, and
`self-signed.badssl.com` → `invalid-certificate` ("self-signed certificate").

### 💰 Pricing (pay-per-event)

- **Host checked — $0.01** per host.

### 💡 Use cases

- **Ops / SRE / IT:** a standing expiry alarm across every domain and service you run.
- **Agencies / MSPs:** monitor all client certificates from one place.
- **Security / compliance:** flag expired, self-signed or mismatched certs across your estate.
- **Agents:** callable as an MCP tool — give it hosts, get back certificate health.

### 🔑 Keyless & agent-callable

No API keys, no accounts, no external services, no paid child Actors — just a standard TLS handshake.

### 🚀 Ready-made tasks (one click)

- [SSL Certificate Checker - Validity, Issuer & Expiry](https://apify.com/centorprat/ssl-certificate-expiry-check/examples/ssl-certificate-checker)
- [SSL Expiry Monitor - Alert Before Certificates Expire](https://apify.com/centorprat/ssl-certificate-expiry-check/examples/ssl-expiry-monitor-alert)
- [TLS Certificate Problem Check - Expired, Self-Signed, Mismatch](https://apify.com/centorprat/ssl-certificate-expiry-check/examples/tls-certificate-problem-check)

### 🤖 For AI agents (MCP)

```
https://mcp.apify.com/?tools=actors,docs,centorprat/ssl-certificate-expiry-check
```

Loads as `centorprat--ssl-certificate-expiry-check`. Claude Code:

```
claude mcp add apify -- npx -y @apify/actors-mcp-server --actors centorprat/ssl-certificate-expiry-check
```

# Actor input Schema

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

e.g. \["github.com", "https://your-site.com", "mail.example.com:993"]. A URL is reduced to host; add :port for non-443. One report per host.

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

Certificates expiring within this many days are flagged 'expiring-soon'.

## `criticalDays` (type: `integer`):

Certificates expiring within this many days are flagged 'expiring-very-soon'.

## `onlyProblems` (type: `boolean`):

On: return only expiring/expired/invalid/unreachable hosts (ideal for scheduled alerting).

## `webhookUrl` (type: `string`):

If set, any certificates needing attention are POSTed here as JSON - wire it to Slack/email via Make or Zapier.

## Actor input object example

```json
{
  "hosts": [
    "github.com",
    "https://apify.com/"
  ],
  "warnDays": 30,
  "criticalDays": 7,
  "onlyProblems": false
}
```

# Actor output Schema

## `certificates` (type: `string`):

One report per host: a signal (valid / expiring-soon / expiring-very-soon / expired / invalid-certificate / unreachable), days until expiry, notAfter/notBefore, issuer, subject CN, SANs, TLS version and cipher, or the reason it is invalid/unreachable. Passive TLS handshake only.

# 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": [
        "github.com",
        "https://apify.com/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("centorprat/ssl-certificate-expiry-check").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": [
        "github.com",
        "https://apify.com/",
    ] }

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

```

## MCP server setup

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

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/l4BpdC76ZE0oJzvTc/builds/RGX004SbirI3dfNdD/openapi.json
