User Location filter dont work

I have a simple question for people used to Perplexity, this is what appears in the perplexity documentation:

import requests

url = "https://api.perplexity.ai/chat/completions"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
payload = {
    "model": "sonar-pro",
    "messages": [
        {"role": "system", "content": "You are a helpful local guide."},
        {"role": "user", "content": "What are some good coffee shops nearby?"}
    ],
    "web_search_options": {
      "user_location": {
        "latitude": 37.7749,
        "longitude": -122.4194
      }
    }
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

but if a run that code this error appears:

{‘error’: {‘message’: “Validation error: For localization, latitude and longitude must be provided together alongside the ‘country’ parameter.”, ‘type’: ‘lat_long_without_country’, ‘code’: 400}}

so.. what should I do? is this a bug?

Thanks for flagging this! I’m working on reproducing this issue right now.

Looks like it is a bug! We’ll update the documentation accordingly. Adding the country code (shown above) will give a valid response. The latitude and longitude params are then used to filter locations within the specified country.

So… there’s no way to search by location without the country code? In the case I’m working with, I only have the latitude and longitude.

Right now, no. The team is actively working on making this possible!

Just noting that this issue is also affecting me.

Thanks!