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

> Run multi-step research with citations on Nimble or any research provider, as a job you poll

> [!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 **Research** answers a question that a few searches cannot settle. The provider searches, reads, and cross-checks sources over many steps, then returns an answer with citations, as prose or as structured data.

A research run takes minutes and is billed, more at a higher `effort`. It runs as a job: start it, then poll it until it ends. For a quick lookup, use [Search](https://docs.nimbleway.com/nimble-sdk/web-router/search.md).

## Quick Start

### Example Request

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

BASE = "https://sdk.nimbleway.com/v2/web-router"
HEADERS = {"Authorization": "Bearer YOUR-API-KEY"}

job = requests.post(
    f"{BASE}/research",
    headers=HEADERS,
    json={"query": "Which EU countries adopted the euro after 2010?", "effort": "low"},
).json()["job"]

while True:
    result = requests.get(
        f"{BASE}/research/{job['job_id']}",
        headers=HEADERS,
        params={"wait": 60},
    ).json()["result"]
    if result["state"] in ("completed", "failed", "cancelled"):
        break

if result["state"] == "completed":
    print(result["response"]["answer"])
    for citation in result["response"]["citations"]:
        print(citation["url"])
```

```typescript TypeScript theme={"system"}
const BASE = "https://sdk.nimbleway.com/v2/web-router";
const headers = {
  Authorization: "Bearer YOUR-API-KEY",
  "Content-Type": "application/json",
};

const start = await fetch(`${BASE}/research`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    query: "Which EU countries adopted the euro after 2010?",
    effort: "low",
  }),
});
const { job } = await start.json();

let result;
do {
  const poll = await fetch(`${BASE}/research/${job.job_id}?wait=60`, { headers });
  ({ result } = await poll.json());
} while (result.state === "queued" || result.state === "running");

if (result.state === "completed") {
  console.log(result.response.answer);
}
```

```bash cURL theme={"system"}
# Start the run
curl -X POST 'https://sdk.nimbleway.com/v2/web-router/research' \
--header 'Authorization: Bearer <YOUR-API-KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "Which EU countries adopted the euro after 2010?",
    "effort": "low"
}'

# Poll it, waiting up to 60 seconds per call
curl 'https://sdk.nimbleway.com/v2/web-router/research/<JOB-ID>?wait=60' \
--header 'Authorization: Bearer <YOUR-API-KEY>'
```

### Example Response

The start answers at once, with status `202`:

```json theme={"system"}
{
  "meta": { "tool": "research" },
  "job": {
    "job_id": "wgrj_3f1c2a9e7b4d4e0a9c1f2d8e5b6a7c90",
    "provider": "nimble_selection",
    "byok": false,
    "state": "queued"
  }
}
```

A poll of a completed run:

```json theme={"system"}
{
  "meta": { "tool": "research" },
  "result": {
    "job_id": "wgrj_3f1c2a9e7b4d4e0a9c1f2d8e5b6a7c90",
    "provider": "nimble_selection",
    "byok": false,
    "state": "completed",
    "detail": null,
    "response": {
      "provider": "nimble_selection",
      "byok": false,
      "answer": "# EU countries that adopted the euro after 2010\n\nFive EU countries adopted the euro after 2010, most recently Bulgaria in 2026...\n\n- **Estonia** joined the euro area on 1 January 2011 [1]...",
      "structured": null,
      "citations": [
        {
          "url": "https://www.ecb.europa.eu/press/pr/date/2011/html/pr110101.en.html",
          "title": "Estonia joins the euro area",
          "snippet": "",
          "field": "[1]",
          "extra": {
            "answer_passages": ["**Estonia** joined the euro area on 1 January 2011 [1]..."]
          }
        }
      ],
      "outcome": "complete"
    }
  }
}
```

## How it works

**1. Start the run**

`POST /v2/web-router/research` answers at once with a `job_id`. Every start
is a new, billed run. Nimble picks the provider and keeps the run with it.

**2. Poll it**

`GET /v2/web-router/research/{job_id}?wait=60` waits up to a minute for the
run to end. Call again while `state` is `queued` or `running`.

**3. Read the answer**

Once `state` is `completed`, `result.response` holds the answer, the
citations, and `structured` data when an `output_schema` was sent.

> [!WARNING]
>
> Poll the run you have instead of starting it again. If a start fails with
> `may_have_started`, a run may be going: do not start another.

## Parameters

> [accordion] query - Required
>
> **query** `string` *required*
>
> The question, or the instructions for the run. Up to 10,000 characters.

> [accordion] effort
>
> **effort** `string`
>
> How much work the run does, and so how long it takes and what it costs. Unset is each provider's own default, which for some is a deep and costly tier.
>
> **Options:**
>
> * `low`: a quick pass, closest in cost to a deep search
> * `medium`: a typical agentic run
> * `high`: several rounds of gathering and cross-checking

> [accordion] output\_schema
>
> **output\_schema** `object`
>
> A JSON Schema the answer must conform to, returned in `response.structured`. Unset asks for prose. The root must be an object with non-empty `properties`, or an array with `items`.

> [accordion] records
>
> **records** `array of objects`
>
> Partial records to enrich, each shaped like `output_schema`, such as `[{"company": "NXP Semiconductors"}]`. The answer's `structured` is then a list, one row per record. Up to 1,000. Nimble needs `effort` `medium` or above for it.

> [accordion] include\_domains / exclude\_domains
>
> **include\_domains** `array of strings`
>
> Restrict sources to these domains. Up to 50.
>
> **exclude\_domains** `array of strings`
>
> Keep these domains out of the sources. Up to 50.

> [accordion] optimized\_for
>
> **optimized\_for** `string` (default: balanced)
>
> What Nimble favors when it picks the provider. It does not change `effort`.
>
> **Options:** `speed`, `cost`, `coverage`, `balanced`

## Structured output

Send an `output_schema` to get data instead of prose:

```json theme={"system"}
{
  "query": "The three largest EU economies by 2025 GDP",
  "effort": "medium",
  "output_schema": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "country": { "type": "string" },
        "gdp_usd_trillions": { "type": "number" }
      }
    }
  }
}
```

The completed answer is in `result.response.structured`. Each citation's `field` names the part of the answer it backs, as a JSON path into `structured` or a marker in `answer`.

## Job states and errors

| `state` | Meaning |
| - | - |
| `queued`, `running` | Still working. Poll again. |
| `completed` | Done. Read `result.response`. |
| `failed` | Stopped on an error. `result.detail` may say why. |
| `cancelled` | Stopped by a cancel. |

* **`502` or `504` on a poll:** the provider did not answer that poll. The run goes on, so poll again.
* **`410` on a poll:** the provider no longer knows the run. Read answers soon after a run completes.
* **Cancel:** `POST /v2/web-router/research/{job_id}/cancel` stops the run and returns it as it stands. A stopped run cannot be resumed.

## Next Steps

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

> [card] [API Reference](https://docs.nimbleway.com/api-reference/webrouter/start-research.md)
>
> Every field of the request and response


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