User:pass requests

Residential proxy backconnect building

When using backconnect, make sure always to use the following endpoint:

  • Proxy server: gate.smartproxy.com
  • Proxy port: 7000

The cURL code will be shown in the examples below. You may try them out on your machine.


Authentication

You can use either your username and password or whitelisted IP authentication to specify all proxy parameters directly. Learn more about how to manage proxy authentication here.

📘

Username and password parameter

To use a proxy username and password, please be aware that your username line will always start with user- followed by your proxy username.

❗️

Connect using either the whitelisted IP or your credentials, but avoid using both at the same time, as this could lead to unexpected issues.

Username:password

An example of a rotating proxy using a proxy username and password to return you an IP address from a random location:

curl -U "user-SPusername:SPpassword" -x "gate.smartproxy.com:7000" "https://ip.smartproxy.com/json"

Replace SPusername and SPpassword with your credentials and run the command in your Terminal or Command Prompt.

You will see the IP address that has been assigned to you for this particular request as well as the information on that IP address, including its location in the output.

321

Output example

In this example, the proxy is rotating, so running another request will return a different IP address.

Whitelisted IP

To use a Whitelisted IP for authentication, specify all of the proxy parameters directly in the endpoint. Here is a cURL example of a sticky proxy using a whitelisted IP to return you an IP address from a random location:

curl -x "https://session-example1-sessionduration-90.gate.smartproxy.com:7000" "https://ip.smartproxy.com/json"

Learn how to use backconnect parameters with Whitelisted IPs here.


Country Targeting

If IPs from a specific country are needed, then modify the username to include the country-xx parameter. Use two-letter Alpha-2 codes. There is a full list of them here.

Example of a rotating proxy that returns IPs from the US:

curl -U user-SPusername-country-us:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Rotating IPs from Italy:

curl -U user-SPusername-country-it:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

City Targeting

Add a city-xxxx parameter to the username to specify a city within a country.

It's used in conjunction with the country parameter and is not standalone.

If the city name consists of multiple words, then use underscores.

Example of a rotating proxy that returns IPs from New York City:

curl -U user-SPusername-country-us-city-new_york:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Rotating IPs from Rome, Italy:

curl -U user-SPusername-country-it-city-rome:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

State Targeting

Adding the state-us_xxxxx to your username will allow for state targeting. Only US states are supported for this at the moment.

An example of a rotating proxy that returns IPs from the state of New York:

curl -U user-SPusername-country-us-state-us_new_york:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Rotating IPs from California:

curl -U user-SPusername-country-us-state-us_california:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Continent Targeting

Adding the continent parameter to your username will allow you to target IPs from a specific continent.

An example of a rotating proxy that returns IPs from Europe:

curl -U user-SPusername-continent-eu:SPpassword -x gate.smartproxy.com:7000 https://ip.smartproxy.com/json

📘

Continent codes

  • Asia – as
  • Africa – af
  • Europe – eu
  • North America – na
  • Oceania – oc
  • South America – sa

ASN Targeting

Adding the asn parameter will allow you to target IPs from a specific carrier.

  • You must choose between city targeting and asn targeting, as they can’t be used simultaneously.
    • The same logic would apply to the continent and country parameters.
  • An example of a proxy withe the AT&T Mobility LLC asn number with a rotating session:
curl -U user-SPusername-asn-20057:SPpassword -x gate.smartproxy.com:7000 https://ip.smartproxy.com/json

📘

Carrier numbers

You can look up carrier numbers by searching online, for example here.


Sticky Session

The examples above have been performed using a rotating session, so you'll get a new IP address with each request. Adding the session variable to the username will allow the IP address to persist for multiple requests.

An example of a Sticky session that returns IP addresses from the US:

curl -U user-SPusername-country-us-session-randomstring123:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Since this proxy is Sticky, the same IP address will be returned if you run the command again, as there is still an active session with that IP address.

The default session duration is 10 minutes. The IP address will automatically rotate after that.

There must be a way to differentiate between each session that is assigned to the user since it's possible to have multiple active sticky sessions at once.

📘

Session Values

The value – randomstring123 is used in the example above. Any alphanumeric text/string could be used depending on your preference. All of these would be viable:

session-random123
session-1 session-abcdef session-2

Different session parameter values are used to differentiate between active sessions and behave just like the different sticky proxy ports with our country endpoints.

For example, if you run the commands above, you will see that the proxy IP persists even if a different proxy is used in between or at the same time.

The proxies with the session variable randomstring123 will return the same IP address as there is a sticky session.


In cases when it's necessary to change the country/city targeting or rotate the proxy IP sooner, the session parameter value must be changed as well (for example, from session-something to session-somethingelse). Otherwise, the IP address will not rotate.

curl -U user-SPusername-country-us-session-abcd:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json
curl -U user-SPusername-country-us-session-randomstring123:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

Session Duration

Adding sessionduration-x to the username will allow the session to persist for up to 24 hours.

📘

Session Length

Any integer between 1 and 1440 is accepted.

For example:
sessionduration-1 sessionduration-10 sessionduration-600

🚧

Premature Rotation

The longer the session you have, the more chances there are that the IP will rotate before your specified time due to the residential device at the end going offline.


A sticky IP from Chicago that will persist for 90 minutes:

curl -U user-SPusername-country-us-city-chicago-session-example1-sessionduration-90:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

A sticky IP from Casablanca that will persist for one minute:

curl -U user-SPusername-country-ma-city-casablanca-session-example2-sessionduration-1:SPpassword -x gate.smartproxy.com:7000 ip.smartproxy.com/json

📘

Note

We cannot guarantee IP availability when using backconnect, especially if smaller countries or cities are targeted.


Support

Need help or just want to say hello? Our customer support is available 24/7. You can also reach us anytime via email at [email protected].

Feedback

Can't find what you're looking for? Request an article!
Have feedback? Share your thoughts on how we can improve.