Country Codes Not Supported?

Aniceto_Ramirez
Tue, 30 Sep 2025 11:55:47 +0000
Bug Reports

Describe the Bug

perplexity.BadRequestError: Error code: 400 - {'error': {'message': 'Validation error: country must be provided as a valid 2-digit ISO country code, got MN', 'type': 'invalid_country_code', 'code': 400}}

Expected Behavior

When calling for information on Mongolia, ISO-Code 2 := “MN”. Same for Cameroon, “CM”, I expect to get searches for these countries but get nothing.

Actual Behavior

rejects MN, CM

Steps to Reproduce API Request & Response

1. Call the API with the following request:
completion = client.chat.completions.create(

    *model*="sonar",

messages=[

        {

“role”: “user”,

“content”: f"Retrieve important breaking news”

        }

    \],

country = “MN”,
)

2. perplexity.BadRequestError: Error code: 400 - {'error': {'message': 'Validation error: country must be provided as a valid 2-digit ISO country code, got MN', 'type': 'invalid_country_code', 'code': 400}}

Environment : Linux, Python SDK

4 posts - 2 participants