# Python SDK · pip install ufcalendar · MMA Fight Data API

> The official Python client for the MMA Fight Data API. One method per endpoint, cursor pagination handled, typed errors. Version 0.11.3.

Canonical: https://mmadataapi.com/sdks/python

A thin client over the REST API, one method per endpoint, pagination handled for you.

```bash
pip install ufcalendar
```

Version 0.11.3 on [PyPI](https://pypi.org/project/ufcalendar/), source on [GitHub](https://github.com/UFCalendar/ufcalendar-python).

## First lines

```python
from ufcalendar import FightAPI

api = FightAPI("ufcalendar_...")   # or set UFCALENDAR_API_KEY and call FightAPI()

latest = next(api.events(org="ufc", status="completed", limit=1))
card = api.event(latest["slug"])
for bout in card["card"]:
    r = bout.get("result")
    if r:
        print(bout["fighter_a"]["name"], "vs", bout["fighter_b"]["name"], r["method"], r["round"], r["time"])
```

List methods are generators: iterate and the client follows `next_cursor` for you. Errors raise `FightAPIError` with `status`, `code` and `request_id`.

## Every method

The odds methods return one consensus line across the sportsbooks we track: information only, not betting advice.

| Method | Endpoint | Returns |
| --- | --- | --- |
| `events()` | [`GET /v1/events`](/reference/events#events) | List events (schedule + results) |
| `event()` | [`GET /v1/events/{idOrSlug}`](/reference/events#event-detail) | Event with full card |
| `event_changes()` | [`GET /v1/events/{idOrSlug}/changes`](/reference/events#changes) | Card-change log |
| `changes()` | [`GET /v1/changes`](/reference/events#changes-feed) | Card-change feed across events |
| `event_storylines()` | [`GET /v1/events/{idOrSlug}/storylines`](/reference/events#storylines) | Storylines of one card |
| `event_pickem()` | [`GET /v1/events/{idOrSlug}/pickem`](/reference/events#event-pickem) | Pick'em splits for one card |
| `calendar_ics_url()` | [`GET /v1/calendar/{org}.ics`](/reference/events#calendar) | ICS calendar feed |
| `find_fights()` | [`GET /v1/fights/search`](/reference/fights#fights-search) | Search completed bouts (filtered) |
| `fight()` | [`GET /v1/fights/{id}`](/reference/fights#fight-detail) | One bout |
| `fight_stats()` | [`GET /v1/fights/{id}/stats`](/reference/fights#fight-stats) | Per-fight totals |
| `fight_rounds()` | [`GET /v1/fights/{id}/rounds`](/reference/fights#fight-rounds) | Round-by-round stats |
| `fight_timeline()` | [`GET /v1/fights/{id}/timeline`](/reference/fights#fight-timeline) | In-fight log: actions, stoppages and fouls (Pro+) |
| `fight_positions()` | [`GET /v1/fights/{id}/positions`](/reference/fights#fight-positions) | Position stats: time by range, control by position (Pro+) |
| `fight_odds()` | [`GET /v1/fights/{id}/odds`](/reference/odds#fight-odds) | Consensus odds for one bout |
| `event_odds()` | [`GET /v1/events/{idOrSlug}/odds`](/reference/odds#event-odds) | Consensus odds for one card |
| `fight_odds_history()` | [`GET /v1/fights/{id}/odds/history`](/reference/odds#odds-history) | Consensus line movement (Pro+) |
| `fighters()` | [`GET /v1/fighters`](/reference/fighters#fighters-search) | Roster search |
| `fighter()` | [`GET /v1/fighters/{idOrSlug}`](/reference/fighters#fighter-detail) | Fighter profile |
| `fighter_history()` | [`GET /v1/fighters/{idOrSlug}/history`](/reference/fighters#fighter-history) | Complete career timeline |
| `fighter_stats()` | [`GET /v1/fighters/{idOrSlug}/stats`](/reference/fighters#fighter-stats) | Career statistics |
| `compare()` | [`GET /v1/compare`](/reference/fighters#compare) | Compare two fighters |
| `fighter_discipline()` | [`GET /v1/fighters/{idOrSlug}/discipline`](/reference/fighters#fighter-discipline) | Discipline: fouls committed and drawn (Pro+) |
| `fighter_positions()` | [`GET /v1/fighters/{idOrSlug}/positions`](/reference/fighters#fighter-positions) | Career position profile: time by range, control for and against (Pro+) |
| `roster()` | [`GET /v1/rosters/{org}`](/reference/fighters#rosters) | A promotion's current roster (Pro+) |
| `roster_moves()` | [`GET /v1/rosters/{org}/moves`](/reference/fighters#roster-moves) | Roster moves: signings, departures, retirements (Pro+) |
| `rankings()` | [`GET /v1/rankings/{org}`](/reference/rankings#rankings) | Official board (point-in-time) |
| `division_rankings()` | [`GET /v1/rankings/{org}/{division}`](/reference/rankings#rankings-division) | One division |
| `champions()` | [`GET /v1/champions`](/reference/rankings#champions) | Current champions |
| `fighter_rankings()` | [`GET /v1/fighters/{idOrSlug}/rankings`](/reference/rankings#fighter-rankings) | Ranking history |
| `power_index()` | [`GET /v1/power-index/{org}`](/reference/rankings#power-index-board) | Power Index board |
| `fighter_power_index()` | [`GET /v1/fighters/{idOrSlug}/power-index`](/reference/rankings#fighter-power-index) | Power Index trajectory |
| `matchmaker()` | [`GET /v1/matchmaker/{org}`](/reference/rankings#matchmaker) | Matchmaker board |
| `whos_next()` | [`GET /v1/matchmaker/next/{fighter}`](/reference/rankings#matchmaker-next) | Who should this fighter fight next |
| `predictions_upcoming()` | [`GET /v1/predictions/upcoming`](/reference/rankings#predictions) | Model win probabilities (UFC) |
| `leaderboard()` | [`GET /v1/stats/leaders`](/reference/stats#stats-leaders) | One stat leaderboard |
| `record_book()` | [`GET /v1/stats/record-book`](/reference/stats#record-book) | The Record Book |
| `year_stats()` | [`GET /v1/stats/years/{year}`](/reference/stats#stats-year) | A year in review |
| `fight_scorecards()` | [`GET /v1/fights/{id}/scorecards`](/reference/officials#scorecards) | Judges' scorecards for a bout |
| `split_decisions()` | [`GET /v1/scorecards/splits`](/reference/officials#scorecard-splits) | Split and majority decisions |
| `judges()` | [`GET /v1/judges`](/reference/officials#judges) | Judge directory |
| `judge()` | [`GET /v1/judges/{id}`](/reference/officials#judge-detail) | One judge |
| `judge_scorecards()` | [`GET /v1/judges/{id}/scorecards`](/reference/officials#judge-scorecards) | Everything a judge has scored |
| `referees()` | [`GET /v1/referees`](/reference/officials#referees) | Referee directory |
| `referee()` | [`GET /v1/referees/{slug}`](/reference/officials#referee-detail) | One referee |
| `referee_fights()` | [`GET /v1/referees/{slug}/fights`](/reference/officials#referee-fights) | Bouts a referee worked |
| `orgs()` | [`GET /v1/orgs`](/reference/orgs#orgs) | List launch orgs with capability flags |
| `org()` | [`GET /v1/orgs/{slug}`](/reference/orgs#org-detail) | One org |
| `org_division()` | [`GET /v1/orgs/{slug}/divisions/{division}`](/reference/orgs#org-division) | One division in one promotion |
| `coverage()` | [`GET /v1/coverage`](/reference/orgs#coverage) | Data coverage per promotion |
| `venues()` | [`GET /v1/venues`](/reference/orgs#venues) | Search venues |
| `venue()` | [`GET /v1/venues/{id}`](/reference/orgs#venue-detail) | Venue |
| `venue_events()` | [`GET /v1/venues/{id}/events`](/reference/orgs#venue-events) | Events at a venue |
| `event_watch()` | [`GET /v1/events/{idOrSlug}/watch`](/reference/orgs#event-watch) | How to watch one event |
| `broadcast_rights()` | [`GET /v1/broadcast-rights/{org}`](/reference/orgs#broadcast-rights) | Who airs it, per country |
| `search()` | [`GET /v1/search`](/reference/content#search) | Typeahead search |
| `articles()` | [`GET /v1/articles`](/reference/content#articles) | Search UFCalendar articles |
| `article()` | [`GET /v1/articles/{slug}`](/reference/content#article-detail) | Get an article |
| `plans()` | [`GET /v1/plans`](/reference/account#plans) | Plans, quotas and how to connect (no key required) |
| `usage()` | [`GET /v1/usage`](/reference/account#usage) | Your quota usage |
| `create_webhook_endpoint()` | [`POST /v1/webhook-endpoints`](/reference/account#webhooks) | Register a webhook endpoint |
| `webhook_endpoints()` | [`GET /v1/webhook-endpoints`](/reference/account#webhooks-list) | List your webhook endpoints |
| `rotate_webhook_secret()` | [`POST /v1/webhook-endpoints/{id}/rotate-secret`](/reference/account#webhooks-rotate) | Rotate an endpoint signing secret |
| `delete_webhook_endpoint()` | [`DELETE /v1/webhook-endpoints/{id}`](/reference/account#webhooks-delete) | Delete a webhook endpoint |
