{"id":170,"date":"2026-10-11T15:32:35","date_gmt":"2026-10-11T15:32:35","guid":{"rendered":"https:\/\/blog.avaloncompany.ai\/2026\/10\/how-to-check-when-an-ssl-certificate-expires-from-code.html"},"modified":"2026-10-11T15:32:35","modified_gmt":"2026-10-11T15:32:35","slug":"how-to-check-when-an-ssl-certificate-expires-from-code","status":"publish","type":"post","link":"https:\/\/avaloncompany.ai\/blog\/2026\/10\/how-to-check-when-an-ssl-certificate-expires-from-code.html","title":{"rendered":"How to Check When an SSL Certificate Expires, From Code"},"content":{"rendered":"<article style=\"max-width:760px;margin:0 auto;color:#172033;font-family:Arial,sans-serif;line-height:1.75\"><p style=\"margin:0 0 12px;color:#365f91;font-size:12px;font-weight:800;letter-spacing:.1em\">AVALON COMPANY \u00b7 PRACTICAL GUIDE<\/p><aside style=\"margin:0 0 26px;padding:18px;background:#f4f8ff;border-left:4px solid #3974c6;border-radius:8px\"><strong>Tools and references.<\/strong><br>Start with the tool or reference linked below.<br><a href=\"https:\/\/rapidapi.com\/avalonai\/api\/ssl-certificate-checker10\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"display:inline-block;margin:0 10px 10px 0;padding:10px 14px;border:1px solid #b8c8e8;border-radius:8px;color:#12355b;font-weight:700;text-decoration:none\">SSL Certificate Checker API on RapidAPI \u2197<\/a><a href=\"https:\/\/apify.com\/avalonai\/web-content-url-tools-mcp\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"display:inline-block;margin:0 10px 10px 0;padding:10px 14px;border:1px solid #b8c8e8;border-radius:8px;color:#12355b;font-weight:700;text-decoration:none\">Web Content &amp; URL Tools MCP Server on Apify \u2197<\/a><\/aside><section data-avalon-company-orientation=\"1\" style=\"margin:0 0 20px;padding:20px;background:#102a43;border-radius:14px;color:#ffffff;box-shadow:0 8px 22px rgba(15,35,69,.16)\"><div style=\"color:#93c5fd;font-size:12px;font-weight:800;letter-spacing:.1em\">START HERE<\/div><div style=\"margin-top:6px;font-size:22px;line-height:1.25;font-weight:800\">How to Check When an SSL Certificate Expires, From Code<\/div><p style=\"margin:10px 0 0;color:#d9e7f5;line-height:1.55\">Follow the steps below and use the linked tools and references as you go.<\/p><div style=\"margin-top:10px\"><span style=\"display:inline-block;margin:4px 6px 0 0;padding:6px 9px;background:#dbeafe;border-radius:999px;color:#12355b;font-size:13px;font-weight:700\">The request<\/span><span style=\"display:inline-block;margin:4px 6px 0 0;padding:6px 9px;background:#dbeafe;border-radius:999px;color:#12355b;font-size:13px;font-weight:700\">What came back for avaloncompany.ai<\/span><span style=\"display:inline-block;margin:4px 6px 0 0;padding:6px 9px;background:#dbeafe;border-radius:999px;color:#12355b;font-size:13px;font-weight:700\">The same call in Python<\/span><\/div><p style=\"margin:12px 0 0;color:#486581;font-size:13px\">Evidence trail: SSL Certificate Checker API on RapidAPI \u00b7 Web Content &amp; URL Tools MCP Server on Apify<\/p><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><p>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.<\/p><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>The request<\/h2><\/div>\n<p>Subscribe to the free plan on RapidAPI, then call the endpoint with your RapidAPI key:<\/p>\n<pre style=\"overflow-x:auto;padding:14px;background:#0f172a;color:#e2e8f0;border-radius:8px;font-size:14px;line-height:1.5\"><code>curl -G &#x27;https:\/\/ssl-certificate-checker10.p.rapidapi.com\/v1\/ssl&#x27; \\\n  --data-urlencode &#x27;host=avaloncompany.ai&#x27; \\\n  -H &#x27;x-rapidapi-host: ssl-certificate-checker10.p.rapidapi.com&#x27; \\\n  -H &#x27;x-rapidapi-key: YOUR_RAPIDAPI_KEY&#x27;<\/code><\/pre><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>What came back for avaloncompany.ai<\/h2><\/div>\n<p>We ran the same check against our own site while writing this post. The key fields of the real response:<\/p>\n<pre style=\"overflow-x:auto;padding:14px;background:#0f172a;color:#e2e8f0;border-radius:8px;font-size:14px;line-height:1.5\"><code>{\n  &quot;trusted&quot;: true,\n  &quot;expired&quot;: false,\n  &quot;days_remaining&quot;: 85,\n  &quot;valid_to&quot;: &quot;2027-01-05T01:16:20+00:00&quot;,\n  &quot;tls_version&quot;: &quot;TLSv1.3&quot;\n}<\/code><\/pre><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>The same call in Python<\/h2><\/div>\n<pre style=\"overflow-x:auto;padding:14px;background:#0f172a;color:#e2e8f0;border-radius:8px;font-size:14px;line-height:1.5\"><code>import requests\n\nresp = requests.get(\n    &#x27;https:\/\/ssl-certificate-checker10.p.rapidapi.com\/v1\/ssl&#x27;,\n    params={&#x27;host&#x27;: &#x27;avaloncompany.ai&#x27;},\n    headers={&#x27;x-rapidapi-host&#x27;: &#x27;ssl-certificate-checker10.p.rapidapi.com&#x27;, &#x27;x-rapidapi-key&#x27;: &#x27;YOUR_RAPIDAPI_KEY&#x27;},\n    timeout=30,\n)\nresp.raise_for_status()\nprint(resp.json())<\/code><\/pre><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>When to use it<\/h2><\/div>\n<ul><li>Alert a week before any of your domains&#x27; certificates expire.<\/li><li>Check a client&#x27;s site for an untrusted or self-signed certificate.<\/li><li>Confirm which TLS version a server negotiates.<\/li><\/ul><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>Limits<\/h2><\/div>\n<ul><li>It checks the certificate served on port 443 for that host name only.<\/li><li>Trust is judged against a standard public root store, like a browser would.<\/li><\/ul><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>Use it from an AI agent<\/h2><\/div>\n<p>The same endpoint is one of the tools in the Web Content &amp; URL Tools MCP Server on Apify. Point any client that supports remote MCP servers at `<a href=\"https:\/\/avalonai--web-content-url-tools-mcp.apify.actor\/mcp`\" rel=\"noopener\" style=\"word-break:break-all\">https:\/\/avalonai&#8211;web-content-url-tools-mcp.apify.actor\/mcp`<\/a> with your Apify token (`YOUR_APIFY_TOKEN`) and the agent can call it directly: <a href=\"https:\/\/apify.com\/avalonai\/web-content-url-tools-mcp\" rel=\"noopener\" style=\"word-break:break-all\">https:\/\/apify.com\/avalonai\/web-content-url-tools-mcp<\/a><\/p><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>Try it<\/h2><\/div>\n<p>SSL Certificate Checker API on RapidAPI (free plan available): <a href=\"https:\/\/rapidapi.com\/avalonai\/api\/ssl-certificate-checker10\" rel=\"noopener\" style=\"word-break:break-all\">https:\/\/rapidapi.com\/avalonai\/api\/ssl-certificate-checker10<\/a><\/p><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>Try it free<\/h2><\/div>\n<p>Our APIs on RapidAPI: <a href=\"https:\/\/rapidapi.com\/user\/avalonai\" rel=\"noopener\" style=\"word-break:break-all\">https:\/\/rapidapi.com\/user\/avalonai<\/a><\/p><\/section>\n<section data-avalon-company-card=\"1\" style=\"margin:18px 0;padding:20px;background:linear-gradient(145deg,#ffffff,#f4f8fd);border:1px solid #c9d9eb;border-top:3px solid #2563eb;border-radius:14px;box-shadow:0 6px 18px rgba(15,35,69,.07)\"><div style=\"margin:0 0 12px;color:#102a43!important;font-size:21px;line-height:1.28;letter-spacing:-.02em\"><h2>Made with<\/h2><\/div>\n<ul><li>SSL Certificate Checker API \u2014 produced the example response in this tutorial (run against avaloncompany.ai): <a href=\"https:\/\/rapidapi.com\/avalonai\/api\/ssl-certificate-checker10\" rel=\"noopener\" style=\"word-break:break-all\">https:\/\/rapidapi.com\/avalonai\/api\/ssl-certificate-checker10<\/a><\/li><\/ul><\/section>\n<div style=\"background:#111827;color:#e5e7eb;border-radius:10px;padding:1.1em 1.4em;margin:2em 0;text-align:center\"><p style=\"margin:0 0 0.9em;font-size:1.02em\">\ud83d\udee0\ufe0f <strong>Free tools, shown in 30 seconds<\/strong><br>Short demonstrations of free tools you can use in your own workflow.<\/p><a href=\"https:\/\/www.youtube.com\/channel\/UCiv9aCVJU4ftkiqbEsiipDw?sub_confirmation=1\" target=\"_blank\" rel=\"noopener\" style=\"display:inline-block;background:#FF0000;color:#ffffff;text-decoration:none;font-weight:bold;padding:0.7em 1.6em;border-radius:6px;font-size:1.02em\">\u25b6 Subscribe to Avalon Company<\/a><p style=\"margin:0.9em 0 0;font-size:0.95em\">All the free tools, no sign-up: <a href=\"https:\/\/avaloncompany.ai\/tools\/?src=blog\" style=\"color:#93c5fd\">avaloncompany.ai\/tools<\/a><\/p><\/div><\/article>","protected":false},"excerpt":{"rendered":"<p>AVALON COMPANY \u00b7 PRACTICAL GUIDETools and references.Start with the tool or reference linked below.SSL Certificate Checker API on RapidAPI \u2197Web Content &amp; URL Tools MCP Server on Apify \u2197START HEREHow to Check When an SSL Certificate Expires, From CodeFollow the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[2,3],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-articles","tag-free-tools","tag-how-to"],"blogger_post_id":null,"_links":{"self":[{"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":0,"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avaloncompany.ai\/blog\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}