# Getting started: gateway, targeting and code

> Set up MENA residential proxies: gateway, country and city targeting, sticky sessions, curl, Python and Playwright examples. No KYC.

- URL: https://menaproxies.com/guides/getting-started/
- Last updated: 2026-10-14
- Publisher: MENA Proxies (https://menaproxies.com)

Everything you need to send your first request through a UAE, Saudi or Egyptian home IP: the gateway, the username format, sticky sessions, and copy-paste examples for curl, Python and Playwright.

**Quick answer — How do I connect to MENA Proxies?**

Point any HTTP or SOCKS5 client at `gw.menaproxies.com`, port 7777 for HTTP and HTTPS or port 7778 for SOCKS5, with the username and password from your **MENA Proxies** dashboard. Put the country in the username, such as `USERNAME-country-ae` for the UAE, and add a session ID to keep one IP. Plans start at $1.88 for 1 GB, with no KYC.

## Connection settings

| Attribute | Value |
| --- | --- |
| Gateway host | `gw.menaproxies.com` |
| HTTP and HTTPS port | `7777` |
| SOCKS5 port | `7778` |
| Username format | `USERNAME-country-{cc}-city-{city}-asn-{asn}-session-{id}-ttl-{minutes}` |
| Country codes | `ae`, `sa`, `qa`, `kw`, `bh`, `om`, `il`, `jo`, `iq`, `lb`, `eg`, `ma`, `dz`, `tn` |
| City IDs | Lower case, `_` for spaces: `dubai`, `abu_dhabi`, `riyadh`, `cairo`, `casablanca` |
| ASN | `asn-<number>`, for example `asn-5384` (e&, UAE), at no extra cost |
| Authentication | Username and password on every plan, or an IP allowlist (up to 10 IPs). Sub-users with their own credentials and traffic cap. API keys you can revoke at any time |
| Sessions | Each new connection gets an IP from the pool, usually a different one; to get a new IP on every request, send one request per connection (turn off keep-alive). Sticky: up to 30 minutes (the IP can change earlier) |

## From payment to first request

1. **Top up and buy a plan** — Top up at least $25 in BTC, USDT, USDC, ETH, SOL, LTC, then buy 1 GB ($1.88) or more from your balance.
2. **Copy your credentials** — The dashboard shows the proxy username and password. Create a sub-user per project if you want separate usage totals and a traffic cap for each.
3. **Add the country to the username** — USERNAME-country-sa for Saudi Arabia, USERNAME-country-eg-city-cairo for Cairo when IPs are online there.
4. **Check the exit** — Request an IP-information service through the proxy and confirm the country and network. See how to verify a proxy's location.

## How do I test with curl?

Use `-x` for HTTP proxies and `--socks5-hostname` for SOCKS5; the `-hostname` variant sends the hostname to the proxy instead of resolving it on your machine.

*curl: rotating, sticky and SOCKS5*

```bash
# UAE, a new home IP on each new connection (each curl run)
curl -x http://USERNAME-country-ae:PASSWORD@gw.menaproxies.com:7777 https://ipinfo.io/json

# Riyadh, the same IP for 30 minutes (session id r1)
curl -x http://USERNAME-country-sa-city-riyadh-session-r1-ttl-30:PASSWORD@gw.menaproxies.com:7777 https://ipinfo.io/json

# Egypt over SOCKS5, hostname resolved by the proxy
curl --socks5-hostname gw.menaproxies.com:7778 -U USERNAME-country-eg:PASSWORD https://ipinfo.io/json
```

## How do I use it from Python, with retries?

Home connections come and go, so a request can occasionally fail on a slow or disconnected IP. Retry with a new IP rather than waiting: without a session ID, each retry gets a new one. Encode the password if it contains special characters.

*Python requests: country rotation with retries*

```python
import time
from urllib.parse import quote
import requests

GATEWAY = "gw.menaproxies.com:7777"
USER, PASSWORD = "USERNAME", quote("PASSWORD", safe="")

def fetch(url, country, session=None, ttl=30, tries=3):
    for attempt in range(1, tries + 1):
        user = f"{USER}-country-{country}"
        if session:  # a new session ID per attempt, so each retry gets a new IP
            user += f"-session-{session}{attempt}-ttl-{ttl}"
        proxy = f"http://{user}:{PASSWORD}@{GATEWAY}"
        try:
            r = requests.get(url, proxies={"http": proxy, "https": proxy}, timeout=30)
            if r.status_code < 500:
                return r
        except requests.RequestException:
            pass
        if attempt < tries:
            time.sleep(2 * attempt)  # back off, then retry on a new IP
    raise RuntimeError(f"{url} failed {tries} times via {country}")

for cc in ["ae", "sa", "eg"]:
    print(cc, fetch("https://ipinfo.io/json", cc).json().get("country"))
```

## How do I use it in a browser with Playwright?

Pass the gateway as the browser's proxy and the targeting in the username. Set the locale and time zone to match the country, so that pages render as they would for a local visitor.

*Playwright (Python): an Arabic browser session from Riyadh*

```python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(proxy={
        "server": "http://gw.menaproxies.com:7777",
        "username": "USERNAME-country-sa-city-riyadh-session-pw1-ttl-30",
        "password": "PASSWORD",
    })
    context = browser.new_context(locale="ar-SA", timezone_id="Asia/Riyadh")
    page = context.new_page()
    page.goto("https://ipinfo.io/json")
    print(page.text_content("body"))
    browser.close()
```

## Which cities and operators can I target?

City targeting works where the pool has home IPs online in that city. The list changes through the day, so read it before a city-level run: the dashboard shows it, and the API returns it with `GET /v1/catalog/countries/{CC}/cities` (upper case in the API, lower case in the proxy username) (see the [API documentation](https://menaproxies.com/docs/api/)). If a city has no IP online, drop the city and use country targeting.

To pick an operator, add its ASN: `USERNAME-country-ae-asn-5384` exits on e& in the UAE. ASN targeting costs nothing extra; `GET /v1/catalog/countries/{CC}/asns` lists the ASNs online in a country, and availability varies.

Useful city IDs: `dubai`, `abu_dhabi`, `sharjah` (UAE); `riyadh`, `jeddah`, `dammam` (Saudi Arabia); `doha` (Qatar); `cairo`, `alexandria`, `giza` (Egypt); `casablanca`, `rabat` (Morocco); `amman` (Jordan); `beirut` (Lebanon).

## What usually goes wrong?

- **407 Proxy Authentication Required**: wrong username or password, or a special character in the password that was not URL-encoded.
- **Connection refused or timeout**: wrong port; HTTP clients need 7777, SOCKS5 clients 7778.
- **Exit in the wrong country**: the country code is missing or misspelled in the username; codes are two letters, lower case.
- **No IP in the city**: the city has no home IP online right now; use country targeting or try later.
- **Request refused at the gateway**: the target is in a blocked category (Banking, government and payment-portal sites, plus SMTP (email-sending) ports 25, 465 and 587).
- **Plan exhausted**: the plan has used all its GB; buy another from your balance.

## Setup questions

### Does MENA Proxies support SOCKS5?

Yes. Use port 7778 on `gw.menaproxies.com` with the same username and password. Use remote DNS (for example `--socks5-hostname` in curl or `socks5h://` in Python) so that the hostname is resolved by the proxy, not on your machine (in Python, `socks5h://` needs `pip install "requests[socks]"`).

### Can I whitelist my server's IP instead of using a password?

Yes. Every plan accepts an IP allowlist of up to 10 IPs, managed in the dashboard or through the API, and allowlisted IPs can use the proxies without a username and password. Targeting and sticky sessions are set in the username, so setups that need them keep username and password authentication.

### How do I keep the same IP for a checkout flow?

Add `-session-<id>-ttl-<minutes>` to the username, for example `USERNAME-country-ae-session-cart1-ttl-20`. Every request with the same session ID uses the same IP for up to 30 minutes (the IP can change earlier). Use a new session ID for each independent flow.

### Where is the API documentation?

At [/docs/api/](https://menaproxies.com/docs/api/): account, top-ups, orders, residential traffic, mobile ports and API keys, with curl, Python and Node.js examples.

---

MENA Proxies: MENA Proxies is a residential proxy provider for the Middle East and North Africa, paid in crypto with no ID upload: rotating home IPs with country targeting in the UAE, Saudi Arabia, Qatar, Egypt, Morocco and 9 more countries, billed per GB.
