Skip to main content

FighterAPI for Python

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

Install

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

Set your key

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

export FIGHTERAPI_API_KEY=your_key_here
from fighterapi import Client

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

Examples

1. Recent events

list_events filters by season and status. Pass league="pfl" or "bellator" for other promotions.

from fighterapi import Client

client = Client()

events = client.list_events(status="final", limit=3)["events"]
for e in events:
    print(e["event_id"], e["event_date"], e["name"])

2. A fight card

get_event returns the bouts on one event.

from fighterapi import Client

client = Client()

card = client.get_event("600061541")
print(card)

3. A fighter's record

Find the id with search_fighters, then pull his fight history.

from fighterapi import Client

client = Client()

fighter = client.search_fighters("Makhachev", limit=1)["fighters"][0]
fights = client.get_fighter_fights(fighter["fighter_id"], limit=5)
print(fighter["name"], fights)

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 fighterapi 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 "fighterapi[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 fighterapi import Client, APIError, InsufficientCreditsError, RateLimitError

client = Client()
try:
    data = client.list_events()
except InsufficientCreditsError:
    print("Out of credits, top up at https://fighterapi.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 $FIGHTERAPI_API_KEY
    base_url="https://mcp.fighterapi.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_events)).

Method Credits What it does
list_events 1 List events
get_event 2 Event
get_schedule 2 Schedule
get_fight 5 Fight
search_fighters 1 Search fighters
get_fighter 5 Fighter
get_fighter_fights 5 Fighter fights
get_leaders 5 Leaders
get_ratings 2 Ratings
get_odds 5 Odds
get_line_movement 10 Line movement

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

License

MIT

Metadata

Release files for fighterapi 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 fighterapi 0.1.0
File Size Uploaded
fighterapi-0.1.0.tar.gz 12.1 kB Details

Built distribution (wheel)

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

Total release size: 23.6 kB

Release files / fighterapi-0.1.0.tar.gz

Download URL fighterapi-0.1.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
526566886fd0032b0073bf112d0963301d70612b89d7b7698f5d15a20644f229
BLAKE2b-256 checksum
How to use checksums
747a652a9f0d0ce6f8ebf55d3ef2e9c99d28b9117449c60d91c55e273f35395f
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 / fighterapi-0.1.0-py3-none-any.whl

Download URL fighterapi-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a750d598f002e9a077750c4527c4f2d03af200e4251e9cc4c809901646df1fad
BLAKE2b-256 checksum
How to use checksums
d6645b72a6ecfa651f156189d541843fe7cff731f7beca226e35ed20377efab4
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