← Back to App

    API Documentation

    Public API endpoints for accessing BasedBall game data

    Overview

    The BasedBall Public API provides read-only access to game data. All endpoints are free to use and require no authentication.

    Read-Only

    All endpoints are GET requests only

    Rate Limited

    10 req/min per IP, 30 req/hr per address

    CORS Enabled

    Use from any domain

    Get Team Games
    GET
    Retrieve the last 4 games for a specific team

    Endpoint

    GET https://www.databaseball.fun/api/public/team-games/[address]

    Path Parameters

    ParameterTypeDescription
    address
    string
    Ethereum wallet address (0x...)

    Example Request

    curl https://www.databaseball.fun/api/public/team-games/0x1234567890abcdef1234567890abcdef12345678

    Response

    {
      "success": true,
      "address": "0x1234567890abcdef1234567890abcdef12345678",
      "games": [
        {
          "gameId": "abc123def456",
          "tier": "MLB",
          "playedAt": "2024-03-15T10:30:00Z",
          "winner": {
            "address": "0x1234567890abcdef1234567890abcdef12345678",
            "teamName": "8liens",
            "score": 8
          },
          "loser": {
            "address": "0xabcdef1234567890abcdef1234567890abcdef12",
            "teamName": "Weed Dolphins",
            "score": 3
          },
          "gameData": {
            "events": [
              {
                "inning": 1,
                "half": "top",
                "outs": 0,
                "batter": "Mike Trout",
                "pitcher": "Justin Verlander",
                "result": "Single",
                "runners": [...],
                "score": {"away": 0, "home": 0}
              }
              // ... full play-by-play continues
            ]
          }
        }
        // ... up to 4 games total
      ],
      "count": 4,
      "timestamp": "2024-03-15T12:00:00Z"
    }

    Note: The gameData field contains the complete play-by-play JSON with all innings, at-bats, and game events.

    Rate Limits

    • • Per IP: 10 requests per minute
    • • Per Address: 30 requests per hour
    • • Response includes rate limit headers

    Error Responses

    400
    Invalid address format
    404
    No games found for address
    405
    Method not allowed (only GET)
    429
    Rate limit exceeded
    Coming Soon
    Future endpoints in development
    GET
    /api/public/player/[tokenId]- Get player details and stats
    GET
    /api/public/leaderboard- Get top players and teams
    GET
    /api/public/season-stats- Get current season statistics

    Questions or feedback? Contact us on Farcaster