{
  "openapi": "3.0.3",
  "info": {
    "title": "x402 Utility APIs",
    "description": "Pay-per-call utility APIs, paywalled with the x402 HTTP payment protocol (USDC on Base mainnet).",
    "version": "3.0.0"
  },
  "servers": [
    {
      "url": "https://x402-qr-api.vercel.app"
    }
  ],
  "paths": {
    "/api/qrcode": {
      "get": {
        "summary": "QR code image (PNG or SVG) for any text or URL.",
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 2000
            },
            "description": "Text or URL to encode"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "default": 300
            },
            "description": "Pixel width of the output image"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "png",
                "svg"
              ],
              "default": "png"
            },
            "description": "Output image format"
          },
          {
            "name": "ecLevel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "L",
                "M",
                "Q",
                "H"
              ],
              "default": "M"
            },
            "description": "QR error correction level"
          },
          {
            "name": "dark",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "000000"
            },
            "description": "Foreground color, 6 or 8 digit hex"
          },
          {
            "name": "light",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "ffffff"
            },
            "description": "Background color, 6 or 8 digit hex"
          }
        ],
        "responses": {
          "200": {
            "description": "QR code image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid parameters"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/read": {
      "get": {
        "summary": "Fetch a URL, strip nav/ads/boilerplate, return clean Markdown + title/byline/wordCount.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public http(s) URL to fetch and extract. Internal/private addresses are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Extracted article content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string",
                      "nullable": true
                    },
                    "byline": {
                      "type": "string",
                      "nullable": true
                    },
                    "siteName": {
                      "type": "string",
                      "nullable": true
                    },
                    "wordCount": {
                      "type": "integer"
                    },
                    "markdown": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid url parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          },
          "422": {
            "description": "Could not fetch or extract readable content from the page"
          }
        }
      }
    },
    "/api/hash": {
      "get": {
        "summary": "MD5 / SHA1 / SHA256 / SHA512 digests of input text.",
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100000
            },
            "description": "Text to hash"
          }
        ],
        "responses": {
          "200": {
            "description": "Hash digests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "length": {
                      "type": "integer"
                    },
                    "digests": {
                      "type": "object",
                      "properties": {
                        "md5": {
                          "type": "string"
                        },
                        "sha1": {
                          "type": "string"
                        },
                        "sha256": {
                          "type": "string"
                        },
                        "sha512": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid text parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/dns": {
      "get": {
        "summary": "DNS lookup: A, AAAA, MX, TXT, NS, CNAME records for a domain.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Domain name to look up"
          }
        ],
        "responses": {
          "200": {
            "description": "DNS records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "a": {
                      "type": "array",
                      "nullable": true
                    },
                    "aaaa": {
                      "type": "array",
                      "nullable": true
                    },
                    "mx": {
                      "type": "array",
                      "nullable": true
                    },
                    "txt": {
                      "type": "array",
                      "nullable": true
                    },
                    "ns": {
                      "type": "array",
                      "nullable": true
                    },
                    "cname": {
                      "type": "array",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid domain parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/headers": {
      "get": {
        "summary": "HTTP status, response headers, redirect chain, and timing for a URL.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public http(s) URL to inspect. Internal/private addresses are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Response metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "requestedUrl": {
                      "type": "string"
                    },
                    "finalUrl": {
                      "type": "string"
                    },
                    "redirected": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "statusText": {
                      "type": "string"
                    },
                    "elapsedMs": {
                      "type": "integer"
                    },
                    "headers": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid url parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          },
          "422": {
            "description": "Failed to fetch the URL"
          }
        }
      }
    },
    "/api/ssl": {
      "get": {
        "summary": "TLS certificate inspection: issuer, subject, validity dates, SANs.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Domain name to check"
          },
          {
            "name": "port",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 443
            },
            "description": "TCP port to connect to"
          }
        ],
        "responses": {
          "200": {
            "description": "Certificate details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "port": {
                      "type": "integer"
                    },
                    "subject": {
                      "type": "object"
                    },
                    "issuer": {
                      "type": "object"
                    },
                    "validFrom": {
                      "type": "string"
                    },
                    "validTo": {
                      "type": "string"
                    },
                    "subjectAltName": {
                      "type": "string",
                      "nullable": true
                    },
                    "fingerprint256": {
                      "type": "string",
                      "nullable": true
                    },
                    "serialNumber": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid domain parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          },
          "422": {
            "description": "TLS connection or handshake failed"
          }
        }
      }
    },
    "/api/convert": {
      "get": {
        "summary": "Convert data between JSON, YAML, and CSV.",
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100000
            },
            "description": "Input to convert"
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "yaml",
                "csv"
              ]
            },
            "description": "Input format"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "yaml",
                "csv"
              ]
            },
            "description": "Output format"
          }
        ],
        "responses": {
          "200": {
            "description": "Converted output",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "output": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing/invalid parameters or conversion failure"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/text-stats": {
      "get": {
        "summary": "Word/sentence/syllable counts, reading time, Flesch reading-ease score.",
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100000
            },
            "description": "Text to analyze"
          }
        ],
        "responses": {
          "200": {
            "description": "Text statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "charCount": {
                      "type": "integer"
                    },
                    "wordCount": {
                      "type": "integer"
                    },
                    "sentenceCount": {
                      "type": "integer"
                    },
                    "syllableCount": {
                      "type": "integer"
                    },
                    "readingTimeMinutes": {
                      "type": "integer"
                    },
                    "fleschReadingEase": {
                      "type": "number",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid text parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/validate": {
      "get": {
        "summary": "Email validation: format check plus a live MX record lookup on the domain.",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "description": "Email address to validate"
          }
        ],
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "formatValid": {
                      "type": "boolean"
                    },
                    "domain": {
                      "type": "string",
                      "nullable": true
                    },
                    "mxValid": {
                      "type": "boolean"
                    },
                    "mxRecords": {
                      "type": "array",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid email parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/jwt": {
      "get": {
        "summary": "Decode a JWT's header/payload and check expiry — signature is not verified.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 8000
            },
            "description": "JWT to decode"
          }
        ],
        "responses": {
          "200": {
            "description": "Decoded token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "header": {
                      "type": "object"
                    },
                    "payload": {
                      "type": "object"
                    },
                    "expired": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "notYetValid": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing token, or not a valid 3-segment JWT"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    },
    "/api/domain-report": {
      "get": {
        "summary": "Synthesized DNS + TLS + HTTP security report with a 0-100 score and findings — one call instead of three.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Domain to generate the report for"
          }
        ],
        "responses": {
          "200": {
            "description": "Synthesized domain report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "score": {
                      "type": "integer"
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "severity": {
                            "type": "string",
                            "enum": [
                              "info",
                              "warning"
                            ]
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "dns": {
                      "type": "object",
                      "nullable": true
                    },
                    "tls": {
                      "type": "object",
                      "nullable": true
                    },
                    "http": {
                      "type": "object",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid domain parameter"
          },
          "402": {
            "description": "Payment required — see the x402 protocol (https://x402.org). Payment requirements are returned in the payment-required response header."
          }
        }
      }
    }
  }
}
