Skip to main content

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(...) or await 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.

Live verification: all 30 routes were exercised; 26 operations succeeded, two are explicitly disabled, and two lack working live resources. See live audit results and rerun instructions.

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-royale-client 1.0.2
File Size Uploaded Provenance Actions
async_royale_client-1.0.2.tar.gz 63.1 kB Without provenance Details for async_royale_client-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for async-royale-client 1.0.2
File Interpreter ABI Platform Actions
async_royale_client-1.0.2-py3-none-any.whl Python 3 none any Details for async_royale_client-1.0.2-py3-none-any.whl

Total release size: 88.4 kB

Release files / async_royale_client-1.0.2.tar.gz

Download URL async_royale_client-1.0.2.tar.gz
Size 63.1 kB
Tags Source
SHA-256 checksum
How to use checksums
10e47054437e4dc1a8e970fba82c6dc3d501ddd31b8a5a05a3585c0bc7ef312d
BLAKE2b-256 checksum
How to use checksums
ed90c5e6b03affe55b53b119039837317585d3ce6ef66198ce6e8399d46247ea
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.2-py3-none-any.whl

Download URL async_royale_client-1.0.2-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc4dffa3ee5c5862cffddccda21f4522d063df3ffb5fa40989f63e931a3846b9
BLAKE2b-256 checksum
How to use checksums
bab2986557faa37741477277856c41f1cf2d3dfbc39e9b3cf526d76f54dca397
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.2

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.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

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