Skip to main content
POST
/
web
/
search
JavaScript
import ContextDev from 'context.dev';

const client = new ContextDev({
  apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
});

const response = await client.web.search({ query: 'x' });

console.log(response.query);
{
  "results": [
    {
      "url": "<string>",
      "title": "<string>",
      "description": "<string>",
      "markdown": {
        "markdown": "<string>"
      }
    }
  ],
  "query": "<string>"
}

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.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
query
string
required

Natural-language search query.

Required string length: 1 - 500
includeDomains
string[]

Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].

excludeDomains
string[]

Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].

freshness
enum<string>

Restrict results to content published within this window.

Available options:
last_24_hours,
last_week,
last_month,
last_year
queryFanout
boolean

Expand the query into multiple parallel variants for broader recall.

markdownOptions
object

Inline Markdown scraping for each result. Set enabled: true to activate.

timeoutMS
integer

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

Required range: 1000 <= x <= 300000

Response

Search succeeded. Results are ordered by relevance.

results
object[]
required
query
string
required

Echo of the original query (useful when fanout was enabled).