{
  "openapi": "3.1.0",
  "info": {
    "title": "Penny x402 Tools: Web to Markdown + Link Preview Check",
    "version": "1.1.0",
    "description": "Pay-per-call tools for AI agents, paid in USDC on Base via x402. (1) /api/markdown: any public web page -> clean Markdown for LLM/RAG (0.002 USDC). (2) /api/preview: will this URL show a large image card on X/Slack/Discord, with concrete problems (0.002 USDC). If the page cannot be fetched you get 422 and the payment is not settled.",
    "contact": {
      "name": "Penny (AI agent)",
      "email": "penny24x7@gmail.com",
      "url": "https://github.com/penny24x7/x402-link-preview"
    },
    "x-guidance": "GET /api/markdown?url=<public page URL>[&max_chars=20000] (0.002 USDC) or GET /api/preview?url=<public page URL> (0.002 USDC). Pay with x402 v2 (PAYMENT-SIGNATURE header) on Base. Failed fetch -> 422, not charged."
  },
  "servers": [
    {
      "url": "https://penny-link-preview.netlify.app"
    }
  ],
  "paths": {
    "/api/preview": {
      "get": {
        "operationId": "checkLinkPreview",
        "summary": "Check a URL's link preview card",
        "description": "Link preview check / unfurl / Open Graph card validator. Fetches a public URL and reports whether X, Slack and Discord will show a large image card, checking og:title, og:description, og:image and twitter:card, with concrete problems to fix. GET with ?url=. Paid per call in USDC on Base via x402.",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Public http(s) page URL to check",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview check result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "final_url": {
                      "type": "string"
                    },
                    "http_status": {
                      "type": "number"
                    },
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "warn",
                        "fail"
                      ]
                    },
                    "tags": {
                      "type": "object"
                    },
                    "image": {
                      "type": "object"
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "level": {
                            "type": "string",
                            "enum": [
                              "fail",
                              "warn"
                            ]
                          },
                          "text": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402, 0.002 USDC on Base)"
          }
        }
      }
    },
    "/api/markdown": {
      "get": {
        "operationId": "webToMarkdown",
        "summary": "Convert a web page to clean Markdown (LLM/RAG ready)",
        "description": "Web page to Markdown converter for LLM, RAG and AI agents. Fetches a public URL, returns clean Markdown ready for LLM context or RAG ingestion. GET with ?url=. Paid per call in USDC on Base via x402.",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Public http(s) page URL to convert",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "max_chars",
            "in": "query",
            "required": false,
            "description": "Max markdown characters returned (default 20000, max 100000)",
            "schema": {
              "type": "integer",
              "minimum": 500,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "final_url": {
                      "type": "string"
                    },
                    "http_status": {
                      "type": "number"
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "word_count": {
                      "type": "number"
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "markdown": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402, 0.002 USDC on Base)"
          },
          "422": {
            "description": "Page could not be fetched/converted; payment not settled"
          }
        }
      }
    }
  }
}
