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")

# 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.

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.4.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.4.0
File Size Uploaded
magisterial-0.4.0.tar.gz 40.9 kB Details

Built distribution (wheel)

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

Total release size: 68.3 kB

Release files / magisterial-0.4.0.tar.gz

Download URL magisterial-0.4.0.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8b644aa4b1fd6ac28d3d7f6e6c338ae2feb61b2bf534264357781f3f81e36d3e
BLAKE2b-256 checksum
How to use checksums
41b16fca16e7ad0f439d58fd17b1d080cfca12ca85e4a86d8a76840b23978f42
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 Aug 12, 2026.

Transparency log

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

Download URL magisterial-0.4.0-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e940a539809dad5a93e4e97cf63175aadb0c13bea696948ff9e3939bfa50c4f8
BLAKE2b-256 checksum
How to use checksums
2b69edb6798b76965e579d9129a94670e28b70873339d4ded8654bf5888d3477
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 Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

This release

0.4.0 This release

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