Skip to content

Commit 8858ef2

Browse files
spenhandclaude
andcommitted
Add bot token unmerge endpoint documentation
Document the new /provisional-accounts/unmerge/bot endpoint that allows unmerging provisional accounts using just the bot token and external_user_id, without requiring an external auth token. This ensures identities can always be removed even if the external auth token is no longer accessible. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9efaf06 commit 8858ef2

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,28 @@ def unmerge_provisional_account(external_auth_token):
498498
If you have a server backend, you'll want to use the server-to-server unmerge endpoint rather than the SDK helper method to maintain better security and control over the unmerge process.
499499
:::
500500

501+
#### Unmerging with Bot Token Endpoint
502+
503+
If you're using the [Bot Token Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-bot-token-endpoint) for authentication, you can unmerge accounts without an external auth token.
504+
505+
```python
506+
import requests
507+
508+
API_ENDPOINT = 'https://discord.com/api/v10'
509+
BOT_TOKEN = 'YOUR_BOT_TOKEN'
510+
511+
def unmerge_provisional_account(external_user_id):
512+
data = {
513+
'external_user_id': external_user_id # identifier used in the /token/bot endpoint
514+
}
515+
headers = {
516+
'Content-Type': 'application/json',
517+
'Authorization': f'Bot {BOT_TOKEN}'
518+
}
519+
r = requests.post('%s/provisional-accounts/unmerge/bot' % API_ENDPOINT, json=data, headers=headers)
520+
r.raise_for_status()
521+
```
522+
501523
### Unmerging Provisional Accounts for Public Clients
502524

503525
<PublicClient />
@@ -619,4 +641,4 @@ Now that you've set up provisional accounts for your game, you can explore more
619641
[`Client::GetTokenFromProvisionalMerge`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a41062b7dafa331ddd2320daf1b4b273b
620642
[`Client::SetTokenExpirationCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aab5bfc76809ea22e79f2f7a067ac4519
621643
[`Client::UnmergeIntoProvisionalAccount`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a2da21ae8a3015e0e5e42c1a7226b256f
622-
[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60
644+
[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60

package-lock.json

Lines changed: 15 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@
4949
"prettier": "^3.2.5",
5050
"remark": "^15.0.1",
5151
"tsx": "^4.20.3",
52-
"typescript": "^5.4.5",
52+
"typescript": "^5.9.2",
5353
"typescript-eslint": "^8.0.0-alpha.12"
5454
},
5555
"dependencies": {
56+
"tsc": "^2.0.4",
5657
"xml2js": "^0.6.2"
5758
}
5859
}

0 commit comments

Comments
 (0)