Using the API Endpoint
Making a request to the Sync API is straightforward. You send a request, and we take care of proxies, browsers, CAPTCHAs, and protections in the background.
Sample Request
curl --request GET \
--url 'https://api.scraperapi.com?api_key=API_KEY&url=https://www.example.com'import requests
#Target URL
target_url = 'https://www.example.com'
# ScraperAPI API Key
api_key = 'API_KEY'
request_url = f'https://api.scraperapi.com?api_key={api_key}&url={target_url}'
response = requests.get(request_url)
print(response.text)import request from 'node-fetch';
//Replace the value for api_key with your actual API Key
const url = 'http://api.scraperapi.com/?api_key=API_KEY&url=https://example.com/';
request(url)
.then(response => {
console.log(response);
})
.catch(error => {
console.error(error);
});Optional Parameters
Sometimes sending normal (flat) requests is not enough, either because the domain is geo-locked to a specific region, it requires JavaScript rendering or it employs stronger bot protection. In those cases, you can add extra ScraperAPI parameters to your requests to ensure you get the data you need. Here are some common examples:
render=true- enables JavaScript Rendering with the request.country_code=us- get results from a specific region. For the complete list of supported countries, visit this page.premium=true- instructs the API to use high-quality residential proxies.session_number=123- keep reusing the same IP across multiple requests. Sessions expire 15 minutes after the last usage.
Here's an example request with JavaScript Rendering enabled
curl --request GET \
--url 'https://api.scraperapi.com?api_key=API_KEY&render=true&url=https://www.example.com'import requests
target_url = 'https://www.example.com'
# Replace the value for api_key with your actual API Key.
api_key = 'API_KEY'
request_url = f'https://api.scraperapi.com?api_key={api_key}&render=true&url={target_url}'
response = requests.get(request_url)
print(response.text)import request from 'request-promise';
//Replace the value for api_key with your actual API Key.
const url = 'https://api.scraperapi.com/?api_key=API_KEY&render=true&url=https://example.com/';
request(url)
.then(response => {
console.log(response);
})
.catch(error => {
console.error(error);
});Note: Ensure that all ScraperAPI parameters are listed before the url parameter, to avoid conflicts with paramters that may already exist in the target URL.
Related Sections
Last updated

