> ## 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 search, page fetch, cloud browser sessions, web automation agents, cited research, and reusable browser profiles behind one API key.

Use **TinyFish** through Corsair: one client, typed API calls, local DB sync, and incoming webhooks.

**What you get:**

* 28 typed API operations
* 1 synced entity (`agentRuns`) for fast `.search()` / `.list()`
* 3 incoming webhook event types

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/tinyfish
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/tinyfish
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/tinyfish
```

```bash bun theme={null}
bun add corsair @corsair-dev/tinyfish
```

**2. Add the plugin**

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

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

Multi-tenancy is the default — scope calls with `corsair.withTenant(id)`. See [Quick start](/quick-start) for KEK + Hub keys, and [Multi-tenancy](/concepts/multi-tenancy) for account isolation.

**3. Choose authentication**

**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}
tinyfish()
```

More: [API Key](/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](/management/connect).

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

## Example API calls

**Search the web**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.tinyfish.api.search.search({ query: 'open source integration layer', location: 'US' });
```

**Queue a web automation run**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.tinyfish.api.agent.runAsync({ url: 'https://example.com', goal: 'Extract the page title' });
```

See the full list on the [API](/plugins/tinyfish/api) page.

## Query synced data

Runs are stamped into the agentRuns entity by sync runs, async acknowledgements, polls and webhook deliveries, so one run never duplicates rows.

```ts theme={null}
const tenant = corsair.withTenant('acme');
const rows = await tenant.tinyfish.db.agentRuns.search({
	data: { status: 'COMPLETED' },
	limit: 50,
});
```

Synced entities: `agentRuns`. See [Database](/plugins/tinyfish/database) for filters and operators.

## Webhooks

Fires when a web automation run finishes; the plugin stamps the terminal state into agentRuns.

```ts theme={null}
tinyfish({
    webhookHooks: {
        run: {
            completed: {
                after: async (ctx, result) => {
                    console.log('Run finished:', result.data.run_id, result.data.status);
                }
            },
        },
    },
})
```

Mount your framework handler once (see [Frameworks](/frameworks/next)), then point the provider at that URL. Full event list: [Webhooks](/plugins/tinyfish/webhooks). Concepts: [Webhooks](/concepts/webhooks), [Hooks](/concepts/hooks).

## What's next

> **[API reference](/plugins/tinyfish/api)**
>
> Every `tinyfish.api.*` operation with input and output types.

> **[Database](/plugins/tinyfish/database)**
>
> Synced entities, search filters, and operators.

> **[Webhooks](/plugins/tinyfish/webhooks)**
>
> Event paths, payloads, and `webhookHooks` examples.

> **[Connect / OAuth](/management/connect)**
>
> createLink, Hub delivery, and tenant connect flows.

> **[Use with agents](/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.