NHL player search
Players (current and past) matching a name: id, name, position, team, last season, number, height, weight, birth city and country, and whether active.
Every response includes credits_used: the credits this call cost.
Part of the NHL API: 20 endpoints with prices, use cases and example responses.
Parameters
| name | type | description |
|---|---|---|
qrequired | string | Player name or part of it. Example: mcdavid |
active | boolean | true active players only, false retired only. |
limit | integer | Results (1-100, default 20). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/nhl/v1/players/search?q=mcdavid" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/nhl/v1/players/search",
params={"q": "mcdavid"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/nhl/v1/players/search");
url.searchParams.set("q", "mcdavid");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).
Example response (real call, trimmed: lists cut to 2 items, long text shortened, raw left out)
{"q": "mcdavid","applied_filters": {"active": null},"count": 2,"players": [{"player_id": 8457287,"name": "Brian McDavid","position_code": "D","team_id": null,"team_abbrev": null,"last_team_id": null,"last_team_abbrev": null,"last_season_id": null,"sweater_number": null,"active": false,"height": "6'1\"","height_in_inches": 73,"height_in_centimeters": 185,"weight_in_pounds": 190,"weight_in_kilograms": 86,"birth_city": "Sudbury","birth_state_province": "ON","birth_country": "CAN","url": "https://www.nhl.com/player/8457287"},{"player_id": 8478402,"name": "Connor McDavid","position_code": "C","team_id": "22","team_abbrev": "EDM","last_team_id": "22","last_team_abbrev": "EDM","last_season_id": "20262027","sweater_number": 97,"active": true,"height": "6'2\"","height_in_inches": 74,"height_in_centimeters": 188,"weight_in_pounds": 190,"weight_in_kilograms": 86,"birth_city": "Richmond Hill","birth_state_province": "ON","birth_country": "CAN","url": "https://www.nhl.com/player/8478402"}],"cached": false,"credits_used": 1}