---
title: "Context.dev / Search the web and read the results"
description: "Context.dev tool context-dev-web-search on looot: input fields, $0.00025 per result, output shape, and code to run it with curl, JavaScript or Python."
sidebar:
  hidden: true
---

{/* Generated by scripts/generate-api-reference.mjs from data/api-reference.json. Do not edit. */}

Searches the web and can scrape each result to markdown in the same call. Send query; numResults, includeDomains, excludeDomains, freshness and country refine it. Returns results with title, URL, description and markdown when asked. Priced per result.

- **Tool id:** `context-dev-web-search`
- **Provider:** [Context.dev](/providers/context-dev)
- **Job:** [Search the web and get ranked results](/reference/jobs/web-search) (`web.search`)
- **Price:** $0.00025 per result. A call that fails at the provider costs $0.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | string | no | Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de". |
| `excludeDomains` | array | no | Blocklist, drop results from these domains. Example: ["pinterest.com", "reddit.com"]. |
| `freshness` | string | no | Restrict results to content published within this window. |
| `includeDomains` | array | no | Allowlist, only return results from these domains. Example: ["arxiv.org", "github.com"]. |
| `markdownOptions` | string | no | Inline Markdown scraping for each result. Set `enabled: true` to activate. |
| `numResults` | integer | no | Number of results to request and return (10-100). Defaults to 10. |
| `query` | string | yes | Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. Example: "stripe payments api" |
| `queryFanout` | boolean | no | Expand the query into multiple parallel variants for broader recall. |
| `tags` | array | no | Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. |
| `timeoutMS` | integer | no | Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). |

## Output

Shape of the run's `result`, checked against 2 real answers:

```txt
{ query, results: { url, title, markdown: { code, markdown }, relevance, description }[], request_id, key_metadata: { credits_consumed, credits_remaining }, cache_metadata: { age_ms, status } }
```

## Run it

Every call needs your API token in `LOOOT_TOKEN`; [Sign in](/get-started/sign-in#use-the-token-in-scripts-and-agents) shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With `wait: 30` the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll `GET /v1/runs/<runId>`.

Example input with placeholder values:

<CodeGroup>

```bash curl
curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"context-dev-web-search","input":{"query":"stripe payments api","tags":["production","team-alpha"]},"wait":30}'
```

```js JavaScript
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "context-dev-web-search",
    input: {
      query: "stripe payments api",
      tags: ["production", "team-alpha"],
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
```

```python Python
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "context-dev-web-search",
        "input": {
            "query": "stripe payments api",
            "tags": ["production", "team-alpha"],
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))
```

</CodeGroup>

To let looot pick among every provider of this job instead, send `job:web.search` as `endpointId`; see [the job page](/reference/jobs/web-search).
