> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Web data infrastructure for agents and applications. Fetch any page through anti-bot bypasses, a headless browser and residential proxies, extract structured JSON, crawl a site from one URL, and track the credits behind it all.

Use **ZenRows** through Corsair: one client, typed API calls.

Every call goes through `https://api.zenrows.com`. The key travels in the `X-API-Key` header, or in the `apikey` query parameter when `customHeaders` is on, because ZenRows copies every request header onto the target page in that mode.

A Fetch answer is not always JSON. `fetch.page` returns the page itself as HTML, Markdown or plaintext, `fetch.cssExtract` and `fetch.outputs` return a JSON object, and `fetch.extract` returns `{ html, parsed }`. ZenRows labels all of these `text/plain`, so the operation you call is what tells you the shape.

A crawl is a job. `crawl.start` returns a `crawl_id` and spends credits per page, `crawl.get` reads its `status` and one page of results, and polling it with the same `cursor` returns only new URLs. On Corsair's cloud, `get_job` and the job card follow it for you.

Extract needs a domain prepared first. `extract.getDomainStatus` says whether it is ready; `extract.prepareDomain` asks for it, which takes minutes and one slot of the monthly allowance. `fetch.cssExtract` works on any site with no preparation.

**What you get:**

* 19 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/zenrows better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/zenrows better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/zenrows better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/zenrows better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { zenrows } from '@corsair-dev/zenrows';

export const corsair = createCorsair({
	plugins: [
		zenrows(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> zenrows()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'zenrows',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Fetch a page as HTML**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.zenrows.api.fetch.page({ url: 'https://example.com' });
```

**Crawl the first two pages of a site**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.zenrows.api.crawl.start({ url: 'https://www.scrapingcourse.com/ecommerce/', maxPages: 2 });
```

See the full list on the [API](https://docs.corsair.dev/plugins/zenrows/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/zenrows/api.md)
>
> Every `zenrows.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.