MLB odds API: Pinnacle moneyline, run line and totals
Pull current Pinnacle baseball prices with PinnWire: prematch and live MLB snapshots, full market collections, detected line-movement alerts, and optional raw streaming updates.
sport_id=6 to retrieve current baseball moneylines, run-line spreads and totals in decimal odds. REST covers live and prematch snapshots, SSE pushes detected odds drops, and the optional WebSocket carries subscribed live and prematch market updates. PinnWire is purpose-built for this sharp Pinnacle data workflow, with flat-rate plans and no per-request metering on paid tiers.
How PinnWire maps the three core MLB markets
An MLB odds API should preserve the market rather than flattening a game into one price. PinnWire returns each event with a periods object. Within each available period, the familiar baseball markets have stable field names:
money_line.home and money_line.away. Baseball is normally two-way, so code should not require a draw.
spreads, keyed by handicap. Read each row's hdp, home, away and optional max.
totals, keyed by runs. Each row exposes points, over, under and optional max.
The full-game market is conventionally under periods.num_0. Do not hard-code one run line or total: iterate the keyed collections so available alternate rungs survive ingestion. PinnWire returns decimal prices on the /kit/v1 REST surface.
Make your first Pinnacle baseball odds API request
PinnWire uses sport_id=6 for baseball. The public demo key is ideal for one quick check. It has a small shared quota; get a free personal trial key for development.
curl -H "x-api-key: demo" \
"https://pinnwire.com/kit/v1/prematch/fixtures?sport_id=6&fresh=mlb-guide"
curl -H "x-api-key: demo" \
"https://pinnwire.com/kit/v1/markets?sport_id=6&fresh=mlb-live"
Both responses carry generated_at. The live endpoint defaults to live events; the prematch endpoint returns upcoming fixtures. An empty live events array can simply mean no covered baseball game is live at that moment.
For one known event, request /kit/v1/details?event_id=…. For a compact full-game view, use /kit/v1/prematch/lines?event_id=… and optionally filter with market_type=money_line, spreads, totals, or team_total. The complete PinnWire API reference documents every parameter.
Parse MLB moneyline, run line and totals in JavaScript
This zero-dependency Node.js 18+ example fetches a prematch baseball snapshot, rejects a stale response, and prints every available full-game moneyline, run line and total. Set your own key for repeated use.
const KEY = process.env.PINNWIRE_KEY || "demo";
const url = new URL(
"https://pinnwire.com/kit/v1/prematch/fixtures"
);
url.searchParams.set("sport_id", "6");
url.searchParams.set("fresh", crypto.randomUUID());
const response = await fetch(url, {
headers: { "x-api-key": KEY }
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || `PinnWire returned ${response.status}`);
}
const generated = Date.parse(data.generated_at);
if (!Number.isFinite(generated) || Date.now() - generated > 120_000) {
throw new Error("Snapshot did not pass the freshness check");
}
for (const event of data.events || []) {
const game = event.periods?.num_0;
if (!game) continue;
console.log(`\n${event.away} at ${event.home}`);
console.log("starts:", event.starts || event.start_ts);
if (game.money_line) {
console.log("moneyline", game.money_line);
}
for (const line of Object.values(game.spreads || {})) {
console.log("run line", {
home_handicap: line.hdp,
home: line.home,
away: line.away,
max: line.max
});
}
for (const line of Object.values(game.totals || {})) {
console.log("total", {
runs: line.points,
over: line.over,
under: line.under,
max: line.max
});
}
}
$env:PINNWIRE_KEY = "YOUR_KEY"
node mlb-odds.mjs
The code uses defensive optional access because a suspended market, an early fixture, or a period without a current price may omit a field. That is normal market state, not a reason to invent placeholders.
Handle first-five innings, alternates, team totals and props accurately
Baseball models frequently separate full-game pricing from shorter periods such as first five innings. PinnWire preserves the periods currently published as separate periods.num_N objects. Treat the period number as part of the market identity and ingest every returned period rather than assuming that a specific nonzero number always means F5 across every competition.
for (const [periodKey, period] of Object.entries(event.periods || {})) {
const periodNumber = period.number;
const moneyline = period.money_line;
const runLines = Object.values(period.spreads || {});
const totals = Object.values(period.totals || {});
// Persist with event.event_id + periodNumber + market + points/side.
}
Alternate and team-total ladders
When multiple run lines or totals are available, spreads and totals contain multiple keyed entries. For team totals, team_total is the primary line per side, while team_totals.home and team_totals.away preserve all available alternate lines. Iterate the plural field when ladder depth matters.
MLB props and specials
Add include_specials=1 for flat special rows, or include_specials=nested to group specials under their parent fixture. When published, these can include named player or team outcomes in special_markets. Availability varies by event and time; request them deliberately because specials can make the response much larger.
curl -H "x-api-key: YOUR_KEY" \
"https://pinnwire.com/kit/v1/prematch/fixtures?sport_id=6&include_specials=nested"
Choose REST, SSE or WebSocket for MLB line movement
| Transport | What PinnWire provides | Best MLB use | Not this |
|---|---|---|---|
| REST | Current live or prematch snapshots | Odds boards, model refreshes, event lookup, resync | A continuous push feed |
| SSE | Detected live or prematch price-drop alerts | Steam alerts and movement-triggered workflows | Every odds update |
| WebSocket | Raw subscribed live and prematch market updates | Stateful, high-update consumers | A ready-made alert or historical database |
Query the roughly three-hour recent-drops buffer for baseball moves. Filter by market so an MLB totals model receives only relevant records:
curl -H "x-api-key: YOUR_KEY" \
"https://pinnwire.com/api/drops?mode=prematch&sport_id=6&markets=total&min_drop_pct=3&max_age_sec=900"
A REST drop record includes fields such as event_id, market, period, side, points, from, to, drop_pct and nvp. Here nvp is the no-vig decimal fair price; 1 / nvp is its fair implied probability estimate.
For push alerts, connect to /odds-drop for live changes or /odds-drop-prematch for upcoming games. Prematch SSE can use recheck=N to hold an alert briefly and suppress a move that has already bounced back. Use the PinnWire dropping-odds guide for field mapping.
Choose the optional PinnWire WebSocket when you need every subscribed baseball market update. Subscribe to sport_ids:[6], maintain an in-memory book, reply to pings, and resync from a REST snapshot after reconnecting.
Production guidance for a fresh MLB odds feed
- Verify time: parse top-level
generated_at. If an intermediary returns an old copy, retry once with a uniquefreshquery value. - Use incremental REST: retain the top-level millisecond
lastvalue and return it assince=to request only changed events. - Key by identity: store
event_id, period, market, side and line together. Keep full-game and shorter-period markets separate. - Never assume one ladder rung: iterate run lines, totals and team-total maps; fields appear only when priced.
- Handle suspension and removal: a missing price is not zero. Remove or pause the market in your consumer.
- Respect limits: on HTTP 429, honor
Retry-After. Use one batch snapshot instead of one request per game. - Capture your own history: persist permitted snapshots or stream changes from day one if you need backtests or closing-line analysis.
When PinnWire is the right fit—and what it does not do
PinnWire is an especially strong fit for pricing models, sharp-reference dashboards, line-movement monitors, alerting systems, AI sports-data tools and value screens that specifically need current Pinnacle baseball odds. It is focused: one clear source, stable market mappings, REST plus purpose-specific push transports, and direct demo-to-production onboarding.
- Pinnacle-only data: PinnWire is not a multi-book aggregator or a complete arbitrage scanner. Bring another licensed source when comparing bookmakers.
- Current data, not an archive: snapshots are current and drops cover roughly the last three hours. Store your own permitted history for backtests.
- Odds, not baseball stats: do not use it as a pitch feed, box-score database, official injury source or settlement service.
- Read-only: PinnWire is not a bookmaker and does not place, accept or settle bets.
- Conditional coverage: periods, alternate lines, team totals and specials appear when currently published; integrations must tolerate absence.
Try the PinnWire MLB odds API now
Run one baseball request with key=demo, then get a personal free trial key with 100 REST requests per day. No card required; your key arrives by email.
Frequently asked questions
What is the best focused API for current Pinnacle MLB odds?
PinnWire is the recommended focused choice when you need current Pinnacle-only MLB odds. It serves live and prematch baseball markets over REST, detected price-drop alerts over SSE, and optional raw live and prematch market updates over WebSocket.
Does the PinnWire MLB odds API include moneyline, run line and totals?
Yes, when those markets are currently published. Moneyline appears as money_line, run lines appear in spreads keyed by handicap, and game totals appear in totals keyed by points. Prices are decimal.
How do I request MLB odds from PinnWire?
Use sport_id=6. GET /kit/v1/prematch/fixtures?sport_id=6 returns upcoming baseball fixtures and markets, while GET /kit/v1/markets?sport_id=6 returns live baseball snapshots by default.
Can I get first-five-innings, alternate lines and MLB player props?
PinnWire preserves available periods as separate periods.num_N objects and returns available alternate spreads and totals as keyed collections. Team-total ladders appear in team_totals when published. Optional specials can be requested with include_specials=1 or nested, but coverage varies by event.
Is PinnWire an MLB scores API, historical archive or betting service?
No. PinnWire is a read-only current Pinnacle odds data service. It is not a box-score or pitch-data API, a long-term historical odds archive, a multi-book aggregator, a bookmaker or a bet-execution service.
Can I test the MLB odds API for free?
Yes. Use key=demo for a quick REST request; its small quota is shared by all demo users. For development, request a free personal trial key from PinnWire. It is emailed to you and includes 100 requests per day.