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>",
  "key_metadata": {
    "credits_consumed": 123,
    "credits_remaining": 123
  }
}
1 Credit Per 10 Results

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

Search query. Accepts natural language as well as Google-style search operators such as site:, -site:, inurl:, intitle:, quoted phrases, and OR.

Required string length: 1 - 500
numResults
integer
default:10

Number of results to request and return (10–100). Defaults to 10.

Required range: 10 <= x <= 100
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
country
enum<string>

Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's gl parameter). Example: "us", "gb", "de".

Available options:
af,
al,
dz,
as,
ad,
ao,
ai,
aq,
ag,
ar,
am,
aw,
au,
at,
az,
bs,
bh,
bd,
bb,
by,
be,
bz,
bj,
bm,
bt,
bo,
ba,
bw,
bv,
br,
io,
bn,
bg,
bf,
bi,
kh,
cm,
ca,
cv,
ky,
cf,
td,
cl,
cn,
cx,
cc,
co,
km,
cg,
cd,
ck,
cr,
ci,
hr,
cu,
cy,
cz,
dk,
dj,
dm,
do,
ec,
eg,
sv,
gq,
er,
ee,
et,
fk,
fo,
fj,
fi,
fr,
gf,
pf,
tf,
ga,
gm,
ge,
de,
gh,
gi,
gr,
gl,
gd,
gp,
gu,
gt,
gn,
gw,
gy,
ht,
hm,
va,
hn,
hk,
hu,
is,
in,
id,
ir,
iq,
ie,
il,
it,
jm,
jp,
jo,
kz,
ke,
ki,
kp,
kr,
kw,
kg,
la,
lv,
lb,
ls,
lr,
ly,
li,
lt,
lu,
mo,
mk,
mg,
mw,
my,
mv,
ml,
mt,
mh,
mq,
mr,
mu,
yt,
mx,
fm,
md,
mc,
mn,
ms,
ma,
mz,
mm,
na,
nr,
np,
nl,
an,
nc,
nz,
ni,
ne,
ng,
nu,
nf,
mp,
no,
om,
pk,
pw,
ps,
pa,
pg,
py,
pe,
ph,
pn,
pl,
pt,
pr,
qa,
re,
ro,
ru,
rw,
sh,
kn,
lc,
pm,
vc,
ws,
sm,
st,
sa,
sn,
rs,
sc,
sl,
sg,
sk,
si,
sb,
so,
za,
gs,
es,
lk,
sd,
sr,
sj,
sz,
se,
ch,
sy,
tw,
tj,
tz,
th,
tl,
tg,
tk,
to,
tt,
tn,
tr,
tm,
tc,
tv,
ug,
ua,
ae,
gb,
us,
um,
uy,
uz,
vu,
ve,
vn,
vg,
vi,
wf,
eh,
ye,
zm,
zw
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).

key_metadata
object

Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.