# url2md

> HTTP API that fetches a public URL, extracts the main readable content, and returns it as clean markdown. Built for LLMs and agents.

## Endpoint

`GET https://url2md.automators.work/md?url={ENCODED_URL}[&raw=1]`

## Parameters

- `url` (string, required) — absolute http(s) URL of the page to convert. URL-encode it if it contains query strings.
- `raw` (flag, optional) — if `1`, convert the full page body instead of extracting the main article. Default: readability extraction.

## Response

- `200` → `Content-Type: text/markdown; charset=utf-8`. Body starts with `# {title}\n\n> Source: {url}\n\n` followed by the extracted markdown.
- `400` → missing or invalid URL, disallowed scheme, or private host.
- `413` → upstream body exceeded 5 MB.
- `415` → upstream returned non-HTML content-type.
- `422` → could not extract readable content. Retry with `&raw=1`.
- `502` → upstream fetch failed.

## Limits

- Response cap: 5 MB.
- Upstream timeout: 10s.
- Cache: `public, max-age=600`.
- Only `http:` and `https:` schemes. Private/loopback hosts are blocked.

## Examples

- `/md?url=https%3A%2F%2Fexample.com%2Farticle` — article extraction
- `/md?url=https%3A%2F%2Fblog.example%2Fpost&raw=1` — full page conversion

## Notes for agents

- Stateless. Same input URL yields (for 10 min) the same markdown.
- Feed the output directly into your context — it is already stripped of scripts, styles, nav, and boilerplate.
- If the first call returns 422, retry once with `&raw=1`. Some sites are not reader-friendly.
- Do not POST. There is only `GET /md`.

## Skills

- [url-to-markdown](/skills/url-to-markdown/SKILL.md): convert any public URL to clean markdown for ingestion into LLM context. <!-- skill: {"version":"0.1.0","license":"MIT"} -->
