> 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/wars.md). Agents can also search and read this documentation through its [MCP server](https://developers.clashperk.com/~gitbook/mcp).

# Wars

Current and past wars, and Clan War Leagues.

## Get a clan's current CWL group

> Comes straight from the game and includes every war in the group. Returns 404 if the clan isn't in CWL.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarLeaguesDto":{"type":"object","properties":{"season":{"type":"string"},"rounds":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarLeagueRound"}},"clans":{"type":"array","items":{"$ref":"#/components/schemas/LeagueGroupClanDto"}},"wars":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarDto"}}},"required":["season","rounds","clans","wars"]},"ClanWarLeagueRound":{"type":"object","properties":{"warTags":{"type":"array","items":{"type":"string"}}},"required":["warTags"]},"LeagueGroupClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"leagueId":{"type":"number"}},"required":["tag","name","leagueId"]},"ClanWarDto":{"type":"object","properties":{"state":{"enum":["notInWar","preparation","inWar","warEnded"],"type":"string"},"startTime":{"type":"string"},"preparationStartTime":{"type":"string"},"endTime":{"type":"string"},"battleModifier":{"enum":["none","hardMode",null],"type":["string","null"]},"attacksPerMember":{"type":["number","null"]},"round":{"type":["number","null"]},"warTag":{"type":["string","null"]},"teamSize":{"type":"number"},"clan":{"$ref":"#/components/schemas/WarClanDto"},"opponent":{"$ref":"#/components/schemas/WarClanDto"},"result":{"type":"string"}},"required":["state","startTime","preparationStartTime","endTime","teamSize","clan","opponent","result"]},"WarClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"members":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberDto"}}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage","members"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"ClanWarMemberDto":{"type":"object","properties":{"attacks":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarAttackDto"}},"bestOpponentAttack":{"$ref":"#/components/schemas/ClanWarAttackDto"},"mapPosition":{"type":"number"},"name":{"type":"string"},"opponentAttacks":{"type":"number"},"tag":{"type":"string"},"townhallLevel":{"type":"number"}},"required":["mapPosition","name","opponentAttacks","tag","townhallLevel"]},"ClanWarAttackDto":{"type":"object","properties":{"attackerTag":{"type":"string"},"defenderTag":{"type":"string"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"order":{"type":"number"},"duration":{"type":"number"}},"required":["attackerTag","defenderTag","stars","destructionPercentage","order","duration"]},"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":{"/wars/{clanTag}/clan-war-leagues/groups":{"get":{"description":"Comes straight from the game and includes every war in the group. Returns 404 if the clan isn't in CWL.","operationId":"getClanWarLeagueGroup","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarLeaguesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a clan's current CWL group","tags":["Wars"]}}}}
```

## Get a clan's wars in its latest CWL group

> Uses the clan's most recent saved CWL group and returns only the clan's own wars.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarLeaguesDto":{"type":"object","properties":{"season":{"type":"string"},"rounds":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarLeagueRound"}},"clans":{"type":"array","items":{"$ref":"#/components/schemas/LeagueGroupClanDto"}},"wars":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarDto"}}},"required":["season","rounds","clans","wars"]},"ClanWarLeagueRound":{"type":"object","properties":{"warTags":{"type":"array","items":{"type":"string"}}},"required":["warTags"]},"LeagueGroupClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"leagueId":{"type":"number"}},"required":["tag","name","leagueId"]},"ClanWarDto":{"type":"object","properties":{"state":{"enum":["notInWar","preparation","inWar","warEnded"],"type":"string"},"startTime":{"type":"string"},"preparationStartTime":{"type":"string"},"endTime":{"type":"string"},"battleModifier":{"enum":["none","hardMode",null],"type":["string","null"]},"attacksPerMember":{"type":["number","null"]},"round":{"type":["number","null"]},"warTag":{"type":["string","null"]},"teamSize":{"type":"number"},"clan":{"$ref":"#/components/schemas/WarClanDto"},"opponent":{"$ref":"#/components/schemas/WarClanDto"},"result":{"type":"string"}},"required":["state","startTime","preparationStartTime","endTime","teamSize","clan","opponent","result"]},"WarClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"members":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberDto"}}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage","members"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"ClanWarMemberDto":{"type":"object","properties":{"attacks":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarAttackDto"}},"bestOpponentAttack":{"$ref":"#/components/schemas/ClanWarAttackDto"},"mapPosition":{"type":"number"},"name":{"type":"string"},"opponentAttacks":{"type":"number"},"tag":{"type":"string"},"townhallLevel":{"type":"number"}},"required":["mapPosition","name","opponentAttacks","tag","townhallLevel"]},"ClanWarAttackDto":{"type":"object","properties":{"attackerTag":{"type":"string"},"defenderTag":{"type":"string"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"order":{"type":"number"},"duration":{"type":"number"}},"required":["attackerTag","defenderTag","stars","destructionPercentage","order","duration"]},"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":{"/wars/{clanTag}/clan-war-leagues/clan":{"get":{"description":"Uses the clan's most recent saved CWL group and returns only the clan's own wars.","operationId":"getClanWarLeagueWars","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarLeaguesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a clan's wars in its latest CWL group","tags":["Wars"]}}}}
```

## List a clan's CWL seasons with member totals

> Built from the wars ClashPerk tracked, newest first. Use the standings endpoint to see a group's table.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarLeagueSeasonsDto":{"type":"object","properties":{"items":{"description":"Newest season first.","type":"array","items":{"$ref":"#/components/schemas/ClanWarLeagueSeasonDto"}}},"required":["items"]},"ClanWarLeagueSeasonDto":{"type":"object","properties":{"groupId":{"type":["number","null"],"description":"The stored group (for standings); null when it wasn't stored."},"groupSeason":{"type":["string","null"],"description":"The game's season id for the group, e.g. \"2026-10-02\"; null when the group wasn't stored."},"leagueId":{"type":["number","null"],"description":"The clan's war league that season; null when the group wasn't stored."},"groupSize":{"type":["number","null"],"description":"Clans in the group; null when the group wasn't stored."},"season":{"type":"string"},"rounds":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarLeagueRoundDto"}},"members":{"description":"Most stars first.","type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberTotalsDto"}}},"required":["groupId","groupSeason","leagueId","groupSize","season","rounds","members"]},"ClanWarLeagueRoundDto":{"type":"object","properties":{"round":{"type":["number","null"],"description":"Position in the group's schedule; null when the group wasn't stored."},"state":{"enum":["preparation","inWar","warEnded"],"type":"string"},"startTime":{"type":"string","format":"date-time"},"endTime":{"type":"string","format":"date-time"},"result":{"enum":["win","lose","tie"],"type":"string"},"id":{"type":"number"},"teamSize":{"type":"number"},"clan":{"$ref":"#/components/schemas/ClanWarSideDto"},"opponent":{"$ref":"#/components/schemas/ClanWarSideDto"}},"required":["round","state","startTime","endTime","result","id","teamSize","clan","opponent"]},"ClanWarSideDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"ClanWarMemberTotalsDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"townHallLevel":{"type":"number","description":"From the member's latest war in the set."},"wars":{"type":"number","description":"Wars the member was in the lineup for."},"attacks":{"type":"number"},"stars":{"type":"number"},"threeStars":{"type":"number"},"destruction":{"type":"number","description":"Sum over attacks; divide by `attacks` for the average."},"missed":{"type":"number","description":"Attacks left unused in ended wars."},"sameThAttacks":{"type":"number","description":"Attacks on a base of the same or a higher Town Hall."},"sameThThreeStars":{"type":"number"}},"required":["tag","name","townHallLevel","wars","attacks","stars","threeStars","destruction","missed","sameThAttacks","sameThThreeStars"]},"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":{"/wars/{clanTag}/clan-war-leagues/seasons":{"get":{"description":"Built from the wars ClashPerk tracked, newest first. Use the standings endpoint to see a group's table.","operationId":"getClanWarLeagueSeasons","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":12,"default":3,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarLeagueSeasonsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List a clan's CWL seasons with member totals","tags":["Wars"]}}}}
```

## GET /wars/{clanTag}/members/stats

> Get war stats for a clan's members

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarStatsDto":{"type":"object","properties":{"wars":{"type":"number","description":"Ended wars counted; fewer than asked when the clan has fewer stored."},"seasons":{"description":"CWL seasons among those wars, newest first.","type":"array","items":{"type":"string"}},"members":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberTotalsDto"}}},"required":["wars","seasons","members"]},"ClanWarMemberTotalsDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"townHallLevel":{"type":"number","description":"From the member's latest war in the set."},"wars":{"type":"number","description":"Wars the member was in the lineup for."},"attacks":{"type":"number"},"stars":{"type":"number"},"threeStars":{"type":"number"},"destruction":{"type":"number","description":"Sum over attacks; divide by `attacks` for the average."},"missed":{"type":"number","description":"Attacks left unused in ended wars."},"sameThAttacks":{"type":"number","description":"Attacks on a base of the same or a higher Town Hall."},"sameThThreeStars":{"type":"number"}},"required":["tag","name","townHallLevel","wars","attacks","stars","threeStars","destruction","missed","sameThAttacks","sameThThreeStars"]},"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":{"/wars/{clanTag}/members/stats":{"get":{"operationId":"getClanMemberWarStats","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"type","required":false,"in":"query","description":"Regular and CWL wars, regular only, or CWL only; friendly wars never count.","schema":{"default":"all","type":"string","enum":["all","regular","cwl"]}},{"name":"wars","required":false,"in":"query","description":"How many of the latest ended wars to count, for `all` and `regular`.","schema":{"minimum":1,"maximum":100,"default":25,"type":"number"}},{"name":"seasons","required":false,"in":"query","description":"How many of the latest CWL seasons to count, for `cwl`.","schema":{"minimum":1,"maximum":12,"default":3,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarStatsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get war stats for a clan's members","tags":["Wars"]}}}}
```

## Get a CWL group's standings

> Get the \`groupId\` from the CWL seasons endpoint. Each war win adds 10 bonus stars, as in the game.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarLeagueStandingsDto":{"type":"object","properties":{"groupId":{"type":"number"},"season":{"type":"string"},"roundsPlayed":{"type":"number","description":"Rounds with at least one war started."},"totalRounds":{"type":"number"},"complete":{"type":"boolean","description":"False when some wars no longer load from the game, so the table is partial."},"rows":{"description":"Best first.","type":"array","items":{"$ref":"#/components/schemas/ClanWarLeagueStandingDto"}}},"required":["groupId","season","roundsPlayed","totalRounds","complete","rows"]},"ClanWarLeagueStandingDto":{"type":"object","properties":{"badgeUrls":{"anyOf":[{"$ref":"#/components/schemas/ClanBadge"},{"type":"null"}]},"tag":{"type":"string"},"name":{"type":"string"},"stars":{"type":"number","description":"Stars plus 10 per war won, as the game ranks them."},"destruction":{"type":"number","description":"Total destruction over all wars: each war's percentage times its size."},"wins":{"type":"number"},"leagueId":{"type":"number","description":"League at the start of the season."}},"required":["badgeUrls","tag","name","stars","destruction","wins","leagueId"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"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":{"/wars/{clanTag}/clan-war-leagues/groups/{groupId}/standings":{"get":{"description":"Get the `groupId` from the CWL seasons endpoint. Each war win adds 10 bonus stars, as in the game.","operationId":"getClanWarLeagueStandings","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"groupId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarLeagueStandingsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a CWL group's standings","tags":["Wars"]}}}}
```

## GET /wars/{clanTag}

> List a clan's tracked wars

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarListDto":{"type":"object","properties":{"next":{"type":["number","null"],"description":"Pass as `before` for the next page; null on the last page."},"items":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarSummaryDto"}}},"required":["next","items"]},"ClanWarSummaryDto":{"type":"object","properties":{"warType":{"allOf":[{"$ref":"#/components/schemas/WarTypes"}]},"state":{"enum":["preparation","inWar","warEnded"],"type":"string"},"preparationStartTime":{"type":"string","format":"date-time"},"startTime":{"type":"string","format":"date-time"},"endTime":{"type":"string","format":"date-time"},"warTag":{"type":["string","null"],"description":"Set for CWL rounds only."},"result":{"description":"From the requested clan's side; \"tie\" while a war is still running and level.","enum":["win","lose","tie"],"type":"string"},"id":{"type":"number"},"teamSize":{"type":"number"},"attacksPerMember":{"type":"number"},"clan":{"$ref":"#/components/schemas/ClanWarSideDto"},"opponent":{"$ref":"#/components/schemas/ClanWarSideDto"}},"required":["warType","state","preparationStartTime","startTime","endTime","warTag","result","id","teamSize","attacksPerMember","clan","opponent"]},"WarTypes":{"type":"number","enum":[1,2,3]},"ClanWarSideDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"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":{"/wars/{clanTag}":{"get":{"operationId":"listClanWars","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"default":20,"type":"number"}},{"name":"before","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/ClanWarListDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List a clan's tracked wars","tags":["Wars"]}}}}
```

## Get a clan's current war

> During CWL, this is the clan's current round. The war is empty if the clan isn't in one, or if its war log is private outside CWL.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"CurrentWarDto":{"type":"object","properties":{"war":{"description":"The regular war, or the CWL round in war (else in preparation, else the last ended one).","anyOf":[{"$ref":"#/components/schemas/ClanWarDto"},{"type":"null"}]},"isWarLogPublic":{"type":"boolean","description":"False when the war log is private: regular wars are hidden then, CWL wars are not."}},"required":["war","isWarLogPublic"]},"ClanWarDto":{"type":"object","properties":{"state":{"enum":["notInWar","preparation","inWar","warEnded"],"type":"string"},"startTime":{"type":"string"},"preparationStartTime":{"type":"string"},"endTime":{"type":"string"},"battleModifier":{"enum":["none","hardMode",null],"type":["string","null"]},"attacksPerMember":{"type":["number","null"]},"round":{"type":["number","null"]},"warTag":{"type":["string","null"]},"teamSize":{"type":"number"},"clan":{"$ref":"#/components/schemas/WarClanDto"},"opponent":{"$ref":"#/components/schemas/WarClanDto"},"result":{"type":"string"}},"required":["state","startTime","preparationStartTime","endTime","teamSize","clan","opponent","result"]},"WarClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"members":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberDto"}}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage","members"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"ClanWarMemberDto":{"type":"object","properties":{"attacks":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarAttackDto"}},"bestOpponentAttack":{"$ref":"#/components/schemas/ClanWarAttackDto"},"mapPosition":{"type":"number"},"name":{"type":"string"},"opponentAttacks":{"type":"number"},"tag":{"type":"string"},"townhallLevel":{"type":"number"}},"required":["mapPosition","name","opponentAttacks","tag","townhallLevel"]},"ClanWarAttackDto":{"type":"object","properties":{"attackerTag":{"type":"string"},"defenderTag":{"type":"string"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"order":{"type":"number"},"duration":{"type":"number"}},"required":["attackerTag","defenderTag","stars","destructionPercentage","order","duration"]},"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":{"/wars/{clanTag}/current":{"get":{"description":"During CWL, this is the clan's current round. The war is empty if the clan isn't in one, or if its war log is private outside CWL.","operationId":"getCurrentWar","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentWarDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a clan's current war","tags":["Wars"]}}}}
```

## Get a tracked war

> Use a war ID from the clan's war list.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Wars","description":"Current and past wars, and Clan War Leagues."}],"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":{"ClanWarDto":{"type":"object","properties":{"state":{"enum":["notInWar","preparation","inWar","warEnded"],"type":"string"},"startTime":{"type":"string"},"preparationStartTime":{"type":"string"},"endTime":{"type":"string"},"battleModifier":{"enum":["none","hardMode",null],"type":["string","null"]},"attacksPerMember":{"type":["number","null"]},"round":{"type":["number","null"]},"warTag":{"type":["string","null"]},"teamSize":{"type":"number"},"clan":{"$ref":"#/components/schemas/WarClanDto"},"opponent":{"$ref":"#/components/schemas/WarClanDto"},"result":{"type":"string"}},"required":["state","startTime","preparationStartTime","endTime","teamSize","clan","opponent","result"]},"WarClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"badgeUrls":{"$ref":"#/components/schemas/ClanBadge"},"clanLevel":{"type":"number"},"attacks":{"type":"number"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"members":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarMemberDto"}}},"required":["tag","name","badgeUrls","clanLevel","attacks","stars","destructionPercentage","members"]},"ClanBadge":{"type":"object","properties":{"large":{"type":"string"},"small":{"type":"string"},"medium":{"type":"string"}},"required":["large","small","medium"]},"ClanWarMemberDto":{"type":"object","properties":{"attacks":{"type":"array","items":{"$ref":"#/components/schemas/ClanWarAttackDto"}},"bestOpponentAttack":{"$ref":"#/components/schemas/ClanWarAttackDto"},"mapPosition":{"type":"number"},"name":{"type":"string"},"opponentAttacks":{"type":"number"},"tag":{"type":"string"},"townhallLevel":{"type":"number"}},"required":["mapPosition","name","opponentAttacks","tag","townhallLevel"]},"ClanWarAttackDto":{"type":"object","properties":{"attackerTag":{"type":"string"},"defenderTag":{"type":"string"},"stars":{"type":"number"},"destructionPercentage":{"type":"number"},"order":{"type":"number"},"duration":{"type":"number"}},"required":["attackerTag","defenderTag","stars","destructionPercentage","order","duration"]},"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":{"/wars/{clanTag}/{warId}":{"get":{"description":"Use a war ID from the clan's war list.","operationId":"getClanWar","parameters":[{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"warId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanWarDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a tracked war","tags":["Wars"]}}}}
```


---

# 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/wars.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.
