GET/api/v1/game/{gamePk}/contextMetrics
Context metrics
Win probability and situational metrics for current state.
On this page
Try it
https://statsapi.mlb.com/api/v1/game/744914/contextMetricsconst res = await fetch('https://statsapi.mlb.com/api/v1/game/744914/contextMetrics')
const data = await res.json()curl -s 'https://statsapi.mlb.com/api/v1/game/744914/contextMetrics'
Reference
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
gamePk | number | yes | Game id from the schedule endpoint. |
Response
Type: ContextMetricsResponse
/** `GET /api/v1/game/{gamePk}/contextMetrics` — partial. */
export interface ContextMetricsResponse {
game: Record<string, unknown>
awayWinProbability?: number
homeWinProbability?: number
[key: string]: unknown
}Build with it
Live examples powered by this endpoint with real data. Inspiration — restyle and remix freely.
Win-probability gauge
A live split bar of each team’s chance to win, right now.
Finding a game…
Example URLs
- Context metrics for a game:
https://statsapi.mlb.com/api/v1/game/744914/contextMetrics