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

# Links

Links between player tags and Discord users.

## Link a player to a Discord user

> To link a player to someone else, you need to be a verified Leader or Co-Leader of the player's clan, or hold the \`manage:links\` role. If the player is already linked to another user, you also need the player's in-game API token.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"CreateLinkInputDto":{"type":"object","properties":{"playerTag":{"type":"string"},"userId":{"type":"string"},"apiToken":{"type":["string","null"]}},"required":["playerTag","userId","apiToken"]},"ResultOkDto":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"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":{"/links":{"post":{"description":"To link a player to someone else, you need to be a verified Leader or Co-Leader of the player's clan, or hold the `manage:links` role. If the player is already linked to another user, you also need the player's in-game API token.","operationId":"createLink","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLinkInputDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultOkDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Link a player to a Discord user","tags":["Links"]}}}}
```

## Unlink a player from its Discord user

> Only the owner can unlink a verified player. An unverified link can also be removed by the person who made it, or by a verified Leader or Co-Leader of the player's clan.

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"ResultOkDto":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"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":{"/links/{playerTag}":{"delete":{"description":"Only the owner can unlink a verified player. An unverified link can also be removed by the person who made it, or by a verified Leader or Co-Leader of the player's clan.","operationId":"deleteLink","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultOkDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Unlink a player from its Discord user","tags":["Links"]}}}}
```

## PUT /links/{playerTag}/default

> Make one of your linked players your default

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"ResultOkDto":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"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":{"/links/{playerTag}/default":{"put":{"operationId":"setDefaultLink","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultOkDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Make one of your linked players your default","tags":["Links"]}}}}
```

## PUT /links/{playerTag}/hidden

> Hide or show a linked player in your task lists

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"SetHiddenInputDto":{"type":"object","properties":{"hidden":{"type":"boolean"}},"required":["hidden"]},"ResultOkDto":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"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":{"/links/{playerTag}/hidden":{"put":{"operationId":"setLinkHidden","parameters":[{"name":"playerTag","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetHiddenInputDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultOkDto"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Hide or show a linked player in your task lists","tags":["Links"]}}}}
```

## GET /links/{userId}

> Get a Discord user's linked players

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"LinksDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"userId":{"type":"string"},"username":{"type":"string"},"verified":{"type":"boolean"},"hidden":{"type":"boolean","description":"Left out of the owner's task lists."}},"required":["tag","name","userId","username","verified"]},"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":{"/links/{userId}":{"get":{"operationId":"getLinksByUserId","parameters":[{"name":"userId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LinksDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get a Discord user's linked players","tags":["Links"]}}}}
```

## Get links by player tags or user IDs

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

```json
{"openapi":"3.2.0","info":{"title":"ClashPerk Discord Bot API","version":"v2.0.192"},"tags":[{"name":"Links","description":"Links between player tags and Discord users."}],"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":{"GetLinksInputDto":{"type":"object","properties":{"playerTags":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},"userIds":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}}}},"LinksDto":{"type":"object","properties":{"tag":{"type":"string"},"name":{"type":"string"},"userId":{"type":"string"},"username":{"type":"string"},"verified":{"type":"boolean"},"hidden":{"type":"boolean","description":"Left out of the owner's task lists."}},"required":["tag","name","userId","username","verified"]},"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":{"/links/query":{"post":{"deprecated":true,"description":"Deprecated: send the same request with the `QUERY` method. This route is removed on 2026-11-25.","operationId":"getLinksViaPost","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetLinksInputDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LinksDto"}}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get links by player tags or user IDs","tags":["Links"]}}}}
```


---

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