Skip to main content
URL to Markdown API

Convert web pages with the URL to Markdown API

Turn website URLs into readable, LLM-ready Markdown for AI agents, retrieval-augmented generation (RAG), and application workflows. Get the content you need without running your own browser infrastructure.

Quickstart

Convert a URL to Markdown with one API call

Send a POST request to the Browserless Smart Scrape API with a target URL and set formats to markdown. The API returns a JSON response with the converted content in its markdown field. Smart Scrape starts with a lightweight HTTP fetch and only escalates when it has to: to a proxied fetch if the request is blocked, a headless browser if the page needs JavaScript rendering, and CAPTCHA solving if a challenge blocks the page. The response’s strategy field tells you which approach returned the content.

Quickstart – convert a website URL to Markdown (cURL)

curl -s -X POST \
  "https://production-sfo.browserless.io/smart-scrape?token=YOUR_API_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://news.ycombinator.com/","formats":["markdown"]}'

Replace YOUR_API_TOKEN_HERE with the token from your Browserless account. Read the response’s markdown field to get the clean text, headings, and links. onlyMainContent is true by default, so navigation, footers, sidebars, and other page chrome are removed before conversion. Set it to false to convert the full page, or use includeTags and excludeTags to keep or drop specific CSS selectors.

Use the API from JavaScript

const token = process.env.BROWSERLESS_TOKEN;

const response = await fetch(
  `https://production-sfo.browserless.io/smart-scrape?token=${token}`,
  { method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ url: 'https://news.ycombinator.com/', formats: ['markdown'] }) });

const data = await response.json();

if (!response.ok || !data.ok) throw new Error(data.message || `HTTP ${response.status}`);

console.log(data.markdown);

This server-side JavaScript example checks both the HTTP status and the API result before using the Markdown. Keep your token in an environment variable rather than exposing it in browser-side code.

Control extraction with BrowserQL

When you need to interact with a page or convert a single element, use the BrowserQL markdown mutation. Navigate to the URL, then return its content as Markdown. Without a selector, it converts the whole document, including navigation and footers, so pass a selector such as main or an article container to convert just the section you need.

mutation Markdownify {
  goto(url: "https://example.com") {
    status
  }
  markdown {
    markdown
  }
}

Run the mutation in the BrowserQL IDE or send it as the query in an HTTP POST to /chromium/bql. Smart Scrape can run up to 20 simple actions – including clicking, writing, typing, and scrolling – before it captures a page. Use Browser Automation Protocol (BAP) when you need to script the whole session, such as conditional steps, several extractions in one run, or solving a CAPTCHA inside a form with solve().

URL to Markdown API FAQs

URL to Markdown API FAQs

Start converting URLs to Markdown

Try Browserless with a single POST request, then use the same managed infrastructure as your Markdown conversion jobs scale, with no browser setup to maintain.