Localize sessions, scrapes and searches
Set an exit country for sessions and Web Data, send Accept-Language headers, and set language and region on searches. See what the exit IP changes.
Updated
To see a page as a visitor in another country sees it, you set the exit country, the language header, or both. Search has its own language and region fields. This guide shows each one and what it changes.
What the exit country changes
The exit country changes the IP address that the site sees. Content that a site selects from the IP follows the exit.
Wayfern has no option for the browser language, the timezone or the geolocation of a session. The session options are the viewport, the exit and recording. Set the language header yourself, as shown below.
Browser sessions
Add country to the connection URL. You can narrow the exit with region, city and isp. A country gives you a residential exit, billed at 320 credits per GB.
wss://api.wayfern.com/ws?token=$WAYFERN_LINK_TOKEN&country=DE&session=de1 Find the codes with GET /api/proxy/locations/countries, then regions, cities and isps (see residential location). An unknown code closes the socket with 4007.
Set Accept-Language in your client:
import { chromium } from "playwright";
const browser = await chromium.connectOverCDP(
`wss://api.wayfern.com/ws?token=${process.env.WAYFERN_LINK_TOKEN}&country=DE&session=de1`,
{ timeout: 120_000 },
);
const context = browser.contexts()[0];
await context.setExtraHTTPHeaders({ "Accept-Language": "de-DE,de;q=0.9" });
const page = await context.newPage();
await page.goto("https://example.com");
console.log(await page.title());
await browser.close(); This changes the request header only. Scripts in the page still read the browser’s own navigator.language.
Web Data calls
country is a two-letter code. It applies only when the call uses a residential exit:
- With
proxy: "residential", every call uses an exit in that country. - With
proxy: "auto", the default, the first try uses a datacenter exit.countryapplies only if the site blocks that try and Wayfern retries through a residential exit. - With
proxy: "datacenter",countryhas no effect.
To get the page of a country every time, set proxy: "residential". Send the language in headers:
curl -X POST https://api.wayfern.com/api/v1/scrape \
-H "Authorization: Bearer $WAYFERN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/pricing",
"proxy": "residential",
"country": "de",
"headers": { "accept-language": "de-DE,de;q=0.9" }
}' Wayfern sends headers only to requests on the origin of url. country and headers are part of the page cache key, so a German capture never answers a request for another country.
Search
The Search API has no exit country field. lang and region set the engine’s own language and market parameters. They do not change the IP.
| Engine | What Wayfern sends |
|---|---|
hl and lr from lang, gl from region, and the Google domain of that country, such as google.de | |
| Bing | setlang from lang, cc from region, and mkt when both are set |
| DuckDuckGo | kl, only when both a language and a country are known |
regiontakes a country code such asDE, or a form such asde-DE. Wayfern uses the part after the dash.langsuch asde-DEalso gives the country when you send noregion.- On Google, a language without a region gets a default market for that language.
curl -X POST https://api.wayfern.com/api/search/v1 \
-H "Authorization: Bearer $WAYFERN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"text": "fahrrad versicherung",
"engines": ["google", "bing"],
"lang": "de",
"region": "DE",
"limit": 10
}' The MCP tool search_web takes the same values as language and region. See the search parameters.