NBA player search
Every NBA player since 1946 whose name matches: id, name, active, first and last season, current team and link. Exact matches first. Pass next_page back as page; null on the last page.
Every response includes credits_used: the credits this call cost.
Part of the NBA API: 22 endpoints with prices, use cases and example responses.
Parameters
| name | type | description |
|---|---|---|
qrequired | string | Player name or part of it. Example: lebron james |
active | boolean | true active players only, false past players only. |
page | integer | Page number, from 1. |
limit | integer | Results per page (1-100, default 25). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/nba/v1/players/search?q=lebron+james" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/nba/v1/players/search",
params={"q": "lebron james"},
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/nba/v1/players/search");
url.searchParams.set("q", "lebron james");
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": "lebron james","applied_filters": {"active": null},"total": 1,"page": 1,"count": 1,"next_page": null,"players": [{"id": 2544,"name": "LeBron James","last_first": "James, LeBron","active": true,"from_year": 2003,"to_year": 2026,"team_id": 1610612755,"team": "PHI","team_name": "Philadelphia 76ers","slug": "lebron_james","played_games": true,"url": "https://www.nba.com/player/2544/lebron_james"}],"cached": false,"credits_used": 1}