# 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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/royaleapi/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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/credits/royaleapi/get-card-stats \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-clan-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-leaderboard \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-player-battles \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-player-profile \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-popular-decks \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/royaleapi/get-tournaments \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.