SSL Certificate Checker Template

  • Python
  • Flask

Check whether a site’s SSL certificate is valid and when it expires.

A Python and Flask app that checks SSL certificates. Enter a domain and see whether its certificate is valid, how many days it has left, when it was issued and its key. The command-line version checks a list of domains and fails when one is expired or close to it, so it can run from cron or CI. Use it to catch expiring certificates before your visitors do.

The ssl certificate checker app running

What it does

Valid, expiring or expired
A clear verdict, with a warning when fewer than 30 days are left.
The details
Issue and expiry dates and the key size; on paid plans, the issuer and every name it covers.
Monitoring from the CLI
Checks several domains and exits with an error if any need attention.
Keeps your key private
The page calls a server route that holds the key, checks the input and limits each visitor to 10 checks a minute.
A web app and a CLI
python app.py runs the page and its route locally. The same lookups work from the terminal, sharing one small API helper.

How it works

The Flask route: it checks the domain and calls SSL Certificate Checker.

app.py
DOMAIN = re.compile(r'^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$')


def domain_arg():
    """The ?domain= value as a bare hostname: "https://Example.com/path" becomes "example.com"."""
    value = request.args.get('domain', '').strip().lower()
    value = re.sub(r'^[a-z]+://', '', value)
    value = re.split(r'[/?#:]', value)[0].rstrip('.')
    return value if DOMAIN.match(value) else None


@app.get('/api/ssl')
def certificate():
    """GET /api/ssl?domain=github.com: the SSL certificate a domain serves."""
    domain = domain_arg()
    if not domain:
        return fail('Enter a domain, like example.com.')
    return jsonify(call_api('sslchecker', {'domain': domain}))

See the whole file on GitHub

Deploy it

  1. Get a free API key

    The free plan includes 200 credits a month, no card needed. Create your key.

  2. Deploy it

    Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for APIVERVE_API_KEY: paste your key there.

  3. Open your app

    Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.

Try the SSL Certificate Checker API — the call this template makes

Request
GETapi.apiverve.com/v1/sslchecker?domain=ebay.com
Query parameters
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "subject": {
      "C": "US",
      "ST": "California",
      "O": "eBay, Inc.",
      "CN": "ebay.com"
    },
    "issuer": {
      "C": "GB",
      "O": "Sectigo Limited",
      "CN": "Sectigo Public Server Authentication CA OV R36"
    },
    "subjectaltname": "DNS:ebay.com, DNS:befr.ebay.be, DNS:benl.ebay.be, DNS:cafr.ebay.ca, DNS:e-bay.it, DNS:ebay.at, DNS:ebay.be, DNS:ebay.ca, DNS:ebay.ch, DNS:ebay.co.uk, DNS:ebay.com.au, DNS:ebay.com.hk, DNS:ebay.com.my, DNS:ebay.com.sg, DNS:ebay.de, DNS:ebay.es, DNS:ebay.fr, DNS:ebay.ie, DNS:ebay.in, DNS:ebay.it, DNS:ebay.nl, DNS:ebay.ph, DNS:ebay.pl, DNS:ebay.us, DNS:ebay.vn, DNS:wwww.ebay.co.uk, DNS:wwww.ebay.com, DNS:wwww.ebay.com.au, DNS:wwww.ebay.de, DNS:wwww.ebay.in, DNS:wwww.ebay.it",
    "infoAccess": {
      "CA Issuers - URI": [
        "http://crt.sectigo.com/SectigoPublicServerAuthenticationCAOVR36.crt"
      ],
      "OCSP - URI": [
        "http://ocsp.sectigo.com"
      ]
    },
    "ca": false,
    "bits": 2048,
    "valid_from": "Jul 28 00:00:00 2025 GMT",
    "valid_to": "Jul 28 23:59:59 2026 GMT",
    "serialNumber": "99F408949A6416EDC3B8F5EC77B2EBE5",
    "domain": "ebay.com",
    "isExpired": false,
    "isValid": true,
    "daysUntilExpiry": 20,
    "isExpiringSoon": true,
    "isSelfSigned": false
  }
}

Build your own with SSL Certificate Checker. Start with 200 free credits. One key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs