{
  "openapi": "3.1.1",
  "info": {
    "title": "DNS + Certificate Explorer API",
    "version": "1.0.0",
    "summary": "DNS records, e-mail security, CAA, live TLS certificate and CT history for a domain.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://dnscertificateexplorer.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "DNS records, e-mail security, CAA, live TLS certificate and CT history for a domain.",
        "description": "Resolves A, AAAA, CNAME, MX, NS, TXT, CAA and SOA records, analyses e-mail spoofing protection (SPF lookups and \"all\" policy, DMARC policy and reporting, MTA-STS), fetches the live TLS certificate from the domain's public IP (issuer, SANs, expiry, key, chain, TLS version, browser trust) and lists recent certificates from Certificate Transparency logs via crt.sh.\n\nMethodology:\n- DNS queries via the server's resolver: A, AAAA, CNAME, MX, NS, TXT, CAA, SOA for the domain and TXT at _dmarc.<domain> and _mta-sts.<domain>.\n- SPF (RFC 7208): one record allowed, max 10 DNS-querying mechanisms, policy from the \"all\" qualifier. DMARC (RFC 7489): p=, pct=, rua=.\n- TLS: one connection to the first public IPv4/IPv6 address on port 443 with SNI; the certificate is verified against Node's trusted root store and the hostname (private addresses are never contacted).\n- Certificate Transparency: crt.sh JSON for the exact domain, latest 25 entries (deduplicated by serial, precertificates included).",
        "tags": [
          "infrastructure"
        ],
        "x-mcp-tool": "dns_certificate_explorer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DnsCertificateExplorerInput"
              },
              "examples": {
                "example1": {
                  "summary": "example.com",
                  "value": {
                    "domain": "example.com",
                    "certificateTransparency": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DnsCertificateExplorerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "DnsCertificateExplorerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "domain": {
            "title": "Domain",
            "type": "string",
            "maxLength": 253
          },
          "certificateTransparency": {
            "title": "Include Certificate Transparency history (crt.sh, slower)",
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "domain"
        ]
      },
      "DnsCertificateExplorerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "domain",
              "records",
              "email",
              "caaIssuers",
              "certificate",
              "ctLog",
              "findings"
            ],
            "properties": {
              "domain": {
                "type": "string"
              },
              "records": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "email": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "spf",
                  "spfLookups",
                  "dmarc",
                  "dmarcPolicy",
                  "mtaSts"
                ],
                "properties": {
                  "spf": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "spfLookups": {
                    "type": "integer"
                  },
                  "dmarc": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dmarcPolicy": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "mtaSts": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "caaIssuers": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "certificate": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "subject",
                  "issuer",
                  "validFrom",
                  "validTo",
                  "daysLeft",
                  "san",
                  "keyType",
                  "keyBits",
                  "serialNumber",
                  "fingerprint256",
                  "chainLength",
                  "hostnameMatches",
                  "authorized",
                  "authorizationError",
                  "protocol",
                  "servedFrom"
                ],
                "properties": {
                  "subject": {
                    "type": "string"
                  },
                  "issuer": {
                    "type": "string"
                  },
                  "validFrom": {
                    "type": "string"
                  },
                  "validTo": {
                    "type": "string"
                  },
                  "daysLeft": {
                    "type": "integer"
                  },
                  "san": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "keyType": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "keyBits": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "serialNumber": {
                    "type": "string"
                  },
                  "fingerprint256": {
                    "type": "string"
                  },
                  "chainLength": {
                    "type": "integer"
                  },
                  "hostnameMatches": {
                    "type": "boolean"
                  },
                  "authorized": {
                    "type": "boolean"
                  },
                  "authorizationError": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "protocol": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "servedFrom": {
                    "type": "string"
                  }
                }
              },
              "ctLog": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "issuer",
                    "names",
                    "notBefore",
                    "notAfter"
                  ],
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "names": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "notBefore": {
                      "type": "string"
                    },
                    "notAfter": {
                      "type": "string"
                    }
                  }
                }
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "severity",
                    "area",
                    "finding"
                  ],
                  "properties": {
                    "severity": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low",
                        "info"
                      ]
                    },
                    "area": {
                      "type": "string"
                    },
                    "finding": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}