Advanced API Functionality
RocketScrape API enables you to customize the API's functionality by adding additional parameters to your requests. The API will accept the following parameters:
Parameter | Description |
apiKey | An account API key that used to authorize user API requests.
Note: Required parameter. |
url | An URL address of a parsed resource.
Note: Required parameter. |
render | Activate javascript rendering by setting render=true in your request. The API will automatically render the javascript on the page and return the HTML response after the javascript has been rendered. Note: Every single request for a parameter render=true counts as 10 requests. |
country_code | Activate country geotargeting by setting country_code=us to use US proxies for example. |
keep_headers | Use your own custom headers by setting keep_headers=true along with sending your own headers to the API. |
device_type | Set your requests to use mobile or desktop user agents by setting device_type=desktop or device_type=mobile . |
Note: Such domains
google, ebay, amazon, aliexpress, similarweb, zoominfo, booking, olx
are considered as "premium" resources and will cost 20 credits per request. Option render=true
for these domains will charge additional 5 credits.If you are crawling a page that requires you to render the javascript on the page in order to obtain the data you need, then we can fetch such pages using a headless browser. To render javascript, simply set
render=true
and we will use a headless Google Chrome instance to fetch the page. This feature is only available on the Basic, Pro, Ultra and Enterprise plans.https://api.rocketscrape.com/?apiKey={YOUR_API_KEY}&url=http://httpbin.org/ip&render=true
If you would like to use your own custom headers (user agents, cookies, etc.) when making a request to the website, simply set
keep_headers=true
and send the API the headers you want to use. Thus, the API will use these headers while sending requests to the website.Note: Use this feature only if you need to send custom headers to retrieve specific results from the website. We have a sophisticated header management system within the API, designed to increase success rates and performance on difficult sites. By sending your own custom headers you override our header system, which oftentimes lowers your success rates. Unless you absolutely need to send custom headers to get the data you need, we advise that you don’t use this functionality.
If you need to get results for mobile devices, use the
device_type
parameter to set the user-agent header for you, instead of setting your own.Note: Property
device_type
only available with the option render=true
.curl --header "X-MyHeader: 123" \
"https://api.rocketscrape.com/?apiKey={YOUR_API_KEY}&url=http://httpbin.org/anything&keep_headers=true"
Certain websites (typically e-commerce stores and search engines) display different data to different users based on the geolocation of the IP used to make the request to the website. In such cases, you can use the APIs geotargeting functionality to use proxies from the specified country to retrieve the correct data from the website with ease.
To control the geolocation of the IP used to make the request, simply set the
country_code
parameter to the country you want the proxy to be from and the API will automatically use the correct IP for that request.For example: to ensure your requests come from the United States, set the
country_code
parameter to country_code=us
.Pro, Ultra and Enterprise Plan users can geotarget their requests to the following 19 countries (Free and Basic Plan can only use US geotargeting) by using the
country_code
in their request:Country code | Country | Plans |
us | United States | All plans |
ca | Canada | Pro plan and higher. |
gb | United Kingdom of Great Britain | Pro plan and higher. |
fr | France | Pro plan and higher. |
de | Germany | Pro plan and higher. |
nl | Netherlands | Pro plan and higher. |
es | Spain | Pro plan and higher. |
ie | Irland | Pro plan and higher. |
se | Sweden | Pro plan and higher. |
in | India | Pro plan and higher. |
hk | Hong Kong | Pro plan and higher. |
id | Indonesia | Pro plan and higher. |
jp | Japan | Pro plan and higher. |
kr | South Korea | Pro plan and higher. |
sg | Singapore | Pro plan and higher. |
bh | Bahrain | Pro plan and higher. |
za | South Africa | Pro plan and higher. |
au | Australia | Pro plan and higher. |
br | Brazil | Pro plan and higher. |
If your project requires you to use desktop or mobile user agents exclusively in the headers it sends to the website, then you can use the
device_type
parameter.- Set
device_type=desktop
to have the API set a desktop (e.g. iOS, Windows, or Linux) user agent. Note: This is the default behavior. Not setting the parameter will result in the same effect. - Set
device_type=mobile
to have the API replicate a mobile (e.g. iPhone or Android) user agent.
Note: The device type you set will be overridden if you use
keep_headers=true
and send your own user agent in the requests header.https://api.rocketscrape.com/?apiKey={YOUR_API_KEY}&url=http://httpbin.org/ip&render=true&device_type=mobile
Note: Property
device_type
is only available with the option render=true
Last modified 1yr ago