# Search MLB players by name API

Search MLB and minor-league players by partial name via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as limit, output, q, and retrieve structured data including submitted player search query, MLB player identifier, player full name, active player status flag, and primary position abbreviation to resolve ids for downstream calls, build player autocomplete boxes, and search retired legends or prospects.

Documentation: https://openany.si/mlb-stats/mlb-stats-search-mlb-players-by-name-api/e9304d1a-5141-408a-ace7-f90a9cbb99ea/
API ID: e9304d1a-5141-408a-ace7-f90a9cbb99ea
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/mlb/v1/players/search
Page update time: 2026-12-03T02:44:17.272Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:44:15.607Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Usage and limits
## MLB Player Search API

Pass q (at least 2 characters of a player's name) with optional active (true or false), limit (default 25, max 100) and sport\_id (1 MLB default, or minor-league levels). Returned players\[\] provide numeric player IDs, positions, handedness, current\_team, mlb\_debut and MLB.com URLs.

## What You Can Build

- **Resolve IDs for downstream calls**: Look up players\[\].id by name before calling MLB Player Profile API or MLB Player Stats API.
- **Build player autocomplete boxes**: Filter with active=true and limit=10 to deliver fast search suggestions for current MLB players.
- **Search retired legends or prospects**: Set active=false for historical players or use sport\_id=11..16 to find minor-league prospects.

## Returned Data

| Field | Meaning |
| --- | --- |
| `q` | Submitted player search query |
| `count` | Number of matching players returned |
| `players[].id` | MLB player identifier |
| `players[].name` | Player full name |
| `players[].active` | Active player status flag |
| `players[].position` | Primary position abbreviation |
| `players[].jersey` | Uniform jersey number |
| `players[].current_team.name` | Current club full name |
| `players[].mlb_debut` | MLB debut date |
| `players[].url` | Source MLB.com player profile URL |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Search MLB players by name API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "description": "Part of a player's name (2+ characters)."
        },
        "active": {
          "type": "string",
          "description": "true or false to limit to active or retired players.",
          "enum": [
            "true",
            "false"
          ]
        },
        "limit": {
          "type": "integer",
          "description": "Max results (default 25, max 100)."
        },
        "sport_id": {
          "type": "string",
          "description": "Level: 1 MLB (default), 11 Triple-A, 12 Double-A, 13 High-A, 14 Single-A, 16 Rookie, 17 winter leagues, 51 international.",
          "enum": [
            "1",
            "11",
            "12",
            "13",
            "14",
            "16",
            "17",
            "21",
            "22",
            "23",
            "51",
            "586"
          ]
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      },
      "required": [
        "q"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "applied_filters": {
      "type": "object",
      "properties": {
        "active": {
          "type": "null"
        },
        "sport_id": {
          "type": "integer"
        }
      }
    },
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "players": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean"
          },
          "bats": {
            "type": "string"
          },
          "birth_country": {
            "type": "string"
          },
          "birth_date": {
            "type": "string"
          },
          "current_team": {
            "type": "object",
            "properties": {
              "abbreviation": {
                "type": "null"
              },
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "id": {
            "type": "integer"
          },
          "jersey": {
            "type": "string"
          },
          "mlb_debut": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "string"
          },
          "throws": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      }
    },
    "q": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/mlb/v1/players/search?limit=1&output=json&q=ohtani&raw=0' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "applied_filters": {
    "active": null,
    "sport_id": 1
  },
  "cached": false,
  "count": 1,
  "credits_used": 1,
  "fetched_at": "2026-11-19T12:22:05.818Z",
  "players": [
    {
      "active": true,
      "bats": "L",
      "birth_country": "Japan",
      "birth_date": "1994-07-05",
      "current_team": {
        "abbreviation": null,
        "id": 119,
        "name": "Los Angeles Dodgers"
      },
      "id": 660271,
      "jersey": "17",
      "mlb_debut": "2018-03-29",
      "name": "Shohei Ohtani",
      "position": "TWP",
      "throws": "R",
      "url": "https://www.mlb.com/player/shohei-ohtani-660271"
    }
  ],
  "q": "ohtani"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### What is the minimum query length for q?
Pass at least 2 characters of a player's name in the required q parameter.

### Can I limit results to active or retired players?
Yes. Set active=true for active players or active=false for retired players.

### How many matching players can be returned per request?
limit defaults to 25 and accepts up to 100 matching players per call.

### Can I search minor-league players with this endpoint?
Yes. Set sport_id to 11 (Triple-A), 12 (Double-A), 13 (High-A), 14 (Single-A), 16 (Rookie), 17 (winter) or 51 (international).

### How do I fetch full stats or awards for a matched player?
Pass players[].id to the MLB Player Profile API or MLB Player Stats API.

### How do caching and response trimming work?
Pass fresh=1 to skip the 24-hour cache, raw=0 to omit bulky raw blocks and fields to select specific keys.

## Available implementations
- apish: https://openany.si/mlb-stats/mlb-stats-search-mlb-players-by-name-api/e9304d1a-5141-408a-ace7-f90a9cbb99ea/

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
