Proxy
Proxies are at the core of every modern web scraper as they allow traffic distribution through multiple connection agents. In other words, proxies in web scraping allow to:
- Change origin country to access geographically locked content.
- Bypass scraper blocking and anti-bot detection solutions.
- Bypass scraper throttling.
All Scrapfly requests go through proxies and are automatically configured for the best scraping experience. However, each scrapfly API call can be additionally configured manually via proxy_pool and country parameters.
What are Proxies?
Each address is associated with an Autonomous System Number (ASN) and linked to a proxy. This is how anti-bot solutions track the origin of the IP and limit requests per IP. Our proxy pool rotates IPs, cools them down, and excludes underperforming proxies to increase success rates. We offer two public proxy pools by default, with the option to set up a custom pool. We manage and monitor our proxy pool for optimal performance, with both datacenter and residential proxies available.
Different kind of proxies exists, by types of IP address issuer:
- Datacenter: Cheap but are detected by advanced anti bot solution
- Residential: More expensive than datacenter but required for most target protected with anti bot solution
Why are Proxies Needed?
Anti-bot solutions rate-limit the number of requests per connecting IP address. Meaning, to scrape more than a page or two scrapers need to distribute traffic through multiple IP addresses. This limit is why we need to manage the proxy pool, rotate IPs, and cool them to increase the success rate.
Available Proxy Pools
A proxy pool represent a group proxies. By default, proxies are grouped by network type like datacenter, residential, 4g etc. One of the main challenges with proxies is the reliability, it's complex to maintain a network of healthy proxies and routing the traffic to them. You don't have to worry about the proxy, simply target the proxy pool and we route the traffic to an healthy proxy meeting your requirements.
All available proxy pools are listed in the proxy section on your dashboard. Each proxy pool have it's own cost (mostly due to network type) and by default these public pools are available:
-
Public Datacenter Pool:
public_datacenter_pool
- 1 API Credits will be counted -
Public Residential Pool:
public_residential_pool
- 25 API Credits will be counted
For example, to use residential proxies configure requests with the proxy_pool=public_residential_pool
parameter:
curl -G \
--request "GET" \
--url "https://api.scrapfly.io/scrape" \
--data-urlencode "proxy_pool=public_residential_pool" \
--data-urlencode "key=__API_KEY__" \
--data-urlencode "url=https://httpbin.dev/anything"
https://api.scrapfly.io/scrape?proxy_pool=public_residential_pool&key=&url=https%253A%252F%252Fhttpbin.dev%252Fanything
Geo Targeting
All Scrapfly scrape requests go through a proxy meaning geo-targeting is available at all times. By default, Scrapfly will smartly select a random proxy from the selected pool for the highest success probability.
To set the desired country, the country parameter can be used and the available country options depend on the selected proxy_pool:
public_datacenter_pool
-
Albania :
al
-
Armenia :
am
-
Argentina :
ar
-
Austria :
at
-
Australia :
au
-
Belgium :
be
-
Bulgaria :
bg
-
Bolivia :
bo
-
Brazil :
br
-
Belarus :
by
-
Canada :
ca
-
Switzerland :
ch
-
Chile :
cl
-
China :
cn
-
Colombia :
co
-
Czechia :
cz
-
Germany :
de
-
Denmark :
dk
-
Ecuador :
ec
-
Estonia :
ee
-
Spain :
es
-
Finland :
fi
-
France :
fr
-
United Kingdom :
gb
-
Georgia :
ge
-
Greece :
gr
-
Croatia :
hr
-
Hungary :
hu
-
Ireland :
ie
-
Israel :
il
-
India :
in
-
Iceland :
is
-
Italy :
it
-
Japan :
jp
-
South Korea :
kr
-
Lithuania :
lt
-
Latvia :
lv
-
Mexico :
mx
-
Netherlands :
nl
-
Norway :
no
-
New Zealand :
nz
-
Peru :
pe
-
Pakistan :
pk
-
Poland :
pl
-
Portugal :
pt
-
Romania :
ro
-
Russia :
ru
-
Saudi Arabia :
sa
-
Sweden :
se
-
Slovakia :
sk
-
Türkiye :
tr
-
Ukraine :
ua
-
United States :
us
public_residential_pool
-
Andorra :
ad
-
United Arab Emirates :
ae
-
Afghanistan :
af
-
Albania :
al
-
Armenia :
am
-
Angola :
ao
-
Argentina :
ar
-
Austria :
at
-
Australia :
au
-
Aruba :
aw
-
Azerbaijan :
az
-
Bosnia & Herzegovina :
ba
-
Bangladesh :
bd
-
Belgium :
be
-
Bulgaria :
bg
-
Bahrain :
bh
-
Benin :
bj
-
Bolivia :
bo
-
Brazil :
br
-
Bahamas :
bs
-
Bhutan :
bt
-
Belarus :
by
-
Belize :
bz
-
Canada :
ca
-
Switzerland :
ch
-
Côte d’Ivoire :
ci
-
Chile :
cl
-
China :
cn
-
Colombia :
co
-
Costa Rica :
cr
-
Cuba :
cu
-
Czechia :
cz
-
Germany :
de
-
Denmark :
dk
-
Dominica :
dm
-
Ecuador :
ec
-
Estonia :
ee
-
Egypt :
eg
-
Spain :
es
-
Ethiopia :
et
-
Finland :
fi
-
Fiji :
fj
-
France :
fr
-
United Kingdom :
gb
-
Georgia :
ge
-
Ghana :
gh
-
Gambia :
gm
-
Greece :
gr
-
Hong Kong SAR China :
hk
-
Honduras :
hn
-
Croatia :
hr
-
Haiti :
ht
-
Hungary :
hu
-
Indonesia :
id
-
Ireland :
ie
-
Israel :
il
-
India :
in
-
Iraq :
iq
-
Iran :
ir
-
Iceland :
is
-
Italy :
it
-
Jordan :
jo
-
Japan :
jp
-
Kenya :
ke
-
Cambodia :
kh
-
South Korea :
kr
-
Kazakhstan :
kz
-
Lebanon :
lb
-
Liberia :
lr
-
Lithuania :
lt
-
Latvia :
lv
-
Morocco :
ma
-
Monaco :
mc
-
Madagascar :
mg
-
North Macedonia :
mk
-
Mongolia :
mn
-
Mauritania :
mr
-
Malta :
mt
-
Mauritius :
mu
-
Maldives :
mv
-
Mexico :
mx
-
Malaysia :
my
-
Mozambique :
mz
-
Nigeria :
ng
-
Netherlands :
nl
-
Norway :
no
-
New Zealand :
nz
-
Oman :
om
-
Panama :
pa
-
Peru :
pe
-
Philippines :
ph
-
Pakistan :
pk
-
Poland :
pl
-
Puerto Rico :
pr
-
Portugal :
pt
-
Paraguay :
py
-
Qatar :
qa
-
Romania :
ro
-
Serbia :
rs
-
Russia :
ru
-
Saudi Arabia :
sa
-
Seychelles :
sc
-
Sudan :
sd
-
Sweden :
se
-
Singapore :
sg
-
Slovenia :
si
-
Slovakia :
sk
-
Senegal :
sn
-
South Sudan :
ss
-
Tunisia :
tn
-
Türkiye :
tr
-
Taiwan :
tw
-
Ukraine :
ua
-
Uganda :
ug
-
United States :
us
-
Uruguay :
uy
-
Uzbekistan :
uz
-
Venezuela :
ve
-
British Virgin Islands :
vg
-
Vietnam :
vn
-
Yemen :
ye
-
South Africa :
za
For example, to target Canada configure requests with the country=CA
parameter:
curl -G \
--request "GET" \
--url "https://api.scrapfly.io/scrape" \
--data-urlencode "country=ca" \
--data-urlencode "key=__API_KEY__" \
--data-urlencode "url=https://httpbin.dev/anything"
https://api.scrapfly.io/scrape?country=ca&key=&url=https%253A%252F%252Fhttpbin.dev%252Fanything
ca,us
and you can also exclude some -mx,-au
.
To know more, you can check the API parameters country section.
Related Errors
All related errors are listed below. You can see full description and example of error response on Errors section
- ERR::PROXY::POOL_NOT_AVAILABLE_FOR_TARGET - The desired proxy pool is not available for the given domain - mostly well known protected domain which require at least residential networks
- ERR::PROXY::POOL_NOT_FOUND - Provided Proxy Pool Name do not exists
- ERR::PROXY::POOL_UNAVAILABLE_COUNTRY - Country not available for given proxy pool
- ERR::PROXY::RESOURCES_SATURATION - Proxy are saturated for the desired country, you can try on other countries. They will come back as soon as possible
- ERR::PROXY::TIMEOUT - Proxy connection or website was too slow and timeout
- ERR::PROXY::UNAVAILABLE - Proxy is unavailable - The domain (mainly gov website) is restricted, You are using session feature and the proxy is unreachable at the moment
Pricing
Each call using the residential proxy pool will count for 25 Scrape API Credits.
API responses contain a header X-Scrapfly-Api-Cost
which indicate the total billed amount.