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

# API reference

> Valyu API reference essentials: base URL, x-api-key authentication, errors, rate limits, pricing and versioning, plus the OpenAPI spec for every endpoint.

Use Valyu to retrieve information for your own application or run a research task. This page covers what every request has in common. The endpoint pages give full parameters and response schemas.

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

## Choose an endpoint

| You need to | Start here | Execution |
| - | - | - |
| Retrieve sources for your own system | [Search](https://docs.valyu.ai/api-reference/endpoint/search.md) | Request and response |
| Extract content from known URLs | [Contents](https://docs.valyu.ai/api-reference/endpoint/contents.md) | Synchronous or asynchronous |
| Run an investigation | [Create research task](https://docs.valyu.ai/api-reference/endpoint/deepresearch-create.md) | Asynchronous task |
| Repeat a saved research workflow | [Workflows](https://docs.valyu.ai/api-reference/endpoint/workflows-list.md) | Template plus research task; beta |
| Discover available data | [Datasources](https://docs.valyu.ai/api-reference/endpoint/datasources-list.md) | Request and response |

If this is your first request, follow the [quickstart](https://docs.valyu.ai/quickstart.md).

To control how old a cached page can be, set `max_age` on [Contents](https://docs.valyu.ai/api-reference/endpoint/contents.md#control-caching).

## Base URL and authentication

Every request goes to `https://api.valyu.ai` and carries your API key in the `x-api-key` header. Request and response bodies are JSON.

```bash cURL theme={null}
curl --fail-with-body https://api.valyu.ai/v1/search \
  -H "x-api-key: $VALYU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "retrieval augmented generation evaluation methods", "max_num_results": 5}'
```

Create a key in the [platform](https://platform.valyu.ai) and load it from your application's environment. The header is `x-api-key`, not `Authorization: Bearer`. Keep the key on the server; do not expose it in browser code.

## Errors

Error bodies always include `error`. Search, Contents and Datasources errors usually add `"success": false`. Requests rejected before they reach an endpoint (a missing or disabled key, or a rate limit) return `error` and `message`, and DeepResearch errors return `error` only. Some errors add a machine-readable `code`; branch on the status and `code` rather than the message text.

| Status | Meaning | What to do |
| - | - | - |
| `400` | Invalid parameters | Fix the request. `error` names the problem. |
| `401` | Missing or invalid API key | Check that the `x-api-key` header is set to a valid key. |
| `402` | The request can't be paid for. `code` is `insufficient_credits` (balance used up), `credit_limit_reached` (monthly usage limit) or `spend_cap_reached` (the key's budget cap). Nothing is charged. | Top up, raise the limit or cap in the dashboard, or wait for your plan to renew. |
| `403` | The key is disabled, revoked or lacks permission, or every dataset you named is unavailable to you: above your plan (`tier_insufficient`), licensed or unknown (`dataset_unavailable`), or DeepResearch-only (`deepresearch_only`) | Check the key and your plan. `recovery` links the upgrade or contact page. |
| `404` | Task, batch, job or workflow not found | Check the ID. Contents jobs can be read only by the key that created them. |
| `409` | The resource changed state, for example a task finished before your cancel arrived | Fetch the current state, then decide whether to retry. |
| `422` | Contents: every URL failed | Nothing is charged. Check the URLs, or retry with `extract_effort: "high"`. |
| `429` | You hit a rate limit | See [rate limits](#rate-limits) below. Nothing is charged. |
| `500` | Unexpected server error | Retry with exponential backoff. Keep the transaction ID for support. |
| `503` | DeepResearch: billing couldn't be checked, so no task was created | Retry with exponential backoff. |

Search and Contents return `206` when the request succeeded only in part, for example when some sources or URLs failed. Treat it as a success and inspect the individual results.

## Warnings

A request that succeeds with something skipped or adjusted, such as a named dataset outside your plan, returns a `warnings` list of `{type, message, detail}` objects. A plan limit never fails a request that can still return something. See [warnings](https://docs.valyu.ai/api-reference/warnings.md) for every type.

## Rate limits

Limits apply per organisation and per endpoint. Search, Contents, and creating or polling DeepResearch tasks each have their own limit. The limit is lower on cheaper plans and higher on paid plans. See [pricing and plans](https://docs.valyu.ai/pricing.md) for the rate on each plan. There is no daily quota.

A request over the limit returns `429 Too Many Requests` with a `Retry-After` header, in seconds. The body names the limit you hit and how to raise it:

```json theme={null}
{
  "error": "rate_limited",
  "message": "Search rate limit reached: your Pay-as-you-go plan allows 5 requests per second. Retry after 2 seconds. Upgrade to Ridiculously Cheap for 10 requests per second: https://platform.valyu.ai/user/account/billing?tab=plan",
  "retry_after": 2,
  "plan": "Pay-as-you-go",
  "limit": {"endpoint": "search", "requests_per_second": 5},
  "upgrade_url": "https://platform.valyu.ai/user/account/billing?tab=plan"
}
```

| Field | Meaning |
| - | - |
| `retry_after` | Seconds to wait before you retry. Matches the `Retry-After` header. |
| `plan` | Your current plan. |
| `limit.endpoint` | Which limit you hit: `search`, `content`, `answer`, `deepresearch` (create) or `deepresearch_poll`. |
| `limit.requests_per_second` | The sustained rate for that endpoint on your plan, as a per-second number. It can be fractional on slow limits. `message` restates it per minute or per hour when that reads more naturally. |
| `upgrade_url` | Where to move to a higher self-serve plan for a higher limit. On the top plans, `contact_url` carries a sales contact link here instead. |

Wait `retry_after` seconds, then retry with backoff. A `429` is temporary and clears on its own: it is not a billing or credit problem, and a rate-limited request is never charged.

## Pricing

You pay per use from your credit balance. Search is priced per result returned, Contents per extracted URL, and DeepResearch per task by mode. Cost fields in a response (`price`, `total_deduction_dollars`, `total_cost_dollars`, `cost`) report what each request was charged. See [pricing](https://docs.valyu.ai/pricing.md) for rates and plans.

## Versioning

All endpoints are under `/v1`. New optional parameters and response fields are added within `v1`, so ignore fields your client doesn't recognise. Changes are announced in the [API changelog](https://docs.valyu.ai/changelog/sdk-and-api.md).

## OpenAPI specification

Use the OpenAPI 3.0 specification to inspect request and response shapes, generate a client or import requests into an API tool.

[Open the OpenAPI specification](https://docs.valyu.ai/api-reference/openapi.json) to view or save the raw JSON.

**1. Import the specification**

In Postman, choose **Import** and enter `https://docs.valyu.ai/api-reference/openapi.json`.

**2. Configure authentication**

Set the API key used by the imported collection's `x-api-key` header. Keep the value in a private environment variable.

**3. Send a small request**

Start with Search and inspect the returned results. Use the async lifecycle documented for research tasks and extraction jobs.

## Machine-readable documentation

> [card] [Documentation index](https://docs.valyu.ai/llms.txt)
>
> Find the guide or reference page for a particular integration task.

> [card] [Documentation MCP](https://docs.valyu.ai/mcp)
>
> Search the documentation from an MCP client.

> [card] [Page Markdown](https://docs.valyu.ai/api-reference/endpoint/search.md)
>
> Append `.md` to a documentation URL to retrieve its text.


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