Skip to main content

AcesAPI for Python

Python client for the AcesAPI tennis data API. It has no required dependencies (standard library only) and works on Python 3.9 and newer. Pandas is optional.

Install

pip install acesapi
pip install "acesapi[pandas]"   # only if you want DataFrames

Set your key

Get a free key at https://acesapi.com/signup. Free accounts get 500 credits a month.

export ACESAPI_API_KEY=your_key_here
from acesapi import Client

client = Client()                      # reads ACESAPI_API_KEY
client = Client(api_key="your_key")    # or pass it in

Examples

1. Current rankings

ATP is the default tour. Pass league="wta" for the women's tour.

from acesapi import Client

client = Client()

ranks = client.get_rankings(limit=5)
for row in ranks["rankings"]:
    print(row["rank"], row["name"], row["points"])

2. Head to head

Look up two player ids with search_players, then compare them.

from acesapi import Client

client = Client()

sinner = client.search_players(name="Sinner", limit=1)["players"][0]
alcaraz = client.search_players(name="Alcaraz", limit=1)["players"][0]
h2h = client.get_head_to_head(sinner["player_id"], alcaraz["player_id"])
print(sinner["name"], "vs", alcaraz["name"])
print("matches:", h2h["summary"]["matches"])
print("wins:", h2h["summary"]["wins"])

3. Results by surface

get_surface_splits shows how a player does on hard, clay and grass.

from acesapi import Client

client = Client()

sinner = client.search_players(name="Sinner", limit=1)["players"][0]
splits = client.get_surface_splits(sinner["player_id"])
for row in splits["splits"]:
    print(row["surface"], row["wins"], "-", row["losses"], row["win_pct"])

Credits

Every method returns the data object from the response. After each call, client.last_credits_used and client.last_credits_remaining hold the counters from the X-Credits-Used and X-Credits-Remaining headers. Methods that take estimate_only=True return the price of a call without running or charging it.

Pandas

from acesapi import to_dataframe

df = to_dataframe(data)                # finds the main list in the response
df = to_dataframe(data, key="rows")    # or name the list yourself

Nested fields become dotted columns. Install pandas separately or with pip install "acesapi[pandas]".

Errors

Every error is an APIError subclass, with the server's message and the HTTP status.

Exception Status Meaning
AuthError 401 Missing, invalid or revoked key
InsufficientCreditsError 402 Not enough credits for the call
NotFoundError 404 The id or name does not exist
RateLimitError 429 Too many requests; has .retry_after when the server sends it
APIError 400, 5xx Bad arguments or a server problem
APIConnectionError none No response (network or timeout)
from acesapi import Client, APIError, InsufficientCreditsError, RateLimitError

client = Client()
try:
    data = client.list_tournaments()
except InsufficientCreditsError:
    print("Out of credits, top up at https://acesapi.com")
except RateLimitError as exc:
    print("Slow down, retry after", exc.retry_after)
except APIError as exc:
    print(exc.status_code, exc.message)

The client retries 429 and 5xx responses and connection failures up to 3 times with backoff, and honors Retry-After. Set Client(max_retries=0) to turn that off.

If you see CERTIFICATE_VERIFY_FAILED on a python.org install for macOS, run the "Install Certificates.command" script that came with Python, or pip install certifi (the client uses it when present).

Options

Client(
    api_key=None,                          # defaults to $ACESAPI_API_KEY
    base_url="https://mcp.acesapi.com",           # point at another host
    timeout=60.0,                          # seconds per request
    max_retries=3,
)

client.call("tool_name", {"arg": "value"}) calls any tool by name, which helps when the API adds a tool before this package does.

Tools

Method names match the API tool names. Arguments are keyword arguments; required ones can also be passed positionally. Each method's docstring lists its arguments (help(client.list_tournaments)).

Method Credits What it does
list_tournaments 1 List tournaments
get_tournament 2 Tournament
get_matches 2 Matches
get_schedule 2 Schedule
get_match 2 Match
search_players 1 Search players
get_player 5 Player
get_player_matches 5 Player matches
get_head_to_head 3 Head to head
get_surface_splits 3 Surface splits
get_player_stats 3 Player stats
get_rankings 2 Rankings
get_ratings 2 Ratings

Full API reference: https://acesapi.com/docs

License

MIT

Metadata

Release files for acesapi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for acesapi 0.1.0
File Size Uploaded
acesapi-0.1.0.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for acesapi 0.1.0
File Interpreter ABI Platform
acesapi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.5 kB

Release files / acesapi-0.1.0.tar.gz

Download URL acesapi-0.1.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cc443e525281b3052ddf70966fd87687c1a94c680b2f8d42a5c90fa61d592675
BLAKE2b-256 checksum
How to use checksums
e46ae8605389cea8e8ddd2426f0835c15392814e0902356b83010061d599fadd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / acesapi-0.1.0-py3-none-any.whl

Download URL acesapi-0.1.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ec36a93b25c144f7ec0ba95b5ba3f7858616c947e452db5d4e30f37ca912d7c
BLAKE2b-256 checksum
How to use checksums
ecf7b05a6bc9f48ea3cfb83980eb7a5ecc9ac73005ca277b5179b3711bc81add
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page