Request with country code:"PR" fails in Chat Completions API

:bug: Describe the Bug

HTTP 400 returnd on Completion API
when request is done with “web_search_options” “country” param set to : “PR”
(proper 2-digit code for Puerto Rico)

:white_check_mark: Expected Behavior

Expected to be supported as other 2-digit country codes (“US”, …) .

:cross_mark: Actual Behavior

HTTP 400 error returned in response:

{"error":{"message":"Validation error: country must be provided as a valid 2-digit ISO country code, got PR","type":"invalid_country_code","code":400}}

:counterclockwise_arrows_button: Steps to Reproduce

  1. Call the API with the following request:
curl --request POST --url https://api.perplexity.ai/chat/completions \
  --header 'Authorization: Bearer <api-key.....>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "sonar",
  "web_search_options": {"user_location": {"country": "PR"}},
  "messages": [{"role": "user","content": "How many stars are there in our galaxy?"}]}'
     
  1. Observe the unexpected behavior.

:pushpin: API Request & Response (if applicable)

curl --request POST --url https://api.perplexity.ai/chat/completions \
  --header 'Authorization: Bearer <api-key.....>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "sonar",
  "web_search_options": {"user_location": {"country": "PR"}},
  "messages": [{"role": "user","content": "How many stars are there in our galaxy?"}]}'  

:globe_showing_europe_africa: Environment

It was supposed to be resolved – see similar bug: