# Quickstart (https://www.scrape-sdk.com/docs/quickstart)

Canonical: https://www.scrape-sdk.com/docs/quickstart
Markdown: https://www.scrape-sdk.com/docs/quickstart.md



## 1. Scrape a URL [#1-scrape-a-url]

```ts
import { scrape } from "scrape-sdk";

const page = await scrape("https://news.ycombinator.com");
console.log(page.markdown, page.provider, page.latencyMs);
```

No keys required. Jina + local are always in the chain. Site and `/docs` roots try `/llms.txt` before HTML.

Pass `maxChars` when the caller is an LLM. Agent tools default to 20\_000.

## 2. Create a client (optional) [#2-create-a-client-optional]

```ts
import { createScrapeClient, fromEnv } from "scrape-sdk";
import { firecrawl } from "scrape-sdk/firecrawl";
import { jina } from "scrape-sdk/jina";
import { local } from "scrape-sdk/local";

const scraper = createScrapeClient({
  providers: [
    firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY! }),
    jina(),
    local(),
  ],
  strategy: "priority",
  cache: { ttlMs: 60_000 },
});

// Equivalent if you export keys in the environment:
// const scraper = fromEnv();
```

`provider` + `fallback` still works. Prefer `providers` for more than two backends.

## 3. Search when you do not have a URL [#3-search-when-you-do-not-have-a-url]

```ts
const found = await scraper.search("firecrawl vs jina reader", { limit: 5 });
```

## 4. Map a site (URLs only) [#4-map-a-site-urls-only]

Cheaper than crawl. Needs a provider with `map` (Firecrawl).

```ts
const urls = await scraper.map("https://docs.firecrawl.dev", { limit: 80 });
```

## 5. Crawl a site [#5-crawl-a-site]

Firecrawl starts a job and **polls** `GET /v2/crawl/{id}` until it completes. Spider returns pages in the crawl response.

```ts
const site = await scraper.crawl("https://docs.firecrawl.dev", { limit: 8, maxDepth: 2 });
```

## 6. Extract JSON [#6-extract-json]

```ts
const data = await scraper.extract("https://firecrawl.dev", {
  schema: {
    type: "object",
    properties: { mission: { type: "string" } },
    required: ["mission"],
  },
});
```