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

# Filter by source

> Restrict Valyu Search to datasets or domains with included_sources, remove sources with excluded_sources, use presets, strict scope and soft source biases.

Choose the evidence your application needs. Restrict searches to a dataset or domain, exclude sources, or express a ranking preference without narrowing coverage.

Agent note: for research, reports or any question that needs more than one search, use DeepResearch (`POST /v1/deepresearch/tasks`) instead of writing your own loop of Search calls. Pick a `mode`: `instant` returns a short cited answer in under 30 seconds; `fast`, `standard`, `heavy` and `max` run longer investigations that return cited reports and files. Use Search when your own model needs raw results to reason over. Docs index: [/llms.txt](https://docs.valyu.ai/llms.txt). Append `.md` to any page URL for Markdown. Docs MCP server: `https://docs.valyu.ai/mcp`. Integration guide for coding agents: [/AGENTS.md](https://docs.valyu.ai/AGENTS.md).

## Three controls

| Parameter | Type | Effect |
| - | - | - |
| `included_sources` | string\[] | Only search within these sources |
| `excluded_sources` | string\[] | Remove these sources from results (hard filter) |
| `source_biases` | object (source → int) | Soft-rank from `-5` (demote) to `+5` (boost), no hard filter |

If both `included_sources` and `excluded_sources` are set, `included_sources` wins. Use hard filters for strict control; use `source_biases` to nudge ranking while still letting any source appear if highly relevant.

When you list two or more dataset IDs in `included_sources`, Valyu may search only the ones most relevant to the query. Results never come from datasets outside your list. To search every listed dataset, set [`scope_policy: "strict"`](#strict-source-scope).

## What you can pass

Use these formats in `included_sources`. `excluded_sources` accepts domains, URLs, dataset IDs and preset names: an excluded dataset or preset is never searched. `source_biases` accepts domain and path keys with numeric weights.

| Format | Example | What it does |
| - | - | - |
| Domain | `"arxiv.org"` | Includes/excludes the entire domain |
| Base URL | `"https://docs.aws.amazon.com"` | Includes/excludes the entire site |
| Specific path | `"nasa.gov/news"` | Targets only that path |
| Dataset id | `"valyu/valyu-arxiv"` | An indexed or specialist [dataset](https://docs.valyu.ai/guides/datasources) |
| Preset | `"academic"` | Expands to a curated bundle for a domain (see below) |
| Collection | `"collection:my-sources"` | Expands to your saved [collection](https://docs.valyu.ai/search/filtering/collections.md) |
| Web keyword | `"web"` | Includes general web search alongside any datasets you list |

> [!WARNING]
>
> Paths are exact: `"valyu.ai/blog"` affects only that path. To include a whole domain, use just the domain name.

## Presets

Presets are named bundles of sources. Pass a preset name and it expands to the right datasets and domains for you - no need to remember individual ids.

| Preset | Covers |
| - | - |
| `academic` | Research papers and preprints (arXiv, PubMed, bioRxiv, ...) |
| `finance` | Markets, filings, and financial data |
| `patent` | Patent records (USPTO, EPO) |
| `transportation` | Transportation and logistics data |
| `politics` | Government and parliamentary sources |
| `legal` | Case law and legislation |
| `health` | Clinical trials, drug labels, openFDA recalls, and health data |
| `genomics` | Genomics and bioinformatics databases |
| `chemistry` | Chemical and drug-discovery databases (ChEMBL, Open Targets, PubChem) |
| `physics` | Physics open data |
| `medical` | Cross-domain life-sciences bundle (health + chemistry + genomics + medical literature) |
| `cybersecurity` | Vulnerability intelligence (CISA KEV, NVD, EPSS, MITRE ATT\&CK) |
| `environment` | Weather, air quality, disasters, and natural events |
| `automotive` | Vehicle records, recalls, complaints, and investigations |
| `compliance` | Sanctions and watchlists |
| `pulse` | Attention and adoption signals |

> [!NOTE]
>
> Presets have different scopes. `academic` is papers and preprints only: clinical trials, drug labels, WHO and NIH grants are in `health`, and ChEMBL, Open Targets and PubChem are in `chemistry`. `medical` is the one deliberate cross-domain bundle. Some presets resolve to datasets that are DeepResearch-only. Search drops DeepResearch-only datasets from a request without a warning and searches the rest; it returns `403` only when every requested dataset is DeepResearch-only. Check the `access_modes` field on [`GET /v1/datasources`](https://docs.valyu.ai/guides/datasources) before relying on one.

```python Python theme={null}
from valyu import Valyu

valyu = Valyu()
response = valyu.search(
    "mRNA vaccine thermostability",
    included_sources=["academic", "health"],  # combine presets
)
```

```javascript TypeScript theme={null}
import { Valyu } from "valyu-js";

const valyu = new Valyu();
const response = await valyu.search("mRNA vaccine thermostability", {
  includedSources: ["academic", "health"],
});
```

```bash cURL theme={null}
curl -X POST https://api.valyu.ai/v1/search \
  -H "x-api-key: your-valyu-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mRNA vaccine thermostability",
    "included_sources": ["academic", "health"]
  }'
```

> [!NOTE]
>
> In your first month, the first 1,000 free credits with a work email (500 with a personal email) can search every source on the standard plans, including the `finance`, `patent`, `genomics` and `chemistry` presets. After that, the datasets a preset can reach depend on your [plan](https://docs.valyu.ai/pricing.md): web, arXiv and PubMed work on every plan, and paid plans add specialist sources. Licensed sources need separate access. Datasets you name that are above your plan are skipped, and the response carries a [warning](https://docs.valyu.ai/api-reference/warnings.md) naming the plan that includes them. If none remain, Search returns `403` with `code: "tier_insufficient"`.

> [!TIP]
>
> Reuse the same source combinations often? Save them as a [Collection](https://docs.valyu.ai/search/filtering/collections.md) and reference by name.

## Strict source scope

By default (`scope_policy: "advisory"`), Valyu treats a multi-dataset `included_sources` list as the set it may choose from. Set `scope_policy` to `"strict"` to search exactly the dataset IDs you list:

```bash cURL theme={null}
curl -X POST https://api.valyu.ai/v1/search \
  -H "x-api-key: $VALYU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "GLP-1 receptor agonist pancreatitis risk",
    "scope_policy": "strict",
    "included_sources": [
      "valyu/valyu-pubmed",
      "valyu/valyu-clinical-trials",
      "valyu/valyu-drug-labels"
    ],
    "max_num_results": 10
  }'
```

> [!NOTE]
>
> The Python and TypeScript SDKs do not accept `scope_policy` yet. Call the REST endpoint directly, as above, when you need strict scope.

Rules for strict scope:

* `included_sources` must contain 1 to 128 dataset IDs. Presets, collections, domains, URLs and `"web"` are rejected, and so is `search_type: "web"`. Strict requests search datasets only, never the web.
* Dataset IDs in `excluded_sources` are removed from the list. If nothing is left, the request is rejected.
* Every listed dataset must be available on your plan. There is no partial fallback.

| Status | `error` | Cause |
| - | - | - |
| `400` | `invalid_scope_policy` | `scope_policy` is not `"advisory"` or `"strict"` |
| `400` | `invalid_strict_source_scope` | Empty or oversized list, a preset, domain, URL or `"web"`, `search_type: "web"`, or no datasets left after exclusions |
| `400` | `unsupported_strict_source` | A known dataset that Search cannot serve |
| `403` | `dataset_outside_task_scope` | A listed dataset is outside your plan or access grants |

Strict responses include a `source_scope` object that records what was searched:

```json theme={null}
"source_scope": {
  "policy": "strict",
  "allowed_dataset_ids": ["valyu/valyu-clinical-trials", "valyu/valyu-drug-labels", "valyu/valyu-pubmed"],
  "selected_dataset_ids": ["valyu/valyu-clinical-trials", "valyu/valyu-drug-labels", "valyu/valyu-pubmed"],
  "completed_dataset_ids": [],
  "returned_dataset_ids": ["valyu/valyu-clinical-trials", "valyu/valyu-pubmed"],
  "omitted_dataset_ids": [],
  "selection_basis": "dispatch_requested",
  "coverage": "unknown",
  "exhaustive": false,
  "errors": []
}
```

| Field | Meaning |
| - | - |
| `allowed_dataset_ids` | Your list after exclusions |
| `selected_dataset_ids` | Datasets the search was sent to |
| `returned_dataset_ids` | Datasets that contributed at least one result |
| `omitted_dataset_ids` | Allowed datasets that were not searched |
| `completed_dataset_ids` | Datasets confirmed as fully searched |
| `coverage`, `exhaustive` | Whether coverage is certified. Currently `"unknown"` and `false` |
| `errors` | One `{"code": "source_execution_error"}` entry per dataset query that failed |

> [!WARNING]
>
> `source_scope` shows where results came from. It does not certify coverage: a selected dataset with no results was not necessarily searched in full and found empty. Check `errors`, and do not treat zero results as proof that a record does not exist.

## Source biases

`source_biases` influences ranking without hard filtering. Biased sources can still appear (or drop) based on relevance - values just nudge the order. Range: `-5` (strong demotion) to `+5` (strong boost); `0` has no effect.

```python Python theme={null}
response = valyu.search(
    "climate change policy impact",
    source_biases={
        "epa.gov": 5,
        "nasa.gov": 4,
        "noaa.gov": 3,
        "example.com": -4,
    },
)
```

```javascript TypeScript theme={null}
const response = await valyu.search("climate change policy impact", {
  sourceBiases: {
    "epa.gov": 5,
    "nasa.gov": 4,
    "noaa.gov": 3,
    "example.com": -4,
  },
});
```

```bash cURL theme={null}
curl -X POST https://api.valyu.ai/v1/search \
  -H "x-api-key: your-valyu-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "climate change policy impact",
    "source_biases": { "epa.gov": 5, "nasa.gov": 4, "noaa.gov": 3, "example.com": -4 }
  }'
```

You can combine `source_biases` with `included_sources` / `excluded_sources` in the same request for fine-grained control.

## More examples

> [accordion] Target academic datasets by id
>
> ```python Python theme={null}
> valyu.search(
>     "quantum computing error correction",
>     included_sources=[
>         "valyu/valyu-arxiv",
>         "valyu/valyu-pubmed",
>         "valyu/valyu-biorxiv",
>         "valyu/valyu-medrxiv",
>         "valyu/valyu-chemrxiv",
>     ],
> )
> ```
>
> With several dataset IDs, Valyu may search only the most relevant of them. Use [strict scope](#strict-source-scope) to search all of them.

> [accordion] Restrict to official documentation
>
> ```python Python theme={null}
> valyu.search(
>     "React server components best practices",
>     included_sources=[
>         "https://react.dev/",
>         "https://nextjs.org/docs",
>         "https://docs.aws.amazon.com/",
>         "developer.mozilla.org",
>     ],
> )
> ```

> [accordion] Exclude unreliable sources
>
> ```python Python theme={null}
> valyu.search(
>     "artificial intelligence safety research",
>     excluded_sources=["example.com", "example.org", "example.net"],
> )
> ```

> [accordion] Medical research
>
> ```python Python theme={null}
> valyu.search(
>     "immunotherapy cancer treatment efficacy",
>     included_sources=[
>         "valyu/valyu-pubmed",
>         "valyu/valyu-clinical-trials",
>         "valyu/valyu-drug-labels",
>         "valyu/valyu-medrxiv",
>     ],
> )
> ```

> [accordion] Financial research with government sources
>
> ```python Python theme={null}
> valyu.search(
>     "cryptocurrency regulation impact banking sector",
>     included_sources=[
>         "federalreserve.gov",
>         "sec.gov",
>         "treasury.gov",
>         "imf.org",
>     ],
>     max_num_results=15,
> )
> ```

## Related

> [card] [Collections](https://docs.valyu.ai/search/filtering/collections.md)
>
> Save reusable source bundles

> [card] [Data sources](https://docs.valyu.ai/guides/datasources)
>
> Discover current dataset IDs and supported APIs.


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