MLB API endpoint
Returns the same anonymous MLB typeahead categories used by MLB.com: player suggestions, team suggestions, content topics, and search terms. Queries need at least three characters.
/mlb/searchQuery parameter q is required and must contain 3 to 100 characters. The endpoint mirrors MLB.com's anonymous typeahead and returns player suggestions, team suggestions, editorial topics, and suggested search terms. The sport is pinned to MLB (sportId=1). An empty array for a suggestion category means there are no matches for that category.
The response topic list includes the upstream tags collection with name, display_name, fields, and slug. Team suggestions include id, name, display_name, sport_id, tri_code, team_name, franchise_name, club_name, and logo variants. Player suggestions include id, name, display_name, team_id, team_tri_code, active, and headshots.
| Field | Filled in, of 8 checked | Values in the sample |
|---|---|---|
| name | 8 | “Yankees Beyond the Diamond” and 7 other values |
| fields | 8 | median 1 entry |
| slug | 8 |
| Parameter | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
| q | string | Yes | Search text; 3-100 characters | Yankees | |
| x-api-key (header) | string | Yes | API key required |
curl -X GET "https://api.crawlora.net/api/v1/mlb/search?q=Yankees" \ -H "x-api-key: $CRAWLORA_API_KEY"
{
"code": 200,
"msg": "OK",
"data": {
"query": "Yankees",
"players": [],
"teams": [
{
"id": 147,
"name": "New York Yankees",
"team_name": "Yankees",
"franchise_name": "New York",
"club_name": "Yankees",
"tri_code": "NYY"
}
],
"search_terms": [],
"topics": [
{
"name": "Yankees Game Highlights",
"slug": "nyy-game-highlights"
}
]
}
}Request schema
No body schema
Response schema
#/definitions/mlb.searchResponseDoc
| Field | Type | Required | Enum | Bounds | Example | Description |
|---|---|---|---|---|---|---|
| code | integer | No | 200 | |||
| data | mlb.SearchResponse | No | ||||
| data.fetched_at | string | No | ||||
| data.players | array | No | ||||
| data.players[].active | boolean | No | ||||
| data.players[].boxscore_name | string | No | ||||
| data.players[].display_name | string | No | ||||
| data.players[].headshots | array | No | ||||
| data.players[].headshots[].type | string | No | ||||
| data.players[].headshots[].url | string | No | ||||
| data.players[].id | integer | No | ||||
| data.players[].name | string | No | ||||
| data.players[].team_id | integer | No | ||||
| data.players[].team_tri_code | string | No | ||||
| data.players[].use_last_name | string | No | ||||
| data.players[].use_name | string | No | ||||
| data.query | string | No | ||||
| data.search_terms | array | No | ||||
| data.search_terms[].display_name | string | No | ||||
| data.search_terms[].name | string | No | ||||
| data.source_url | string | No | ||||
| data.teams | array | No | ||||
| data.teams[].club_name | string | No | ||||
| data.teams[].display_name | string | No | ||||
| data.teams[].franchise_name | string | No | ||||
| data.teams[].id | integer | No | ||||
| data.teams[].logos | array | No | ||||
| data.teams[].logos[].type | string | No | ||||
| data.teams[].logos[].url | string | No | ||||
| data.teams[].name | string | No | ||||
| data.teams[].sport_id | integer | No | ||||
| data.teams[].team_name | string | No | ||||
| data.teams[].tri_code | string | No | ||||
| data.topics | array | No | ||||
| data.topics[].display_name | string | No | ||||
| data.topics[].fields | array | No | ||||
| data.topics[].name | string | No | ||||
| data.topics[].slug | string | No | ||||
| msg | string | No | OK |
| Status | Description | Schema |
|---|---|---|
| 400 | Bad Request | #/definitions/app.Response |
| 503 | Service Unavailable | #/definitions/app.Response |
Use environment variables for secrets and keep Crawlora API keys server-side.
curl -X GET "https://api.crawlora.net/api/v1/mlb/search?q=Yankees" \
-H "x-api-key: $CRAWLORA_API_KEY"