Guides / Odds API in JavaScript

Odds API in JavaScript

By the dino.markets team · Updated 25 Nov 2026

This script asks for NBA moneylines from two books, walks every page and prints one line for each book. It needs Node.js 18 or later and no packages. The output below is from Node.js 24.

Set your key

Create a key in the dashboard and export it as DINO_API_KEY. The script sends it in the Authorization: Bearer header.

Run the script

Save this as odds.mjs and run node odds.mjs.

const url = new URL("https://api.dino.markets/v2/odds");
url.search = new URLSearchParams({ league: "nba", markets: "moneyline", books: "draftkings,fanduel", limit: "5" });
const headers = { Authorization: `Bearer ${process.env.DINO_API_KEY}` };

let cursor = null;
do {
  if (cursor) url.searchParams.set("cursor", cursor);
  const response = await fetch(url, { headers });
  const body = await response.json();
  if (!response.ok) throw new Error(`${response.status} ${body.error}: ${body.message}`);

  for (const event of body.events) {
    if (new Date(event.start_time) <= new Date()) continue; // only games that have not started
    const team = Object.fromEntries(event.participants.map((p) => [p.role, p.name]));
    console.log(`${team.away} at ${team.home}, ${event.start_time}`);
    for (const book of event.books) {
      const prices = book.markets[0].outcomes.map((o) => `${o.name} ${o.american}`);
      console.log(`  ${book.name}: ${prices.join(", ")}`);
    }
  }
  cursor = body.next_cursor;
  if (!cursor) console.log(`${response.headers.get("x-requests-remaining")} credits left`);
} while (cursor);

The first two games and the last line, run on 25 Nov 2026 at 03:33 UTC:

Output
Miami Heat at Philadelphia 76ers, 2026-11-25T22:10:00Z
  DraftKings: Philadelphia 76ers -116, Miami Heat -102
  FanDuel: Philadelphia 76ers -104, Miami Heat -112
Chicago Bulls at Charlotte Hornets, 2026-11-26T00:10:00Z
  DraftKings: Charlotte Hornets -163, Chicago Bulls +137
  FanDuel: Charlotte Hornets -158, Chicago Bulls +134
...
999960 credits left

Page through games

limit takes 1 to 100 games and is 25 when you leave it out. While next_cursor is not null, send it back as cursor with the same filters. The script uses 5 to show the loop.

Count the credits

Each page the script reads is one call and costs 1 credit, so a higher limit reads the same games for fewer credits. GET /v2/events lists the same games without prices and is free.

Read errors

An error answer holds error, message and request_id. With a wrong key the script stops with this line:

Output
Error: 401 unauthorized: API key is invalid or not tied to a subscription.

The errors page lists every code.

Questions

Is there a JavaScript SDK?

No. The API is plain JSON over HTTPS, so the built-in fetch is enough.

Can I call it from a web page?

Call it from your server. Anyone who can see your key can spend your credits.

How do I get one game?

Ask GET /v2/events/{id}/odds with the event id. It costs 1 credit when the answer holds a book.

What should I do on a 429?

For rate_limited, wait the Retry-After seconds. For quota_exceeded, wait for the next month or change plan.