API Documentation
Learn how to integrate the Web2MD API into your applications with our comprehensive guide
Available API Services
- /api/convert– Convert any webpage to Markdown
- /api/crawler– Crawl a website and list all discovered URLs
- /api/kepler– Extract precise data using CSS selectors
https://www.web2md.site/api/convert
Headers
Content-Type: application/json
Body Parameters
url
(string, required)The URL of the web page you want to convert
options
(object, optional)Conversion options object
includeTitle
(boolean) - Include page titleincludeLinks
(boolean) - Preserve linksimproveReadability
(boolean) - Extract main content{
"markdown": "# Page Title\n\nContent...",
"title": "Page Title"
}
curl -X POST https://www.web2md.site/api/convert \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/docs",
"options": {
"includeTitle": true,
"includeLinks": true,
"improveReadability": true
}
}'
https://www.web2md.site/api/crawler
Headers
Content-Type: application/json
Body Parameters
url
(string, required)The starting URL to crawl
options
(object, optional)Crawling options object
maxUrls
(number) - Max URLs to crawl (default: 100)sameDomain
(boolean) - Restrict to same domain (default: true)timeout
(number) - Per-request timeout in ms (default: 5000)delay
(number) - Delay between requests in ms (default: 1000){
"urls": [
"https://example.com/",
"https://example.com/about",
"https://example.com/contact"
],
"errors": [],
"totalProcessed": 3
}
curl -X POST https://www.web2md.site/api/crawler -H 'Content-Type: application/json' -d '{
"url": "https://example.com/",
"options": {
"maxUrls": 10,
"sameDomain": true,
"timeout": 5000,
"delay": 1000
}
}'
https://www.web2md.site/api/kepler
url
(string, required)The URL of the webpage to scrape. Protocol optional (defaults to http://)
selector
(string, required)CSS selector to target elements. Supports multiple selectors separated by commas
attr
(string, optional)Extract a specific HTML attribute instead of text content (e.g., href, src, class)
spaced
(boolean, optional)Add spaces between HTML tags when extracting text (default: false)
pretty
(boolean, optional)Format JSON response with indentation (default: false)
Single Element Result
{
"result": "Example Domain"
}
Multiple Elements Result
{
"result": [
"First paragraph text",
"Second paragraph text",
"Third paragraph text"
]
}
Multiple Selectors Result
{
"result": {
"h1": ["Example Domain"],
"p": [
"This domain is for use in illustrative examples",
"More information..."
]
}
}
Extract page title
curl "https://www.web2md.site/api/kepler?url=https://example.com&selector=h1&pretty=true"
CSS Selector Support
Use any CSS selector including complex combinations, pseudo-selectors, and attribute selectors.
Multiple Selectors
Extract different elements with comma-separated selectors in a single request.
Attribute Extraction
Extract HTML attributes like href, src, class, or any custom attributes.
CORS Enabled
Ready for browser-based applications with full CORS support.