POST/v1/scrape

Scrape 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/scrape

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer token with your API key
Content-TypeYesapplication/json

Request Body

ParameterTypeRequiredDescription
urlstringYesURL to scrape
selectorsobjectNoCSS selectors to extract data
renderbooleanNoEnable JavaScript rendering (default: false)
antiBotbooleanNoEnable anti-bot bypass (default: false)
proxystringNoProxy country code (us, uk, de, etc.)
waitForstring | numberNoCSS selector to wait for, or ms delay
screenshotbooleanNoCapture screenshot (default: false)
cookiesarrayNoCookies to send with request
headersobjectNoCustom 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

CodeHTTPDescription
INVALID_URL400URL is malformed or unsupported
BLOCKED403Request blocked by target site
NOT_FOUND404Target page not found
TIMEOUT408Request timed out
RATE_LIMITED429Too many requests

Related Endpoints