Endpoint
Query parameters
The ISO 3166-1 alpha-2 or alpha-3 country code (e.g., “PL” or “POL”).
Response
Returns the raw response from RestCountries API v3.1. The response is an array containing country data.Country data object from RestCountries API
Caching
This endpoint uses Next.js’sforce-cache strategy:
app/api/country/route.ts:11-13
Country data is cached indefinitely to reduce external API calls and improve performance.
Example request
Example response
The response includes many additional fields beyond what’s shown above. Refer to the RestCountries API documentation for the complete schema.
Error responses
Missing country code:400
Failed to fetch from RestCountries:
500
Code example
Use cases
This endpoint is primarily used by:- Country search/autocomplete components
- Guess validation in the game interface
- Displaying country details after user selection