Developer Tools
SDKs
Official client libraries to integrate the Baseball API in your language of choice.
TypeScript SDK
Official TypeScript / JavaScript client, zero runtime dependencies.
A TypeScript SDK for the Baseball API built on native fetch, with full type definitions and no runtime dependencies.
Installation
npm install apibaseballRequirements: Node.js 18+ (or any environment with a global fetch)
Quick Usage
import { BaseballClient } from "apibaseball";
const client = new BaseballClient({
apiKey: process.env.APIBASEBALL_KEY!,
});
const leagues = await client.getLeagues({ page: 1 });
const games = await client.getGames({
from: "2026-07-01",
to: "2026-07-07",
});Key Features
- Authentication via header (X-Api-Key) or query parameter
- Configurable request timeout
- Custom fetch implementation support
- Built-in pagination with metadata
- BaseballApiError with HTTP status and error codes
- Full TypeScript support with .d.ts definitions
Supported Endpoints
- Countries, leagues, and leagues by country
- Teams by league and player data
- Game schedules with date range filtering
- Live game feeds
- Team injuries and statistics
- Odds data
- League standings
License: MIT
Full documentation & source on GitHub 