Request Body
The search query or question you want to ask. This should be a clear and specific prompt that will guide the AI in finding and extracting relevant information.Example: “What is the latest version of Python and what are its main features?”
Optional headers to customize the search behavior. This can include user agent, cookies, or other HTTP headers.Example:{
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Cookie": "cookie1=value1; cookie2=value2"
}
Optional schema to structure the output. If provided, the AI will attempt to format the results according to this schema.Example:{
"properties": {
"version": {"type": "string"},
"release_date": {"type": "string"},
"major_features": {"type": "array", "items": {"type": "string"}}
},
"required": ["version", "release_date", "major_features"]
}
Optional parameter to enable mock mode. When set to true, the request will return mock data instead of performing an actual search. Useful for testing and development.Default: false
Response
Unique identifier for the search request. Use this ID to check the status and retrieve results.
Status of the request. One of: “queued”, “processing”, “completed”, “failed”
The original search query that was submitted.
The search results. If an output_schema was provided, this will be structured according to that schema.
List of URLs that were used as references for the answer.
Error message if the request failed. Empty string if successful.
Example Request
curl -X POST 'https://api.scrapegraphai.com/v1/searchscraper' \
-H 'SGAI-APIKEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"user_prompt": "What is the latest version of Python and what are its main features?",
"output_schema": {
"properties": {
"version": {"type": "string"},
"release_date": {"type": "string"},
"major_features": {"type": "array", "items": {"type": "string"}}
},
"required": ["version", "release_date", "major_features"]
},
"mock": false
}'
Example Response
{
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"status": "completed",
"user_prompt": "What is the latest version of Python and what are its main features?",
"result": {
"version": "3.12",
"release_date": "October 2, 2023",
"major_features": [
"Improved error messages",
"Per-interpreter GIL",
"Support for the Linux perf profiler",
"Faster startup time"
]
},
"reference_urls": [
"https://www.python.org/downloads/",
"https://docs.python.org/3.12/whatsnew/3.12.html"
],
"error": ""
}