# Webpage to Markdown

`POST https://api.serpkite.com/v1/webpage` · Credits: 1 per page

Fetch any public URL and get clean Markdown plus title, description and metadata.

Fetch any public URL and get clean Markdown and plain text plus metadata (title, description, language, canonical, author, published time). Built for feeding pages to an LLM. This is the one endpoint without a `results` list.

To fetch the top search results in the same call as the search, use [`include_content`](https://serpkite.com/docs/include-content) on /v1/search instead.

## Request body

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `url` **required** | string |  | Public http(s) URL to fetch. Required. |
| `format` | string | `json` | `markdown` returns the page Markdown as `text/markdown`. One of: `json`, `markdown`. |
| `include_html` | boolean | `false` | Webpage: also return the raw HTML. |
| `max_age` | integer |  | Accept a cached result up to this many seconds old. Cache hits cost 50% of the credits. |

## Example request

cURL:

```bash
curl https://api.serpkite.com/v1/webpage \
  -H "Authorization: Bearer $SERPKITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/Search_engine_results_page","format":"markdown"}'
```

TypeScript:

```ts
import { SerpKite } from "serpkite";

const sk = new SerpKite(); // reads SERPKITE_API_KEY
const res = await sk.webpage({ url: "https://en.wikipedia.org/wiki/Search_engine_results_page", format: "markdown" });
console.log(res);
```

Python:

```python
from serpkite import SerpKite

sk = SerpKite()  # reads SERPKITE_API_KEY
res = sk.webpage("https://en.wikipedia.org/wiki/Search_engine_results_page", format="markdown")
print(res)
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `request` | object | The normalised request, with defaults filled in: `endpoint`, `engine`, `q`, `country`, `language`, `location`, `num`, `page`, `device`, `autocorrect`… |
| `url` | string | Final URL after redirects. |
| `status_code` | integer | HTTP status of the fetched page. |
| `markdown` | string | Main content as Markdown. |
| `text` | string | Main content as plain text. |
| `html` | string | Raw HTML, only with `include_html: true`. |
| `metadata` | object | `title`, `description`, `language`, `canonical`, `site_name`, `image`, `published_time`, `author`. |
| `meta` | object | `request_id`, `credits_used`, `cached`, `cached_at`, `engine` (the provider that answered), `route` (provider attempts, see [Search providers](https://serpkite.com/docs/providers)), `latency_ms`, `parse_quality` (`ok`, `partial`, `empty`), `resolved_urls`. |

## Example response

```json
{
  "request": {
    "endpoint": "webpage",
    "engine": "google",
    "url": "https://en.wikipedia.org/wiki/Search_engine_results_page",
    "format": "json"
  },
  "url": "https://en.wikipedia.org/wiki/Search_engine_results_page",
  "status_code": 200,
  "markdown": "# Search engine results page\n\nA **search engine results page** (**SERP**) is a webpage that is displayed by a search engine in response to a query by a user…",
  "text": "Search engine results page. A search engine results page (SERP) is a webpage that is displayed by a search engine in response to a query by a user…",
  "metadata": {
    "title": "Search engine results page - Wikipedia",
    "language": "en",
    "canonical": "https://en.wikipedia.org/wiki/Search_engine_results_page",
    "site_name": "Wikipedia"
  },
  "meta": {
    "request_id": "req_01J8ZK4M6Q2V7",
    "credits_used": 1,
    "cached": false,
    "engine": "google",
    "latency_ms": 1034
  }
}
```

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | A parameter is missing or invalid. |
| 401 | `unauthorized` | The API key is missing, invalid or revoked. |
| 402 | `insufficient_credits` | Your balance is too low. Buy a pack or wait for the monthly free grant. |
| 429 | `rate_limited` | Too many requests per second for your plan. Retry after the Retry-After header. |
| 503 | `upstream_error` | Google could not be fetched or parsed. Not billed; retry after Retry-After. |

All errors: https://serpkite.com/docs/errors

## Notes

- Only public pages are fetched: no logins, no paywalled content.
- Pages that can't be fetched return `503 upstream_error` and are not billed.

## Related

- [Page content with search](https://serpkite.com/docs/include-content)
- [RAG pipeline](https://serpkite.com/docs/guides/rag-pipeline)