{
  "openapi": "3.1.1",
  "info": {
    "title": "PQC Readiness Check API",
    "version": "1.0.0",
    "summary": "Live post-quantum (ML-KEM) TLS check for any public domain.",
    "description": "No key. Free limits per IP: 12 checks a minute, 10 in any 24 hours, shared with the MCP server at https://pqcreadinesscheck.com/mcp. Docs: https://pqcreadinesscheck.com/docs/api. Changes: https://pqcreadinesscheck.com/docs/changelog.",
    "contact": {
      "name": "PQC Readiness Check",
      "email": "info@pqcreadinesscheck.com",
      "url": "https://pqcreadinesscheck.com/docs"
    }
  },
  "externalDocs": {
    "url": "https://pqcreadinesscheck.com/docs/api"
  },
  "servers": [
    {
      "url": "https://pqcreadinesscheck.com"
    }
  ],
  "paths": {
    "/api/scan": {
      "get": {
        "operationId": "checkDomain",
        "summary": "Check a domain",
        "description": "Runs the full check. Takes 5 to 15 seconds: allow 40. The same host within 10 minutes can return the stored result.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A public host name, like example.com. Scheme, path, query and port are removed.",
            "example": "example.com"
          },
          {
            "name": "save",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            },
            "description": "Set to 1 to also save the result and get back id and link, a private page that works for 30 days."
          }
        ],
        "responses": {
          "200": {
            "description": "The check ran. The body is the result, whatever the score.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResult"
                }
              }
            }
          },
          "400": {
            "description": "We couldn't check this name. The body says why.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "invalid": {
                    "summary": "localhost",
                    "value": {
                      "error": "That doesn't look like a website address. Try something like yourcompany.com.",
                      "code": "invalid"
                    }
                  },
                  "blocked": {
                    "summary": "a name that resolves to 10.0.0.1",
                    "value": {
                      "error": "We only check public websites.",
                      "code": "blocked"
                    }
                  },
                  "dns": {
                    "summary": "nosuchname-example.com",
                    "value": {
                      "error": "We couldn't find nosuchname-example.com. Check the spelling.",
                      "code": "dns"
                    }
                  },
                  "unreachable": {
                    "summary": "example.net",
                    "value": {
                      "error": "We couldn't open a secure connection to example.net on port 443. The server may block unknown clients, or HTTPS may be off on this name. Try www.example.net or the exact address your visitors use.",
                      "code": "unreachable"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached. The body says which one.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              },
              "retry-after": {
                "description": "Seconds until your next check is allowed, for the minute or the day limit you hit.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "rate-limit-0": {
                    "summary": "the 13th check in a minute",
                    "value": {
                      "error": "Too many checks in a minute. Please wait a moment.",
                      "code": "rate-limit"
                    }
                  },
                  "rate-limit-1": {
                    "summary": "the 11th check in 24 hours",
                    "value": {
                      "error": "The free API allows 10 checks a day. Write to us for more.",
                      "code": "rate-limit"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The checker is briefly unavailable. Retry later.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "unavailable": {
                    "summary": "any",
                    "value": {
                      "error": "The checker is being updated. Please try again in a few minutes.",
                      "code": "unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "checkDomainPost",
        "summary": "Check a domain, keep it out of the URL",
        "description": "Same check and limits as GET. The domain goes in the body, so it stays out of URLs and access logs. Always saves the result and returns id and link.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string"
                  }
                },
                "required": [
                  "domain"
                ]
              },
              "example": {
                "domain": "example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The check ran. The body is the result, whatever the score.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResult"
                }
              }
            }
          },
          "400": {
            "description": "We couldn't check this name. The body says why.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "invalid": {
                    "summary": "localhost",
                    "value": {
                      "error": "That doesn't look like a website address. Try something like yourcompany.com.",
                      "code": "invalid"
                    }
                  },
                  "blocked": {
                    "summary": "a name that resolves to 10.0.0.1",
                    "value": {
                      "error": "We only check public websites.",
                      "code": "blocked"
                    }
                  },
                  "dns": {
                    "summary": "nosuchname-example.com",
                    "value": {
                      "error": "We couldn't find nosuchname-example.com. Check the spelling.",
                      "code": "dns"
                    }
                  },
                  "unreachable": {
                    "summary": "example.net",
                    "value": {
                      "error": "We couldn't open a secure connection to example.net on port 443. The server may block unknown clients, or HTTPS may be off on this name. Try www.example.net or the exact address your visitors use.",
                      "code": "unreachable"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit reached. The body says which one.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              },
              "retry-after": {
                "description": "Seconds until your next check is allowed, for the minute or the day limit you hit.",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "rate-limit-0": {
                    "summary": "the 13th check in a minute",
                    "value": {
                      "error": "Too many checks in a minute. Please wait a moment.",
                      "code": "rate-limit"
                    }
                  },
                  "rate-limit-1": {
                    "summary": "the 11th check in 24 hours",
                    "value": {
                      "error": "The free API allows 10 checks a day. Write to us for more.",
                      "code": "rate-limit"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The checker is briefly unavailable. Retry later.",
            "headers": {
              "cache-control": {
                "description": "Always no-store.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanError"
                },
                "examples": {
                  "unavailable": {
                    "summary": "any",
                    "value": {
                      "error": "The checker is being updated. Please try again in a few minutes.",
                      "code": "unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/verified/{domain}/json": {
      "get": {
        "operationId": "getVerified",
        "summary": "Stored result behind a public verified page",
        "description": "The exact bytes we stored for a verified page. Hash them with SHA-256 and compare with the x-content-sha256 header, the page and the PDF. Does not run a check and does not count against limits.",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "The stored scan result.",
            "headers": {
              "x-content-sha256": {
                "description": "SHA-256 of the body, lower case hex.",
                "schema": {
                  "type": "string"
                }
              },
              "cache-control": {
                "description": "public, max-age=300",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResult"
                }
              }
            }
          },
          "404": {
            "description": "No verified page for this domain. Body: Not found, as text/plain.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ScanResult": {
        "title": "PQC Readiness Check scan result",
        "description": "Success body of GET /api/scan. New fields and new enum values can be added at any time: ignore what you don't know. See /docs/changelog.",
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
          },
          "ip": {
            "type": "string",
            "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the check ran, ISO 8601 in UTC. A result served from the 10 minute cache keeps its original time."
          },
          "ms": {
            "type": "integer",
            "description": "Subdomains only: how many names we found in certificate logs and DNS."
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "The website alone, port 443 on host."
          },
          "webScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "The website alone, port 443 on host."
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "pq",
                    "tls13",
                    "no-old-tls",
                    "cert",
                    "cert-key",
                    "mlkem1024"
                  ],
                  "description": "pq, tls13, no-old-tls, cert, cert-key or mlkem1024."
                },
                "label": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "got": {
                  "type": "integer",
                  "description": "Subdomains only: how many names we found in certificate logs and DNS."
                },
                "max": {
                  "type": "integer",
                  "description": "Subdomains only: how many names we found in certificate logs and DNS."
                }
              },
              "required": [
                "id",
                "label",
                "got",
                "max"
              ]
            },
            "description": "How webScore adds up. 6 lines, always in this order."
          },
          "grade": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "C",
              "D",
              "F"
            ],
            "description": "Graded on encryption only. A mail server with no STARTTLS is F. A subdomain is never F for a certificate mismatch."
          },
          "webGrade": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "C",
              "D",
              "F"
            ],
            "description": "Graded on encryption only. A mail server with no STARTTLS is F. A subdomain is never F for a certificate mismatch."
          },
          "verdict": {
            "type": "string",
            "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
          },
          "summary": {
            "type": "string",
            "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
          },
          "tlsVersion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Best protocol the server agreed to, like TLSv1.3. null if no TLS handshake worked."
          },
          "cipher": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cipher of the connection that set tlsVersion, like TLS_AES_256_GCM_SHA384."
          },
          "note": {
            "type": "string",
            "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
          },
          "pq": {
            "type": "object",
            "properties": {
              "supported": {
                "type": "boolean",
                "description": "true if it accepted an ML-KEM group."
              },
              "groups": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "X25519MLKEM768",
                    "SecP256r1MLKEM768",
                    "SecP384r1MLKEM1024",
                    "MLKEM768"
                  ]
                },
                "description": "The groups it accepted, tested 1 at a time. Values: X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024, MLKEM768."
              }
            },
            "required": [
              "supported",
              "groups"
            ],
            "description": "The post-quantum result for the website."
          },
          "cert": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "subject": {
                "type": "string",
                "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
              },
              "issuer": {
                "type": "string",
                "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
              },
              "validTo": {
                "type": "string",
                "format": "date-time",
                "description": "Expiry, ISO 8601 in UTC."
              },
              "daysLeft": {
                "type": "integer",
                "description": "Subdomains only: how many names we found in certificate logs and DNS."
              },
              "trusted": {
                "type": "boolean",
                "description": "true if it accepted an ML-KEM group."
              },
              "keyType": {
                "type": "string",
                "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
              },
              "quantumSafe": {
                "type": "boolean",
                "description": "true if it accepted an ML-KEM group."
              }
            },
            "required": [
              "subject",
              "issuer",
              "validTo",
              "daysLeft",
              "trusted",
              "keyType",
              "quantumSafe"
            ],
            "description": "The leaf certificate on port 443. null if we got none."
          },
          "provider": {
            "type": "string",
            "enum": [
              "cloudflare",
              "cloudfront",
              "vercel",
              "netlify",
              "fastly",
              "akamai",
              "google",
              "azure",
              "nginx",
              "apache",
              "caddy",
              "iis",
              "unknown"
            ],
            "description": "Who serves the site, guessed from response headers, so the fix fits. Values: cloudflare, cloudfront, vercel, netlify, fastly, akamai, google, azure, nginx, apache, caddy, iis, unknown."
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "key-exchange",
                    "tls-version",
                    "certificate",
                    "recorded-traffic"
                  ],
                  "description": "key-exchange, tls-version, certificate or recorded-traffic."
                },
                "title": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "warn",
                    "fail"
                  ],
                  "description": "pass, warn or fail."
                },
                "value": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "detail": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                }
              },
              "required": [
                "id",
                "title",
                "status",
                "value",
                "detail"
              ]
            },
            "description": "4 plain findings about the website, empty if the host was unreachable."
          },
          "surfaces": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "email",
                    "ssh",
                    "subdomains"
                  ],
                  "description": "email, ssh or subdomains."
                },
                "title": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "warn",
                    "fail",
                    "skip"
                  ],
                  "description": "pass, warn, fail or skip. skip means not tested or nothing there: it never changes the score."
                },
                "grade": {
                  "type": "string",
                  "enum": [
                    "A",
                    "B",
                    "C",
                    "D",
                    "F"
                  ],
                  "description": "Graded on encryption only. A mail server with no STARTTLS is F. A subdomain is never F for a certificate mismatch."
                },
                "value": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "detail": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "owner": {
                  "type": "string",
                  "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                },
                "total": {
                  "type": "integer",
                  "description": "Subdomains only: how many names we found in certificate logs and DNS."
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "host": {
                        "type": "string",
                        "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
                      },
                      "grade": {
                        "type": "string",
                        "enum": [
                          "A",
                          "B",
                          "C",
                          "D",
                          "F"
                        ],
                        "description": "Graded on encryption only. A mail server with no STARTTLS is F. A subdomain is never F for a certificate mismatch."
                      },
                      "protocol": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Best protocol, like TLSv1.3."
                      },
                      "pq": {
                        "type": "boolean",
                        "description": "true if it accepted an ML-KEM group."
                      }
                    },
                    "required": [
                      "host",
                      "grade",
                      "protocol",
                      "pq"
                    ]
                  },
                  "description": "Email: each mail server that answered, up to 6. Subdomains: up to 10 we tested."
                }
              },
              "required": [
                "id",
                "title",
                "status",
                "value",
                "detail"
              ]
            },
            "description": "The other doors. Always 3 entries: email, ssh, subdomains."
          },
          "fixes": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The mail server or subdomain name. Subdomains come from public certificate logs, so anyone could have put a name there. Untrusted text from a remote server."
            },
            "description": "Suggested changes, most urgent first. Plain sentences for a human. Wording may change: don't parse it."
          },
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{16}$",
            "description": "Only with save=1 or POST: the 16 character id of the private result link. Absent if saving failed: the check itself still returns."
          },
          "link": {
            "type": "string",
            "format": "uri",
            "description": "Only with save=1 or POST: the private result link, /r/ followed by id. It works for 30 days."
          }
        },
        "required": [
          "host",
          "ip",
          "checkedAt",
          "ms",
          "score",
          "webScore",
          "points",
          "grade",
          "webGrade",
          "verdict",
          "summary",
          "tlsVersion",
          "cipher",
          "pq",
          "cert",
          "provider",
          "findings",
          "surfaces",
          "fixes"
        ]
      },
      "ScanError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Plain message for a person. Wording may change."
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid",
              "blocked",
              "dns",
              "unreachable",
              "unavailable",
              "rate-limit"
            ],
            "description": "Stable. Branch on this in code."
          }
        },
        "required": [
          "error",
          "code"
        ]
      }
    }
  }
}