ClashRoyaleAPI
Typed, async-only Python client for all 30 documented GET endpoints of the official Clash Royale REST API. Requires Python 3.12+; uses curl_cffi and Pydantic v2.
pip install async-royale-client
import asyncio
import os
from clashroyaleapi import Client
async def main():
async with Client(os.environ["CLASH_ROYALE_API_TOKEN"]) as client:
player = await client.get_player("#2VVYYRVYP")
print(player.name, player.trophies)
async for card in client.iter_get_cards(limit=100):
print(card.name)
asyncio.run(main())
Create your own token at https://developer.clashroyale.com and allowlist the public IP making requests. Authentication failures may indicate an IP mismatch rather than an invalid token.
Documentation · User guide · Endpoint reference · Models
Behavior
- Every network operation is async. Use
async with Client(...)orawait client.close(). - Individual resources return Pydantic models, paginated endpoints return
Page[T], and unpaginated arrays return lists.iter_<method_name>methods traverse cursor pages. - Models expose snake_case fields and retain unknown fields.
model.to_dict()exports JSON-compatible data with original API aliases. - Up to three attempts for GET requests encountering transport failures, 429, or 5xx. Retry delays are bounded to 30 seconds. Caching is opt-in.
- Complete endpoint coverage refers to the supplied official documentation snapshot, not a guarantee of upstream availability. Nested model definitions collapsed in that snapshot cannot be exhaustively validated. Deprecated endpoints remain supported.
Development
uv sync --locked --python 3.12
uv run pytest
uv run ruff check src scripts tests
uv run mypy
uv run python scripts/build_docs.py
uv build
uv run twine check dist/*
The endpoint manifest is docs/api-reference.json. Explicit endpoint methods and response models are generated by scripts/generate_client.py; review changes to the manifest and generator before regeneration. Raw browser exports are excluded from Git because they may contain credentials. See release instructions.
Migration
The unfinished api.api.RoyaleAPI interface is replaced by clashroyaleapi.Client. Add await to network calls and use async context management. Replace get_player_chest_cycle with get_player_upcoming_chests and read .items; battle logs are lists from get_player_battle_log. Model fields replace the old cached properties and generator accessors: use player.cards, player.clan, and player.league_statistics.
License and affiliation
GPL-3.0-only; see LICENSE. This project is unofficial and is not affiliated with, endorsed, sponsored, or approved by Supercell. Supercell is not responsible for its operation or content. Clash Royale trademarks and game content belong to their respective owners.
Metadata
Release files for async-royale-client 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| async_royale_client-1.0.1.tar.gz | 48.8 kB | Without provenance | Details for async_royale_client-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_royale_client-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for async_royale_client-1.0.1-py3-none-any.whl |
Total release size: 74.0 kB
Release files / async_royale_client-1.0.1.tar.gz
| Download URL | async_royale_client-1.0.1.tar.gz |
|---|---|
| Size | 48.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4bdc7df1924699f85c94f251fc7fe8d2c811ac64c3cced62218d796d0793371
|
|
BLAKE2b-256 checksum How to use checksums |
9eacb7fbf61d05e210a3e56ae6b2a93a9112c9ff6484527b0632b35702943960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / async_royale_client-1.0.1-py3-none-any.whl
| Download URL | async_royale_client-1.0.1-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6b841617b108eb49a641547db2d8733b1b336152afe6f1977d20565d27279e7
|
|
BLAKE2b-256 checksum How to use checksums |
ef33e76820d1ae9d2cab30a4877243c8d02fb9006a9322266437be8deb3e1947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for async-royale-client 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.