{"profile":"basic","original_length":131,"clean_length":143,"removed_bytes":-12,"clean":"{\"html\": \"<p>Hello <b>world</b>, this is <i>rich</i> text with a <a href=\"\\"https://example.com\\"\">link</a></p>\", \"profile\": \"strip\"}"}
curl --location --request POST 'https://zylalabs.com/api/13167/web+content+sanitizer+api/26714/sanitize+web+content' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"html": "Hello world, this is rich text with a link
", "profile": "strip"}'
注册后,每个开发者都会被分配一个个人 API 访问密钥,这是一个唯一的字母和数字组合,用于访问我们的 API 端点。要使用 Web Content Sanitizer API 进行身份验证,只需在 Authorization 标头中包含您的 bearer token。
| 标头 | 描述 |
|---|---|
授权
|
必需
应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。
|
无长期承诺。随时升级、降级或取消。 免费试用包括最多 50 个请求。
(年度计费可节省 2 个月 🎉)
领先企业的信赖之选
Make user submitted markup safe before it reaches your pages. One call strips scripts, inline event handlers and dangerous attributes while preserving harmless formatting.
Useful for user comments and reviews, rich text editor output before storage, markup arriving from messages or external hooks, and scraped content displayed inside your product.
The Sanitize Web Content endpoint returns a JSON object containing the cleaned HTML markup, the profile used for sanitization, the original length of the input, the cleaned length, and the number of bytes removed during the process.
The key fields in the response data include "profile" (the sanitization profile used), "original_length" (length of the input markup), "clean_length" (length of the sanitized markup), "removed_bytes" (number of bytes removed), and "clean" (the sanitized HTML content).
The endpoint accepts parameters such as "markup" (the HTML content to be sanitized) and "profile" (to specify the cleaning profile: plain text, safe formatting, or relaxed). Users can also provide a custom allowed tag list.
The response data is organized as a JSON object. It includes fields for the profile used, lengths of the original and cleaned markup, the number of bytes removed, and the cleaned HTML content itself, making it easy to parse and utilize.
Typical use cases include sanitizing user comments and reviews, cleaning rich text editor output before storage, processing markup from messages or external hooks, and ensuring scraped content is safe for display within applications.
Users can customize their requests by selecting different sanitization profiles (plain text, safe formatting, relaxed) and by providing a custom allowed tag list to control which HTML tags are preserved during the sanitization process.
在响应中 "profile" 表示使用的清理方法 "original_length" 显示输入标记的长度 "clean_length" 表示清理输出的长度 "removed_bytes" 反映剥离的数据量 "clean" 包含已清理的 HTML
数据准确性通过使用预定义的清理配置文件来保持,这些配置文件始终去除有害元素,同时保留安全格式。API还提供关于移除数据量的反馈,使用户能够评估清理的有效性