POST
/v1/scrapeScrape Endpoint
Extract data from any webpage with a single API call. Supports CSS selectors, JavaScript rendering, and anti-bot bypass.
Endpoint
bash
POST https://api.scrpy.co/v1/scrapeRequest Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token with your API key |
Content-Type | Yes | application/json |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL to scrape |
selectors | object | No | CSS selectors to extract data |
render | boolean | No | Enable JavaScript rendering (default: false) |
antiBot | boolean | No | Enable anti-bot bypass (default: false) |
proxy | string | No | Proxy country code (us, uk, de, etc.) |
waitFor | string | number | No | CSS selector to wait for, or ms delay |
screenshot | boolean | No | Capture screenshot (default: false) |
cookies | array | No | Cookies to send with request |
headers | object | No | Custom headers to include |
Example Request
bash
curl -X POST https://api.scrpy.co/v1/scrape \
-H #a5d6ff;">"Authorization: Bearer sk_live_xxxxx" \
-H #a5d6ff;">"Content-Type: application/json" \
-d #a5d6ff;">'{
"url": "https://example.com/product/123",
"selectors": {
"title": "h1.product-title",
"price": ".price::text",
"images": ".gallery img::attr(src)::all"
},
"render": true,
"antiBot": true,
"proxy": "us",
"waitFor": ".product-loaded"
}'Response
Success Response (200)
javascript
{
"success": true,
"data": {
"title": "Premium Wireless Headphones",
"price": "$149.99",
"images": [
"https://example.com/img1.jpg",
"https://example.com/img2.jpg"
]
},
"metadata": {
"url": "https://example.com/product/123",
"statusCode": 200,
"duration": 1523,
"timestamp": "2024-01-15T10:30:00Z",
"credits": 2
}
}Error Response
javascript
{
"success": false,
"error": {
"code": "BLOCKED",
"message": "Request was blocked by the target site",
"suggestion": "Try enabling antiBot mode"
}
}Error Codes
| Code | HTTP | Description |
|---|---|---|
INVALID_URL | 400 | URL is malformed or unsupported |
BLOCKED | 403 | Request blocked by target site |
NOT_FOUND | 404 | Target page not found |
TIMEOUT | 408 | Request timed out |
RATE_LIMITED | 429 | Too many requests |
Related Endpoints
- Jobs Endpoint → - Manage async scraping jobs
- Schedules Endpoint → - Set up recurring scrapes