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

# WebRouter

> One API for web search, extract, research, and browse, across Nimble and third-party providers

> [!NOTE]
>
> **WebRouter is in closed beta.** It's available to selected accounts, and the API may still change. To get access, [talk to the Nimble team](https://nimbleway.com/contact-general/).

**WebRouter** gives AI agents and apps one API for the web: search, extract, research, and browse, across Nimble and third-party providers. Send a query in plain words. WebRouter picks the tool and the provider, runs it, and returns one response shape.

> [card] One key, many providers
>
> Nimble routes each call to a leading web provider. No vendor accounts or keys to manage.

> [card] One response shape
>
> Every provider's results come back in the same fields. Switching providers changes no code.

> [card] Automatic fallback
>
> When a provider fails or returns nothing, Nimble tries the next. Jobs stay with the provider that started them.

## Which call do I use?

| You want to | Call | You get back |
| - | - | - |
| Let WebRouter pick the tool and run it | [Route](https://docs.nimbleway.com/nimble-sdk/web-router/route.md) | The answer, or a job for research and browse |
| Find pages for a query | [Search](https://docs.nimbleway.com/nimble-sdk/web-router/search.md) | Ranked results, in seconds |
| Read pages you already have URLs for | [Extract](https://docs.nimbleway.com/nimble-sdk/web-router/extract.md) | Page content, in seconds |
| Answer a question across many sources, with citations | [Research](https://docs.nimbleway.com/nimble-sdk/web-router/research.md) | A job, done in minutes |
| Have an agent work through a site in a real browser | [Browse](https://docs.nimbleway.com/nimble-sdk/web-router/browse.md) | A job, done in minutes |

Not sure? Start with Route.

## Quick Start

### Example Request

```python Python theme={"system"}
import requests

response = requests.post(
    "https://sdk.nimbleway.com/v2/web-router/route",
    headers={"Authorization": "Bearer YOUR-API-KEY"},
    json={"query": "latest Python release"},
)

print(response.json()["result"]["results"][0]["url"])
```

```typescript TypeScript theme={"system"}
const response = await fetch("https://sdk.nimbleway.com/v2/web-router/route", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR-API-KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ query: "latest Python release" }),
});

const data = await response.json();
console.log(data.result.results[0].url);
```

```bash cURL theme={"system"}
curl -X POST 'https://sdk.nimbleway.com/v2/web-router/route' \
--header 'Authorization: Bearer <YOUR-API-KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "latest Python release"
}'
```

### Example Response

Trimmed for reading. See [Route](https://docs.nimbleway.com/nimble-sdk/web-router/route.md) for every field.

```json theme={"system"}
{
  "plan": {
    "steps": [{ "tool": "search", "body": { "query": "latest Python release" } }]
  },
  "result": {
    "provider": "nimble_selection",
    "byok": false,
    "results": [
      {
        "url": "https://www.python.org/downloads/",
        "title": "Download Python | Python.org",
        "description": "Download the latest version of Python..."
      }
    ]
  },
  "job": null
}
```

`plan` shows the tool WebRouter picked. `result.provider` is `nimble_selection`: Nimble picked the provider. See [Providers](#providers).

## How it works

**1. You send a query**

In plain words: a question, a task, or the URLs to read.

**2. WebRouter picks the tool**

Search, extract, research, or browse, weighing `optimized_for` and `budgets`.

**3. Nimble picks the provider**

Your own provider keys first, then Nimble's. A provider that fails, or
returns nothing, falls through to the next.

**4. You get the answer**

Search and extract answer within the call. Research and browse start a job you poll.

## Authentication

All requests use the Nimble API base URL and a Bearer token, like the rest of the [Nimble API](https://docs.nimbleway.com/api-reference/introduction.md):

```bash theme={"system"}
https://sdk.nimbleway.com/v2/web-router
```

```bash theme={"system"}
Authorization: Bearer YOUR_API_KEY
```

Get your API key from the [Nimble Dashboard](https://online.nimbleway.com/settings/api-keys).

## Jobs

Research and browse run for minutes, so they run as jobs:

1. A start answers at once with status `202` and a `job_id`.
2. Poll `GET /v2/web-router/research/{job_id}?wait=60` (or `/browse/`) until `state` is `completed`, `failed`, or `cancelled`.
3. Read the answer in `result.response`.

> [!WARNING]
>
> Every start is a new, billed job. Poll the job you have instead of starting it again.

[Research](https://docs.nimbleway.com/nimble-sdk/web-router/research.md) and [Browse](https://docs.nimbleway.com/nimble-sdk/web-router/browse.md) show the full flow, with polling code.

## Response shape

Search, Extract, and job polls return `{meta, result}`. Job starts return `{meta, job}`. `meta.tool` names the tool that ran. Route returns `{plan, result, job}`.

## Providers

Nimble picks the provider for every call. Requests never name one.

* **`provider` is `nimble_selection`** when Nimble picked and served the call. `byok` is `false`.
* **Your own keys come first.** If your account has its own key for a provider, Nimble tries it first. A response served on your key names that provider, and `byok` is `true`.

## Errors

Errors carry a request id in the `x-nimble-request-id` header and in the body. Quote it when contacting support.

```json theme={"system"}
{
  "detail": {
    "message": "An error occurred",
    "extra": {
      "nimble_request_id": "3b2a6c1e9f4d4e7a8c5b0d2f1a6e9c74",
      "nimble_trace_id": "9e1f0c7b2a5d4f3e8b6c1a0d7e2f5b94",
      "error_type": "validation_error",
      "errors": [
        { "type": "missing", "loc": ["body", "query"], "msg": "Field required" }
      ]
    }
  }
}
```

## MCP server

The same tools are available to AI agents as an MCP server at `https://mcp.webrouter.net/mcp`. Sign in with your Nimble account. Tool names keep the `web_gateway_` prefix, such as `web_gateway_search`.

```bash theme={"system"}
claude mcp add --transport http nimble-webrouter https://mcp.webrouter.net/mcp
```

## Next Steps

> [card] [Route](https://docs.nimbleway.com/nimble-sdk/web-router/route.md)
>
> One call: WebRouter picks the tool and runs it

> [card] [Search](https://docs.nimbleway.com/nimble-sdk/web-router/search.md)
>
> Find pages on any search provider

> [card] [Research](https://docs.nimbleway.com/nimble-sdk/web-router/research.md)
>
> Answer questions across many sources, with citations

> [card] [Browse](https://docs.nimbleway.com/nimble-sdk/web-router/browse.md)
>
> Have an agent work through a site in a real browser


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