New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

odds-api-io

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

odds-api-io

Official Node.js SDK for Odds-API.io - Real-time sports betting odds from 250+ bookmakers

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Odds-API.io Node.js SDK

npm version License: MIT TypeScript Node.js Version

Official Node.js SDK for Odds-API.io - Real-time sports betting odds from 250+ bookmakers.

Features

  • 🏀 20+ Sports - Basketball, football, tennis, and more
  • 📊 Comprehensive Odds Data - Real-time odds from 250+ bookmakers
  • 💰 Arbitrage Detection - Find risk-free betting opportunities
  • 📈 Value Bets - Identify positive expected value bets
  • 🔴 Live Events - Track in-play events and odds
  • 🔍 Advanced Search - Search events, participants, and leagues
  • TypeScript First - Full type safety with TypeScript
  • 📦 Dual Package - Works with both ESM and CommonJS
  • 🛡️ Error Handling - Custom error classes for better debugging

Installation

npm install odds-api-io

Get Your API Key

Visit odds-api.io/#pricing to get your API key.

Quick Start

TypeScript

import { OddsAPIClient } from 'odds-api-io';

const client = new OddsAPIClient({
  apiKey: 'your-api-key-here'
});

// Get all available sports
const sports = await client.getSports();
console.log(`Found ${sports.length} sports`);

// Get upcoming NBA events
const events = await client.getEvents({
  sport: 'basketball',
  league: 'usa-nba'
});

// Search for specific games
const lakersGames = await client.searchEvents('Lakers');

// Get live events
const liveEvents = await client.getLiveEvents('basketball');

JavaScript (CommonJS)

const { OddsAPIClient } = require('odds-api-io');

const client = new OddsAPIClient({
  apiKey: 'your-api-key-here'
});

async function getOdds() {
  const events = await client.getEvents({
    sport: 'basketball',
    league: 'usa-nba'
  });
  
  const odds = await client.getEventOdds({
    eventId: events[0].id,
    bookmakers: 'singbet,bet365'
  });
  
  console.log(odds);
}

getOdds();

JavaScript (ESM)

import { OddsAPIClient } from 'odds-api-io';

const client = new OddsAPIClient({
  apiKey: 'your-api-key-here'
});

const sports = await client.getSports();

Examples

Finding Arbitrage Opportunities

import { OddsAPIClient } from 'odds-api-io';

const client = new OddsAPIClient({ apiKey: 'your-api-key' });

const arbs = await client.getArbitrageBets({
  bookmakers: 'singbet,bet365',
  limit: 10,
  includeEventDetails: true
});

arbs.forEach(arb => {
  console.log(`Profit: ${arb.profitPercentage}%`);
  console.log('Legs:', arb.legs);
});

Tracking Odds Movements

// Get odds for a specific event
const odds = await client.getEventOdds({
  eventId: '62924717',
  bookmakers: 'singbet,bet365'
});

// Track how odds change over time
const movements = await client.getOddsMovement({
  eventId: '62924717',
  bookmaker: 'singbet',
  market: 'moneyline'
});

Getting Value Bets

// Find value betting opportunities
const valueBets = await client.getValueBets({
  bookmaker: 'singbet',
  includeEventDetails: true
});

valueBets.forEach(bet => {
  console.log(`Value: ${bet.valuePercentage}%`);
  console.log(`Odds: ${bet.odds} (Fair: ${bet.fairOdds})`);
});

Working with Participants

// Search for teams/players
const warriors = await client.getParticipants({
  sport: 'basketball',
  search: 'Warriors'
});

// Get participant details by ID
const participant = await client.getParticipantById(3428);

Managing Bookmakers

// Get all available bookmakers
const bookmakers = await client.getBookmakers();

// Select specific bookmakers for your account
await client.selectBookmakers('singbet,bet365');

// Check which bookmakers you've selected
const selected = await client.getSelectedBookmakers();

// Clear selected bookmakers
await client.clearSelectedBookmakers();

API Reference

Sports & Leagues

MethodDescriptionDocs
getSports()Get all available sportsDocs
getLeagues(sport)Get leagues for a sportDocs

Events

MethodDescriptionDocs
getEvents(params)Get events with filtersDocs
getEventById(eventId)Get specific event detailsDocs
getLiveEvents(sport)Get currently live eventsDocs
searchEvents(query)Search for events by keywordDocs

Historical

MethodDescriptionDocs
getHistoricalEvents(params)Get finished historical events in a date rangeDocs
getHistoricalOdds(params)Get closing odds for a historical eventDocs

Odds

MethodDescriptionDocs
getEventOdds(params)Get odds for an eventDocs
getOddsMovement(params)Track odds changesDocs
getOddsForMultipleEvents(params)Get odds for multiple eventsDocs
getUpdatedOddsSince(params)Get odds updated since timestampDocs

Participants

MethodDescriptionDocs
getParticipants(params)Get participants/teamsDocs
getParticipantById(id)Get participant by IDDocs

Bookmakers

MethodDescriptionDocs
getBookmakers()Get all available bookmakersDocs
getSelectedBookmakers()Get your selected bookmakersDocs
selectBookmakers(bookmakers)Select bookmakers for your accountDocs
clearSelectedBookmakers()Clear bookmaker selectionDocs

Betting Analysis

MethodDescriptionDocs
getArbitrageBets(params)Find arbitrage opportunitiesDocs
getValueBets(params)Find value betsDocs

Error Handling

The SDK includes custom error classes for better error handling:

import {
  OddsAPIClient,
  OddsAPIError,
  InvalidAPIKeyError,
  RateLimitExceededError,
  NotFoundError,
  TimeoutError,
  NetworkError
} from 'odds-api-io';

const client = new OddsAPIClient({ apiKey: 'your-api-key' });

try {
  const events = await client.getEvents({ sport: 'basketball' });
} catch (error) {
  if (error instanceof InvalidAPIKeyError) {
    console.error('Your API key is invalid');
  } else if (error instanceof RateLimitExceededError) {
    console.error('Rate limit exceeded - wait before retrying');
  } else if (error instanceof NotFoundError) {
    console.error('Resource not found');
  } else if (error instanceof TimeoutError) {
    console.error('Request timeout');
  } else if (error instanceof NetworkError) {
    console.error('Network error');
  } else if (error instanceof OddsAPIError) {
    console.error('API error:', error.message);
  }
}

Configuration

const client = new OddsAPIClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://api2.odds-api.io/v3', // Optional, default shown
  timeout: 10000 // Optional, default 10 seconds
});

TypeScript Support

This SDK is written in TypeScript and includes complete type definitions:

import type {
  Sport,
  League,
  Event,
  HistoricalEvent,
  Participant,
  Bookmaker,
  EventOdds,
  HistoricalEventOdds,
  ArbitrageBet,
  ValueBet,
  GetEventsParams,
  GetHistoricalEventsParams,
  GetHistoricalOddsParams
} from 'odds-api-io';

Free Tier Limitations

The free API tier has some restrictions:

  • Limited bookmakers - Only 2 bookmakers can be selected at once
  • Rate limits - Check the API documentation for current limits
  • No WebSocket - Free tier uses HTTP requests only

Upgrade your plan for full access.

Resources

Examples Directory

Check the examples/ directory for more comprehensive examples:

  • basic-usage.ts / basic-usage.js - Getting started
  • arbitrage-betting.ts - Finding arbitrage opportunities
  • odds-tracking.ts - Monitoring odds movements

License

MIT © Odds-API.io

Disclaimer

This is the official SDK for Odds-API.io. This tool is for informational purposes only and should not be used as the sole basis for betting decisions.

Built with ❤️ for the sports betting and analytics community

Keywords

odds

FAQs

Package last updated on 18 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts