Introduction
The ScrapeCompass API simplifies web data extraction through an intuitive REST interface. This documentation covers available endpoints, parameters, and response formats, with real examples to help you get started quickly.
Authentication
All requests must include an API Key in the request header:
Authorization: Bearer YOUR_API_KEY
Endpoints
1. GET /v1/data
Fetch raw HTML or processed data from the specified target URL.
You can also pass query parameters to specify the format
(e.g., JSON, CSV).
- url - The webpage you want to scrape (encoded).
- format - Optional. Defaults to JSON.
Example: GET /v1/data?url=https%3A%2F%2Fwww.example.com&format=json Authorization: Bearer YOUR_API_KEY Response (JSON): { "status": "success", "data": "...Example.com content..." }
2. POST /v1/extract
Submit a more advanced extraction request with custom CSS or XPath selectors. Ideal for structured data output (e.g., for e-commerce product details).
Request Body Fields:
- url - The target webpage URL.
- selectors - An array of CSS or XPath selectors.
- format - Output format (JSON/CSV).
Example cURL: curl -X POST "https://api.ScrapeCompass.com/v1/extract" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "url": "https://www.example.com/product/123", "selectors": ["#title", ".price", ".description"], "format": "json" }' Response: { "status": "success", "extracted_data": { "title": "Example Product Title", "price": "$19.99", "description": "A short product description..." } }
3. GET /v1/status
Retrieve your account usage stats, remaining API calls, concurrency limits, and service health info.
GET /v1/status Authorization: Bearer YOUR_API_KEY Response: { "status": "success", "account": { "api_calls_used": 2000, "api_calls_limit": 10000, "concurrent_requests": 2 }, "service_health": { "uptime_percent": "99.95%", "last_incident": "2023-06-15" } }
Response Formats
The API supports JSON, XML, and CSV. For large results, pagination or chunked
delivery may apply. Use the format
parameter to specify desired output.
Error Handling
All error responses include a status
field and a message
.
Common HTTP status codes:
- 400 Bad Request: Missing or invalid parameters.
- 401 Unauthorized: Invalid or missing API Key.
- 403 Forbidden: API Key lacks permission.
- 429 Too Many Requests: Rate limit exceeded.
- 500 Server Error: Unexpected issue on our side.
Next Steps
Explore our Guides for deeper tutorials, advanced extraction logic, and best practices to optimize your scraping workflows.