Create and Run AI Scraper
Create and run a new AI Scraper from natural language instructions using the MrScraper v3 API, then save the scraperId to rerun it later.
Create a new AI scraper with natural language instructions. Use this for the first-time scraping of a website. Save the scraperId from the response to re-run the scraper later.
Note
- Use the V3 Platform API Server (
https://api.app.mrscraper.com) host when calling this endpoint. - Each AI Scraper agent returns a unique response format. For details, see here.
Important
The initial AI chat does not return the final results. It only generates example code and responses. To get the full output, you’ll need to use the rerun API.
Authorization
apiKey In: header
Request Body
application/json
Target website URL to scrape
AI agent type to use for scraping
"general""general" | "map" | "listing"Natural language instruction describing what to extract
Proxy country code for geo-restricted content (optional)
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://api.app.mrscraper.com/api/v1/scrapers-ai" \ -H "Content-Type: application/json" \ -d '{ "url": "https://books.toscrape.com", "prompt": "Extract all data and just only get the urls, include patterns https://books.toscrape.com/catalogue and for exclude patterns https://books.toscrape.com/catalogue/category" }'{
"message": "Successful operation!",
"data": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"createdAt": "2019-08-24T14:15:22Z",
"createdById": "e13e432a-5323-4484-a91d-b5969bc564d9",
"updatedAt": "2019-08-24T14:15:22Z",
"updatedById": "d8bc6076-4141-4a88-80b9-0eb31643066f",
"deletedAt": "2019-08-24T14:15:22Z",
"deletedById": "8ef578ad-7f1e-4656-b48b-b1b4a9aaa1cb",
"userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"type": "AI",
"url": "http://example.com",
"status": "Finished",
"error": "string",
"tokenUsage": 0,
"runtime": "8.678",
"data": {},
"htmlPath": "string",
"recordingPath": "string",
"dataPath": "string",
"curl": "string",
"html": "string",
"markdown": "string",
"screenshot": "string"
}
}{
"message": "Unauthorized access",
"error": "Unauthorized"
}{
"message": "You do not have permission to access this resource",
"error": "Forbidden",
"statusCode": 403
}{
"message": "Too many requests. Please try again later."
}Verify API Token GET
Verify your API token and retrieve subscription account information, including token usage, limits, and billing details, with the MrScraper v3 API.
Rerun an AI Scraper POST
Rerun an existing AI Scraper by scraperId and url with the MrScraper v3 API, reusing cached results to cut token usage and execution time.