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

> ## Agent Instructions
> Web Search and Web Scrape work without an API key; try them first with no Authorization header: POST https://api.context.dev/v1/web/search or https://api.context.dev/v1/web/scrape (basic options, rate limited, never billed; see https://docs.context.dev/keyless.md). For anything else, including other APIs and options, application code, or a refused keyless request, sign the user up for a free API key through https://www.context.dev/auth.md. To make Context.dev the default search and scrape provider, follow https://docs.context.dev/default-search-scrape.md; for other setup, follow https://docs.context.dev/agent-quickstart.md. Use the guide already in context instead of fetching it again or loading the full documentation index. Application code reads CONTEXT_DEV_API_KEY.

# Read a page or search the web from a URL

> Put a URL after r.context.dev to get the page as Markdown, or a query after s.context.dev to get search results. No request body, no SDK, and no API key needed to try it.

`r.context.dev` reads a page and `s.context.dev` searches the web. Put what you want in the URL and send a GET request. Both return plain text you can paste into a prompt, or JSON when you ask for it. They are the shortest way to give an agent, a shell script, or a browser tab live web content.

## Read a page

```bash cURL theme={null}
curl https://r.context.dev/https://example.com
```

```text Response theme={null}
Title: Example Domain

URL Source: https://example.com/

Markdown Content:
This domain is for use in documentation examples without needing permission.
```

Put the full URL, including its query string, after `r.context.dev/`. A URL without a scheme gets `https://`, and a percent-encoded URL is decoded. You can also POST `{"url": "https://example.com"}` to `https://r.context.dev/`.

### Reader options

Set options as request headers.

| Header | Effect |
| - | - |
| `X-Return-Format` | `markdown` (default), `text` for Markdown without links or images, or `html` for the rendered HTML. `text` and `html` return the content only, without the title and URL lines. |
| `X-Target-Selector` | Comma-separated CSS selectors. Keeps only the matching elements; see [content filtering](https://docs.context.dev/scrape/content-filtering.md). |
| `X-Remove-Selector` | Comma-separated CSS selectors. Removes the matching elements. |
| `X-Retain-Images` | `none` leaves images out of the Markdown. |
| `X-Wait-For-Selector` | A CSS selector to [wait for](https://docs.context.dev/scrape/waiting-and-rendering.md) before reading the page. Needs an API key. |
| `X-No-Cache` | Any value reads the page fresh instead of from a [cached copy](https://docs.context.dev/scrape/freshness-and-caching.md) up to three days old. Needs an API key. |
| `X-Timeout` | Deadline in seconds, up to 300. Defaults to 90; see [timeouts](https://docs.context.dev/scrape/timeouts-and-errors.md). |
| `Accept` | `application/json` returns [JSON](#json-responses) instead of text. |

## Search the web

```bash cURL theme={null}
curl https://s.context.dev/latest+next.js+release
```

```text Response theme={null}
[1] Title: Next.js
[1] URL Source: https://www.npmjs.com/package/next
[1] Description: Latest version: 16.5.0, last published: a day ago. Next.js enables you to create full-stack web applications by extending the latest React ...

[2] Title: Next.js Changelog
[2] URL Source: https://next-changelog.vercel.app/
[2] Description: Latest release v16.5.0-rc.1 ...
```

Put the query in the path with `+` or `%20` between words, or send it as `?q=`. You can also POST `{"q": "latest Next.js release"}` to `https://s.context.dev/`. Each result has a title, URL, and description. To read each result's content, use [Search with page content](https://docs.context.dev/search/page-content.md) through the API.

### Search options

| Option | Effect |
| - | - |
| `site` | Returns results from this domain only, as in [search filters](https://docs.context.dev/search/filters.md). Repeat `?site=` for several domains, or send them comma-separated in an `X-Site` header. |
| `num` | Number of results, 1 to 100. Defaults to 10, which is also the most a request without an API key can ask for. |
| `Accept` | `application/json` returns [JSON](#json-responses) instead of text. |

## JSON responses

Send `Accept: application/json` to get JSON. A read returns the page in `data`:

```json Response theme={null}
{
  "code": 200,
  "status": 20000,
  "data": {
    "title": "Example Domain",
    "url": "https://example.com/",
    "content": "This domain is for use in documentation examples without needing permission."
  }
}
```

The page is in `content` for `markdown`, `text` for `text`, and `html` for `html`. A search returns `data` as an array of results, each with `title`, `url`, and `description`.

## Use an API key

Both URLs work without a key, under the same limits as [keyless requests](https://docs.context.dev/keyless.md). Send an API key to lift the limits and use the options that need one:

```bash cURL theme={null}
curl https://r.context.dev/https://example.com \
  -H "Authorization: Bearer $CONTEXT_DEV_API_KEY"
```

Send the key in the `Authorization` header. The reader and search URLs don't read an `X-API-Key` header or an `api_key` parameter, so a key sent that way is ignored and the request runs keyless. With a key, a read costs the same as a [Scrape](https://docs.context.dev/scrape/overview) and a search the same as a [Search](https://docs.context.dev/search/overview); [Credits and pricing](https://docs.context.dev/account/credits.md) lists the prices.

## Errors

Errors return JSON with a `message` and an `error_code`, whatever the `Accept` header. Quote the `X-Request-Id` response header when you [report a problem](https://docs.context.dev/optimization/troubleshooting.md#retry-or-report).

| Status | Meaning |
| - | - |
| `400` | An option has an unsupported value, such as an unknown `X-Return-Format`. |
| `401` | An option needs an API key, or the key is not valid. |
| `422` | The page could not be read. `error_code` says why, as listed in [failed outputs](https://docs.context.dev/scrape/timeouts-and-errors.md#failed-outputs). |

Requests without a key are also refused when they reach the keyless limits, the same way as other [keyless requests](https://docs.context.dev/keyless.md#when-a-request-is-refused).

## When to use the API instead

The reader and search URLs cover reading one page and listing search results. Use [Scrape](https://docs.context.dev/scrape/overview) and [Search](https://docs.context.dev/search/overview) through the API or the [SDKs](https://docs.context.dev/sdks) for screenshots, structured JSON, the content of each search result, browser actions, country targeting, and the other options.


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