Skip to main content

Magisterial Python SDK

The official Python library for the Magisterial developer API — college sports data across NCAA D1/D2/D3, NAIA, and NJCAA: players, teams, rosters, cross-program careers, games, the live transfer portal, and an agent-backed natural-language query endpoint.

Installation

pip install magisterial

Requires Python 3.10+.

Usage

Create an API key at magisterial.ai/console/api-keys and set MAGISTERIAL_API_KEY (or pass api_key= to the client).

from magisterial import Magisterial

client = Magisterial()

# Search players (auto-pagination follows the cursor for you)
page = client.players.search(
    sport="soccer", division="D1,NAIA,NJCAA-D1", gender="women",
    position="Forward", sort_by="goals",
)
for player in page.auto_paging_iter():
    print(player.name, player.team, player.stats.get("goals"))

# One player's full profile
player = client.players.get(184223, sport="soccer", division="D3")

# Live transfer portal (usage-billed; use `since` for incremental polling)
portal = client.portal.list(sport="basketball", division="D1", status="INC")

# Schools (cross-sport, cross-division institution identity)
schools = client.schools.list(state="MA")
school = client.schools.get(schools.data[0].id)

# Natural-language query (usage-billed): submit and wait for the answer
run = client.query.create_and_poll(
    prompt="Who led the NESCAC in assists this season?",
    sport="soccer", division="D3", gender="men",
)
print(run.answer)

Async

Every method is mirrored on AsyncMagisterial:

import asyncio
from magisterial import AsyncMagisterial

async def main():
    async with AsyncMagisterial() as client:
        page = await client.players.search(sport="soccer", division="D1")
        async for player in page.auto_paging_iter():
            print(player.name)

asyncio.run(main())

Errors

Non-2xx responses raise typed exceptions carrying the API's error envelope:

from magisterial import Magisterial, NotFoundError, RateLimitError

client = Magisterial()
try:
    client.players.get(1, sport="soccer", division="D1")
except NotFoundError as e:
    print(e.error_code)   # "player_not_found"
except RateLimitError as e:
    print(e.retry_after)  # seconds, from the Retry-After header

BillingError (402) means API billing is not enabled or the monthly budget is exhausted — manage both in the developer console.

Retries

Idempotent requests (and players.search) are retried automatically on 429s, 5xx and connection failures — up to max_retries (default 2), honoring the server's Retry-After. Billable creates (query.create, alerts.create) are never retried automatically.

Managed athletes (Enterprise)

Invite an athlete to authorize your platform, then pass their player id as on_behalf_of to teams.coaches for delegated coach-contact reads:

grant = client.athletes.create(184223, sport_path="mens-soccer")
# ... athlete accepts the invitation ...
staff = client.teams.coaches(
    1873, sport="soccer", division="D3", on_behalf_of=184223,
)

client.athletes.list(), .get(), .resend_invite(), .revoke(), and .list_access() manage the grant lifecycle and its audit log.

Types

All request/response models live in magisterial.types and are generated from the published OpenAPI spec (scripts/sync-types.sh), so they cannot drift from the live API contract.

License

MIT

Metadata

Release files for magisterial 0.5.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 magisterial 0.5.0
File Size Uploaded
magisterial-0.5.0.tar.gz 53.3 kB Details

Built distribution (wheel)

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

Total release size: 86.1 kB

Release files / magisterial-0.5.0.tar.gz

Download URL magisterial-0.5.0.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
082532d4654613d4ee4035bae6c5257c62770fab79281e162ac522b7c30c2c34
BLAKE2b-256 checksum
How to use checksums
9564ba8e0f01d643674a3e8c492bd9f2658fb76339025e1856db97042ba54fa4
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 Sep 18, 2026.

Transparency log

Release files / magisterial-0.5.0-py3-none-any.whl

Download URL magisterial-0.5.0-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c50eb6d328a46ec3cc048dd20a31c1a133bcd01ea7edb4f100e4b1e796825ccf
BLAKE2b-256 checksum
How to use checksums
6d788a6fddf55907136c01944fc35b38adc9fd93b3a8478e67c08b147b4f160c
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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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