Integration · HTTP clients
How to use a proxy with curl
curl uses a proxy with -x (--proxy) and authenticates with -U (--proxy-user): curl -x http://host:port -U user:pass https://example.com. It is the fastest way to check a username, a country or a sticky session before it goes into a crawler, because one command shows the exit IP and the proxy's answer.
Reviewed 30 Oct 2026
http://USERNAME _pool-arcfast _country-de:PASSWORD@ proxy.arcproxies.io:8000The short answer
-xsets the proxy,-U user:passthe proxy credentials; both can also live in one URL.-w '%{http_connect}'prints the proxy's answer to the CONNECT request: 200 is fine, 407 means wrong credentials.socks5h://resolves hostnames at the proxy;socks5://resolves them on your machine.--retrycovers timeouts and 408, 429, 500, 502, 503, 504, not a 407.
Setup
Set up curl with a proxy, step by step
- 01
Send one request and read the exit IP
The echo service returns the address the target sees: a German residential exit for this username.
shell3 linescurl -x http://proxy.arcproxies.io:8000 \ -U "USERNAME_pool-arcfast_country-de:PASSWORD" \ "https://api.ipify.org?format=json" - 02
Confirm a sticky session holds
Run the same sticky username twice: both calls should print the same IP. Run the rotating username twice: the IPs may differ, because each curl run opens a new connection.
shell7 linesfor i in 1 2; do curl -s -x http://proxy.arcproxies.io:8000 -U "USERNAME_pool-arcfast_country-de_session-k3f9a1x2_sesstime-10:PASSWORD" https://api.ipify.org; echodonefor i in 1 2; do curl -s -x http://proxy.arcproxies.io:8000 -U "USERNAME_pool-arcfast_country-de:PASSWORD" https://api.ipify.org; echodone - 03
Check a country or city
Change the tokens and compare.
_country-is a lowercase ISO code;_city-comes from the published list, lowercased without spaces. An IP-geolocation lookup on the result is a rough check, since databases disagree at city level.shell7 linescurl -s -x http://proxy.arcproxies.io:8000 \ -U "USERNAME_pool-arcfast_country-gb_city-manchester:PASSWORD" \ https://api.ipify.org; echocurl -s -x http://proxy.arcproxies.io:8000 \ -U "USERNAME_pool-arcfast_country-us_city-losangeles:PASSWORD" \ https://api.ipify.org; echo - 04
Use SOCKS5 instead of HTTP
Same port, same credentials, different scheme.
socks5h://lets the gateway resolve the hostname.shell2 linescurl -x "socks5h://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" \ https://api.ipify.org - 05
Diagnose a failing proxy
%{http_connect}is the proxy's answer to the CONNECT request,%{http_code}the site's answer. A 407 tunnel failure makes curl exit with an error (code 56 in curl 8.x) before the site is ever reached.-vshows the full exchange.shell7 linescurl -s -o /dev/null \ -w 'proxy=%{http_connect} site=%{http_code} exit=%{exitcode} time=%{time_total}s\n' \ -x http://proxy.arcproxies.io:8000 -U "USERNAME_pool-arcfast_country-de:PASSWORD" \ https://example.com/# proxy=200 site=200 exit=0 … fine# proxy=407 site=000 exit=56 … wrong username or password - 06
Timeouts and retries for scripts
--connect-timeoutbounds connection setup,--max-timethe whole transfer.--retryretries timeouts and 408, 429, 500, 502, 503, 504, waiting one second and doubling, and honoursRetry-After.shell5 linescurl --compressed \ --connect-timeout 10 --max-time 60 \ --retry 3 \ -x http://proxy.arcproxies.io:8000 -U "USERNAME_pool-arcfast_country-de:PASSWORD" \ "https://example.com/products?page=1"
Ways to give curl the proxy credentials
| Form | Example | Note |
|---|---|---|
| Separate flag | -x http://host:port -U user:pass | Clearest; curl hides the argument from process listings where it can |
| In the proxy URL | -x http://user:pass@host:port | Percent-encode @ as %40 and : as %3a in the password |
| Environment | https_proxy=http://user:pass@host:port curl … | -x overrides it; handy for tools that call curl |
| Config file | proxy-user = "user:pass" in a file passed with -K | Keeps the password out of shell history |
curl's own manual warns that -U on the command line can still be seen briefly by other users on the same machine, and recommends reading credentials from a file.
HTTP proxy, CONNECT and HTTPS sites
For an https:// URL, curl asks the gateway to open an HTTP CONNECT tunnel to the site's port 443 and then runs TLS through it, so the gateway sees the hostname but not the request. For an http:// URL, curl sends the request to the proxy in absolute form instead. -p (--proxytunnel) forces a tunnel for plain HTTP too.
For a step-by-step method to confirm where an exit really is, including the limits of geolocation databases, see how to test a proxy's location.
Rotating vs sticky from the command line
Every curl invocation is a new connection, so a rotating username can return a new exit each time; several URLs in one invocation may reuse a connection and share one. Add _session-<handle>_sesstime-<minutes> to pin the exit across invocations. A sticky session is best effort: if the exit goes offline, the same handle returns a new IP.
The problem
Common pitfalls
Quoting the URL
In zsh and some other shells, an unquoted ? in a URL is a glob and the command fails before curl runs. Quote URLs with query strings.
socks5:// when you meant socks5h://
socks5:// resolves DNS locally, which can pick a regional server for your own location rather than the exit's. Use socks5h://.
Expecting --retry to fix a 407
A refused tunnel is not a transient error. Fix the credentials; retries will not help.
Forgetting --compressed
curl does not ask for compressed responses unless you pass --compressed. Through a per-GB proxy, that is bandwidth you pay for.
FAQ
Questions
Something not covered? Write to contact@arcproxies.io.
How do I use curl with a proxy that needs a username and password?
Use curl -x http://host:port -U username:password https://example.com, or put the credentials in the proxy URL: curl -x http://username:password@host:port https://example.com.
How do I check my proxy IP with curl?
Request an IP echo service through the proxy, for example curl -x http://host:port -U user:pass https://api.ipify.org. The response is the exit IP the target sees.
What is the difference between socks5 and socks5h in curl?
With socks5://, curl resolves the hostname itself and sends the IP to the proxy. With socks5h://, the proxy resolves the hostname. For geo-targeted work, socks5h:// keeps DNS consistent with the exit.
What does curl exit code 56 mean with a proxy?
Exit 56 is a failure receiving network data. With a proxy it often means the gateway refused the CONNECT tunnel; -w '%{http_connect}' shows the proxy's status, and 407 means the credentials were rejected.
Does curl --retry retry proxy errors?
It retries transient errors: timeouts and HTTP 408, 429, 500, 502, 503 and 504. A 407 from the proxy is not among them; --retry-all-errors would retry it, but wrong credentials stay wrong.
Sources & review
Last reviewed by the ARC Proxies team. Prices are read from the live catalog at build time.
- [1]curl: curl man page
- [2]everything curl: Proxies
Next
What people build with it
Integrations
Other http clients
Get started
Get credentials and paste them in.
Sign up, buy a gigabyte, generate a username in the dashboard. Code WELCOME15 takes 15% off your first purchase; bandwidth never expires.