Unofficial Python SDK for the Halo Infinite web API.
Project description
Welcome to SPNKr
SPNKr is an async Python SDK for the undocumented Halo Infinite web API.
It is intended for personal analysis workflows (match history, skill/rank data, metadata, and theater film parsing). The project is unofficial and provided as-is.
- Documentation: https://acurtis166.github.io/SPNKr/
- PyPI: https://pypi.org/project/spnkr/
- GitHub: https://github.com/acurtis166/spnkr
What You Can Do
- Request player match history, service records, and match stats.
- Retrieve skill/MMR/CSR data by match or playlist.
- Resolve player profile data (XUID <-> gamertag).
- Fetch content metadata (maps, modes, playlists, medals, season data).
- Access economy/customization-related endpoints.
- Download and parse theater film highlight events.
Install
Requires Python >= 3.11.
pip install spnkr
Optional caching support:
pip install "spnkr[cache]"
Quickstart
1. Get tokens
SPNKr needs these Halo headers:
x-343-authorization-spartan343-clearance
You can get them in two ways:
- Manual (fastest): copy headers from Halo Waypoint network traffic.
- Programmatic (recommended): use Azure app registration + refresh flow.
Detailed steps are in the docs:
2. Create the client
import asyncio
from aiohttp import ClientSession
from spnkr import HaloInfiniteClient
async def main() -> None:
async with ClientSession() as session:
client = HaloInfiniteClient(
session=session,
spartan_token="SPARTAN_TOKEN",
clearance_token="CLEARANCE_TOKEN",
requests_per_second=5,
)
# Accepts gamertag, raw XUID, or wrapped xuid(...) formats.
resp = await client.stats.get_match_history("MyGamertag", start=0, count=5)
history = await resp.parse()
if history.results:
latest = history.results[0].match_info
print(f"Latest match start: {latest.start_time:%Y-%m-%d %H:%M:%S}")
if __name__ == "__main__":
asyncio.run(main())
3. Refresh tokens when needed
Spartan tokens are short-lived. If you already have replacement tokens, update an existing client without recreating it:
client.set_tokens(spartan_token="NEW_SPARTAN", clearance_token="NEW_CLEARANCE")
For automated token refresh, see auth helpers:
authenticate_playerrefresh_player_tokens
Reference: https://acurtis166.github.io/SPNKr/reference/authentication/
Service Overview
HaloInfiniteClient exposes service properties for the main API domains:
| Property | Purpose |
|---|---|
client.stats |
Match history, service records, and match stats |
client.skill |
MMR/CSR and other skill-related data |
client.profile |
Player identity/profile lookups |
client.discovery_ugc |
Maps, game variants, playlists, and UGC metadata |
client.gamecms_hacs |
Medals, seasons, career reward track, and other CMS data |
client.economy |
Store/customization related data |
Reference: https://acurtis166.github.io/SPNKr/reference/services/
Response Parsing Model
Service methods return response wrappers around aiohttp.ClientResponse.
Use .parse() to convert payloads into Pydantic models while still retaining
access to the raw response when needed.
- Wrappers: https://acurtis166.github.io/SPNKr/reference/responses/
- Models: https://acurtis166.github.io/SPNKr/reference/models/
Caching
SPNKr supports aiohttp-client-cache as a drop-in session replacement.
This can reduce repeated requests, especially for metadata-heavy workflows.
When caching localized Discovery UGC calls (for example with
language="fr-FR"), configure cache keys to account for language and avoid
token-specific duplication.
Full caching guidance: https://acurtis166.github.io/SPNKr/basic-usage/
Film / Theater Parsing
The spnkr.film module includes helpers for downloading film chunks and parsing
timestamped highlight events from theater recordings.
In theater mode, these highlight events appear as timeline markers for key match moments such as kills, deaths, medals, and mode-specific events.
Here is a minimal example script to dump highlight events for a match to JSON.
import asyncio
import json
from aiohttp import ClientSession
from spnkr import HaloInfiniteClient, film
async def main():
async with ClientSession() as session:
client = HaloInfiniteClient(
session, spartan_token="SPARTAN_TOKEN", clearance_token=""
)
events = await film.read_highlight_events(client, match_id="MATCH_GUID")
with open("highlight_events.json", "w") as fp:
json.dump([e._asdict() for e in events], fp)
if __name__ == "__main__":
asyncio.run(main())
Reference: https://acurtis166.github.io/SPNKr/reference/film/
Acknowledgements
- Xbox Live authentication flow: https://github.com/OpenXbox/xbox-webapi-python
- Halo Infinite authentication flow and endpoint research: https://den.dev/blog/halo-api-authentication
- Microsoft/343 Industries
Disclaimer
This software is not endorsed or supported by Microsoft or 343 Industries. It is a personal project for Halo Infinite data analysis.
Authentication requires personal credentials and tokens; use at your own risk.
Contributing
Contributions to fix issues or add endpoint support are welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spnkr-0.10.2.tar.gz.
File metadata
- Download URL: spnkr-0.10.2.tar.gz
- Upload date:
- Size: 48.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2dee16bea297872ad67f51d5e147b11ab7f1b1a90cf8d3fbb931f8d212d104c
|
|
| MD5 |
81866dbb78e82e048fd54d344dd192aa
|
|
| BLAKE2b-256 |
e38e52bb0870998ceb2a0a3d4993e5cba1da90de3c8b58b2c9103cd1eb925411
|
File details
Details for the file spnkr-0.10.2-py3-none-any.whl.
File metadata
- Download URL: spnkr-0.10.2-py3-none-any.whl
- Upload date:
- Size: 56.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4017ffb2fd810367e5f398ee8135664d439b2dbaa53d94d4a06239214d29af7d
|
|
| MD5 |
71ebf4d5e74b868465c03704ef5bfdf8
|
|
| BLAKE2b-256 |
202d8aa1c99519605b0073746d07452b0f1383acdac10ee022d5d33675c18ced
|