Skip to main content

GET /api/games

Retrieves all games from the database with their details including title, explanation, points reward, and category information.

Authentication

No authentication required.

Request

No parameters required.

Response

games
array
Array of game objects

Response Example

[
  {
    "id": 1,
    "title": "Math Quiz Challenge",
    "explanation": "Solve mathematical problems to earn points",
    "points_reward": "100",
    "categoryId": 1,
    "category": {
      "id": 1,
      "name": "Mathematics"
    },
    "createdAt": "2026-01-15T10:30:00.000Z",
    "updatedAt": "2026-01-15T10:30:00.000Z"
  },
  {
    "id": 2,
    "title": "Science Trivia",
    "explanation": "Test your science knowledge",
    "points_reward": "150",
    "categoryId": 2,
    "category": {
      "id": 2,
      "name": "Science"
    },
    "createdAt": "2026-01-16T14:20:00.000Z",
    "updatedAt": "2026-01-16T14:20:00.000Z"
  }
]

Status Codes

200
Success
Games retrieved successfully
404
Error
Games not found
{
  "error": "Games not found"
}

cURL Example

curl -X GET https://api.cognit.com/api/games

Build docs developers (and LLMs) love