{"uid":"cap_Xd5be3_E5iHPBIhkFTBPu","slug":"html-sanitizer-by-openverbs-476e3c5d","name":"HTML Sanitizer by OpenVerbs","description":"Sanitize untrusted HTML to a safe allowlist. Keeps common formatting and links but removes dangerous scripting tags, inline event handlers and unsafe URL schemes. Ideal for rendering user-supplied HTML.","url":"https://html.openverbs.com/v1/sanitize","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["html"],"properties":{"html":{"type":"string","maxLength":200000,"description":"Untrusted HTML to sanitize."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ikF4W3Y7iqtVXVfLQ0z3W","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Sanitizes untrusted HTML by stripping dangerous scripting tags, inline event handlers, and unsafe URL schemes while preserving safe formatting and links","exampleAgentPrompt":"Sanitize this HTML from a user comment before I render it on the page — strip out any script tags, event handlers, or unsafe URLs but keep the formatting and links intact: '<b>Hello</b><script>alert(1)</script><a href=\"javascript:evil()\">click me</a>'","exampleUseCases":[{"title":"User comment HTML rendering","prompt":"A user just submitted this HTML comment to my forum and I need to render it safely — can you sanitize it so all script tags, onclick handlers, and javascript: links are removed but bold text and regular links are preserved? Here's the HTML: '<p>Great post! <b>Love it</b> <a href=\"https://example.com\">link</a><script>steal(document.cookie)</script></p>'"},{"title":"CMS rich text editor sanitization","prompt":"My CMS lets editors paste rich text HTML from Word and external sources, and I need to sanitize this blob before saving it: '<div style=\"color:red\">Content</div><iframe src=\"evil.com\"></iframe><p onclick=\"malware()\">Click here</p>' — strip anything dangerous but keep the paragraph structure."},{"title":"Email newsletter HTML cleanup","prompt":"Before I send this newsletter HTML through our mailer, can you clean it up to remove any unsafe elements like script tags or inline event handlers? Here's the raw HTML: '<h1>Newsletter</h1><p>Read more</p><script src=\"tracker.js\"></script><img onerror=\"fetch(evil)\" src=\"x\">'"}],"resultDescription":"Returns sanitized HTML with dangerous elements removed — script tags, inline event handlers (onclick, onerror, onload, etc.), and unsafe URL schemes (javascript:, data: in hrefs) are stripped, while safe structural and formatting tags (p, b, i, a with safe hrefs, ul, li, etc.) are preserved.","failureModes":["HTML input exceeds 200,000 character limit — request rejected","Missing required 'html' field in request body — validation error","Malformed JSON body — parse error","Payment not provided or insufficient — 402 Payment Required","Network timeout for very large HTML documents near the size limit"],"whenToPreferThis":"Choose this endpoint when you need to render user-supplied or third-party HTML in a browser or application and want to prevent XSS attacks without writing your own allowlist logic. It is ideal for user-generated content pipelines (comments, forum posts, rich text editors) where you want to preserve safe formatting while removing all scripting vectors. Prefer this over client-side sanitization libraries when you need server-side guarantees or are processing HTML in a backend agent workflow.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:31:37.813Z","isFirstParty":false}