acesapi
v0.2.0
Published
JavaScript and TypeScript client for the AcesAPI Tennis data API: stats, play-by-play, odds and player props. No dependencies.
Maintainers
Readme
acesapi
Tennis data and odds API. JavaScript and TypeScript client for the AcesAPI Tennis data API. No dependencies; Node 18+, Deno, Bun, and edge runtimes with fetch.
First call in plain Python
No package needed: standard library only. Set ACESAPI_API_KEY to your key (free at https://acesapi.com/signup) and run this. search_players costs 1 credit.
import json, os, urllib.request
req = urllib.request.Request(
"https://mcp.acesapi.com/v1/search_players",
data=json.dumps({"name": "sinner"}).encode(),
headers={"x-api-key": os.environ["ACESAPI_API_KEY"], "content-type": "application/json"},
)
with urllib.request.urlopen(req) as resp:
data = json.load(resp)["data"]
print("credits left:", resp.headers["x-credits-remaining"])
rows = next(v for v in data.values() if isinstance(v, list))
for row in rows[:5]:
print(row)Every tool works the same way: POST https://mcp.acesapi.com/v1/, JSON in, {"data": ...} out, with X-Credits-Used and X-Credits-Remaining headers.
AcesAPI at a glance
- Tennis data and odds API: ATP and WTA tennis since 2007: sets, draws, rankings, head to head, surface Elo, sportsbook lines.
- 15 tools, every one on the free plan. Each call costs 1 to 5 credits; the table below has every price.
- Free: 500 credits every month, no card. Plans: Starter $19/month (10,000 credits), Pro $49/month (30,000 credits), Scale $149/month (125,000 credits), Business $299/month (300,000 credits). Top-ups: 400 credits per $1, from $5.
- MCP server: https://mcp.acesapi.com/mcp?key=YOUR_API_KEY (or the key in an
x-api-keyheader; Claude and ChatGPT connect with a sign-in instead) - REST: POST https://mcp.acesapi.com/v1/ with your key in an
x-api-keyheader and the arguments as a JSON body. - Python:
pip install acesapi. JavaScript:npm install acesapi - Matches: Since 2007. ATP and WTA singles, main draws from 2007 and qualifying from 2022, with every set and tiebreak score.
- Rankings: Weekly. The weekly top 100 to 150 for both tours since 2007, 35 to 49 lists a year.
- Ratings: By surface. Our Elo for every player, overall and on hard, clay and grass, before and after every match.
| Credits | Tools | | --- | --- | | 1 | get_data_status, list_tournaments, search_players | | 2 | get_tournament, get_matches, get_schedule, get_match, get_rankings, get_ratings | | 3 | get_head_to_head, get_surface_splits, get_player_stats | | 5 | get_odds, get_player, get_player_matches |
Install
npm install acesapiGet a free key (500 credits every month, no card) at https://acesapi.com/signup?utm_source=npm&utm_medium=readme&utm_campaign=acesapi-js and set ACESAPI_API_KEY.
import { Client } from "acesapi"
const client = new Client() // reads ACESAPI_API_KEY, or new Client({ apiKey: "..." })
const data = await client.getRankings({"limit":5})
console.log(data)
console.log("credits left:", client.lastCreditsRemaining)Every method takes one object with the API's parameter names and returns the unwrapped data. client.call("tool_name", {...}) reaches any tool newer than this package. Errors are typed: AuthError (401), InsufficientCreditsError (402), NotFoundError (404), RateLimitError (429, with retryAfter), APIError otherwise. 429 and 5xx responses are retried with backoff.
Load a whole season
client.loadSeason(dataset, season) pulls every page of one dataset for a season and returns an array of row objects. Nested fields become dotted keys (home.abbrev).
const rows = await client.loadSeason("matches", 2025) // first call: pages through the API
const again = await client.loadSeason("matches", 2025) // second call: read from ~/.cache/acesapi/, no requests
await client.loadSeason("matches", 2025, { refresh: true }) // pull againSeasons are calendar years. ATP by default; pass params: { league: "wta" } for the women's tour.
| Dataset | Tool | What a row is | Requests for a typical season | Credits for a typical season |
| --- | --- | --- | --- | --- |
| matches | getMatches | every ATP match (league="wta" for the women's tour) with set scores | 6 | 12 |
| tournaments | listTournaments | a season's tournaments with surface and champion | 1 | 1 |
Price a big pull first
Every request costs the tool's normal credits. Per-game datasets (plays, odds and props by game) make one request per played game, so a full season is thousands of credits. Ask first:
console.log(await client.loadSeason("matches", 2025, { estimate: true }))
// { dataset: "matches", season: ..., calls: ..., credits: ..., basis: ..., data_calls: 0 }estimate: true makes no data requests and spends nothing. Where the tool accepts estimate_only (season-wide odds, props) it asks the server for the price; it uses the games already in your cache when there are some, and typical season sizes otherwise. The numbers in the table are the same typical sizes: they are approximate, an order of magnitude and not a quote.
maxCalls(default 100) stops a pull that turns out larger than expected. It throwsLoadLimitError, which holds the rows fetched so far (err.rows), and caches nothing. Raise it deliberately for a big pull.- Extra tool arguments go in
params({ team: "BOS" },{ league: "mls" }). Do not pass the season, paging or date arguments:loadSeasonsets them. - In Node the result is cached as JSON lines under
~/.cache/acesapi/(cacheDirorACESAPI_CACHE_DIRmoves it,cache: falseskips it). Browsers and other runtimes withoutnode:fshave no cache. client.lastLoadreports the last load:rows,calls,creditsUsedandcached.- Per-game datasets skip games that start today or later.
Tools
| Method | What it returns | Credits |
| --- | --- | --- |
| listTournaments | List tournaments | 1 |
| getTournament | Tournament | 2 |
| getMatches | Matches | 2 |
| getSchedule | Schedule | 2 |
| getMatch | Match | 2 |
| searchPlayers | Search players | 1 |
| getPlayer | Player | 5 |
| getPlayerMatches | Player matches | 5 |
| getHeadToHead | Head to head | 3 |
| getSurfaceSplits | Surface splits | 3 |
| getPlayerStats | Player stats | 3 |
| getRankings | Rankings | 2 |
| getRatings | Ratings | 2 |
| getOdds | Odds | 5 |
| getDataStatus | Data status | 1 |
Full reference with response shapes: https://acesapi.com/docs?utm_source=npm&utm_medium=readme&utm_campaign=acesapi-js. The same data is available as a hosted MCP server for Claude, ChatGPT and Cursor: https://acesapi.com/mcp. A Python client is on PyPI: pip install acesapi.
MIT licensed.
