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

# Search API quickstart

> Use the Valyu Search API to retrieve ranked results from the web, SEC filings, PubMed, arXiv, clinical trials and patents, with citations and cost per request.

Search returns ranked source material for your application or agent. You choose the query, sources and context size; your code decides what to do with the results.

Use it to retrieve company information, find relevant papers, or add current evidence to an answer. If you want Valyu to plan and write a multi-step investigation, start with [DeepResearch](https://docs.valyu.ai/guides/deepresearch-quickstart.md).

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).

## Make your first search

New to the API? The [quickstart](https://docs.valyu.ai/quickstart.md) covers your key, SDK installation and first request. The example below assumes `VALYU_API_KEY` is set and shows how to use the returned evidence and cost.

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

valyu = Valyu()
response = valyu.search(
    "Microsoft annual report cloud revenue growth drivers",
    search_type="web",
    max_num_results=5,
    response_length="short",
)
if not response or not response.success:
    raise RuntimeError(response.error if response else "No search response")

for result in response.results:
    print(result.title, result.url)
    print(result.content)
print(f"Cost: {response.total_deduction_dollars}")
```

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

const valyu = new Valyu();
const response = await valyu.search(
  "Microsoft annual report cloud revenue growth drivers",
  { searchType: "web", maxNumResults: 5, responseLength: "short" }
);
if (!response.success) throw new Error(response.error ?? "Search failed");

for (const result of response.results) {
  console.log(result.title, result.url);
  console.log(result.content);
}
console.log(`Cost: ${response.total_deduction_dollars}`);
```

```bash cURL theme={null}
curl https://api.valyu.ai/v1/search \
  -H "Content-Type: application/json" \
  -H "x-api-key: $VALYU_API_KEY" \
  -d '{
    "query": "Microsoft annual report cloud revenue growth drivers",
    "search_type": "web",
    "max_num_results": 5,
    "response_length": "short"
  }'
```

## Put the results to work

Each result includes a title, URL and content. Keep the source URL alongside the text when passing evidence to your model or showing it in your product. Use `total_deduction_dollars` to record the request cost.

A successful request can return fewer results than requested. That can reflect the query, filters, source availability or relevance threshold. It does not establish that no relevant information exists.

## Choose the search scope

| `search_type` | Scope | Starting point |
| - | - | - |
| `all` | Web and available specialist sources | Questions that may need several source types |
| `web` | Web content | Company websites, announcements and general information |
| `proprietary` | Indexed and specialist datasets, including open academic sources | Papers, filings and other defined datasets |
| `news` | News articles | News coverage of an event or company |

`proprietary` is an API value, not a claim that every included dataset is exclusive or licensed. Check [source access and endpoint availability](https://docs.valyu.ai/guides/datasources) before relying on a dataset.

## Focus the evidence

For example, retrieve biomedical literature rather than a mix of general websites:

```python Python theme={null}
response = valyu.search(
    "CAR-T B-cell lymphoma long-term follow-up outcomes",
    included_sources=["valyu/valyu-pubmed"],
    include_abstracts=True,
    max_num_results=5,
)
```

```typescript TypeScript theme={null}
const response = await valyu.search(
  "CAR-T B-cell lymphoma long-term follow-up outcomes",
  {
    includedSources: ["valyu/valyu-pubmed"],
    includeAbstracts: true,
    maxNumResults: 5,
  }
);
```

`include_abstracts` expands PubMed retrieval to the abstract corpus. Abstract availability does not imply that full text is available for every paper.

## Adjust the request

| Parameter | When to change it |
| - | - |
| `max_num_results` | Request more or fewer results. Set it explicitly; REST and SDK defaults can differ. Standard limit: 20; up to 100 with approved access |
| `max_price` | Cap on the cost of the whole request; see [cost controls](https://docs.valyu.ai/search/tips-and-tricks.md#track-cost-separately-from-context-size) |
| `response_length` | Limit content per result: `short`, `medium`, `large`, `max`, or an integer character limit |
| `included_sources` | Restrict to selected datasets, domains, presets or collections |
| `excluded_sources` | Exclude specific sources |
| `source_biases` | Prefer a domain without restricting the entire search to it |
| `start_date`, `end_date` | Restrict the publication window |
| `instructions` | Give ranking guidance, up to 500 characters; ignored in fast mode |
| `relevance_threshold` | Adjust the minimum relevance score; a higher score can reduce result count |
| `fast_mode` | Use a lower-latency web search path; incompatible with `proprietary` |
| `url_only` | Retrieve URLs without full content extraction for `web` or `news` |
| `include_image_links` | Set to `false` to replace image links with their alt text. Default: `true`. See [remove image links](https://docs.valyu.ai/search/tips-and-tricks.md#remove-image-links-to-save-tokens) |

Python uses snake\_case arguments; TypeScript uses camelCase options. The [API reference](https://docs.valyu.ai/api-reference/endpoint/search.md) lists the full request and response schema.

## Move from a query to an integration

Test several real questions from the feature you are building. Inspect the evidence, source dates, latency and cost before changing filters or adding a research loop.

> [card] [Write effective queries](https://docs.valyu.ai/search/prompting.md)
>
> Specify the subject, question and evidence you need.

> [card] [Control sources](https://docs.valyu.ai/search/filtering/sources.md)
>
> Choose datasets, domains and reusable collections.

> [card] [Tune retrieval](https://docs.valyu.ai/search/tips-and-tricks.md)
>
> Balance useful evidence, context size and cost.

> [card] [Run research](https://docs.valyu.ai/guides/deepresearch-quickstart.md)
>
> Create an asynchronous investigation and receive a cited report.


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