Proxy Port
Send your own traffic through FourA's exits from any client that accepts a proxy URL: a browser, a download tool, a scraper you already run. The proxy port opens a tunnel to the target you name and copies bytes both ways, so it carries what the JSON API doesn't: streams, large downloads, and whole browser sessions.
Connecting
| Setting | Value |
|---|---|
| Host | proxy.foura.ai |
| Port | 34004 |
| Protocol | HTTP CONNECT with Basic authentication |
| Target ports | 443 and 80 |
Credentials come from the dashboard. Create a proxy user under Proxy in the sidebar and you get a generated username and password. They're separate from your API key on purpose: a proxy handshake travels in the clear on every connection, and a proxy user can be rotated without touching your API integration. See Proxy Users.
curl -x http://USERNAME:PASSWORD@proxy.foura.ai:34004 https://example.com
import requests
proxy = "http://USERNAME:PASSWORD@proxy.foura.ai:34004"
r = requests.get("https://example.com", proxies={"https": proxy, "http": proxy})
print(r.status_code)
The port speaks CONNECT only. An https:// target is tunnelled by every client. A plain http:// target works when your client tunnels it too (curl: --proxytunnel); a client that forwards the plain request to the proxy instead gets 405 Method Not Allowed.
Options Ride in the Username
Everything after the credential is a list of -key-value pairs, in any order:
USERNAME-network-premium-country-de-session-a1
Values are lowercase words. A dash inside a value starts a new option, so -city-new-york reads as two options and is refused. An unknown key is refused too, never dropped: a misspelt -contry-de comes back as a 400 that names the supported keys, rather than being served from the wrong country.
| Option | Values | What it does |
|---|---|---|
network |
shared (default, alias pool), premium (alias residential) |
Which network the address comes from. Shared is FourA's own exits, included in your plan. Premium is home addresses, drawn from the premium traffic your plan includes plus any you bought. |
fallback |
premium (alias residential), off |
Shared network only. Take a premium exit when the shared network can't carry the request. Off unless asked for, and it only fires when your plan includes premium traffic and allowance remains. |
country |
ISO 3166-1 alpha-2, repeatable | The exit country the target sees. Repeat it for a multi-country scope: -country-de-country-fr. |
session |
1 to 32 letters, digits, or underscores | Connections sharing a name share an address (sticky). Omit it for a new address per connection (rotating). |
state |
a word | Region. Premium only. |
city |
a word | City. Premium only. |
asn |
a number | Network, by AS number. Premium only. |
os |
windows, android, ios, mac |
The kind of device the address belongs to. Premium only. |
lifetime |
3 to 1440 |
Minutes a sticky premium address is held. Premium only. |
Every option except network, fallback, and session accepts any, which clears a value saved on the proxy user for this one connection.
Three combinations are refused with a 400 rather than partly honoured:
state,city,asn,os, orlifetimeon the shared network. The shared network is chosen by country and nothing finer; add-network-premiumto target a city.-fallback-premiumtogether with-network-premium. A fallback has nothing to do on the network it falls back to.- Finer targeting with a fallback armed. A fallback may or may not fire, so a city it could only sometimes honour is refused.
Sessions
On the shared network, a named session keeps the same exit for as long as you keep using it, on a sliding ten-minute window. If that exit stops working, the session moves to another one rather than failing. A browser driven through the port should always carry a session name: a page load opens dozens of connections, and without a session each one leaves from a different address.
On the premium network, a named session holds its address for lifetime minutes, or the network's default when you don't set one.
Saved defaults
Targeting saved on a proxy user in the dashboard applies to every connection made with it, so the username can stay short. Anything you put in the username wins for that one connection, and any takes a saved value back. A saved premium default spends only when your plan allows it; otherwise the connection is served from the shared network and the tunnel still opens.
CONNECT headers
A client that can add headers to the CONNECT request may send the same options as headers. A header wins over the same option in the username.
| Header | Same as |
|---|---|
X-Foura-Network |
-network- |
X-Foura-Fallback |
-fallback- (premium or off) |
X-Foura-Country |
-country-, comma-separated for several |
X-Foura-Session |
-session- |
X-Foura-State |
-state- |
X-Foura-City |
-city- |
X-Foura-Asn |
-asn- |
X-Foura-Lifetime |
-lifetime- |
curl -x http://USERNAME:PASSWORD@proxy.foura.ai:34004 \
--proxy-header "X-Foura-Country: de" \
https://example.com
Responses
A tunnel that opens answers 200 Connection established. Every refusal made after your credentials are checked carries an X-Foura-Error header with a one-line reason, so read that header before anything else.
| Status | When |
|---|---|
| 400 Bad Request | A malformed request, or an option FourA can't honour. X-Foura-Error spells out the option and the supported values. |
| 403 Forbidden | The target port isn't served, the target isn't a public internet host, the port isn't included in your plan, or you named -network-premium and your plan has no premium traffic left or doesn't include the premium network. |
| 405 Method Not Allowed | A plain request instead of CONNECT. |
| 407 Proxy Authentication Required | Missing or wrong credentials. The answer never says which half was wrong. |
| 408 Request Timeout | The client connected and sent nothing for 15 seconds. |
| 431 Request Header Fields Too Large | The CONNECT request's headers ran past 16 KB. |
| 429 Too Many Requests | One of your plan's numbers: tunnels open at once, tunnel openings a minute, or the standard traffic for this billing period. Also when the port itself is at its capacity or opening rate. X-Foura-Error says which. |
| 502 Bad Gateway | No working exit was found for that target within the selection budget, or FourA's own resolver couldn't look the host up. The two are different messages in X-Foura-Error. |
| 503 Service Unavailable | The proxy port is switched off. |
Limits
- Tunnels open at once and tunnel openings a minute come from your plan, and they are counted for the account rather than per proxy user: issuing a second credential does not buy a second allowance. Your numbers are on Usage & Limits.
- Finding an exit takes up to 45 seconds before the port gives up with a 502. A session that already has an exit usually connects in well under a second.
- A tunnel with no bytes in either direction is closed after two idle minutes.
- When the port is updated, tunnels that are already open get just under three minutes to finish and are then closed, while new connections keep opening. A long download or stream should reconnect when its tunnel closes.
- A proxy user you disable or delete in the dashboard stops authenticating within a minute.
Metering
Bytes through the port count toward the bandwidth on your Usage & Limits page, and bytes through a premium exit count toward your premium traffic as well: the same bytes, reported twice, never added together. When a tunnel opens, the traffic of premium exits the port tried but didn't use counts as premium traffic too. Unused shared-network tries aren't counted, and nothing is counted when no tunnel opens.
The standard traffic the port may use is your plan's. On a plan sold by credits the port has its own included gigabytes, and the Billing page sells more of them; on a plan sold by traffic it draws on the same pool as the API. When that runs out, new connections are refused until the period resets or you add more, and the usage mails say when.
Once the premium allowance is spent, the three ways onto that network are answered differently, on purpose. A connection that names -network-premium is refused with a 403 saying so, because a caller who asked to spend and was quietly served from somewhere else would keep asking and reconcile a premium line that never appears. A fallback is not taken, and a premium default saved on the proxy user is downgraded to the shared network, which still opens the tunnel: neither of those chose to spend on this connection.
Related
- Proxy Users: Create proxy users and build a connection string in the dashboard
- Proxy Request: The JSON API alternative, with retries and validation built in
- Reuse a Proxy Across Requests: Keeping one exit on the JSON API
- Usage & Limits: Bandwidth and premium traffic against your plan