# Get New York Yankees Roster and Player Stats from MLB

**Use case:** 

Extract the current New York Yankees active roster directly from the MLB Stats API. This task returns detailed player bios and season performance metrics, including batting average, home runs, and RBIs. Ideal for fantasy baseball managers and sports developers, it provides fields like fullName, primaryPosition, and jerseyNumber. Change the teamIds to follow other clubs.

## Input

```json
{
  "mode": "getPlayers",
  "seasons": [
    "2024"
  ],
  "teamIds": [
    "Yankees"
  ],
  "playerIds": [],
  "gamePks": [],
  "startDate": "2026-06-01",
  "endDate": "2026-06-07",
  "statGroup": "hitting",
  "statType": "season",
  "rosterType": "active",
  "leagueId": "both",
  "gameType": "R",
  "leaderCategory": "homeRuns",
  "referenceType": "venues",
  "includeStats": true,
  "includeTeamTotals": false,
  "maxItems": 40
}
```

## Output

```json
{
  "recordType": {
    "label": "Record type"
  },
  "playerName": {
    "label": "Player name"
  },
  "teamName": {
    "label": "Team name"
  },
  "gamePk": {
    "label": "Game pk"
  },
  "officialDate": {
    "label": "Official date"
  },
  "statGroup": {
    "label": "Stat group"
  },
  "leaderCategory": {
    "label": "Leader category"
  },
  "rank": {
    "label": "Rank"
  },
  "value": {
    "label": "Value"
  },
  "homeRuns": {
    "label": "Home runs"
  },
  "battingAverage": {
    "label": "Batting average"
  },
  "era": {
    "label": "Era"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Official MLB Team, Schedule & Stat Line Scraper Actor is ready to run with the inputs already set for "Get New York Yankees Roster and Player Stats from MLB". [Sign up or log in](https://console.apify.com/create-task-from-example/72kdkM4xYJcrNy7IA) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Get New York Yankees Roster and Player Stats from MLB" task

The Official MLB Team, Schedule & Stat Line Scraper Actor will start running based on the input automatically. You can also change all the input fields, like mode, seasons, and more, to match your specific use case.

### 3. Receive the "Get New York Yankees Roster and Player Stats from MLB" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as record type, player name, team name, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Get New York Yankees Roster and Player Stats from MLB" task via API](https://apify.com/dataspryva/official-mlb-team-schedule-and-stat-line-scraper.md).

## FAQ

### How do I get the MLB Yankees active roster?

The MLB roster task returns Yankees player bios and roster details from MLB’s public Stats API. The supplied settings select the active roster; use “Try for free” to copy them into your account and run the task.

### What data does the MLB Yankees roster include?

The MLB roster task can return player names, positions, jersey numbers, bios, and other roster details. With stats enabled, it attaches season stats for the selected stat group.

### How do I get another MLB team's roster?

In the MLB roster task, change the team selection to an MLB team ID, name, abbreviation, or team URL. For example, the Yankees ID is 147 and their abbreviation is NYY.

### Can I export the MLB Yankees roster to CSV or Excel?

After running the MLB roster task, download its dataset as CSV, Excel, JSON, XML, RSS, or an HTML table, or read the results through the Apify API.

### Can I run the MLB Yankees roster on a schedule or through an API?

You can run the MLB roster task on an Apify schedule, through the Apify API, or using integrations such as Zapier, Make, and n8n.

## About this Actor

This example demonstrates how to use [Official MLB Team, Schedule & Stat Line Scraper](https://apify.com/dataspryva/official-mlb-team-schedule-and-stat-line-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/dataspryva/official-mlb-team-schedule-and-stat-line-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/dataspryva/official-mlb-team-schedule-and-stat-line-scraper.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
