Skip to main content
Returns the daily geography game including hint packages that unlock progressively based on the user’s guess count. Hints are partially revealed until the game is complete.

Endpoint

Query parameters

string
Target date in YYYY-MM-DD format. Defaults to today’s date if not provided.Validation: Must match the pattern ^\d{4}-\d{2}-\d{2}$

Response

string
required
The date of this daily game in YYYY-MM-DD format
HintPackage[]
required
Array of hint packages. Each package unlocks after a guess is made.
Country | null
required
The target country details. Only revealed when the game is over (6 guesses made or game won). Returns null during active gameplay.

Hint unlock logic

Hints are progressively revealed based on gameplay:
  • Initial state: First hint package is unlocked (1 package visible)
  • After each guess: One additional hint package unlocks
  • Maximum guesses: 6 attempts
  • Game over: All hints become visible when the game ends
From app/api/daily/route.ts:140

Example request

Example response

During gameplay (game not finished):
After game completion:

Error responses

Invalid date format:
Status: 400 Server error:
Status: 500

Game generation

If no game exists for the requested date, the API automatically generates one:
  1. Selects a random country from the countries database
  2. Fetches details from RestCountries API
  3. Retrieves CIA World Factbook data
  4. Generates hint packages from factbook data
  5. Stores the game in MongoDB (if available)
  6. Falls back to Poland if no valid country is found after 5 attempts
The daily game is consistent for all users on a given date. Once generated, it’s cached in the database.
If the database connection fails, the game is generated in-memory and will not persist across requests. This may result in different games for the same date.

Code example