# Locations and languages

> Country location codes, city targeting with location_name, map coordinates, language codes, and the free lists that enumerate them.

SERP tasks need a location and a language. You can name both by code or by name, as in DataForSEO.

## Locations

| Field | Example | Notes |
|---|---|---|
| `location_code` | `2840` | Country-level codes: 2000 plus the ISO 3166-1 numeric code. 2840 is the United States, 2826 the United Kingdom, 2276 Germany. |
| `location_name` | `"United States"` | A country name targets the whole country. |
| `location_name` | `"Austin,Texas,United States"` | Comma-separated, ending in the country, targets a city or region within it. |
| `location_coordinate` | `"30.2672,-97.7431,14z"` | Latitude, longitude and an optional zoom, for Google Maps. Without a zoom we use `14z`. |

City and region `location_code` values aren't served yet. A `location_code` that isn't a country returns `40501` ("Use a country-level location_code or a location_name."). Use `location_name` for cities.

## Languages

| Field | Example |
|---|---|
| `language_code` | `"en"`, `"de"`, `"pt"` |
| `language_name` | `"English"`, `"German"` |

One of the two is required on SERP tasks. Missing or unknown, the task fails with `40501`.

## The lists

Free, `GET`, same envelope as any compatible route:

| Route | Returns |
|---|---|
| `GET /v1/serp/google/locations` | Every country: `location_code`, `location_name`, `country_iso_code`, `location_type: "Country"` |
| `GET /v1/serp/google/locations/us` | The one country matching an ISO alpha-2 code |
| `GET /v1/serp/google/languages` | Every language: `language_name`, `language_code` |
| `GET /v1/serp/bing/locations`, `/v1/serp/bing/languages` | The same lists for Bing |

```bash
curl "https://api.dataforgaio.com/v1/serp/google/locations/gb" -u "api:$DATAFORGAIO_API_KEY"
```

```json
[{ "location_code": 2826, "location_name": "United Kingdom", "location_code_parent": null, "country_iso_code": "GB", "location_type": "Country" }]
```

(That's `tasks[0].result`.)

## Other endpoints

| Endpoint | How location and language work |
|---|---|
| `my_business_info` | `keyword` is the business name (plus city, if you like), `cid:<n>` or `place_id:<id>`. `location_name` is added to a name search. `language_code` or `language_name` sets the language. `location_code` is echoed but doesn't target. |
| `products` | `hl` sets the language. |
| `photos` | `language` (default `en`) and `region` (default `us`, a 2-letter country). |
| `llm_responses` | `web_search_country_iso_code` (2 letters) and `web_search_city` steer web search. Perplexity doesn't take `web_search_city`. |
| Meta ads | `country` (ISO-2 or `ALL`), or the `country` in an Ad Library URL. |
| Yelp ads | `locations`, as you'd type them into Yelp: `"Austin, TX"`. |
| `POST /v1/serp` (Crawl API) | `country` (2 letters) and `language` (`en`, `pt-BR`). |
