{"openapi":"3.1.0","info":{"title":"AgentRead","version":"1.0.0","description":"AgentRead by Rowan Vale converts public web pages and documents into clean markdown and scans text for prompt-injection risk. Clients should send a descriptive User-Agent header; Cloudflare blocks some default library User-Agents (for example Python urllib).","x-guidance":"Call POST /v1/read with a JSON body containing a url (or upload a file as multipart/form-data) to receive clean markdown. Set scan to true to add a prompt-injection scan. Call POST /v1/scan with JSON containing text or url to receive a risk verdict. Each IP gets a free daily quota, shared with MCP; after that, pay per call. Pay with x402 exact USDC on Base through PayAI by retrying the request with the payment header from the 402 challenge. Alternatively, POST /v1/invoice to create a Lightning invoice, pay the bolt11 invoice, then retry the request with the X-Lightning-Invoice header set to the payment hash. Discovery metadata is at /.well-known/x402 and /llms.txt."},"servers":[{"url":"https://agent-read.toolschemaforge.workers.dev"}],"paths":{"/":{"get":{"operationId":"home","summary":"AgentRead home page","tags":["Discovery"],"security":[],"responses":{"200":{"description":"HTML home page","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/health":{"get":{"operationId":"health","summary":"Health check","tags":["Discovery"],"security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/llms.txt":{"get":{"operationId":"llms","summary":"Agent guidance in llms.txt format","tags":["Discovery"],"security":[],"responses":{"200":{"description":"Plain-text guidance for agents","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/openapi.json":{"get":{"operationId":"openapi","summary":"OpenAPI discovery document","tags":["Discovery"],"security":[],"responses":{"200":{"description":"OpenAPI 3.1.0 document","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/glama.json":{"get":{"operationId":"glamaClaim","summary":"Glama MCP connector claim","tags":["Discovery"],"security":[],"responses":{"200":{"description":"Glama connector claim","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/x402":{"get":{"operationId":"x402Discovery","summary":"x402 discovery metadata","tags":["Discovery"],"security":[],"responses":{"200":{"description":"x402 resource metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mcp":{"post":{"operationId":"mcp","summary":"MCP streamable HTTP endpoint","tags":["MCP"],"security":[],"responses":{"200":{"description":"JSON-RPC response"},"202":{"description":"Notification accepted"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"JSON-RPC 2.0 request or batch for initialize, ping, tools/list, or tools/call."}}}}}},"/v1/read":{"post":{"operationId":"read","summary":"Read - clean markdown from a URL or document","description":"Read a URL or upload a file and return clean markdown. Pay $0.001 (1 sat) with x402 exact USDC on Base through PayAI, or create a Lightning invoice at POST /v1/invoice and retry with the X-Lightning-Invoice header. The free tier applies first.","tags":["Read"],"security":[],"x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.001000","max":"0.003000"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Public http(s) URL of the document to read."},"max_tokens":{"type":"integer","minimum":1,"maximum":1000000,"description":"Optional output token budget."},"scan":{"type":"boolean","description":"Also scan the converted document for prompt-injection risk."}},"required":["url"],"additionalProperties":false}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"url":{"type":"string","format":"uri"},"max_tokens":{"type":"integer","minimum":1,"maximum":1000000},"scan":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"markdown":{"type":"string"},"title":{"type":["string","null"]},"source_url":{"type":["string","null"]},"tokens_est":{"type":"integer","minimum":0},"truncated":{"type":"boolean"},"scan":{"type":"object","properties":{"risk":{"type":"string","enum":["low","medium","high"]},"score":{"type":"number"},"signals":{"type":"array","items":{"type":"string"}}},"required":["risk","score","signals"]}},"required":["markdown","title","source_url","tokens_est","truncated"],"additionalProperties":false}}}},"400":{"description":"Invalid input"},"402":{"description":"Payment Required"},"403":{"description":"Blocked by network or robots policy"},"413":{"description":"Payload too large"},"415":{"description":"Unsupported document type"},"422":{"description":"Conversion failed"}}}},"/v1/scan":{"post":{"operationId":"scan","summary":"Scan - prompt-injection risk analysis","description":"Scan text or a URL for prompt-injection risk. Pay $0.002 (2 sats) with x402 exact USDC on Base through PayAI, or create a Lightning invoice at POST /v1/invoice and retry with the X-Lightning-Invoice header. The free tier applies first.","tags":["Scan"],"security":[],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.002000"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":200000,"description":"Text to scan for prompt-injection risk."},"url":{"type":"string","format":"uri","description":"Public http(s) URL of text to fetch and scan."}},"oneOf":[{"required":["text"]},{"required":["url"]}],"additionalProperties":false}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"risk":{"type":"string","enum":["low","medium","high"]},"score":{"type":"number","minimum":0,"maximum":1},"signals":{"type":"array","items":{"type":"string"}}},"required":["risk","score","signals"],"additionalProperties":false}}}},"400":{"description":"Invalid input"},"402":{"description":"Payment Required"},"403":{"description":"Blocked by network or robots policy"},"413":{"description":"Payload too large"},"415":{"description":"Unsupported document type"},"422":{"description":"Conversion failed"}}}},"/v1/invoice":{"post":{"operationId":"createInvoice","summary":"Create a Lightning invoice","tags":["Payment"],"security":[],"responses":{"200":{"description":"Invoice created","content":{"application/json":{"schema":{"type":"object","properties":{"payment_hash":{"type":"string"},"bolt11":{"type":"string"},"sats":{"type":"integer"},"product":{"type":"string"},"retry_header":{"type":"string"}},"required":["payment_hash","bolt11","sats","product","retry_header"]}}}},"400":{"description":"Invalid product"},"429":{"description":"Rate limited"},"502":{"description":"Invoice provider error"}}}},"/v1/invoice/{hash}":{"get":{"operationId":"getInvoice","summary":"Check a Lightning invoice","tags":["Payment"],"security":[],"responses":{"200":{"description":"Invoice status","content":{"application/json":{"schema":{"type":"object","properties":{"payment_hash":{"type":"string"},"status":{"type":"string"},"product":{"type":"string"},"sats":{"type":"integer"}},"required":["payment_hash","status","product","sats"]}}}},"404":{"description":"Invoice not found"},"502":{"description":"Invoice provider error"}},"parameters":[{"name":"hash","in":"path","required":true,"schema":{"type":"string"}}]}},"/icon.png":{"get":{"operationId":"icon","summary":"Application icon","tags":["Discovery"],"security":[],"responses":{"200":{"description":"400 by 400 PNG icon","content":{"image/png":{"schema":{"type":"string"}}}}}}},"/favicon.ico":{"get":{"operationId":"favicon","summary":"Favicon","tags":["Discovery"],"security":[],"responses":{"200":{"description":"ICO favicon","content":{"image/x-icon":{"schema":{"type":"string"}}}}}}},"/api/stats":{"get":{"operationId":"stats","summary":"Admin usage statistics","description":"Not a paid (x402) route. Requires an admin bearer token (Authorization: Bearer <ADMIN_TOKEN>); returns 401 otherwise.","tags":["Admin"],"security":[],"responses":{"200":{"description":"Usage statistics","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Admin secret required"}}}}},"components":{"securitySchemes":{"adminBearer":{"type":"http","scheme":"bearer"}}}}