How can a Perplexity Search API request specify a search country?

The Citead team, updated

In short. Use the top-level country field with a two-letter ISO 3166-1 alpha-2 code.

Definition: The country field gives a Perplexity Search API request a country context for the web search. It is a string containing an ISO 3166-1 alpha-2 country code, and the reference specifies a length of exactly two characters.

Key facts

  • Perplexity's Search API reference describes the operation as searching the web and retrieving relevant web page contents.
  • The request body has a country string field, described as an ISO 3166-1 alpha-2 country code.
  • The same reference gives country a required string length of 2.
  • The request still needs query, which the reference marks as required.
  • Perplexity's Search Filters documentation illustrates the same country-code convention with US and FR.

How do you set the country?

Send country as a top-level property in the JSON body of the POST request to https://api.perplexity.ai/search. Keep query in the same object. A request body can be written as:

{
  "query": "coffee shops",
  "country": "FR"
}

The reference lists query as the required search query and lists country as a separate string property.

Which country-code format does the API accept?

Use the two-letter ISO 3166-1 alpha-2 form. The Search API reference states the format and sets the string length to 2. Perplexity's separate Search Filters documentation gives US and FR as examples of the two-letter form.

The value is a country code such as FR; country names and longer geographic labels are outside the documented format. The cited documentation establishes the code family and length; it does not provide a complete list of valid codes on the Search API reference page.

How does this relate to other Perplexity location fields?

Perplexity's Search Filters documentation describes user_location with fields for country, region, city, latitude, and longitude. That page is under the Agent API documentation and shows a location object. The Search API reference uses the direct country property shown above, so its request shape should be checked against that endpoint's own schema.

The Search API reference also lists separate fields such as search_language_filter and search_domain_filter. A country context and those filters are separate request properties.

How should you check a request?

Check four details before sending the body: query is present, country is a JSON string, the value has two characters, and the value follows ISO 3166-1 alpha-2 notation. FR matches the example format in Perplexity's documentation. If a request uses user_location, verify that it targets the Agent API example rather than the Search API endpoint.

FAQ

Is country a country name?

No. The Search API reference defines it as an ISO 3166-1 alpha-2 country code, represented as a string.

Does the country value have a fixed length?

Yes. The reference states that the string length is 2, and Perplexity's example values are US and FR.

Should country be nested inside user_location?

For the Search API request, place country directly in the JSON body alongside query. user_location appears in Perplexity's separate Agent API location documentation.

Sources

  1. Perplexity, "Search the Web", 28 September 2026
  2. Perplexity, "Search Filters", 6 October 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark