---
agent:
  instructions: "Search crawlapi docs via GET /.well-known/search?q={query} (add &format=json or Accept: application/json for JSON)."
  endpoint: "https://docs.crawlapi.dev/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.crawlapi.dev/llms.txt"
---

> Documentation index: https://docs.crawlapi.dev/llms.txt
> Search docs: https://docs.crawlapi.dev/.well-known/search?q={query}
> OpenAPI 3.1 specification: https://docs.crawlapi.dev/openapi.json

# Markdown output

> Clean article text, headings, code blocks, tables, and link rules.

`markdown` is the default format for `POST /v1/scrape`. Omit `format` or send `"format": "markdown"` to receive clean article text in `data.markdown` alongside every page link in `data.links`.

## Example

**cURL**

```bash
curl -sS https://api.crawlapi.dev/v1/scrape \
  -H "Authorization: Bearer $CRAWLAPI_API_KEY" \
  -H 'content-type: application/json' \
  --data '{"url": "https://en.wikipedia.org/wiki/Web_scraping"}'
```

**TypeScript**

```typescript
const response = await fetch('https://api.crawlapi.dev/v1/scrape', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CRAWLAPI_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ url: 'https://en.wikipedia.org/wiki/Web_scraping', format: 'markdown' }),
});
const body = await response.json();
if (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.data.markdown);
```

**Python**

```python
import os
import requests

response = requests.post(
    "https://api.crawlapi.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['CRAWLAPI_API_KEY']}"},
    json={"url": "https://en.wikipedia.org/wiki/Web_scraping", "format": "markdown"},
    timeout=65,
)
body = response.json()
if not body["success"]:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["data"]["markdown"])
```

The response returns clean page text in `data.markdown` and every unique page link in `data.links`.

## What is kept and removed

| Element | Output in `data.markdown` |
| --- | --- |
| Headings | `#` through `######`, with the page title promoted when missing |
| Paragraphs, blockquotes, lists | Clean markdown preserving ordered and unordered lists |
| Data tables | Markdown tables (layout tables flatten to plain text) |
| Code blocks | Fenced code blocks preserving declared language tags |
| Images | Dropped (no image URLs or base64 data) |
| Page chrome | Navigation bars, footers, cookie banners, dialogs, form controls, and repeated UI chrome removed |

## Link rules

Inline links in `data.markdown` are normalized to keep token counts low:

- **Absolute `http(s)` URLs:** Relative links resolve against the page's base URL. Non-web schemes (`mailto:`, `javascript:`) stay as plain text.
- **Tracking removed:** Parameters such as `utm_*`, `fbclid`, and `gclid` are stripped from links and from `metadata.final_url`.
- **Linked once:** Each unique URL links on its first appearance; repeated mentions render as plain text.
- **Noisy controls flattened:** Same-page fragment anchors and listing filter/sort controls render as plain text while pagination links stay linked.
- **Full page `data.links[]`:** Separate from inline links, `data.links` returns every unique absolute `http(s)` `<a href>` on the entire page (including navigation) in document order, with fragments and tracking stripped. RSS and Atom feeds populate `data.links` with entry URLs; other documents return `[]`.

## Special sources

- **X and YouTube:** Dedicated markdown layouts with metrics, threads, descriptions, chapters, and transcripts. See [X and YouTube](https://docs.crawlapi.dev/special-sites.md).
- **Documents:** PDFs, Office files, CSVs, JSON, feeds, and plain text convert to markdown through the same endpoint. See [PDFs and documents](https://docs.crawlapi.dev/documents.md).

## Response metadata

Every response includes `data.metadata` alongside `data.markdown` so you can index, deduplicate, and filter results before storing them:

| Field | Meaning |
| --- | --- |
| `title` / `description` | Page title and meta description |
| `language` | Detected BCP-47 language tag (or `null` when unavailable) |
| `status` | Final HTTP status code returned by the target site |
| `final_url` | Canonical URL after redirects, with tracking parameters removed |
| `truncated` | Present and `true` only when `data.markdown` was trimmed at `2 MiB` |
| `login_required` | Present and `true` only when the target served a readable sign-in wall |

## Output size

`data.markdown` is capped at **`2 MiB`** UTF-8. When a very large page exceeds that cap, the text is trimmed cleanly and `metadata.truncated` is set to `true`.

## Next steps

- [Structured JSON](https://docs.crawlapi.dev/json.md) Extract normalized entities, tables, JSON-LD, and embedded state.
- [PDFs & documents](https://docs.crawlapi.dev/documents.md) Convert PDF, Office, CSV, JSON, and RSS/Atom URLs.
- [X & YouTube](https://docs.crawlapi.dev/special-sites.md) Dedicated layouts for X threads and YouTube videos.
- [Errors & retries](https://docs.crawlapi.dev/errors.md) Handle `retryable` flags and sign-in walls cleanly.
