> For the complete documentation index, see [llms.txt](https://developers.clashperk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.clashperk.com/players.md). Agents can also search and read this documentation through its [MCP server](https://developers.clashperk.com/~gitbook/mcp).

# Players

Player profiles, battle logs, ranked weeks, seasons, wars and clan history.

## GET /players/{playerTag}

> Get a player's profile

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"PlayerDto":{"type":"object","properties":{"warPreference":{"enum":["in","out"],"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"townHallLevel":{"type":"number"},"townHallWeaponLevel":{"type":"number"},"expLevel":{"type":"number"},"trophies":{"type":"number"},"bestTrophies":{"type":"number"},"warStars":{"type":"number"},"attackWins":{"type":"number"},"defenseWins":{"type":"number"},"builderHallLevel":{"type":"number"},"builderBaseTrophies":{"type":"number"},"bestBuilderBaseTrophies":{"type":"number"},"donations":{"type":"number"},"donationsReceived":{"type":"number"},"clanCapitalContributions":{"type":"number"},"role":{"type":"string"},"clan":{"$ref":"#/components/schemas/PlayerClanDto"},"leagueTier":{"$ref":"#/components/schemas/LeagueTierDto"},"builderBaseLeague":{"$ref":"#/components/schemas/NamedLeagueDto"},"currentLeagueGroupTag":{"type":"string"},"currentLeagueSeasonId":{"type":"number"},"previousLeagueGroupTag":{"type":"string"},"previousLeagueSeasonId":{"type":"number"},"legendStatistics":{"$ref":"#/components/schemas/LegendStatisticsDto"},"achievements":{"type":"array","items":{"$ref":"#/components/schemas/PlayerAchievementDto"}},"troops":{"type":"array","items":{"$ref":"#/components/schemas/PlayerItemDto"}},"heroes":{"type":"array","items":{"$ref":"#/components/schemas/PlayerItemDto"}},"spells":{"type":"array","items":{"$ref":"#/components/schemas/PlayerItemDto"}},"heroEquipment":{"type":"array","items":{"$ref":"#/components/schemas/PlayerItemDto"}},"labels":{"type":"array","items":{"$ref":"#/components/schemas/LabelDto"}},"playerHouse":{"$ref":"#/components/schemas/PlayerHouseDto"}},"required":["name","tag","townHallLevel","expLevel","trophies","bestTrophies","warStars","attackWins","defenseWins","donations","donationsReceived","clanCapitalContributions","leagueTier","currentLeagueGroupTag","currentLeagueSeasonId","previousLeagueGroupTag","previousLeagueSeasonId","achievements","troops","heroes","spells","heroEquipment","labels"]},"PlayerClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"clanLevel":{"type":"number"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"}},"required":["tag","name","clanLevel","badgeUrls"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"LeagueTierDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"iconUrls":{"$ref":"#/components/schemas/LeagueTierIconUrlsDto"}},"required":["id","name","iconUrls"]},"LeagueTierIconUrlsDto":{"type":"object","properties":{"small":{"type":"string"},"large":{"type":"string"}},"required":["small","large"]},"NamedLeagueDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"}},"required":["id","name"]},"LegendStatisticsDto":{"type":"object","properties":{"previousSeason":{"$ref":"#/components/schemas/PlayerSeasonDto"},"previousBuilderBaseSeason":{"$ref":"#/components/schemas/PlayerSeasonDto"},"bestBuilderBaseSeason":{"$ref":"#/components/schemas/PlayerSeasonDto"},"currentSeason":{"$ref":"#/components/schemas/PlayerCurrentSeasonDto"},"bestSeason":{"$ref":"#/components/schemas/PlayerSeasonDto"},"legendTrophies":{"type":"number"}},"required":["legendTrophies"]},"PlayerSeasonDto":{"type":"object","properties":{"id":{"type":"string"},"rank":{"type":"number"},"trophies":{"type":"number"}},"required":["id","rank","trophies"]},"PlayerCurrentSeasonDto":{"type":"object","properties":{"id":{"type":"string"},"rank":{"type":"number"},"trophies":{"type":"number"}},"required":["trophies"]},"PlayerAchievementDto":{"type":"object","properties":{"completionInfo":{"type":["string","null"]},"village":{"enum":["home","builderBase"],"type":"string"},"name":{"type":"string"},"stars":{"type":"number"},"value":{"type":"number"},"target":{"type":"number"},"info":{"type":"string"}},"required":["completionInfo","village","name","stars","value","target","info"]},"PlayerItemDto":{"type":"object","properties":{"equipment":{"type":"array","items":{"$ref":"#/components/schemas/PlayerItemDto"}},"village":{"enum":["home","builderBase"],"type":"string"},"name":{"type":"string"},"level":{"type":"number"},"maxLevel":{"type":"number"},"superTroopIsActive":{"type":"boolean"}},"required":["village","name","level","maxLevel"]},"LabelDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"iconUrls":{"$ref":"#/components/schemas/IconUrlsDto"}},"required":["id","name","iconUrls"]},"IconUrlsDto":{"type":"object","properties":{"small":{"type":"string"},"tiny":{"type":"string"},"medium":{"type":"string"}},"required":["small"]},"PlayerHouseDto":{"type":"object","properties":{"elements":{"type":"array","items":{"$ref":"#/components/schemas/PlayerHouseElementDto"}}},"required":["elements"]},"PlayerHouseElementDto":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"number"}},"required":["type","id"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}":{"get":{"operationId":"getPlayer","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlayerDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's profile","tags":["Players"]}}}}
```

## GET /players/{playerTag}/seasons

> Get a player's season stats

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"PlayerSeasonStatsItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PlayerSeasonStatsDto"}}},"required":["items"]},"PlayerSeasonStatsDto":{"type":"object","properties":{"season":{"type":"string","description":"The league season's start date, `YYYY-MM-DD`."},"townHallLevel":{"type":"number"},"trophies":{"type":"number"},"attackWins":{"type":"number"},"defenseWins":{"type":"number"},"donations":{"type":"number"},"donationsReceived":{"type":"number"},"warStars":{"type":"number"},"cwlStars":{"type":"number"},"capitalGold":{"type":"number"},"clanGamesPoints":{"type":"number"},"goldLoot":{"type":"number"},"elixirLoot":{"type":"number"},"darkElixirLoot":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/PlayerSeasonClanStatsDto"}}},"required":["season","townHallLevel","trophies","attackWins","defenseWins","donations","donationsReceived","warStars","cwlStars","capitalGold","clanGamesPoints","goldLoot","elixirLoot","darkElixirLoot","clans"]},"PlayerSeasonClanStatsDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"donations":{"type":"number"},"donationsReceived":{"type":"number"}},"required":["tag","name","donations","donationsReceived"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/seasons":{"get":{"operationId":"getPlayerSeasons","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":12,"default":2,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlayerSeasonStatsItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's season stats","tags":["Players"]}}}}
```

## Get a player's ranked league weeks

> If the player isn't in a league group right now, there's no current week in the response.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"RankedDto":{"type":"object","properties":{"current":{"description":"This week's group; null when the player isn't in one (between weeks, or unranked).","anyOf":[{"$ref":"#/components/schemas/RankedWeekDto"},{"type":"null"}]},"lastWeek":{"description":"Last week's group, while this week's has no battles yet. Null otherwise.","anyOf":[{"$ref":"#/components/schemas/RankedWeekDto"},{"type":"null"}]},"history":{"description":"Past weeks, newest first.","type":"array","items":{"$ref":"#/components/schemas/RankedHistoryItemDto"}}},"required":["current","lastWeek","history"]},"RankedWeekDto":{"type":"object","properties":{"maxBattles":{"type":["number","null"],"description":"Attacks allowed this week, and the most defenses taken; null when the game data is unavailable."},"league":{"$ref":"#/components/schemas/RankedLeagueDto"},"startTime":{"format":"date-time","type":"string"},"endTime":{"format":"date-time","type":"string"},"rank":{"type":"number"},"total":{"type":"number","description":"Players in the group."},"promotionZone":{"type":"number","description":"The top this many move up a league at the end of the week; 0 when nobody does."},"demotionZone":{"type":"number","description":"The bottom this many move down; 0 when nobody does."},"trophies":{"type":"number"},"members":{"description":"Standings, best first.","type":"array","items":{"$ref":"#/components/schemas/RankedGroupMemberDto"}},"attacks":{"description":"The player's own attacks and defenses, newest first.","type":"array","items":{"$ref":"#/components/schemas/RankedBattleDto"}},"defenses":{"type":"array","items":{"$ref":"#/components/schemas/RankedBattleDto"}},"attackWins":{"type":"number"},"attackLosses":{"type":"number"},"defenseWins":{"type":"number"},"defenseLosses":{"type":"number"}},"required":["maxBattles","league","startTime","endTime","rank","total","promotionZone","demotionZone","trophies","members","attacks","defenses","attackWins","attackLosses","defenseWins","defenseLosses"]},"RankedLeagueDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"iconUrl":{"type":["string","null"]}},"required":["id","name","iconUrl"]},"RankedGroupMemberDto":{"type":"object","properties":{"clan":{"description":"Null when the player isn't in a clan.","anyOf":[{"$ref":"#/components/schemas/RankedClanDto"},{"type":"null"}]},"rank":{"type":"number"},"tag":{"type":"string"},"name":{"type":"string"},"trophies":{"type":"number"},"attackWins":{"type":"number"},"attackLosses":{"type":"number"},"defenseWins":{"type":"number"},"defenseLosses":{"type":"number"}},"required":["clan","rank","tag","name","trophies","attackWins","attackLosses","defenseWins","defenseLosses"]},"RankedClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"}},"required":["tag","name"]},"RankedBattleDto":{"type":"object","properties":{"opponent":{"$ref":"#/components/schemas/RankedOpponentDto"},"stars":{"type":"number"},"destruction":{"type":"number"},"trophies":{"type":"number","description":"League trophies the player earned from this battle, on attack or on defense."},"createdAt":{"format":"date-time","type":"string"}},"required":["opponent","stars","destruction","trophies","createdAt"]},"RankedOpponentDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"}},"required":["tag","name"]},"RankedHistoryItemDto":{"type":"object","properties":{"league":{"$ref":"#/components/schemas/RankedLeagueDto"},"startTime":{"format":"date-time","type":"string"},"placement":{"type":"number"},"trophies":{"type":"number"},"defenseStars":{"type":"number"},"maxBattles":{"type":"number"},"attackWins":{"type":"number"},"attackLosses":{"type":"number"},"defenseWins":{"type":"number"},"defenseLosses":{"type":"number"}},"required":["league","startTime","placement","trophies","defenseStars","maxBattles","attackWins","attackLosses","defenseWins","defenseLosses"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/ranked":{"get":{"description":"If the player isn't in a league group right now, there's no current week in the response.","operationId":"getPlayerRankedWeeks","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RankedDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's ranked league weeks","tags":["Players"]}}}}
```

## Get a player's most used ranked armies

> Each hero with the pet and equipment used most, and the army used most, from the week's ranked attacks.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"RankedArmiesDto":{"type":"object","properties":{"tag":{"type":"string"},"weekId":{"type":"string"},"attacks":{"type":"number","description":"Ranked attacks with an army code."},"heroes":{"description":"Each hero's most used pet and equipment, most used hero first.","type":"array","items":{"$ref":"#/components/schemas/LegendHeroSetupDto"}},"army":{"description":"The most used army, without the clan castle. Null with no attacks.","anyOf":[{"$ref":"#/components/schemas/LegendArmyDto"},{"type":"null"}]}},"required":["tag","weekId","attacks","heroes","army"]},"LegendHeroSetupDto":{"type":"object","properties":{"name":{"type":"string"},"pet":{"type":["string","null"]},"equipment":{"type":"array","items":{"type":"string"}},"share":{"type":"number","description":"Share of the attacks with this exact setup, in percent."}},"required":["name","pet","equipment","share"]},"LegendArmyDto":{"type":"object","properties":{"share":{"type":"number","description":"Share of the attacks with this exact army, in percent."},"troops":{"description":"Most first.","type":"array","items":{"$ref":"#/components/schemas/LegendArmyUnitDto"}},"spells":{"description":"Most first.","type":"array","items":{"$ref":"#/components/schemas/LegendArmyUnitDto"}},"siege":{"anyOf":[{"$ref":"#/components/schemas/LegendArmyUnitDto"},{"type":"null"}]}},"required":["share","troops","spells","siege"]},"LegendArmyUnitDto":{"type":"object","properties":{"name":{"type":"string"},"count":{"type":"number"}},"required":["name","count"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/ranked/armies":{"get":{"description":"Each hero with the pet and equipment used most, and the army used most, from the week's ranked attacks.","operationId":"getRankedArmies","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"weekId","required":false,"in":"query","description":"The ranked week's start date (Monday); the current week when left out.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RankedArmiesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's most used ranked armies","tags":["Players"]}}}}
```

## Get a player's battle log

> Only battles ClashPerk has tracked, up to 448.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"BattleLogItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BattleLogDto"}}},"required":["items"]},"BattleLogDto":{"type":"object","properties":{"name":{"type":"string"},"tag":{"type":"string"},"opponentTag":{"type":"string"},"battleType":{"type":"string"},"isAttack":{"type":"boolean"},"stars":{"type":"number"},"destruction":{"type":"number"},"trophies":{"type":"number"},"startTrophies":{"type":"number","default":0},"endTrophies":{"type":"number","default":0},"trophyChange":{"type":"number"},"battleDate":{"type":"string"},"battleSeason":{"type":"string"},"battleWeek":{"type":"string"},"leagueId":{"type":"number"},"ingestedAt":{"format":"date-time","type":"string"}},"required":["name","tag","opponentTag","battleType","isAttack","stars","destruction","trophies","startTrophies","endTrophies","trophyChange","battleDate","battleSeason","battleWeek","leagueId","ingestedAt"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/battle-log":{"get":{"description":"Only battles ClashPerk has tracked, up to 448.","operationId":"getPlayerBattleLog","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BattleLogItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's battle log","tags":["Players"]}}}}
```

## Get a player's daily battle totals

> Deprecated: use \`GET /v1/legends/{playerTag}/days\` for one player, or \`GET /v1/clans/{clanTag}/legend-battles/daily\` for a clan. This route is removed on 2026-12-15.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"BattleLogAggregateItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BattleLogDailyDto"}}},"required":["items"]},"BattleLogDailyDto":{"type":"object","properties":{"name":{"type":"string"},"tag":{"type":"string"},"battleDate":{"type":"string"},"trophies":{"type":"number"},"offenseTrophies":{"type":"number"},"defenseTrophies":{"type":"number"},"gain":{"type":"number"},"attackCount":{"type":"number"},"defenseCount":{"type":"number"}},"required":["name","tag","battleDate","trophies","offenseTrophies","defenseTrophies","gain","attackCount","defenseCount"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/battle-log/aggregate":{"get":{"deprecated":true,"description":"Deprecated: use `GET /v1/legends/{playerTag}/days` for one player, or `GET /v1/clans/{clanTag}/legend-battles/daily` for a clan. This route is removed on 2026-12-15.","operationId":"getPlayerDailyBattles","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BattleLogAggregateItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's daily battle totals","tags":["Players"]}}}}
```

## Rank players by Legend League trophies

> Deprecated: send the same request with the \`QUERY\` method. This route is removed on 2026-11-25.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"BattleLogLeaderboardInputDto":{"type":"object","properties":{"seasonId":{"type":"string","description":"The league season's start date. A legacy `YYYY-MM` season id is still accepted.","pattern":"^\\d{4}-\\d{2}(-\\d{2})?$"},"playerTags":{"type":"array","items":{"type":"string"}}},"required":["seasonId","playerTags"]},"BattleLogLeaderboardDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BattleLogLeaderboardItemDto"}}},"required":["items"]},"BattleLogLeaderboardItemDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"trophies":{"type":"number"}},"required":["tag","name","trophies"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/battle-log/leaderboard":{"post":{"deprecated":true,"description":"Deprecated: send the same request with the `QUERY` method. This route is removed on 2026-11-25.","operationId":"getBattleLogLeaderboardViaPost","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BattleLogLeaderboardInputDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BattleLogLeaderboardDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Rank players by Legend League trophies","tags":["Players"]}}}}
```

## Get a player's clan history

> Newest first. For the clan the player is in now, the last-seen time is the current time.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"ClanHistoryItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/GlobalClanHistoryEntity"}}},"required":["items"]},"GlobalClanHistoryEntity":{"type":"object","properties":{"clan":{"$ref":"#/components/schemas/GlobalClanEntity"},"playerTag":{"type":"string"},"firstSeen":{"format":"date-time","type":"string"},"lastSeen":{"format":"date-time","type":"string"}},"required":["clan","playerTag","firstSeen","lastSeen"]},"GlobalClanEntity":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"}},"required":["tag","name"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/history":{"get":{"description":"Newest first. For the clan the player is in now, the last-seen time is the current time.","operationId":"getPlayerClanHistory","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanHistoryItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's clan history","tags":["Players"]}}}}
```

## GET /players/{playerTag}/wars

> List a player's wars and attacks

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"AttackHistoryItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AttackHistoryDto"}}},"required":["items"]},"AttackHistoryDto":{"type":"object","properties":{"warType":{"allOf":[{"$ref":"#/components/schemas/WarTypes"}]},"startTime":{"type":"string","format":"date-time"},"endTime":{"type":"string","format":"date-time"},"attacks":{"type":"array","items":{"$ref":"#/components/schemas/AttackRecordDto"}},"season":{"type":"string"},"id":{"type":"number"},"clan":{"type":"object","properties":{"name":{"type":"string"},"tag":{"type":"string"}},"required":["name","tag"]},"opponent":{"type":"object","properties":{"name":{"type":"string"},"tag":{"type":"string"}},"required":["name","tag"]},"attacker":{"type":"object","properties":{"name":{"type":"string"},"tag":{"type":"string"},"townHallLevel":{"type":"number"},"mapPosition":{"type":"number"}},"required":["name","tag","townHallLevel","mapPosition"]},"attacksPerMember":{"type":"number"},"teamSize":{"type":"number"}},"required":["warType","startTime","endTime","attacks","season","id","clan","opponent","attacker","attacksPerMember","teamSize"]},"WarTypes":{"type":"number","enum":[1,2,3]},"AttackRecordDto":{"type":"object","properties":{"defender":{"type":"object","properties":{"tag":{"type":"string"},"townHallLevel":{"type":"number"},"mapPosition":{"type":"number"}},"required":["tag","townHallLevel","mapPosition"]},"stars":{"type":"number"},"trueStars":{"type":"number"},"defenderTag":{"type":"string"},"destruction":{"type":"number"}},"required":["defender","stars","trueStars","defenderTag","destruction"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/wars":{"get":{"operationId":"getPlayerWars","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"The newest wars first, at most this many.","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"startDate","required":false,"in":"query","description":"Date string or timestamp in milliseconds","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttackHistoryItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List a player's wars and attacks","tags":["Players"]}}}}
```

## Get a player's war totals per season

> Only counts wars that started on or after \`startDate\`.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"AggregateAttackHistoryItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AggregateAttackHistoryDto"}}},"required":["items"]},"AggregateAttackHistoryDto":{"type":"object","properties":{"season":{"type":"string"},"totalWars":{"type":"number"},"totalAttacks":{"type":"number"},"total3Stars":{"type":"number"},"totalMissed":{"type":"number"},"totalStars":{"type":"number"}},"required":["season","totalWars","totalAttacks","total3Stars","totalMissed","totalStars"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/wars/aggregate":{"get":{"description":"Only counts wars that started on or after `startDate`.","operationId":"getPlayerWarTotals","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"startDate","required":true,"in":"query","description":"Date string or timestamp in milliseconds","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateAttackHistoryItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's war totals per season","tags":["Players"]}}}}
```

## Get a player's CWL totals per league group

> Only counts rounds that started on or after \`startDate\`, newest group first. An attack counts as missed once its round ends.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Players","description":"Player profiles, battle logs, ranked weeks, seasons, wars and clan history."}],"servers":[{"url":"/v1","description":"[latest]"},{"url":"/v2","description":"[unstable]"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"in header (authorization: bearer [token])"}},"schemas":{"AggregateClanWarLeagueHistoryItemsDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AggregateClanWarLeagueHistoryDto"}}},"required":["items"]},"AggregateClanWarLeagueHistoryDto":{"type":"object","properties":{"clan":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"}},"required":["tag","name"]},"leagueId":{"type":["number","null"],"description":"The clan's war league in that group; null when the group wasn't stored."},"season":{"type":"string"},"wars":{"type":"number","description":"Rounds the player was in the lineup for."},"attacks":{"type":"number"},"missed":{"type":"number","description":"Attacks left unused in ended rounds."},"stars":{"type":"number"},"threeStars":{"type":"number"},"destruction":{"type":"number","description":"Sum over attacks; divide by `attacks` for the average."}},"required":["clan","leagueId","season","wars","attacks","missed","stars","threeStars","destruction"]},"ErrorResponseDto":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ErrorCodes"}]},"message":{"type":"string"},"statusCode":{"type":"number"},"method":{"type":"string"},"path":{"type":"string"}},"required":["code","message","statusCode","method","path"]},"ErrorCodes":{"type":"string","enum":["FORBIDDEN","UNAUTHORIZED","NOT_FOUND","BAD_REQUEST","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","HANDOFF_TOKEN_EXPIRED","USER_BLOCKED","INVALID_PASSKEY","GUILD_ACCESS_FORBIDDEN","BOT_NOT_IN_GUILD","GIVEAWAY_NOT_FOUND","GIVEAWAY_NOT_ACTIVE","GIVEAWAY_ALREADY_DRAWN","GIVEAWAY_ALREADY_ENTERED","GIVEAWAY_NO_LINKED_ACCOUNT","GIVEAWAY_NOT_IN_CLAN"]}}},"paths":{"/players/{playerTag}/clan-war-leagues/aggregate":{"get":{"description":"Only counts rounds that started on or after `startDate`, newest group first. An attack counts as missed once its round ends.","operationId":"getPlayerClanWarLeagueTotals","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"startDate","required":true,"in":"query","description":"Date string or timestamp in milliseconds","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateClanWarLeagueHistoryItemsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's CWL totals per league group","tags":["Players"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.clashperk.com/players.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
