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

# Legends

Legend League attacks, seasons and rank estimates.

## Get Legend League rank thresholds

> Shows how many trophies it takes to reach certain ranks among the players ClashPerk tracks. Includes live numbers, the latest daily snapshot and up to 45 days of history.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendRankingThresholdsDto":{"type":"object","properties":{"live":{"$ref":"#/components/schemas/LegendRankingThresholdsSnapShotDto"},"eod":{"anyOf":[{"$ref":"#/components/schemas/LegendRankingThresholdsSnapShotDto"},{"type":"null"}]},"history":{"type":"array","items":{"$ref":"#/components/schemas/LegendRankingThresholdsSnapShotDto"}}},"required":["live","eod","history"]},"LegendRankingThresholdsSnapShotDto":{"type":"object","properties":{"timestamp":{"type":"string"},"thresholds":{"type":"array","items":{"$ref":"#/components/schemas/ThresholdsDto"}}},"required":["timestamp","thresholds"]},"ThresholdsDto":{"type":"object","properties":{"rank":{"type":"number"},"minTrophies":{"type":"number"}},"required":["rank","minTrophies"]},"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":{"/legends/ranking-thresholds":{"get":{"description":"Shows how many trophies it takes to reach certain ranks among the players ClashPerk tracks. Includes live numbers, the latest daily snapshot and up to 45 days of history.","operationId":"getLegendRankingThresholds","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendRankingThresholdsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get Legend League rank thresholds","tags":["Legends"]}}}}
```

## Get the daily Legend League 3-star rate

> Attacks and 3-star attacks on each game day of a season and the season before it, across every legend player ClashPerk tracks.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendTripleRatesDto":{"type":"object","properties":{"season":{"$ref":"#/components/schemas/LegendTripleRateSeasonDto"},"lastSeason":{"$ref":"#/components/schemas/LegendTripleRateSeasonDto"}},"required":["season","lastSeason"]},"LegendTripleRateSeasonDto":{"type":"object","properties":{"seasonId":{"type":"string"},"days":{"description":"Oldest first. Days without tracked attacks are left out.","type":"array","items":{"$ref":"#/components/schemas/LegendTripleRateDayDto"}}},"required":["seasonId","days"]},"LegendTripleRateDayDto":{"type":"object","properties":{"date":{"type":"string","description":"The game day, which starts at 05:00 UTC."},"attacks":{"type":"number"},"triples":{"type":"number","description":"Attacks that won 3 stars."},"players":{"type":"number","description":"Players who attacked that day."}},"required":["date","attacks","triples","players"]},"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":{"/legends/triple-rates":{"get":{"description":"Attacks and 3-star attacks on each game day of a season and the season before it, across every legend player ClashPerk tracks.","operationId":"getLegendTripleRates","parameters":[{"name":"seasonId","required":false,"in":"query","description":"The league season's start date; the current season when left out.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendTripleRatesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the daily Legend League 3-star rate","tags":["Legends"]}}}}
```

## Get a player's legend days in a season

> Shows each day's starting and ending trophies, the Monday reset and every battle.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendDaysDto":{"type":"object","properties":{"tag":{"type":"string"},"seasonId":{"type":"string"},"items":{"description":"Days with a battle or a tracked trophy change, oldest first.","type":"array","items":{"$ref":"#/components/schemas/LegendDayDto"}}},"required":["tag","seasonId","items"]},"LegendDayDto":{"type":"object","properties":{"date":{"type":"string","description":"The game day, which starts at 05:00 UTC."},"initialTrophies":{"type":["number","null"],"description":"Trophies at the end of the day before, or the first tracked trophies. Null when none were tracked."},"currentTrophies":{"type":["number","null"],"description":"Trophies after the day's last tracked change. Null when no trophy change was tracked."},"reset":{"description":"The Monday reset to 5000 (everyone's, at season start), when it moved this player.","allOf":[{"$ref":"#/components/schemas/LegendResetDto"}]},"attackCount":{"type":"number"},"defenseCount":{"type":"number"},"attackTrophies":{"type":"number","description":"Trophies gained from attacks."},"defenseTrophies":{"type":"number","description":"Trophies lost to defenses, as a negative number."},"missedDefenseTrophies":{"type":"number","description":"Trophies the game took at the start of the day for defenses the player didn't get the day\nbefore (fewer than 8), as a negative number. Absent when none were taken. Also in `changes`."},"changes":{"description":"Trophy changes no battle explains. Initial + attacks + defenses + changes = current.","type":"array","items":{"$ref":"#/components/schemas/LegendDayChangeDto"}},"battles":{"description":"Oldest first.","type":"array","items":{"$ref":"#/components/schemas/LegendDayBattleDto"}}},"required":["date","initialTrophies","currentTrophies","attackCount","defenseCount","attackTrophies","defenseTrophies","changes","battles"]},"LegendResetDto":{"type":"object","properties":{"from":{"type":"number","description":"Trophies before the reset."},"to":{"type":"number","description":"Trophies after the reset, always 5000."}},"required":["from","to"]},"LegendDayChangeDto":{"type":"object","properties":{"type":{"description":"`reset`: the Monday or season start reset to 5000. `missedDefenses`: what the game took at the\nstart of the day for defenses the player didn't get the day before. `untracked`: anything no tracked battle explains.","allOf":[{"$ref":"#/components/schemas/LegendDayChangeType"}]},"trophies":{"type":"number"}},"required":["type","trophies"]},"LegendDayChangeType":{"type":"string","enum":["reset","missedDefenses","untracked"],"description":"`reset`: the Monday or season start reset to 5000. `missedDefenses`: what the game took at the\nstart of the day for defenses the player didn't get the day before. `untracked`: anything no tracked battle explains."},"LegendDayBattleDto":{"type":"object","properties":{"isAttack":{"type":"boolean"},"stars":{"type":"number"},"destruction":{"type":"number"},"trophyChange":{"type":"number"},"opponentTag":{"type":"string"},"battleTime":{"format":"date-time","type":"string","description":"When the battle ended."}},"required":["isAttack","stars","destruction","trophyChange","opponentTag","battleTime"]},"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":{"/legends/{playerTag}/days":{"get":{"description":"Shows each day's starting and ending trophies, the Monday reset and every battle.","operationId":"getLegendDays","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"seasonId","required":false,"in":"query","description":"The league season's start date; the current season when left out.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendDaysDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's legend days in a season","tags":["Legends"]}}}}
```

## Get a player's most used legend armies

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

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendArmiesDto":{"type":"object","properties":{"tag":{"type":"string"},"seasonId":{"type":"string"},"attacks":{"type":"number","description":"Legend 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","seasonId","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":{"/legends/{playerTag}/armies":{"get":{"description":"Each hero with the pet and equipment used most, and the army used most, from the season's legend attacks.","operationId":"getLegendArmies","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"seasonId","required":false,"in":"query","description":"The league season's start date; the current season when left out.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendArmiesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's most used legend armies","tags":["Legends"]}}}}
```

## GET /legends/{playerTag}/seasons

> Get a player's recent legend seasons

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendSeasonsDto":{"type":"object","properties":{"items":{"description":"Newest first, at most 6.","type":"array","items":{"$ref":"#/components/schemas/LegendSeasonDto"}}},"required":["items"]},"LegendSeasonDto":{"type":"object","properties":{"seasonId":{"type":"string"},"initial":{"type":"number","description":"Trophies when the season's first attack or defense was tracked."},"trophies":{"type":"number","description":"Trophies after the season's last tracked attack or defense."},"attackTrophies":{"type":"number","description":"Trophies gained from attacks. Several attacks between two checks land as one log entry, so\nattacks are only totalled, not counted."},"defenseTrophies":{"type":"number","description":"Trophies lost to defenses, as a negative number."}},"required":["seasonId","initial","trophies","attackTrophies","defenseTrophies"]},"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":{"/legends/{playerTag}/seasons":{"get":{"operationId":"getLegendSeasons","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendSeasonsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a player's recent legend seasons","tags":["Legends"]}}}}
```

## Estimate a player's legend rank

> The rank is worked out from the players ClashPerk tracks this season, so it may differ from the game. Returns 404 if the player isn't tracked.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Legends","description":"Legend League attacks, seasons and rank estimates."}],"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":{"LegendRankDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"rank":{"type":"number"},"trophies":{"type":"number"}},"required":["tag","name","rank","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":{"/legends/{playerTag}/estimate-rank":{"get":{"description":"The rank is worked out from the players ClashPerk tracks this season, so it may differ from the game. Returns 404 if the player isn't tracked.","operationId":"estimateLegendRank","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegendRankDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Estimate a player's legend rank","tags":["Legends"]}}}}
```


---

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