{
  "openapi": "3.1.0",
  "info": {
    "title": "CheckSSLExpiry Developer API",
    "version": "1.0.0",
    "description": "High-speed, production-grade SSL/TLS certificate validity inspector, DNS CAA policy analyzer, and HTTP transport security checker. Free forever with no registration or API keys required.",
    "contact": {
      "name": "CheckSSLExpiry API Support",
      "url": "https://checksslexpiry.com/developers"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://checksslexpiry.com",
      "description": "Production Global Edge Network (Cloudflare Workers)"
    }
  ],
  "paths": {
    "/api/v1/check": {
      "get": {
        "summary": "Inspect SSL/TLS Certificate & Security via Query Parameter",
        "description": "Inspects real-time SSL/TLS certificate health, days to expiration, SANs coverage, DNS CAA records, Dual-Stack IPv4/IPv6, and HTTP security headers.",
        "operationId": "checkCertificateGet",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "The target fully qualified domain name (e.g. github.com, cloudflare.com).",
            "schema": {
              "type": "string",
              "example": "github.com"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful certificate inspection result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing domain parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (maximum 60 requests per minute per IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimitResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Inspect SSL/TLS Certificate & Security via JSON Body",
        "description": "Accepts a JSON payload with a domain name and returns comprehensive certificate and transport security telemetry.",
        "operationId": "checkCertificatePost",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "domain"
                ],
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "The target domain name to inspect.",
                    "example": "cloudflare.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful certificate inspection result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or malformed domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimitResponse"
                }
              }
            }
          }
        }
      }
    },
    "/badge/{domain}.svg": {
      "get": {
        "summary": "Get Live Vector SVG Status Badge",
        "description": "Generates a Shields.io-compatible vector SVG badge showing live certificate days remaining.",
        "operationId": "getSvgBadge",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "Domain name with optional .svg extension (e.g. github.com.svg).",
            "schema": {
              "type": "string",
              "example": "github.com.svg"
            }
          },
          {
            "name": "style",
            "in": "query",
            "required": false,
            "description": "Badge style: flat or rounded.",
            "schema": {
              "type": "string",
              "enum": [
                "flat",
                "rounded"
              ],
              "default": "flat"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SVG Vector Badge.",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CertificateResponse": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "example": "github.com"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "expiring_soon",
              "critical",
              "expired",
              "hostname_mismatch",
              "untrusted_chain"
            ],
            "example": "healthy"
          },
          "statusMessage": {
            "type": "string",
            "example": "Valid and active certificate (76 days remaining)."
          },
          "isValid": {
            "type": "boolean",
            "example": true
          },
          "isExpired": {
            "type": "boolean",
            "example": false
          },
          "daysRemaining": {
            "type": "integer",
            "example": 76
          },
          "hoursRemaining": {
            "type": "integer",
            "example": 1824
          },
          "validity": {
            "type": "object",
            "properties": {
              "validFrom": {
                "type": "string",
                "format": "date-time"
              },
              "validTo": {
                "type": "string",
                "format": "date-time"
              },
              "validFromTimestamp": {
                "type": "integer"
              },
              "validToTimestamp": {
                "type": "integer"
              }
            }
          },
          "subject": {
            "type": "object",
            "properties": {
              "commonName": {
                "type": "string",
                "example": "github.com"
              },
              "organization": {
                "type": "string",
                "example": "GitHub, Inc."
              },
              "sans": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "coversDomain": {
                "type": "boolean",
                "example": true
              }
            }
          },
          "issuer": {
            "type": "object",
            "properties": {
              "commonName": {
                "type": "string",
                "example": "DigiCert TLS Hybrid ECC SHA384 2020 CA1"
              },
              "organization": {
                "type": "string",
                "example": "DigiCert Inc"
              }
            }
          },
          "fingerprints": {
            "type": "object",
            "properties": {
              "sha256": {
                "type": "string",
                "example": "88:AC:..."
              },
              "serialNumber": {
                "type": "string",
                "example": "05:7D:..."
              }
            }
          },
          "tls": {
            "type": "object",
            "properties": {
              "protocol": {
                "type": "string",
                "example": "TLSv1.3"
              },
              "cipherSuite": {
                "type": "string",
                "example": "TLS_AES_256_GCM_SHA384"
              },
              "alpn": {
                "type": "string",
                "example": "h2"
              }
            }
          },
          "dns": {
            "type": "object",
            "properties": {
              "dualStack": {
                "type": "object"
              },
              "caa": {
                "type": "object"
              }
            }
          },
          "securityHeaders": {
            "type": "object",
            "properties": {
              "grade": {
                "type": "string",
                "example": "A+"
              },
              "gradeScore": {
                "type": "integer",
                "example": 95
              }
            }
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "example": true
          },
          "code": {
            "type": "string",
            "example": "INVALID_DOMAIN"
          },
          "message": {
            "type": "string",
            "example": "Invalid domain format."
          },
          "guidance": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RateLimitResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "example": true
          },
          "code": {
            "type": "string",
            "example": "RATE_LIMITED"
          },
          "message": {
            "type": "string",
            "example": "API rate limit exceeded."
          },
          "resetSeconds": {
            "type": "integer",
            "example": 45
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}