# Research

A sourced report on a question, as a job.

Plans searches, reads pages and writes a report as an [asynchronous job](https://websearch.fast/docs/concepts/jobs). Every claim in the report cites a numbered source that the job read. `depth` (`quick`, `standard`, `deep`) sets the default limits of searches, pages and report length.

Progress can be read as events, either as a server-sent event stream or as a JSON list. A job and its report are kept for 30 days after the job ends.

### What is charged

Charged per unit used while the job runs (searches, pages read and model work), when the job produced a report (complete or partial) or was cancelled by you. A job that failed on our side without a report is free. `max_cost_usd` caps what one job can charge.

Units: `research_search`, `research_page`, `research_model`. `usage.items` in the response lists them.

## Start a research job

```
POST https://api.websearch.fast/v1/web/research
```

Planned. Until it ships, calls return `501 api_not_implemented`.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string |  | 1 to 128 bytes; a retry with the same key and body within 24 hours returns the same job. 1 to 128 characters. |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | yes | 1 to 4000 characters. |
| `instructions` | string |  | At most 8000 characters. |
| `depth` | string |  | One of `quick`, `standard`, `deep`. Default `standard`. |
| `max_searches` | integer |  | 1 to 200. |
| `max_pages` | integer |  | 1 to 400. |
| `language` | string |  | BCP 47 language tag. At most 12 characters. |
| `country` | string |  | ISO 3166-1 alpha-2 country code, case-insensitive. |
| `freshness` | string |  | Only results published within this period. One of `hour`, `day`, `week`, `month`, `year`. |
| `date_from` | string |  | Date YYYY-MM-DD (UTC). |
| `date_to` | string |  | Date YYYY-MM-DD (UTC). |
| `include_domains` | array of string |  | Host names; subdomains included. At most 20 items. |
| `exclude_domains` | array of string |  | At most 50 items. |
| `output` | object |  |  |
| `output.format` | string |  | One of `markdown`, `json`. Default `markdown`. |
| `output.schema` | object |  | JSON Schema 2020-12 subset; root must be an object; at most 16 KB, depth 5, 200 properties. |
| `output.max_words` | integer |  | 100 to 10,000. |
| `webhook_url` | string |  | Public https URL that receives the final job object, signed with webhook_secret. At most 500 characters. |
| `metadata` | object |  | Your own string values, echoed on the job; at most 4 KB. |

### Example request

curl:

```bash
curl https://api.websearch.fast/v1/web/research \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "How did residential heat pump sales in the EU change in 2025 and why?",
    "depth": "standard"
  }'
```

Python:

```python
import os
import uuid
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/research",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "query": "How did residential heat pump sales in the EU change in 2025 and why?",
        "depth": "standard",
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/research", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "How did residential heat pump sales in the EU change in 2025 and why?",
    depth: "standard",
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Example response

```json
{
  "object": "web.research",
  "id": "wr_01JD7Q9R2M",
  "status": "queued",
  "created_at": 1795867205,
  "input": {
    "query": "How did residential heat pump sales in the EU change in 2025 and why?",
    "depth": "standard",
    "max_searches": 30,
    "max_pages": 50,
    "output": {"format": "markdown", "max_words": 1500}
  },
  "progress": {
    "steps_done": 0,
    "searches": 0,
    "pages_read": 0,
    "sources_kept": 0
  },
  "poll_after_ms": 5000,
  "expires_at": 1798459205
}
```

### Response fields

Job created; the ceiling is reserved.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `web.research`. |
| `id` | string | yes | At most 64 characters. Starts with `wr_`. |
| `status` | string | yes | One of `queued`, `running`, `succeeded`, `failed`, `cancelled`. |
| `stop_reason` | string |  | One of `completed`, `budget`, `limit`, `cancelled`, `deadline`, `error`. |
| `created_at` | integer | yes |  |
| `started_at` | integer |  |  |
| `completed_at` | integer |  |  |
| `input` | object | yes |  |
| `usage` | object | yes |  |
| `usage.items` | array of object | yes |  |
| `usage.items.unit` | string | yes | Billable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge. |
| `usage.items.count` | integer | yes |  |
| `error` | object |  |  |
| `error.code` | string | yes |  |
| `error.message` | string |  |  |
| `poll_after_ms` | integer |  |  |
| `webhook_secret` | string |  | Only in the create response, when webhook_url was set. |
| `metadata` | object |  |  |
| `expires_at` | integer |  |  |
| `progress` | object |  |  |
| `progress.steps_done` | integer |  |  |
| `progress.searches` | integer |  |  |
| `progress.pages_read` | integer |  |  |
| `progress.sources_kept` | integer |  |  |
| `report` | object |  |  |
| `report.format` | string | yes | One of `markdown`, `json`. |
| `report.text` | string |  |  |
| `report.data` | object |  |  |
| `report.sources` | array of object | yes |  |
| `report.sources.index` | integer | yes | At least 1. |
| `report.sources.url` | string | yes |  |
| `report.sources.title` | string |  |  |
| `report.sources.site_name` | string |  |  |
| `report.sources.published_at` | string |  |  |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `409` | `idempotency_conflict` or `request_in_progress`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |

## Get a research job

```
GET https://api.websearch.fast/v1/web/research/{id}
```

Planned. Until it ships, calls return `501 api_not_implemented`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Starts with `wr_`. |

### Example request

curl:

```bash
curl https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
```

Python:

```python
import os
import httpx

response = httpx.get(
    "https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Response fields

The job.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `web.research`. |
| `id` | string | yes | At most 64 characters. Starts with `wr_`. |
| `status` | string | yes | One of `queued`, `running`, `succeeded`, `failed`, `cancelled`. |
| `stop_reason` | string |  | One of `completed`, `budget`, `limit`, `cancelled`, `deadline`, `error`. |
| `created_at` | integer | yes |  |
| `started_at` | integer |  |  |
| `completed_at` | integer |  |  |
| `input` | object | yes |  |
| `usage` | object | yes |  |
| `usage.items` | array of object | yes |  |
| `usage.items.unit` | string | yes | Billable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge. |
| `usage.items.count` | integer | yes |  |
| `error` | object |  |  |
| `error.code` | string | yes |  |
| `error.message` | string |  |  |
| `poll_after_ms` | integer |  |  |
| `webhook_secret` | string |  | Only in the create response, when webhook_url was set. |
| `metadata` | object |  |  |
| `expires_at` | integer |  |  |
| `progress` | object |  |  |
| `progress.steps_done` | integer |  |  |
| `progress.searches` | integer |  |  |
| `progress.pages_read` | integer |  |  |
| `progress.sources_kept` | integer |  |  |
| `report` | object |  |  |
| `report.format` | string | yes | One of `markdown`, `json`. |
| `report.text` | string |  |  |
| `report.data` | object |  |  |
| `report.sources` | array of object | yes |  |
| `report.sources.index` | integer | yes | At least 1. |
| `report.sources.url` | string | yes |  |
| `report.sources.title` | string |  |  |
| `report.sources.site_name` | string |  |  |
| `report.sources.published_at` | string |  |  |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |

## Cancel a research job

```
POST https://api.websearch.fast/v1/web/research/{id}/cancel
```

Planned. Until it ships, calls return `501 api_not_implemented`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Starts with `wr_`. |

### Example request

curl:

```bash
curl -X POST https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/cancel \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
```

Python:

```python
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/cancel",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Response fields

The job.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `web.research`. |
| `id` | string | yes | At most 64 characters. Starts with `wr_`. |
| `status` | string | yes | One of `queued`, `running`, `succeeded`, `failed`, `cancelled`. |
| `stop_reason` | string |  | One of `completed`, `budget`, `limit`, `cancelled`, `deadline`, `error`. |
| `created_at` | integer | yes |  |
| `started_at` | integer |  |  |
| `completed_at` | integer |  |  |
| `input` | object | yes |  |
| `usage` | object | yes |  |
| `usage.items` | array of object | yes |  |
| `usage.items.unit` | string | yes | Billable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge. |
| `usage.items.count` | integer | yes |  |
| `error` | object |  |  |
| `error.code` | string | yes |  |
| `error.message` | string |  |  |
| `poll_after_ms` | integer |  |  |
| `webhook_secret` | string |  | Only in the create response, when webhook_url was set. |
| `metadata` | object |  |  |
| `expires_at` | integer |  |  |
| `progress` | object |  |  |
| `progress.steps_done` | integer |  |  |
| `progress.searches` | integer |  |  |
| `progress.pages_read` | integer |  |  |
| `progress.sources_kept` | integer |  |  |
| `report` | object |  |  |
| `report.format` | string | yes | One of `markdown`, `json`. |
| `report.text` | string |  |  |
| `report.data` | object |  |  |
| `report.sources` | array of object | yes |  |
| `report.sources.index` | integer | yes | At least 1. |
| `report.sources.url` | string | yes |  |
| `report.sources.title` | string |  |  |
| `report.sources.site_name` | string |  |  |
| `report.sources.published_at` | string |  |  |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |

## Progress events of a research job

```
GET https://api.websearch.fast/v1/web/research/{id}/events
```

Planned. Until it ships, calls return `501 api_not_implemented`.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Last-Event-ID` | string |  |  |

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Starts with `wr_`. |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `after` | integer |  |  |

### Example request

curl:

```bash
curl "https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/events?after=0" \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
```

Python:

```python
import os
import httpx

response = httpx.get(
    "https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/events",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    params={
        "after": 0,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/research/wr_01JD7Q9R2M/events?after=0", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Response fields

text/event-stream with Accept: text/event-stream (reconnect with Last-Event-ID), otherwise a JSON list.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `list`. |
| `data` | array of object | yes |  |
| `data.seq` | integer | yes |  |
| `data.event` | string | yes | One of `status`, `search`, `page`, `note`, `report`, `error`, `done`. |
| `data.data` | object |  |  |
| `data.created` | integer | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string |  |  |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |
