Endpoint
Request body
string
required
The game date in YYYY-MM-DD format
Country[]
required
Array of country guesses. Each guess should include basic country data that will be enriched with calculated fields.
Response
boolean
required
Indicates if the progress was saved successfully
string
required
The user’s session ID (UUID v4 format)
boolean
required
Whether the user has won the game (guessed correctly)
Country[]
required
The enriched array of guesses with calculated fields
Geographic calculations
The endpoint enriches each guess with calculated geographic data: Distance calculation uses the Haversine formula:app/api/progress/route.ts:39
Bearing calculation computes the angle from guess to target:
app/api/progress/route.ts:40
Connection logic determines geographic relationships:
app/api/progress/route.ts:44-49
Session management
The endpoint automatically creates and manages user sessions:- Checks for existing
geo_sessioncookie - Generates new UUID v4 session ID if not present
- Sets HTTP-only cookie with 10-year expiration
- Associates all progress with the session ID
app/api/progress/route.ts:20-22
Win detection
The game is marked as won when the newest guess matches the target country name (case-insensitive):app/api/progress/route.ts:65-68
Example request
Example response
The
guesses array in the response is enriched with distance, bearing, and connection fields calculated on the server.Error responses
Invalid payload:400
This occurs when:
dateis missingguessesis not an array
500
This occurs when the database operation fails.
Code example
GET /api/progress
Retrieves the user’s progress for a specific date, including guess history and personal statistics.Endpoint
Query parameters
string
required
The game date in YYYY-MM-DD format.Validation: Must match the pattern
^\d{4}-\d{2}-\d{2}$Authentication
Requiresgeo_session cookie. If no session exists, returns empty progress.
Response
Country[]
required
Array of the user’s guesses for this date (enriched with distance/bearing/connection)
boolean
required
Whether the user won this game
object
required
User’s overall statistics across all games
Example request
Example response
With existing progress:Error responses
Invalid date:400
Server error:
500