Before you start
- Get an API keySign up for 100 free credits, no card. Keys start with
gs_live_. - Put it in the environmentEvery example reads it from
GROUNDSOCIAL_API_KEY:export GROUNDSOCIAL_API_KEY=gs_live_… - Set up TypeScript
npm init -y && npm pkg set type=module && npm i -D tsx typescript @types/node
Call Web scraping API: any page to Markdown from TypeScript
GET /v1/web/scrape. Save this as main.ts and run npx tsx main.ts. It prints data.metadata.title.
// The fields this script reads, as the recorded response has them.
interface Page {
data: {
metadata: {
title: string
}
}
}
class ApiError extends Error {
constructor(
readonly code: string,
readonly hint: string,
readonly retryable: boolean,
) {
super(`${code}: ${hint}`)
}
}
async function call<T>(path: string, params: Record<string, string> = {}): Promise<T> {
const url = new URL(path, 'https://api.groundsocial.dev')
for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v)
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}`,
},
signal: AbortSignal.timeout(60_000),
})
if (!res.ok) {
const { error } = (await res.json()) as {
error: { code: string; message: string; hint?: string; retryable: boolean }
}
throw new ApiError(error.code, error.hint ?? error.message, error.retryable)
}
return (await res.json()) as T
}
const data = await call<Page>('/v1/web/scrape', { url: 'https://example.com/', formats: 'markdown,links' })
console.log(data.data.metadata.title)The response
A real Web response to this call, recorded from the live API on 27 Nov 2026 and shortened for display: arrays keep their first items and … marks every cut. Live calls return current data in the same shape.
{
"data": {
"markdown": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it …",
"links": [],
"metadata": {
"title": "Example Domain",
"language": "en",
"sourceURL": "https://example.com/",
"url": "https://example.com/",
"statusCode": 200,
"contentType": "text/html; charset=utf-8",
"fetchedAt": "2026-11-27T00:25:35.671Z"
}
}
}Parameters
| Name | In | Type | Description |
|---|---|---|---|
url (required) | query | string | A public http(s) URL. Example: https://example.com/. |
formats | query | string | Comma-separated: markdown, html, rawHtml, links, text, images (default markdown). Example: markdown,links. |
only_main_content | query | "true" | "false" | Drop navigation, headers, footers and asides (default true). One of true, false. |
include_tags | query | string | Comma-separated CSS selectors to keep (only those). |
exclude_tags | query | string | Comma-separated CSS selectors to drop. |
accept_language | query | string | Accept-Language header, e.g. de-DE,de;q=0.9. |
block_ads | query | "true" | "false" | One of true, false. |
remove_base64_images | query | "true" | "false" | One of true, false. |
mobile | query | "true" | "false" | Accepted for compatibility; pages are fetched as desktop. One of true, false. |
timeout | query | integer | – |
wait_for | query | integer | null | Accepted for compatibility; no JavaScript runs, so there is nothing to wait for. |
max_age | query | integer | null | – |
location_country | query | string | – |
proxy | query | "basic" | "auto" | "enhanced" | One of basic, auto, enhanced. |
Errors and retries
Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.
try {
const data = await call<Page>('/v1/web/scrape', { url: 'https://example.com/', formats: 'markdown,links' })
} catch (err) {
if (!(err instanceof ApiError)) throw err
if (err.code === 'insufficient_credits') console.error('Top up:', err.hint)
else if (err.code === 'target_not_found') console.error('Nothing there (not charged).')
else if (err.retryable) console.error('Try again after Retry-After:', err.hint)
else throw err
}| Status | Meaning |
|---|---|
200 | The page. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | That host does not resolve or the page does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Web is temporarily unavailable. Retryable; nothing was charged. |
Every error code and what to do about it.
Pricing
| Cost | |
|---|---|
| Per call | 1 credit per call |
| 1,000 calls | $1.00 on the starter pack, $0.40 at volume |
| No key (MPP or x402) | $0.01 per call |
| Failed call | Refunded, never charged |
Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.
From an AI agent (MCP)
The same call is the web_scrape_get tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcpThen ask for it in words (“Any public web page as Markdown, HTML, text, links and metadata”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "web_scrape_get",
"arguments": {
"url": "https://example.com/",
"formats": "markdown,links"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
Feed pages to an LLM
Scrape with the default only_main_content=true and pass data.markdown as context.
Questions
Does it run JavaScript?
No: it reads the HTML the server sends. Pages that only render in a browser come back thin.
What about a 404?
You get the page with metadata.statusCode 404.
Keep going
- This call in Python, JavaScript, Go, PHP, cURL.
- Web scraping API: any page to Markdown reference: every field and status code.
- Web tutorials and all TypeScript tutorials.
- Web API: every endpoint and price.
- How to batch web scraping with TypeScript: Up to 10 web pages as Markdown in one call.
- How to scrape Website URL map with TypeScript: A site’s URLs from its sitemaps and links.
- How to scrape Website crawl with TypeScript: Crawl a site from a URL: up to 10 pages as Markdown in about 25 s, with a cursor.
- How to scrape Web search with TypeScript: Search the web: titles, URLs, snippets and news, optionally with page content.
Run it on your own data
One key for Web and 76 more platforms, over REST or MCP. Free credits on signup, no card.
Web is a trademark of its owner. We are not affiliated with or endorsed by it.