How to Check When an SSL Certificate Expires, From Code

·

AVALON COMPANY · PRACTICAL GUIDE

START HERE
How to Check When an SSL Certificate Expires, From Code

Follow the steps below and use the linked tools and references as you go.

The requestWhat came back for avaloncompany.aiThe same call in Python

Evidence trail: SSL Certificate Checker API on RapidAPI · Web Content & URL Tools MCP Server on Apify

An expired certificate takes a site offline for every visitor at once. One GET request returns whether the certificate is trusted, when it expires and how many days are left.

The request

Subscribe to the free plan on RapidAPI, then call the endpoint with your RapidAPI key:

curl -G 'https://ssl-certificate-checker10.p.rapidapi.com/v1/ssl' \
  --data-urlencode 'host=avaloncompany.ai' \
  -H 'x-rapidapi-host: ssl-certificate-checker10.p.rapidapi.com' \
  -H 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What came back for avaloncompany.ai

We ran the same check against our own site while writing this post. The key fields of the real response:

{
  "trusted": true,
  "expired": false,
  "days_remaining": 85,
  "valid_to": "2027-01-05T01:16:20+00:00",
  "tls_version": "TLSv1.3"
}

The same call in Python

import requests

resp = requests.get(
    'https://ssl-certificate-checker10.p.rapidapi.com/v1/ssl',
    params={'host': 'avaloncompany.ai'},
    headers={'x-rapidapi-host': 'ssl-certificate-checker10.p.rapidapi.com', 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY'},
    timeout=30,
)
resp.raise_for_status()
print(resp.json())

When to use it

  • Alert a week before any of your domains' certificates expire.
  • Check a client's site for an untrusted or self-signed certificate.
  • Confirm which TLS version a server negotiates.

Limits

  • It checks the certificate served on port 443 for that host name only.
  • Trust is judged against a standard public root store, like a browser would.

Use it from an AI agent

The same endpoint is one of the tools in the Web Content & URL Tools MCP Server on Apify. Point any client that supports remote MCP servers at `https://avalonai–web-content-url-tools-mcp.apify.actor/mcp` with your Apify token (`YOUR_APIFY_TOKEN`) and the agent can call it directly: https://apify.com/avalonai/web-content-url-tools-mcp

Try it

SSL Certificate Checker API on RapidAPI (free plan available): https://rapidapi.com/avalonai/api/ssl-certificate-checker10

Try it free

Our APIs on RapidAPI: https://rapidapi.com/user/avalonai

Made with

🛠️ Free tools, shown in 30 seconds
Short demonstrations of free tools you can use in your own workflow.

▶ Subscribe to Avalon Company

All the free tools, no sign-up: avaloncompany.ai/tools

More to read