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

# Guilds

Server settings: clans, logs and roles. Dashboard sessions only.

## GET /guilds/{guildId}/clans

> List the server's clans by category

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/clans":{"get":{"operationId":"getGuildClans","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List the server's clans by category","tags":["Guilds"]}}}}
```

## Add a clan to the server

> Servers can add 5, 20 or 100 clans depending on their member count. Going past that, or adding a clan that's already in more than 10 other servers, needs proof that you lead the clan. Supporter servers skip this check.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"AddGuildClanInput":{"type":"object","properties":{"tag":{"type":"string","description":"With or without `#`; the letter O is read as zero, as in the game.","pattern":"^#?[0-9A-Za-z]{3,15}$"},"categoryId":{"type":["string","null"]}},"required":["tag"]},"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/clans":{"post":{"description":"Servers can add 5, 20 or 100 clans depending on their member count. Going past that, or adding a clan that's already in more than 10 other servers, needs proof that you lead the clan. Supporter servers skip this check.","operationId":"addGuildClan","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddGuildClanInput"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Add a clan to the server","tags":["Guilds"]}}}}
```

## Reorder the server's clans and categories

> Send every category with its clans, in the order you want. Clans you put under \`uncategorized\` are taken out of their category.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ReorderClanCategoriesInput":{"type":"object","properties":{"categories":{"minItems":1,"type":"array","items":{"$ref":"#/components/schemas/ReorderCategoriesInput"}}},"required":["categories"]},"ReorderCategoriesInput":{"type":"object","properties":{"_id":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/ReorderClansInput"}}},"required":["_id","order","clans"]},"ReorderClansInput":{"type":"object","properties":{"_id":{"type":"string"},"order":{"type":"number"}},"required":["_id","order"]},"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/clans/reorder":{"patch":{"description":"Send every category with its clans, in the order you want. Clans you put under `uncategorized` are taken out of their category.","operationId":"reorderGuildClans","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderClanCategoriesInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Reorder the server's clans and categories","tags":["Guilds"]}}}}
```

## Remove a clan from the server

> This also deletes the clan's logs and removes it from reminders. Any reminder left with no clans is deleted.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/clans/{clanTag}":{"delete":{"description":"This also deletes the clan's logs and removes it from reminders. Any reminder left with no clans is deleted.","operationId":"removeGuildClan","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Remove a clan from the server","tags":["Guilds"]}}}}
```

## Update a clan's alias, short name and channels

> You only need to send the fields you want to change. Each alias must be unique in the server, and a channel can only belong to one clan.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanSettingsInput":{"type":"object","properties":{"alias":{"type":["string","null"],"description":"Up to 15 characters, no spaces or leading #.","pattern":"^[^#\\s]\\S{0,14}$"},"nickname":{"type":["string","null"],"minLength":1,"maxLength":15},"channels":{"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}}}},"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/clans/{clanTag}":{"patch":{"description":"You only need to send the fields you want to change. Each alias must be unique in the server, and a channel can only belong to one clan.","operationId":"updateGuildClan","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanSettingsInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update a clan's alias, short name and channels","tags":["Guilds"]}}}}
```

## POST /guilds/{guildId}/categories

> Create a clan category

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanCategoryInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":36}},"required":["name"]},"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/categories":{"post":{"operationId":"createClanCategory","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanCategoryInput"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Create a clan category","tags":["Guilds"]}}}}
```

## Delete a clan category

> Its clans aren't removed. They move to Uncategorized.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/categories/{categoryId}":{"delete":{"description":"Its clans aren't removed. They move to Uncategorized.","operationId":"deleteClanCategory","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"categoryId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Delete a clan category","tags":["Guilds"]}}}}
```

## PATCH /guilds/{guildId}/categories/{categoryId}

> Rename a clan category

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanCategoryInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":36}},"required":["name"]},"GuildClansDto":{"type":"object","properties":{"guildId":{"type":"string"},"name":{"type":"string"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/CategoryDto"}}},"required":["guildId","name","categories"]},"CategoryDto":{"type":"object","properties":{"_id":{"type":"string"},"displayName":{"type":"string"},"order":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanDto"}}},"required":["_id","displayName","order","clans"]},"GuildClanDto":{"type":"object","properties":{"_id":{"type":"string"},"categoryId":{"type":"string"},"name":{"type":"string"},"tag":{"type":"string"},"order":{"type":"number"},"league":{"type":"string"},"level":{"type":"number"},"members":{"type":"number"},"alias":{"type":["string","null"],"description":"Finds the clan in commands; `{ALIAS}` in nicknames."},"nickname":{"type":["string","null"],"description":"Shown instead of the clan name in reminders and lists."},"channels":{"description":"Commands run in these channels use this clan when no tag is given.","type":"array","items":{"type":"string"}}},"required":["_id","categoryId","name","tag","order","league","level","members","alias","nickname","channels"]},"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":{"/guilds/{guildId}/categories/{categoryId}":{"patch":{"operationId":"renameClanCategory","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"categoryId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanCategoryInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildClansDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Rename a clan category","tags":["Guilds"]}}}}
```

## List channels and threads the bot can post in

> A channel the bot can't post in still shows up if it has threads the bot can use, but the channel itself can't be picked.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildChannelDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"number","description":"Discord channel type: 0 text, 5 announcement, 15 forum, 16 media; 10, 11, 12 threads."},"parentId":{"type":["string","null"],"description":"A channel's category, or a thread's channel."},"selectable":{"type":"boolean","description":"False for a forum or media channel, which is listed only as the heading of its posts."},"hasWebhook":{"type":"boolean","description":"ClashPerk already has a webhook here (a thread's is its channel's), so no Discord sign-in is needed."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks here (a thread's are its channel's), e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["id","name","type","parentId","selectable","hasWebhook","missingPermissions"]},"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":{"/guilds/{guildId}/channels":{"get":{"description":"A channel the bot can't post in still shows up if it has threads the bot can use, but the channel itself can't be picked.","operationId":"listChannels","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GuildChannelDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List channels and threads the bot can post in","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/channel-categories

> List the server's channel categories

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildCategoryDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","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":{"/guilds/{guildId}/channel-categories":{"get":{"operationId":"listChannelCategories","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GuildCategoryDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List the server's channel categories","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/channels/mentionable

> List channels a message can mention

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"MentionChannelDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"number","description":"Discord channel type: 0 text, 2 voice, 5 announcement, 13 stage, 15 forum, 16 media; 10, 11, 12 threads."},"parentId":{"type":["string","null"],"description":"A thread's channel; null for a channel."}},"required":["id","name","type","parentId"]},"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":{"/guilds/{guildId}/channels/mentionable":{"get":{"operationId":"listMentionableChannels","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MentionChannelDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List channels a message can mention","tags":["Guilds"]}}}}
```

## List the server's roles

> Sorted from highest to lowest. @everyone and roles owned by bots or integrations are left out.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildRoleDto":{"type":"object","properties":{"problem":{"description":"Why ClashPerk can't give this role out, or null when it can.","anyOf":[{"$ref":"#/components/schemas/RoleProblem"},{"type":"null"}]},"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"number"},"position":{"type":"number"}},"required":["problem","id","name","color","position"]},"RoleProblem":{"type":"string","enum":["above_bot","managed","no_manage_roles"],"description":"Why ClashPerk can't give this role out, or null when it can."},"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":{"/guilds/{guildId}/roles":{"get":{"description":"Sorted from highest to lowest. @everyone and roles owned by bots or integrations are left out.","operationId":"listRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GuildRoleDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List the server's roles","tags":["Guilds"]}}}}
```

## List server permissions ClashPerk is missing

> Only the permissions its features need across the server: Manage Roles for auto-roles and Manage Nicknames for auto-nickname.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"BotPermissionsDto":{"type":"object","properties":{"missingPermissions":{"description":"`Manage Roles` (auto-roles) and `Manage Nicknames` (auto-nickname) when the bot lacks them.","type":"array","items":{"type":"string"}}},"required":["missingPermissions"]},"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":{"/guilds/{guildId}/bot-permissions":{"get":{"description":"Only the permissions its features need across the server: Manage Roles for auto-roles and Manage Nicknames for auto-nickname.","operationId":"getBotPermissions","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotPermissionsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List server permissions ClashPerk is missing","tags":["Guilds"]}}}}
```

## List custom emojis the bot can use

> Includes the server's own emojis and the bot's emojis.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildEmojisDto":{"type":"object","properties":{"server":{"description":"This server's, without the ones it lost with its boost level.","type":"array","items":{"$ref":"#/components/schemas/GuildEmojiDto"}},"bot":{"description":"The bot's own, which it can use in any server.","type":"array","items":{"$ref":"#/components/schemas/GuildEmojiDto"}}},"required":["server","bot"]},"GuildEmojiDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"animated":{"type":"boolean"}},"required":["id","name","animated"]},"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":{"/guilds/{guildId}/emojis":{"get":{"description":"Includes the server's own emojis and the bot's emojis.","operationId":"listEmojis","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildEmojisDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List custom emojis the bot can use","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/clan-logs

> List every clan log in the server

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildClanLogDto":{"type":"object","properties":{"logType":{"allOf":[{"$ref":"#/components/schemas/ClanLogType"}]},"channelStatus":{"allOf":[{"$ref":"#/components/schemas/ChannelStatus"}]},"clanTag":{"type":"string"},"id":{"type":"string"},"channelId":{"type":"string"},"channelName":{"type":["string","null"]},"parentChannelName":{"type":["string","null"],"description":"The channel a thread is in; null for channels."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"lastPostedAt":{"format":"date-time","type":["string","null"],"description":"When the bot last posted this log. Null before its first post."},"isEnabled":{"type":"boolean"},"roleId":{"type":["string","null"]},"color":{"type":["number","null"]},"updatedAt":{"format":"date-time","type":"string"}},"required":["logType","channelStatus","clanTag","id","channelId","channelName","parentChannelName","missingPermissions","lastPostedAt","isEnabled","roleId","color","updatedAt"]},"ClanLogType":{"type":"string","enum":["clan_achievements_log","continuous_donation_log","daily_donation_log","weekly_donation_log","monthly_donation_log","clan_games_embed_log","last_seen_embed_log","legend_attacks_daily_summary_log","clan_capital_weekly_summary_log","clan_capital_contribution_log","clan_capital_raid_log","war_attack_log","cwl_attack_log","war_embed_log","war_missed_attacks_log","cwl_embed_log","cwl_missed_attacks_log","cwl_lineup_change_log","cwl_monthly_summary_log","member_join_leave_log","role_change_log","name_change_log","town_hall_upgrade_log","war_preference_log","ranked_battle_league_change_log"]},"ChannelStatus":{"type":"string","enum":["ok","archived","locked","deleted","noAccess","unknown"]},"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":{"/guilds/{guildId}/clan-logs":{"get":{"operationId":"listGuildClanLogs","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GuildClanLogDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List every clan log in the server","tags":["Guilds"]}}}}
```

## Get the server's clan log limit

> Shows how many clans can have logs in this server, and which clans already count toward that limit.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanLogLimitDto":{"type":"object","properties":{"limit":{"type":"number","description":"How many clans can have logs in this server."},"clanTags":{"description":"Clans that already have logs; adding logs to these never hits the limit.","type":"array","items":{"type":"string"}},"patron":{"type":"boolean"}},"required":["limit","clanTags","patron"]},"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":{"/guilds/{guildId}/clan-logs/limit":{"get":{"description":"Shows how many clans can have logs in this server, and which clans already count toward that limit.","operationId":"getClanLogLimit","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanLogLimitDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's clan log limit","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/clans/{clanTag}/embed

> Get a clan's embed

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanEmbedStateDto":{"type":"object","properties":{"embed":{"description":"Null when the clan has no embed.","anyOf":[{"$ref":"#/components/schemas/ClanEmbedDto"},{"type":"null"}]}},"required":["embed"]},"ClanEmbedDto":{"type":"object","properties":{"fields":{"type":"array","items":{"$ref":"#/components/schemas/ClanEmbedField"}},"channelId":{"type":"string"},"channelName":{"type":["string","null"]},"color":{"type":["number","null"]},"description":{"type":["string","null"],"description":"Null when it shows the in-game clan description."},"requirements":{"type":["string","null"],"description":"Null when it shows the in-game Town Hall requirement."},"bannerImage":{"type":["string","null"]},"messageId":{"type":["string","null"],"description":"The posted message, once the bot has sent it."},"updatedAt":{"format":"date-time","type":"string"}},"required":["fields","channelId","channelName","color","description","requirements","bannerImage","messageId","updatedAt"]},"ClanEmbedField":{"type":"string","enum":["clanLeader","requirements","trophiesRequired","location","warPerformance","warFrequency","clanWarLeague","clanCapitalLeague","townHalls"]},"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":{"/guilds/{guildId}/clans/{clanTag}/embed":{"get":{"operationId":"getClanEmbed","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanEmbedStateDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a clan's embed","tags":["Guilds"]}}}}
```

## Create or update a clan's embed

> The bot posts or updates the message the next time it refreshes. A clan's first log or embed counts toward the server's clan log limit.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanEmbedInput":{"type":"object","properties":{"fields":{"maxItems":9,"type":"array","items":{"$ref":"#/components/schemas/ClanEmbedField"}},"channelId":{"type":"string","pattern":"^\\d{17,20}$"},"webhook":{"description":"From Discord's `webhook.incoming` sign-in; without one, a known webhook in the channel is reused.","allOf":[{"$ref":"#/components/schemas/ReminderWebhookInput"}]},"color":{"type":["number","null"],"description":"Embed color as an RGB integer; null uses the server's default.","minimum":0,"maximum":16777215},"description":{"type":["string","null"],"description":"Null shows the in-game clan description.","minLength":1,"maxLength":1200},"requirements":{"type":["string","null"],"description":"Null shows the in-game Town Hall requirement.","minLength":1,"maxLength":600},"bannerImage":{"type":["string","null"],"maxLength":256,"format":"uri"}},"required":["fields","channelId"]},"ClanEmbedField":{"type":"string","enum":["clanLeader","requirements","trophiesRequired","location","warPerformance","warFrequency","clanWarLeague","clanCapitalLeague","townHalls"]},"ReminderWebhookInput":{"type":"object","properties":{"id":{"type":"string","pattern":"^\\d{17,20}$"},"token":{"type":"string","minLength":1}},"required":["id","token"]},"ClanEmbedDto":{"type":"object","properties":{"fields":{"type":"array","items":{"$ref":"#/components/schemas/ClanEmbedField"}},"channelId":{"type":"string"},"channelName":{"type":["string","null"]},"color":{"type":["number","null"]},"description":{"type":["string","null"],"description":"Null when it shows the in-game clan description."},"requirements":{"type":["string","null"],"description":"Null when it shows the in-game Town Hall requirement."},"bannerImage":{"type":["string","null"]},"messageId":{"type":["string","null"],"description":"The posted message, once the bot has sent it."},"updatedAt":{"format":"date-time","type":"string"}},"required":["fields","channelId","channelName","color","description","requirements","bannerImage","messageId","updatedAt"]},"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":{"/guilds/{guildId}/clans/{clanTag}/embed":{"put":{"description":"The bot posts or updates the message the next time it refreshes. A clan's first log or embed counts toward the server's clan log limit.","operationId":"saveClanEmbed","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanEmbedInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanEmbedDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Create or update a clan's embed","tags":["Guilds"]}}}}
```

## Delete a clan's embed

> The message already posted stays in the channel, but the bot stops updating it.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"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":{"/guilds/{guildId}/clans/{clanTag}/embed":{"delete":{"description":"The message already posted stays in the channel, but the bot stops updating it.","operationId":"deleteClanEmbed","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Delete a clan's embed","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/clans/{clanTag}/logs

> List a clan's logs

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanLogDto":{"type":"object","properties":{"logType":{"allOf":[{"$ref":"#/components/schemas/ClanLogType"}]},"channelStatus":{"allOf":[{"$ref":"#/components/schemas/ChannelStatus"}]},"id":{"type":"string"},"channelId":{"type":"string"},"channelName":{"type":["string","null"]},"parentChannelName":{"type":["string","null"],"description":"The channel a thread is in; null for channels."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"lastPostedAt":{"format":"date-time","type":["string","null"],"description":"When the bot last posted this log. Null before its first post."},"isEnabled":{"type":"boolean"},"roleId":{"type":["string","null"]},"color":{"type":["number","null"]},"updatedAt":{"format":"date-time","type":"string"}},"required":["logType","channelStatus","id","channelId","channelName","parentChannelName","missingPermissions","lastPostedAt","isEnabled","roleId","color","updatedAt"]},"ClanLogType":{"type":"string","enum":["clan_achievements_log","continuous_donation_log","daily_donation_log","weekly_donation_log","monthly_donation_log","clan_games_embed_log","last_seen_embed_log","legend_attacks_daily_summary_log","clan_capital_weekly_summary_log","clan_capital_contribution_log","clan_capital_raid_log","war_attack_log","cwl_attack_log","war_embed_log","war_missed_attacks_log","cwl_embed_log","cwl_missed_attacks_log","cwl_lineup_change_log","cwl_monthly_summary_log","member_join_leave_log","role_change_log","name_change_log","town_hall_upgrade_log","war_preference_log","ranked_battle_league_change_log"]},"ChannelStatus":{"type":"string","enum":["ok","archived","locked","deleted","noAccess","unknown"]},"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":{"/guilds/{guildId}/clans/{clanTag}/logs":{"get":{"operationId":"listClanLogs","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClanLogDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List a clan's logs","tags":["Guilds"]}}}}
```

## Create or update a clan log

> A clan's first log counts toward the server's clan log limit. A new log starts by posting the last 30 minutes of activity.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanLogType":{"type":"string","enum":["clan_achievements_log","continuous_donation_log","daily_donation_log","weekly_donation_log","monthly_donation_log","clan_games_embed_log","last_seen_embed_log","legend_attacks_daily_summary_log","clan_capital_weekly_summary_log","clan_capital_contribution_log","clan_capital_raid_log","war_attack_log","cwl_attack_log","war_embed_log","war_missed_attacks_log","cwl_embed_log","cwl_missed_attacks_log","cwl_lineup_change_log","cwl_monthly_summary_log","member_join_leave_log","role_change_log","name_change_log","town_hall_upgrade_log","war_preference_log","ranked_battle_league_change_log"]},"ClanLogInput":{"type":"object","properties":{"channelId":{"type":"string","pattern":"^\\d{17,20}$"},"webhook":{"description":"From Discord's `webhook.incoming` sign-in; without one, a known webhook in the channel is reused.","allOf":[{"$ref":"#/components/schemas/ReminderWebhookInput"}]},"isEnabled":{"type":"boolean"},"roleId":{"type":["string","null"],"description":"Pinged with each post; null for none.","pattern":"^\\d{17,20}$"},"color":{"type":["number","null"],"description":"Embed color as an RGB integer; null uses the server's default.","minimum":0,"maximum":16777215}},"required":["channelId","isEnabled","roleId","color"]},"ReminderWebhookInput":{"type":"object","properties":{"id":{"type":"string","pattern":"^\\d{17,20}$"},"token":{"type":"string","minLength":1}},"required":["id","token"]},"ClanLogDto":{"type":"object","properties":{"logType":{"allOf":[{"$ref":"#/components/schemas/ClanLogType"}]},"channelStatus":{"allOf":[{"$ref":"#/components/schemas/ChannelStatus"}]},"id":{"type":"string"},"channelId":{"type":"string"},"channelName":{"type":["string","null"]},"parentChannelName":{"type":["string","null"],"description":"The channel a thread is in; null for channels."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"lastPostedAt":{"format":"date-time","type":["string","null"],"description":"When the bot last posted this log. Null before its first post."},"isEnabled":{"type":"boolean"},"roleId":{"type":["string","null"]},"color":{"type":["number","null"]},"updatedAt":{"format":"date-time","type":"string"}},"required":["logType","channelStatus","id","channelId","channelName","parentChannelName","missingPermissions","lastPostedAt","isEnabled","roleId","color","updatedAt"]},"ChannelStatus":{"type":"string","enum":["ok","archived","locked","deleted","noAccess","unknown"]},"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":{"/guilds/{guildId}/clans/{clanTag}/logs/{logType}":{"put":{"description":"A clan's first log counts toward the server's clan log limit. A new log starts by posting the last 30 minutes of activity.","operationId":"saveClanLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"logType","required":true,"in":"path","schema":{"$ref":"#/components/schemas/ClanLogType"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanLogInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClanLogDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Create or update a clan log","tags":["Guilds"]}}}}
```

## DELETE /guilds/{guildId}/clans/{clanTag}/logs/{logType}

> Delete a clan log

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ClanLogType":{"type":"string","enum":["clan_achievements_log","continuous_donation_log","daily_donation_log","weekly_donation_log","monthly_donation_log","clan_games_embed_log","last_seen_embed_log","legend_attacks_daily_summary_log","clan_capital_weekly_summary_log","clan_capital_contribution_log","clan_capital_raid_log","war_attack_log","cwl_attack_log","war_embed_log","war_missed_attacks_log","cwl_embed_log","cwl_missed_attacks_log","cwl_lineup_change_log","cwl_monthly_summary_log","member_join_leave_log","role_change_log","name_change_log","town_hall_upgrade_log","war_preference_log","ranked_battle_league_change_log"]},"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":{"/guilds/{guildId}/clans/{clanTag}/logs/{logType}":{"delete":{"operationId":"deleteClanLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}},{"name":"logType","required":true,"in":"path","schema":{"$ref":"#/components/schemas/ClanLogType"}}],"responses":{"204":{"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Delete a clan log","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/auto-roles

> Get the server's auto-role settings

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"AutoRolesDto":{"type":"object","properties":{"townHall":{"type":"object","additionalProperties":{"type":"string"}},"builderHall":{"type":"object","additionalProperties":{"type":"string"}},"leagues":{"type":"object","additionalProperties":{"type":"string"}},"builderLeagues":{"type":"object","additionalProperties":{"type":"string"}},"trophies":{"type":"object","additionalProperties":{"type":"string"}},"delayExclusions":{"type":"array","items":{"$ref":"#/components/schemas/DelayExclusion"}},"nicknameAccount":{"allOf":[{"$ref":"#/components/schemas/NicknameAccount"}]},"familyRole":{"type":["string","null"]},"exclusiveFamilyRole":{"type":["string","null"]},"familyLeadersRoles":{"type":"array","items":{"type":"string"}},"guestRole":{"type":["string","null"]},"verifiedRole":{"type":["string","null"]},"linkedRole":{"type":["string","null"]},"eosPushRole":{"type":["string","null"]},"eosPushClans":{"type":"array","items":{"type":"string"}},"allowNonFamilyTownHall":{"type":"boolean","description":"Town Hall and Builder Hall roles also go to accounts outside the server's clans."},"allowNonFamilyLeagues":{"type":"boolean","description":"League and builder league roles also go to accounts outside the server's clans."},"verifiedOnlyClanRoles":{"type":"boolean"},"autoUpdate":{"type":"boolean"},"forceRefresh":{"type":"boolean"},"allowNotLinked":{"type":"boolean","description":"Members with no linked account still get roles like the guest role."},"removalDelay":{"type":"number","description":"Milliseconds; one of the bot's choices."},"additionDelay":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/AutoRoleClanDto"}},"familyNicknameFormat":{"type":"string","description":"Nickname format for members in your clans; \"\" means none."},"nonFamilyNicknameFormat":{"type":"string","description":"Nickname format for everyone else; \"\" means none."},"autoNickname":{"type":"boolean","description":"Nicknames change on the bot's checks, not only on a refresh."},"nicknameRoleLabels":{"$ref":"#/components/schemas/NicknameRoleLabels"}},"required":["townHall","builderHall","leagues","builderLeagues","trophies","delayExclusions","nicknameAccount","familyRole","exclusiveFamilyRole","familyLeadersRoles","guestRole","verifiedRole","linkedRole","eosPushRole","eosPushClans","allowNonFamilyTownHall","allowNonFamilyLeagues","verifiedOnlyClanRoles","autoUpdate","forceRefresh","allowNotLinked","removalDelay","additionDelay","clans","familyNicknameFormat","nonFamilyNicknameFormat","autoNickname","nicknameRoleLabels"]},"DelayExclusion":{"type":"string","enum":["townHallRoles","builderHallRoles","leagueRoles","builderLeagueRoles","guestRole"]},"NicknameAccount":{"type":"string","enum":["default-account","best-account","default-or-best-account"]},"AutoRoleClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"leader":{"type":["string","null"]},"coLeader":{"type":["string","null"]},"elder":{"type":["string","null"]},"member":{"type":["string","null"]},"everyone":{"type":["string","null"]},"warRole":{"type":["string","null"]}},"required":["tag","name","leader","coLeader","elder","member","everyone","warRole"]},"NicknameRoleLabels":{"type":"object","properties":{"leader":{"type":"string","maxLength":10},"coLeader":{"type":"string","maxLength":10},"elder":{"type":"string","maxLength":10},"member":{"type":"string","maxLength":10}},"required":["leader","coLeader","elder","member"]},"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":{"/guilds/{guildId}/auto-roles":{"get":{"operationId":"getAutoRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRolesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's auto-role settings","tags":["Guilds"]}}}}
```

## Update the server-wide auto-role settings

> You only need to send the fields you want to change. Roles must be below the bot's highest role, and the server needs at least one clan first.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"AutoRolesInput":{"type":"object","properties":{"townHall":{"type":"object","additionalProperties":{"type":"string"}},"builderHall":{"type":"object","additionalProperties":{"type":"string"}},"leagues":{"type":"object","additionalProperties":{"type":"string"}},"builderLeagues":{"type":"object","additionalProperties":{"type":"string"}},"trophies":{"type":"object","additionalProperties":{"type":"string"}},"delayExclusions":{"type":"array","items":{"$ref":"#/components/schemas/DelayExclusion"}},"nicknameAccount":{"allOf":[{"$ref":"#/components/schemas/NicknameAccount"}]},"familyRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"exclusiveFamilyRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"familyLeadersRoles":{"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}},"guestRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"verifiedRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"linkedRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"eosPushRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"eosPushClans":{"type":"array","items":{"type":"string"}},"allowNonFamilyTownHall":{"type":"boolean"},"allowNonFamilyLeagues":{"type":"boolean"},"verifiedOnlyClanRoles":{"type":"boolean"},"autoUpdate":{"type":"boolean"},"forceRefresh":{"type":"boolean"},"allowNotLinked":{"type":"boolean"},"removalDelay":{"type":"number","enum":[0,3600000,7200000,14400000,21600000,28800000,43200000,64800000,86400000,129600000,172800000,259200000,604800000,1036800000]},"additionDelay":{"type":"number","enum":[0,3600000,7200000,14400000,21600000,28800000,43200000,64800000,86400000]},"familyNicknameFormat":{"type":"string","maxLength":100},"nonFamilyNicknameFormat":{"type":"string","maxLength":100},"autoNickname":{"type":"boolean"},"nicknameRoleLabels":{"$ref":"#/components/schemas/NicknameRoleLabels"}}},"DelayExclusion":{"type":"string","enum":["townHallRoles","builderHallRoles","leagueRoles","builderLeagueRoles","guestRole"]},"NicknameAccount":{"type":"string","enum":["default-account","best-account","default-or-best-account"]},"NicknameRoleLabels":{"type":"object","properties":{"leader":{"type":"string","maxLength":10},"coLeader":{"type":"string","maxLength":10},"elder":{"type":"string","maxLength":10},"member":{"type":"string","maxLength":10}},"required":["leader","coLeader","elder","member"]},"AutoRolesDto":{"type":"object","properties":{"townHall":{"type":"object","additionalProperties":{"type":"string"}},"builderHall":{"type":"object","additionalProperties":{"type":"string"}},"leagues":{"type":"object","additionalProperties":{"type":"string"}},"builderLeagues":{"type":"object","additionalProperties":{"type":"string"}},"trophies":{"type":"object","additionalProperties":{"type":"string"}},"delayExclusions":{"type":"array","items":{"$ref":"#/components/schemas/DelayExclusion"}},"nicknameAccount":{"allOf":[{"$ref":"#/components/schemas/NicknameAccount"}]},"familyRole":{"type":["string","null"]},"exclusiveFamilyRole":{"type":["string","null"]},"familyLeadersRoles":{"type":"array","items":{"type":"string"}},"guestRole":{"type":["string","null"]},"verifiedRole":{"type":["string","null"]},"linkedRole":{"type":["string","null"]},"eosPushRole":{"type":["string","null"]},"eosPushClans":{"type":"array","items":{"type":"string"}},"allowNonFamilyTownHall":{"type":"boolean","description":"Town Hall and Builder Hall roles also go to accounts outside the server's clans."},"allowNonFamilyLeagues":{"type":"boolean","description":"League and builder league roles also go to accounts outside the server's clans."},"verifiedOnlyClanRoles":{"type":"boolean"},"autoUpdate":{"type":"boolean"},"forceRefresh":{"type":"boolean"},"allowNotLinked":{"type":"boolean","description":"Members with no linked account still get roles like the guest role."},"removalDelay":{"type":"number","description":"Milliseconds; one of the bot's choices."},"additionDelay":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/AutoRoleClanDto"}},"familyNicknameFormat":{"type":"string","description":"Nickname format for members in your clans; \"\" means none."},"nonFamilyNicknameFormat":{"type":"string","description":"Nickname format for everyone else; \"\" means none."},"autoNickname":{"type":"boolean","description":"Nicknames change on the bot's checks, not only on a refresh."},"nicknameRoleLabels":{"$ref":"#/components/schemas/NicknameRoleLabels"}},"required":["townHall","builderHall","leagues","builderLeagues","trophies","delayExclusions","nicknameAccount","familyRole","exclusiveFamilyRole","familyLeadersRoles","guestRole","verifiedRole","linkedRole","eosPushRole","eosPushClans","allowNonFamilyTownHall","allowNonFamilyLeagues","verifiedOnlyClanRoles","autoUpdate","forceRefresh","allowNotLinked","removalDelay","additionDelay","clans","familyNicknameFormat","nonFamilyNicknameFormat","autoNickname","nicknameRoleLabels"]},"AutoRoleClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"leader":{"type":["string","null"]},"coLeader":{"type":["string","null"]},"elder":{"type":["string","null"]},"member":{"type":["string","null"]},"everyone":{"type":["string","null"]},"warRole":{"type":["string","null"]}},"required":["tag","name","leader","coLeader","elder","member","everyone","warRole"]},"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":{"/guilds/{guildId}/auto-roles":{"patch":{"description":"You only need to send the fields you want to change. Roles must be below the bot's highest role, and the server needs at least one clan first.","operationId":"updateAutoRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRolesInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRolesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update the server-wide auto-role settings","tags":["Guilds"]}}}}
```

## Set a clan's auto-roles

> This replaces all of the clan's roles, so any role you leave out is cleared. An in-war role can only be used by one clan.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"AutoRoleClanInput":{"type":"object","properties":{"leader":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"coLeader":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"elder":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"member":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"everyone":{"type":["string","null"],"pattern":"^\\d{17,20}$"},"warRole":{"type":["string","null"],"pattern":"^\\d{17,20}$"}},"required":["leader","coLeader","elder","member","everyone","warRole"]},"AutoRolesDto":{"type":"object","properties":{"townHall":{"type":"object","additionalProperties":{"type":"string"}},"builderHall":{"type":"object","additionalProperties":{"type":"string"}},"leagues":{"type":"object","additionalProperties":{"type":"string"}},"builderLeagues":{"type":"object","additionalProperties":{"type":"string"}},"trophies":{"type":"object","additionalProperties":{"type":"string"}},"delayExclusions":{"type":"array","items":{"$ref":"#/components/schemas/DelayExclusion"}},"nicknameAccount":{"allOf":[{"$ref":"#/components/schemas/NicknameAccount"}]},"familyRole":{"type":["string","null"]},"exclusiveFamilyRole":{"type":["string","null"]},"familyLeadersRoles":{"type":"array","items":{"type":"string"}},"guestRole":{"type":["string","null"]},"verifiedRole":{"type":["string","null"]},"linkedRole":{"type":["string","null"]},"eosPushRole":{"type":["string","null"]},"eosPushClans":{"type":"array","items":{"type":"string"}},"allowNonFamilyTownHall":{"type":"boolean","description":"Town Hall and Builder Hall roles also go to accounts outside the server's clans."},"allowNonFamilyLeagues":{"type":"boolean","description":"League and builder league roles also go to accounts outside the server's clans."},"verifiedOnlyClanRoles":{"type":"boolean"},"autoUpdate":{"type":"boolean"},"forceRefresh":{"type":"boolean"},"allowNotLinked":{"type":"boolean","description":"Members with no linked account still get roles like the guest role."},"removalDelay":{"type":"number","description":"Milliseconds; one of the bot's choices."},"additionDelay":{"type":"number"},"clans":{"type":"array","items":{"$ref":"#/components/schemas/AutoRoleClanDto"}},"familyNicknameFormat":{"type":"string","description":"Nickname format for members in your clans; \"\" means none."},"nonFamilyNicknameFormat":{"type":"string","description":"Nickname format for everyone else; \"\" means none."},"autoNickname":{"type":"boolean","description":"Nicknames change on the bot's checks, not only on a refresh."},"nicknameRoleLabels":{"$ref":"#/components/schemas/NicknameRoleLabels"}},"required":["townHall","builderHall","leagues","builderLeagues","trophies","delayExclusions","nicknameAccount","familyRole","exclusiveFamilyRole","familyLeadersRoles","guestRole","verifiedRole","linkedRole","eosPushRole","eosPushClans","allowNonFamilyTownHall","allowNonFamilyLeagues","verifiedOnlyClanRoles","autoUpdate","forceRefresh","allowNotLinked","removalDelay","additionDelay","clans","familyNicknameFormat","nonFamilyNicknameFormat","autoNickname","nicknameRoleLabels"]},"DelayExclusion":{"type":"string","enum":["townHallRoles","builderHallRoles","leagueRoles","builderLeagueRoles","guestRole"]},"NicknameAccount":{"type":"string","enum":["default-account","best-account","default-or-best-account"]},"AutoRoleClanDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"leader":{"type":["string","null"]},"coLeader":{"type":["string","null"]},"elder":{"type":["string","null"]},"member":{"type":["string","null"]},"everyone":{"type":["string","null"]},"warRole":{"type":["string","null"]}},"required":["tag","name","leader","coLeader","elder","member","everyone","warRole"]},"NicknameRoleLabels":{"type":"object","properties":{"leader":{"type":"string","maxLength":10},"coLeader":{"type":"string","maxLength":10},"elder":{"type":"string","maxLength":10},"member":{"type":"string","maxLength":10}},"required":["leader","coLeader","elder","member"]},"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":{"/guilds/{guildId}/auto-roles/clans/{clanTag}":{"put":{"description":"This replaces all of the clan's roles, so any role you leave out is cleared. An in-war role can only be used by one clan.","operationId":"saveClanAutoRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"clanTag","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRoleClanInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRolesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Set a clan's auto-roles","tags":["Guilds"]}}}}
```

## List the server's active flags

> Also shows how many active flags the server has and how many it's allowed. Supporter servers have no limit.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"FlagType":{"type":"string","enum":["ban","strike"]},"FlagsDto":{"type":"object","properties":{"items":{"description":"Active flags, newest first.","type":"array","items":{"$ref":"#/components/schemas/FlagDto"}},"total":{"type":"number","description":"Active flags of both types, against the limit."},"limit":{"type":["number","null"],"description":"Null for supporter servers, which have no limit."}},"required":["items","total","limit"]},"FlagDto":{"type":"object","properties":{"flagType":{"allOf":[{"$ref":"#/components/schemas/FlagType"}]},"id":{"type":"string"},"refId":{"type":"string","description":"The short reference the bot shows, e.g. in `/flag delete`."},"tag":{"type":"string"},"name":{"type":"string"},"flagImpact":{"type":"number","description":"Strike points; 1 unless set."},"reason":{"type":"string"},"expiresAt":{"format":"date-time","type":["string","null"],"description":"Null when it never expires."},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"$ref":"#/components/schemas/FlagAuthorDto"}},"required":["flagType","id","refId","tag","name","flagImpact","reason","expiresAt","createdAt","createdBy"]},"FlagAuthorDto":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["id","username","displayName"]},"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":{"/guilds/{guildId}/flags":{"get":{"description":"Also shows how many active flags the server has and how many it's allowed. Supporter servers have no limit.","operationId":"listFlags","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"flagType","required":false,"in":"query","description":"Only flags of this type","schema":{"$ref":"#/components/schemas/FlagType"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List the server's active flags","tags":["Guilds"]}}}}
```

## Flag one or more players

> Each player found gets their own flag. Servers without a subscription can have up to 1,000 active flags.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"FlagInput":{"type":"object","properties":{"flagType":{"allOf":[{"$ref":"#/components/schemas/FlagType"}]},"playerTags":{"description":"One or more player tags; the bot's option fits about 25.","minItems":1,"maxItems":25,"type":"array","items":{"type":"string"}},"reason":{"type":"string","minLength":1,"maxLength":256},"expiresInDays":{"type":["number","null"],"description":"Leave out for a flag that never expires.","minimum":1,"maximum":36500},"flagImpact":{"type":"number","description":"Strike points, 1 to 100; defaults to 1. The bot stores it for bans too.","minimum":1,"maximum":100}},"required":["flagType","playerTags","reason"]},"FlagType":{"type":"string","enum":["ban","strike"]},"FlagDto":{"type":"object","properties":{"flagType":{"allOf":[{"$ref":"#/components/schemas/FlagType"}]},"id":{"type":"string"},"refId":{"type":"string","description":"The short reference the bot shows, e.g. in `/flag delete`."},"tag":{"type":"string"},"name":{"type":"string"},"flagImpact":{"type":"number","description":"Strike points; 1 unless set."},"reason":{"type":"string"},"expiresAt":{"format":"date-time","type":["string","null"],"description":"Null when it never expires."},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"$ref":"#/components/schemas/FlagAuthorDto"}},"required":["flagType","id","refId","tag","name","flagImpact","reason","expiresAt","createdAt","createdBy"]},"FlagAuthorDto":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["id","username","displayName"]},"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":{"/guilds/{guildId}/flags":{"post":{"description":"Each player found gets their own flag. Servers without a subscription can have up to 1,000 active flags.","operationId":"createFlags","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagInput"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FlagDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Flag one or more players","tags":["Guilds"]}}}}
```

## DELETE /guilds/{guildId}/flags/{flagId}

> Delete an active flag

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"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":{"/guilds/{guildId}/flags/{flagId}":{"delete":{"operationId":"deleteFlag","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"flagId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Delete an active flag","tags":["Guilds"]}}}}
```

## Search the server's members

> Finds members whose username or server nickname starts with what you type. Returns up to 50.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ListMemberDto":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"displayName":{"type":"string"},"avatarUrl":{"type":"string"}},"required":["id","username","displayName","avatarUrl"]},"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":{"/guilds/{guildId}/members/list":{"get":{"description":"Finds members whose username or server nickname starts with what you type. Returns up to 50.","operationId":"searchMembers","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"query","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ListMemberDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Search the server's members","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/server-logs

> Get the server-wide log settings

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs":{"get":{"operationId":"getServerLogs","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server-wide log settings","tags":["Guilds"]}}}}
```

## PUT /guilds/{guildId}/server-logs/flag-alert

> Set up the flag alert log

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"FlagAlertLogInput":{"type":"object","properties":{"roleId":{"type":["string","null"],"description":"Pinged when a flagged player joins a clan; null for none.","pattern":"^\\d{17,20}$"},"useAutoRole":{"type":"boolean","description":"Ping each clan's leader and co-leader roles from auto-roles instead of `roleId`."},"channelId":{"type":"string","pattern":"^\\d{17,20}$"},"webhook":{"description":"From Discord's `webhook.incoming` sign-in; without one, a known webhook in the channel is reused.","allOf":[{"$ref":"#/components/schemas/ReminderWebhookInput"}]}},"required":["channelId"]},"ReminderWebhookInput":{"type":"object","properties":{"id":{"type":"string","pattern":"^\\d{17,20}$"},"token":{"type":"string","minLength":1}},"required":["id","token"]},"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/flag-alert":{"put":{"operationId":"saveFlagAlertLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagAlertLogInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Set up the flag alert log","tags":["Guilds"]}}}}
```

## DELETE /guilds/{guildId}/server-logs/flag-alert

> Turn off the flag alert log

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/flag-alert":{"delete":{"operationId":"deleteFlagAlertLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Turn off the flag alert log","tags":["Guilds"]}}}}
```

## PUT /guilds/{guildId}/server-logs/roster-changelog

> Set up the roster changelog

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogChannelInput":{"type":"object","properties":{"channelId":{"type":"string","pattern":"^\\d{17,20}$"},"webhook":{"description":"From Discord's `webhook.incoming` sign-in; without one, a known webhook in the channel is reused.","allOf":[{"$ref":"#/components/schemas/ReminderWebhookInput"}]}},"required":["channelId"]},"ReminderWebhookInput":{"type":"object","properties":{"id":{"type":"string","pattern":"^\\d{17,20}$"},"token":{"type":"string","minLength":1}},"required":["id","token"]},"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/roster-changelog":{"put":{"operationId":"saveRosterChangelog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogChannelInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Set up the roster changelog","tags":["Guilds"]}}}}
```

## DELETE /guilds/{guildId}/server-logs/roster-changelog

> Turn off the roster changelog

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/roster-changelog":{"delete":{"operationId":"deleteRosterChangelog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Turn off the roster changelog","tags":["Guilds"]}}}}
```

## PUT /guilds/{guildId}/server-logs/maintenance

> Set up the maintenance log

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"MaintenanceLogInput":{"type":"object","properties":{"channelId":{"type":"string","pattern":"^\\d{17,20}$"}},"required":["channelId"]},"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/maintenance":{"put":{"operationId":"saveMaintenanceLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaintenanceLogInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Set up the maintenance log","tags":["Guilds"]}}}}
```

## DELETE /guilds/{guildId}/server-logs/maintenance

> Turn off the maintenance log

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/maintenance":{"delete":{"operationId":"deleteMaintenanceLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Turn off the maintenance log","tags":["Guilds"]}}}}
```

## Set up the welcome message

> Saves the message and turns it on.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"WelcomeLogInput":{"type":"object","properties":{"channelId":{"type":"string","pattern":"^\\d{17,20}$"},"webhook":{"description":"From Discord's `webhook.incoming` sign-in; without one, a known webhook in the channel is reused.","allOf":[{"$ref":"#/components/schemas/ReminderWebhookInput"}]},"welcomeText":{"type":"string","minLength":1,"maxLength":500,"pattern":"\\{\\{user\\}\\}"},"description":{"type":"string","maxLength":2000},"bannerImage":{"type":["string","null"],"maxLength":256,"format":"uri"},"embedColor":{"type":["number","null"],"description":"RGB integer; null uses the bot's default.","minimum":0,"maximum":16777215}},"required":["channelId","welcomeText","description"]},"ReminderWebhookInput":{"type":"object","properties":{"id":{"type":"string","pattern":"^\\d{17,20}$"},"token":{"type":"string","minLength":1}},"required":["id","token"]},"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/welcome":{"put":{"description":"Saves the message and turns it on.","operationId":"saveWelcomeLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WelcomeLogInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Set up the welcome message","tags":["Guilds"]}}}}
```

## Turn off the welcome message

> The message is saved, so you can turn it back on later.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerLogsDto":{"type":"object","properties":{"flagAlert":{"anyOf":[{"$ref":"#/components/schemas/FlagAlertLogDto"},{"type":"null"}]},"rosterChangelog":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"maintenance":{"anyOf":[{"$ref":"#/components/schemas/ServerLogChannelDto"},{"type":"null"}]},"welcome":{"anyOf":[{"$ref":"#/components/schemas/WelcomeLogDto"},{"type":"null"}]}},"required":["flagAlert","rosterChangelog","maintenance","welcome"]},"FlagAlertLogDto":{"type":"object","properties":{"roleId":{"type":["string","null"]},"useAutoRole":{"type":"boolean"},"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["roleId","useAutoRole","channelId","channelName","missingPermissions"]},"ServerLogChannelDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["channelId","channelName","missingPermissions"]},"WelcomeLogDto":{"type":"object","properties":{"channelId":{"type":"string"},"channelName":{"type":["string","null"],"description":"Null when the bot can't see the channel any more."},"missingPermissions":{"description":"Permissions `/debug` checks that ClashPerk lacks in the channel, e.g. `Send Messages`.","type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"welcomeText":{"type":"string"},"description":{"type":"string"},"bannerImage":{"type":["string","null"]},"embedColor":{"type":["number","null"]}},"required":["channelId","channelName","missingPermissions","enabled","welcomeText","description","bannerImage","embedColor"]},"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":{"/guilds/{guildId}/server-logs/welcome":{"delete":{"description":"The message is saved, so you can turn it back on later.","operationId":"deleteWelcomeLog","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerLogsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Turn off the welcome message","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/buttons

> Get the server's button messages

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ButtonsDto":{"type":"object","properties":{"link":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]},"refresh":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]},"myRosters":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]}},"required":["link","refresh","myRosters"]},"ButtonMessageDto":{"type":"object","properties":{"tokenField":{"description":"Set for the link button only.","allOf":[{"$ref":"#/components/schemas/ButtonTokenField"}]},"title":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":["string","null"]},"thumbnailUrl":{"type":["string","null"]},"color":{"type":["number","null"]},"buttonStyle":{"type":"number"}},"required":["title","description","imageUrl","thumbnailUrl","color","buttonStyle"]},"ButtonTokenField":{"type":"string","enum":["required","optional","hidden"],"description":"Set for the link button only."},"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":{"/guilds/{guildId}/buttons":{"get":{"operationId":"getButtonMessages","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ButtonsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's button messages","tags":["Guilds"]}}}}
```

## Update a button message

> Changes what \`/setup buttons\` posts. Messages that were already posted keep their old look.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ButtonType":{"type":"string","enum":["link","refresh","myRosters"]},"ButtonMessageInput":{"type":"object","properties":{"tokenField":{"description":"Link button only: whether members enter their player token.","allOf":[{"$ref":"#/components/schemas/ButtonTokenField"}]},"title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","minLength":1,"maxLength":2000},"imageUrl":{"type":["string","null"],"maxLength":256},"thumbnailUrl":{"type":["string","null"],"maxLength":256},"color":{"type":["number","null"],"description":"RGB integer; null for none.","minimum":0,"maximum":16777215},"buttonStyle":{"type":"number","description":"1 blurple, 2 grey, 3 green, 4 red.","enum":[1,2,3,4]}},"required":["title","description","buttonStyle"]},"ButtonTokenField":{"type":"string","enum":["required","optional","hidden"],"description":"Set for the link button only."},"ButtonsDto":{"type":"object","properties":{"link":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]},"refresh":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]},"myRosters":{"anyOf":[{"$ref":"#/components/schemas/ButtonMessageDto"},{"type":"null"}]}},"required":["link","refresh","myRosters"]},"ButtonMessageDto":{"type":"object","properties":{"tokenField":{"description":"Set for the link button only.","allOf":[{"$ref":"#/components/schemas/ButtonTokenField"}]},"title":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":["string","null"]},"thumbnailUrl":{"type":["string","null"]},"color":{"type":["number","null"]},"buttonStyle":{"type":"number"}},"required":["title","description","imageUrl","thumbnailUrl","color","buttonStyle"]},"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":{"/guilds/{guildId}/buttons/{buttonType}":{"put":{"description":"Changes what `/setup buttons` posts. Messages that were already posted keep their old look.","operationId":"updateButtonMessage","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}},{"name":"buttonType","required":true,"in":"path","schema":{"$ref":"#/components/schemas/ButtonType"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ButtonMessageInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ButtonsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update a button message","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/events

> Get the server's scheduled Discord events

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildEventsDto":{"type":"object","properties":{"allowedEvents":{"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"fullDurationEvents":{"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"enabled":{"type":"boolean"},"clanGames":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"raidWeekend":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"cwl":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"seasonReset":{"$ref":"#/components/schemas/GuildEventCategoryDto"}},"required":["allowedEvents","fullDurationEvents","enabled","clanGames","raidWeekend","cwl","seasonReset"]},"GuildEventType":{"type":"string","enum":["clan_games_start","clan_games_end","cwl_start","cwl_signup_end","cwl_end","season_end","raid_week_start","raid_week_end"]},"GuildEventCategoryDto":{"type":"object","properties":{"imageUrl":{"type":["string","null"]},"location":{"type":["string","null"]}},"required":["imageUrl","location"]},"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":{"/guilds/{guildId}/events":{"get":{"operationId":"getGuildEvents","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildEventsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's scheduled Discord events","tags":["Guilds"]}}}}
```

## Update the server's scheduled Discord events

> Replaces the setting. The bot creates the events on its next check, within 30 minutes.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildEventsInput":{"type":"object","properties":{"allowedEvents":{"uniqueItems":true,"minItems":1,"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"fullDurationEvents":{"description":"Start events that stay until the game event ends, instead of 30 minutes.","uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"enabled":{"type":"boolean"},"clanGames":{"$ref":"#/components/schemas/GuildEventCategoryInput"},"raidWeekend":{"$ref":"#/components/schemas/GuildEventCategoryInput"},"cwl":{"$ref":"#/components/schemas/GuildEventCategoryInput"},"seasonReset":{"$ref":"#/components/schemas/GuildEventCategoryInput"}},"required":["allowedEvents","fullDurationEvents","enabled","clanGames","raidWeekend","cwl","seasonReset"]},"GuildEventType":{"type":"string","enum":["clan_games_start","clan_games_end","cwl_start","cwl_signup_end","cwl_end","season_end","raid_week_start","raid_week_end"]},"GuildEventCategoryInput":{"type":"object","properties":{"imageUrl":{"type":["string","null"],"maxLength":256,"format":"uri"},"location":{"type":["string","null"],"description":"Shown as the event's location. Defaults to \"in game\".","minLength":1,"maxLength":100}}},"GuildEventsDto":{"type":"object","properties":{"allowedEvents":{"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"fullDurationEvents":{"type":"array","items":{"$ref":"#/components/schemas/GuildEventType"}},"enabled":{"type":"boolean"},"clanGames":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"raidWeekend":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"cwl":{"$ref":"#/components/schemas/GuildEventCategoryDto"},"seasonReset":{"$ref":"#/components/schemas/GuildEventCategoryDto"}},"required":["allowedEvents","fullDurationEvents","enabled","clanGames","raidWeekend","cwl","seasonReset"]},"GuildEventCategoryDto":{"type":"object","properties":{"imageUrl":{"type":["string","null"]},"location":{"type":["string","null"]}},"required":["imageUrl","location"]},"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":{"/guilds/{guildId}/events":{"put":{"description":"Replaces the setting. The bot creates the events on its next check, within 30 minutes.","operationId":"updateGuildEvents","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildEventsInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildEventsDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update the server's scheduled Discord events","tags":["Guilds"]}}}}
```

## Upload a cover image for scheduled events

> Takes a PNG, JPEG, GIF or WebP file up to 8 MB, 20 an hour per user. Send the returned link as a category image to use it.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildEventImageDto":{"type":"object","properties":{"url":{"type":"string","description":"The uploaded image's public link, to send as a category's `imageUrl`."}},"required":["url"]},"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":{"/guilds/{guildId}/events/images":{"post":{"description":"Takes a PNG, JPEG, GIF or WebP file up to 8 MB, 20 an hour per user. Send the returned link as a category image to use it.","operationId":"uploadGuildEventImage","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildEventImageDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Upload a cover image for scheduled events","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/managers

> Get the server's manager roles

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ManagerRolesDto":{"type":"object","properties":{"managerRoles":{"type":"array","items":{"type":"string"}},"rosterManagerRoles":{"type":"array","items":{"type":"string"}},"flagsManagerRoles":{"type":"array","items":{"type":"string"}},"linksManagerRoles":{"type":"array","items":{"type":"string"}}},"required":["managerRoles","rosterManagerRoles","flagsManagerRoles","linksManagerRoles"]},"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":{"/guilds/{guildId}/managers":{"get":{"operationId":"getManagerRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagerRolesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's manager roles","tags":["Guilds"]}}}}
```

## Update the server's manager roles

> You only need to send the lists you want to change. Sending an empty list clears it.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ManagerRolesInput":{"type":"object","properties":{"managerRoles":{"description":"Can use every command and this dashboard, like Manage Server.","maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}},"rosterManagerRoles":{"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}},"flagsManagerRoles":{"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}},"linksManagerRoles":{"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}}}},"ManagerRolesDto":{"type":"object","properties":{"managerRoles":{"type":"array","items":{"type":"string"}},"rosterManagerRoles":{"type":"array","items":{"type":"string"}},"flagsManagerRoles":{"type":"array","items":{"type":"string"}},"linksManagerRoles":{"type":"array","items":{"type":"string"}}},"required":["managerRoles","rosterManagerRoles","flagsManagerRoles","linksManagerRoles"]},"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":{"/guilds/{guildId}/managers":{"patch":{"description":"You only need to send the lists you want to change. Sending an empty list clears it.","operationId":"updateManagerRoles","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagerRolesInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagerRolesDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update the server's manager roles","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/link-parsing

> Get where ClashPerk expands Clash of Clans links pasted in chat

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"LinkParsingDto":{"type":"object","properties":{"player":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"clan":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"army":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"base":{"$ref":"#/components/schemas/LinkParsingRuleDto"}},"required":["player","clan","army","base"]},"LinkParsingRuleDto":{"type":"object","properties":{"mode":{"enum":["reply","message","replace"],"type":"string"},"enabled":{"type":"boolean"},"channels":{"type":"array","items":{"$ref":"#/components/schemas/LinkParsingChannelDto"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/LinkParsingChannelDto"}}},"required":["mode","enabled","channels","categories"]},"LinkParsingChannelDto":{"type":"object","properties":{"status":{"enum":["ok","archived","locked","deleted","noAccess","unknown"],"type":"string"},"id":{"type":"string"},"name":{"type":["string","null"],"description":"Null when the channel was deleted or ClashPerk can't see it."},"missingPermissions":{"description":"Permissions ClashPerk lacks here, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["status","id","name","missingPermissions"]},"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":{"/guilds/{guildId}/link-parsing":{"get":{"operationId":"getLinkParsing","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkParsingDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get where ClashPerk expands Clash of Clans links pasted in chat","tags":["Guilds"]}}}}
```

## Choose where ClashPerk expands Clash of Clans links pasted in chat

> Replaces the setting: one rule per link type (player, clan, army, base), each with its own channels and categories. Everything is off by default.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"LinkParsingInput":{"type":"object","properties":{"player":{"description":"`action=OpenPlayerProfile`","allOf":[{"$ref":"#/components/schemas/LinkParsingRuleInput"}]},"clan":{"description":"`action=OpenClanProfile`","allOf":[{"$ref":"#/components/schemas/LinkParsingRuleInput"}]},"army":{"description":"`action=CopyArmy`","allOf":[{"$ref":"#/components/schemas/LinkParsingRuleInput"}]},"base":{"description":"`action=OpenLayout`","allOf":[{"$ref":"#/components/schemas/LinkParsingRuleInput"}]}},"required":["player","clan","army","base"]},"LinkParsingRuleInput":{"type":"object","properties":{"mode":{"enum":["reply","message","replace"],"type":"string"},"enabled":{"type":"boolean","description":"Needs at least one channel or category when on."},"channelIds":{"description":"Text, announcement, forum or media channels. Threads and forum posts follow their channel.","uniqueItems":true,"maxItems":100,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}},"categoryIds":{"description":"Every channel in these categories, including ones added later.","uniqueItems":true,"maxItems":25,"type":"array","items":{"type":"string","pattern":"^\\d{17,20}$"}}},"required":["mode","enabled","channelIds","categoryIds"]},"LinkParsingDto":{"type":"object","properties":{"player":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"clan":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"army":{"$ref":"#/components/schemas/LinkParsingRuleDto"},"base":{"$ref":"#/components/schemas/LinkParsingRuleDto"}},"required":["player","clan","army","base"]},"LinkParsingRuleDto":{"type":"object","properties":{"mode":{"enum":["reply","message","replace"],"type":"string"},"enabled":{"type":"boolean"},"channels":{"type":"array","items":{"$ref":"#/components/schemas/LinkParsingChannelDto"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/LinkParsingChannelDto"}}},"required":["mode","enabled","channels","categories"]},"LinkParsingChannelDto":{"type":"object","properties":{"status":{"enum":["ok","archived","locked","deleted","noAccess","unknown"],"type":"string"},"id":{"type":"string"},"name":{"type":["string","null"],"description":"Null when the channel was deleted or ClashPerk can't see it."},"missingPermissions":{"description":"Permissions ClashPerk lacks here, e.g. `Send Messages`.","type":"array","items":{"type":"string"}}},"required":["status","id","name","missingPermissions"]},"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":{"/guilds/{guildId}/link-parsing":{"put":{"description":"Replaces the setting: one rule per link type (player, clan, army, base), each with its own channels and categories. Everything is off by default.","operationId":"saveLinkParsing","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkParsingInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkParsingDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Choose where ClashPerk expands Clash of Clans links pasted in chat","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/config

> Get the server's embed color, webhook limit and subscription

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerConfigDto":{"type":"object","properties":{"color":{"type":["number","null"]},"webhookLimit":{"type":"number"},"subscription":{"$ref":"#/components/schemas/SubscriptionDto"}},"required":["color","webhookLimit","subscription"]},"SubscriptionDto":{"type":"object","properties":{"active":{"type":"boolean"},"tier":{"type":["string","null"],"description":"A special tier such as `lifetime` or `gifted`; null for a regular plan."}},"required":["active","tier"]},"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":{"/guilds/{guildId}/config":{"get":{"operationId":"getGuildConfig","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerConfigDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the server's embed color, webhook limit and subscription","tags":["Guilds"]}}}}
```

## Update the server's embed color or webhook limit

> You only need to send the fields you want to change. Set the color to null to go back to the default.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"ServerConfigInput":{"type":"object","properties":{"color":{"type":["number","null"],"description":"RGB integer for the bot's embeds; null goes back to the default.","minimum":0,"maximum":16777215},"webhookLimit":{"type":"number","description":"Most webhooks the bot creates in one channel before it shares them between logs.","minimum":3,"maximum":8}}},"ServerConfigDto":{"type":"object","properties":{"color":{"type":["number","null"]},"webhookLimit":{"type":"number"},"subscription":{"$ref":"#/components/schemas/SubscriptionDto"}},"required":["color","webhookLimit","subscription"]},"SubscriptionDto":{"type":"object","properties":{"active":{"type":"boolean"},"tier":{"type":["string","null"],"description":"A special tier such as `lifetime` or `gifted`; null for a regular plan."}},"required":["active","tier"]},"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":{"/guilds/{guildId}/config":{"patch":{"description":"You only need to send the fields you want to change. Set the color to null to go back to the default.","operationId":"updateGuildConfig","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerConfigInput"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerConfigDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Update the server's embed color or webhook limit","tags":["Guilds"]}}}}
```

## GET /guilds/{guildId}/beta

> Check whether the server is in the beta

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Guilds","description":"Server settings: clans, logs and roles. Dashboard sessions only."}],"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":{"GuildBetaDto":{"type":"object","properties":{"beta":{"type":"boolean"}},"required":["beta"]},"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":{"/guilds/{guildId}/beta":{"get":{"operationId":"getGuildBetaStatus","parameters":[{"name":"guildId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuildBetaDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Check whether the server is in the beta","tags":["Guilds"]}}}}
```


---

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