> ## 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.

# API

> API reference for WebScraping.AI: every `webscrapingai.api.*` operation with input and output types.

Every `webscrapingai.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Account

### getInfo

`account.getInfo`

Return account quota and credit information

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.account.getInfo({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | Yes | — |
| `remaining_api_calls` | `number` | No | — |
| `remaining_monthly_credits` | `number` | No | — |
| `remaining_payg_credits` | `number` | No | — |
| `remaining_total_credits` | `number` | No | — |
| `resets_at` | `number` | No | — |

***

## Ai

### askQuestion

`ai.askQuestion`

Answer a question using the content of a web page

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.ai.askQuestion({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |
| `question` | `string` | Yes | — |

**Output:** `string`

***

### extractFields

`ai.extractFields`

Extract requested fields from a web page as structured JSON

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.ai.extractFields({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |
| `fields` | `Record<string, string>` | Yes | — |

**Output:** `Record<string, any>`

***

## Scraping

### getHtml

`scraping.getHtml`

Return the rendered HTML of a web page

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.scraping.getHtml({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |

**Output:** `string`

***

### getSelectedHtml

`scraping.getSelectedHtml`

Return HTML matching one CSS selector

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.scraping.getSelectedHtml({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |
| `selector` | `string` | Yes | — |

**Output:** `string`

***

### getSelectedMultiple

`scraping.getSelectedMultiple`

Return HTML matching multiple CSS selectors

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.scraping.getSelectedMultiple({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |
| `selectors` | `string[]` | Yes | — |

**Output:** `string \| string[] \| Record<string, string>`

***

### getText

`scraping.getText`

Return clean text or Markdown extracted from a web page

**Risk:** `read`

```ts theme={null}
await corsair.webscrapingai.api.scraping.getText({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `js` | `boolean` | No | — |
| `js_timeout` | `number` | No | — |
| `timeout` | `number` | No | — |
| `wait_for` | `string` | No | — |
| `proxy` | `datacenter \| residential \| stealth` | No | — |
| `country` | `string` | No | — |
| `device` | `desktop \| mobile \| tablet` | No | — |
| `headers` | `Record<string, string>` | No | — |
| `js_script` | `string` | No | — |
| `custom_proxy` | `string` | No | — |
| `error_on_404` | `boolean` | No | — |
| `error_on_redirect` | `boolean` | No | — |
| `text_format` | `plain \| json \| xml` | No | — |
| `return_links` | `boolean` | No | — |

**Output:** `string \| object`

> [accordion] Output full type
>
> ```ts theme={null}
> string | {
>   title?: string,
>   description?: string | null,
>   content: string
> }
> ```

***


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