{
  "openapi": "3.1.0",
  "info": {
    "title": "p256check API",
    "version": "1.0.0",
    "description": "Check whether a website uses ECDSA P-256 keys and whether Chrome will distrust its certificate chain on 15 March 2027."
  },
  "servers": [
    {
      "url": "https://p256check.eu"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkSite",
        "summary": "Check a website for ECDSA P-256 and Chrome's 2027 P-256 CA distrust",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "example.com"
            },
            "description": "Domain name or URL to check (port 443 only)."
          }
        ],
        "responses": {
          "200": {
            "description": "Check result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "host": {
                      "type": "string"
                    },
                    "checkedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "cached": {
                      "type": "boolean"
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "reachable": {
                          "type": "boolean"
                        },
                        "supportsP256": {
                          "type": "boolean",
                          "description": "Server can present an ECDSA P-256 certificate."
                        },
                        "servesP256ByDefault": {
                          "type": "boolean"
                        },
                        "defaultKey": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "example": "ECDSA P-256"
                        },
                        "issuer": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "certValid": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "chrome2027": {
                          "type": "string",
                          "enum": [
                            "affected",
                            "not_affected",
                            "unknown"
                          ],
                          "description": "Affected by Chrome's 15 March 2027 distrust of ECDSA P-256 CAs."
                        },
                        "p256CAs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "CAs in the chain with an ECDSA P-256 key."
                        },
                        "alternateChainAffected": {
                          "type": "boolean"
                        },
                        "hybridPQ": {
                          "type": "boolean",
                          "description": "Accepts X25519MLKEM768 key exchange."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/stats": {
      "get": {
        "operationId": "getStatistics",
        "summary": "Totals across all checks",
        "responses": {
          "200": {
            "description": "Statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/checks": {
      "get": {
        "operationId": "listChecks",
        "summary": "Recent checks, newest first",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent checks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}