← Back to ScrapeGraphAI
POST/api/search
Search the web
Runs a search, scrapes the top N result URLs, optionally runs LLM extraction with prompt and schema.
ScrapeGraphAI·Dynamic pricing
Dynamic pricing
((body.prompt ? 0.025 : 0.01) + (get(body, 'fetchConfig.stealth', 0) ? 0.025 : 0)) * (body.numResults ? body.numResults : 3)
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "scrapegraphai",
path: "/api/search",
body: {
"query": "example"
}
});
console.log(output);Body parameters
queryrequired
string
Search query (1-500 chars)
numResults
number
Number of results to scrape (1-20, default 3)
format
string
Output format: html or markdown (default markdown)
mode
string
Content mode: normal, reader, or prune (default prune)
prompt
string
LLM extraction prompt (1-10000 chars)
schema
object
JSON schema for structured extraction
locationGeoCode
string
Geo code for location-based results (max 10 chars)
timeRange
string
Time filter: past_hour, past_24_hours, past_week, past_month, past_year
fetchConfig
object
Fetch options
Response
id
string
raw
null
json.sales
array
json.address
string
usage.promptTokens
number
usage.completionTokens
number
results.0.url
string
results.0.title
string
results.0.content
string
metadata.pages.scraped
number
metadata.pages.requested
number
metadata.chunker.chunks.0.size
number