---
title: "SofaScore event at-bats"
method: GET
path: "/sofascore/event-at-bats"
tags: ["SofaScore"]
---

# SofaScore event at-bats

`GET /sofascore/event-at-bats`

## Request

- Base URL: `https://api.crawlora.net/api/v1`
- URL: `https://api.crawlora.net/api/v1/sofascore/event-at-bats`
- Auth: API key in header `x-api-key`

Returns a baseball match's at-bat timeline from SofaScore, in play order: for each plate appearance the inning and half (`top` or `bottom`), pitcher, hitter, their teams, when it ended and the home and away win probabilities before and after it. Use an at-bat `id` with sofascore-event-at-bat-pitches to read its pitches. Returns 404 when SofaScore has no at-bat data for the match, which includes matches that have not started and sports other than baseball.

## Query parameters

- `id` string, required

## Headers

- `x-api-key` string, required

## Response `200`

OK

- SofascoreEventAtBatsResponseDoc
  - `code` integer
  - `data` SofascoreEventAtBatsResponse
    - `at_bats` SofascoreBaseballAtBat[]
      - `away_win_probability` number
      - `away_win_probability_start` number
      - `end_time` string
      - `end_timestamp` integer: EndTimestamp is the Unix time the at-bat finished (it matches the end of its last pitch); EndTime is the same instant in RFC 3339.
      - `hitter` SofascorePlayerBrief
        - `id` integer
        - `jersey_number` string
        - `name` string
        - `position` string
        - `short_name` string
        - `slug` string
      - `hitter_team` SofascoreTeamRef
        - `country` string: Country the team belongs to.
        - `id` integer: SofaScore team id. Use it with the team endpoints.
        - `name` string: Full team name.
        - `national` boolean: True for a national team.
        - `short_name` string: Shortened team name.
        - `slug` string: URL slug of the team on SofaScore.
      - `home_win_probability` number
      - `home_win_probability_start` number: Win probabilities are percentages. The *Start values are before the at-bat, the others after it.
      - `id` integer
      - `inning` integer
      - `inning_half` string: InningHalf is `top` or `bottom`.
      - `pitcher` SofascorePlayerBrief
        - `id` integer
        - `jersey_number` string
        - `name` string
        - `position` string
        - `short_name` string
        - `slug` string
      - `pitcher_team` SofascoreTeamRef
        - `country` string: Country the team belongs to.
        - `id` integer: SofaScore team id. Use it with the team endpoints.
        - `name` string: Full team name.
        - `national` boolean: True for a national team.
        - `short_name` string: Shortened team name.
        - `slug` string: URL slug of the team on SofaScore.
    - `count` integer
    - `event_id` integer
    - `fetched_at` string
    - `source_url` string
  - `msg` string

## Other responses

- `400`: Bad Request
- `404`: Not Found
- `429`: Too Many Requests
- `503`: Service Unavailable

---

[API](https://skmtc.dev/crawlora/apis/crawlora-api.md) · [All operations](https://skmtc.dev/crawlora/apis/crawlora-api/llms.txt) · [OpenAPI document](https://skmtc.dev/crawlora/apis/crawlora-api/revisions/afac9b012a27?raw)
