Developer Tools

SDKs

Official client libraries to integrate the Baseball API in your language of choice.

Python SDK — Coming Soon

We're working on an official Python client for the Baseball API. In the meantime, you can call the REST API directly.

PHP SDK — Coming Soon

We're working on an official PHP client for the Baseball API. In the meantime, you can call the REST API directly.

Java SDK — Coming Soon

We're working on an official Java client for the Baseball API. In the meantime, you can call the REST API directly.

TypeScript SDK

Official TypeScript / JavaScript client, zero runtime dependencies.

View on GitHub

A TypeScript SDK for the Baseball API built on native fetch, with full type definitions and no runtime dependencies.

Installation

npm install apibaseball

Requirements: 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