# Royaleapi — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Track player profiles and battle histories, discover popular decks and card statistics, and explore clan information and leaderboards for Clash Royale. Access comprehensive game data and competitive rankings to improve your gameplay strategy and tournament participation.

**Category:** Sports | **Website:** [royaleapi.com/](https://royaleapi.com/) | **Docs:** [parse.bot/marketplace/16e2de94-673e-45cd-801d-d7519b5f1d89/royaleapi-com-api](https://parse.bot/marketplace/16e2de94-673e-45cd-801d-d7519b5f1d89/royaleapi-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_card_stats

Get card usage and win rate statistics from RoyaleAPI. Returns all cards sorted by popularity with their usage and win rate percentages. No input parameters required.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_card_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_clan_details

Get clan details and member list from RoyaleAPI. Returns the clan name, description, and a full list of members with their roles (Leader, Co-leader, Elder, Member), trophies, and levels.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `clan_tag` | string | Yes | Clan tag with or without leading # (e.g. RU0Y02JV or #RU0Y02JV). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_clan_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"clan_tag":"<string>"}'
```

### get_leaderboard

Get global or regional leaderboard for players or clans from RoyaleAPI. Returns up to 1000 ranked entries with scores and metadata. Player rankings include clan name and level; clan rankings include member count and location.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `region` | string | No | Region filter. Use 'global' for worldwide or a country code (e.g. us, kr, de). |
| `type` | string | No | Leaderboard type. Accepted values: players, clans. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_leaderboard \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"region":"<string>","type":"<string>"}'
```

### get_player_battles

Get player battle history from RoyaleAPI. Returns a list of recent battles with results (Victory/Defeat/Draw), battle type, relative time, and participant info including player names and tags.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `player_tag` | string | Yes | Player tag with or without leading # (e.g. J0VU9CGP or #J0VU9CGP). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_player_battles \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"player_tag":"<string>"}'
```

### get_player_profile

Get player statistics and profile info from RoyaleAPI. Returns the player's name, trophies, league, clan affiliation, and detailed gameplay statistics. The stats object contains key-value pairs scraped from the player's profile page (total games, wins, donations, account age, etc.).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `player_tag` | string | Yes | Player tag with or without leading # (e.g. J0VU9CGP or #J0VU9CGP). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_player_profile \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"player_tag":"<string>"}'
```

### get_popular_decks

Get popular Clash Royale decks from RoyaleAPI ranked by rating. Returns up to 20 decks with their card compositions (as slug strings) and win rate statistics for the specified time range.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `time_range` | string | No | Time range for popularity calculation. Accepted values: 1d, 3d, 7d, 14d, 28d. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_popular_decks \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"time_range":"<string>"}'
```

### get_tournaments

Get list of current and recent Clash Royale tournaments from RoyaleAPI. Returns tournament names, tags, player counts (current/max format), status (In Progress or Ended), and whether the tournament is open for entry.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-royaleapi-com-api-16e2de94/get_tournaments \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```
