Skip to content

Teams

Endpoints for managing sports teams and user preferences.

List Teams

Get a list of all available teams, optionally filtered by sport.

Endpoint

GET /api/auth/teams

Query Parameters

  • sport_id (optional) - Filter teams by sport
  • search (optional) - Search teams by name
  • page (optional) - Page number for pagination
  • per_page (optional) - Items per page (default: 20)

Response

json
{
  "data": [
    {
      "id": 1,
      "name": "Manchester United",
      "slug": "manchester-united",
      "sport_id": 1,
      "sport": {
        "id": 1,
        "name": "Football",
        "slug": "football"
      },
      "logo": "https://cdn.example.com/teams/man-utd.png",
      "country": "England",
      "founded": 1878
    },
    {
      "id": 2,
      "name": "Real Madrid",
      "slug": "real-madrid",
      "sport_id": 1,
      "sport": {
        "id": 1,
        "name": "Football",
        "slug": "football"
      },
      "logo": "https://cdn.example.com/teams/real-madrid.png",
      "country": "Spain",
      "founded": 1902
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 10,
    "per_page": 20,
    "total": 200
  }
}

Save Primary Team

Set the user's primary/favorite team.

Endpoint

POST /api/auth/teams/primary

Request

json
{
  "team_id": 1
}

Response

json
{
  "message": "Primary team saved successfully",
  "data": {
    "team": {
      "id": 1,
      "name": "Manchester United",
      "logo": "https://cdn.example.com/teams/man-utd.png"
    }
  }
}

Error Responses

  • 404 - Team not found
  • 422 - Invalid team ID

Save Other Teams

Set the user's secondary/other favorite teams.

Endpoint

POST /api/auth/teams/other

Request

json
{
  "team_ids": [2, 3, 4]
}

Response

json
{
  "message": "Other teams saved successfully",
  "data": {
    "teams": [
      {
        "id": 2,
        "name": "Real Madrid",
        "logo": "https://cdn.example.com/teams/real-madrid.png"
      },
      {
        "id": 3,
        "name": "Barcelona",
        "logo": "https://cdn.example.com/teams/barcelona.png"
      },
      {
        "id": 4,
        "name": "Liverpool",
        "logo": "https://cdn.example.com/teams/liverpool.png"
      }
    ]
  }
}

Notes

  • Maximum of 5 other teams can be selected
  • Team IDs must be valid and exist in the database
  • Previous selections will be replaced