Scraper
Create and Run AI Scraper
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.
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 x-api-token<token>
In: header
Request Body
application/json
url*string
Target website URL to scrape
agent?string
AI agent type to use for scraping
Default
"general"Value in
"general" | "map" | "listing"message*string
Natural language instruction describing what to extract
proxyCountry?string
Proxy country code for geo-restricted content (optional)
Response Body
application/json
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", "message": "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" }'{
"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": 0,
"data": {},
"htmlPath": "string",
"recordingPath": "string",
"screenshotPath": "string",
"dataPath": "string"
}{
"message": "Invalid or missing API token",
"error": "Unauthorized",
"statusCode": 401
}{
"message": "You do not have permission to access this resource",
"error": "Forbidden",
"statusCode": 403
}{
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422
}{
"message": "An unexpected error occurred",
"error": "Internal Server Error",
"statusCode": 500
}