> ## Documentation Index
> Fetch the complete documentation index at: https://docs.proxyscrape.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to target countries and use sticky sessions with Unlimited Residential proxies (UDP and non-UDP)

> Target a specific country and configure sticky sessions with the Unlimited Residential package.

With the Unlimited Residential package you control both **where** your proxies exit (country, city, or state) and **how long** an IP stays the same (sticky sessions). Both are configured by appending keywords to your proxy username — no change to the host or port is needed.

## Country targeting

To route through a specific country, append `-country-` followed by the 2-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) (uppercase) to the end of your proxy username.

Examples:

* `yourusername-country-US` — United States
* `yourusername-country-GB` — United Kingdom
* `yourusername-country-DE` — Germany

## City targeting

To narrow a country down to a specific city, append `-city-` followed by the city name (lowercase, no spaces) after the `-country-` code.

Examples:

* `yourusername-country-US-city-newyork` — New York City, United States
* `yourusername-country-GB-city-london` — London, United Kingdom
* `yourusername-country-DE-city-berlin` — Berlin, Germany

## State targeting

To narrow a country down to a specific state, append `-state-` followed by the 2-letter state code (uppercase, no spaces) after the `-country-` code.

Examples:

* `yourusername-country-US-state-CA` — California, United States
* `yourusername-country-US-state-TX` — Texas, United States
* `yourusername-country-US-state-FL` — Florida, United States

<Warning>
  You can target either a city **or** a state, but not both at the same time.
</Warning>

<Info>
  Not all countries, cities, and states are supported. To check whether a specific location is available, reach out to our [support team](https://proxyscrape.com/contact).
</Info>

<Note>
  You can also build these usernames from the dashboard: go to the [Proxy Setup](https://dashboard.proxyscrape.com/services/residential-unlimited/proxy-setup/) section, choose your desired country, city, or state from the dropdowns, and the appended characters are generated at the end of your username for you to copy and paste into your program.
</Note>

## Sticky sessions

By default, residential proxies rotate the exit IP on every request. To keep the same IP across multiple requests, append `-session-{id}-ttl-{seconds}` to the end of your proxy username, where:

* `{id}` is a session identifier — any number from 0 to 99999.
* `{seconds}` is how long the session stays sticky. Duration is minute-based, so use a whole number of minutes expressed in seconds (e.g. `60`, `300`, `600`).

Sticky sessions combine with location targeting — just add the session keywords after the country, city, or state.

Examples:

* `yourusername-session-658235-ttl-300` — 5 minute sticky session
* `yourusername-session-658235-ttl-600` — 10 minute sticky session
* `yourusername-country-US-city-newyork-session-658235-ttl-900` — 15 minute sticky session with city targeting (New York City, United States)
* `yourusername-country-US-state-CA-session-658235-ttl-900` — 15 minute sticky session with state targeting (California, United States)

<Note>
  The session `{id}` can also be generated from the dashboard: go to the [Proxy Setup](https://dashboard.proxyscrape.com/services/residential-unlimited/proxy-setup/) section and the appended characters are generated at the end of your username for you to copy and paste into your program.
</Note>

<Warning>
  There is no strict limit on session length, but an IP can only be held while the node serving it stays online. If that node goes offline, the proxy rotates. We recommend a maximum of 120 minutes. To force a rotation before the session expires, change the `{id}` in your username to a new number.
</Warning>
