Discord error 20001: Bots cannot use this endpoint
Last verified against Discord Developer Docs - Opcodes and status codes
Bots cannot use this endpointWhat error 20001 means
The route you called exists, but Discord only serves it to user accounts or OAuth2 bearer tokens, and you sent a Bot token. The token is valid; it is just the wrong kind of credential for this endpoint.
Some features belong to a person rather than an application: a user's own settings and relationships, and data that requires the user's consent through OAuth2. A bot token cannot stand in for that user. Code that calls these routes with a bot token, often copied from a self-bot script or an old tutorial, gets 20001.
The fix is never to swap in a user token. Automating a normal user account is against Discord's terms. If you need data about a user, run the OAuth2 authorization flow with the right scope and call the endpoint with the bearer token you receive.
What it looks like
{
"message": "Bots cannot use this endpoint",
"code": 20001
}Why it happens
- Calling a user-only route (for example a user's own settings or relationships) with a bot token
- Library method intended for OAuth2 bearer tokens invoked on the bot client
- Code ported from a self-bot library that assumes a user account
- Wrong Authorization prefix chosen by a shared HTTP helper
How to fix Discord error 20001
- 1Check the endpoint's documentation for which token types it accepts
- 2If the data needs user consent, implement the OAuth2 code grant and call the endpoint with the Bearer prefix and the user's access token
- 3Remove any code paths that rely on user-account behavior
- 4Make your HTTP helper choose Bot or Bearer explicitly per call
How to stop it recurring
Keep bot-token and bearer-token calls in separate clients so a route cannot be called with the wrong credential by accident. The opposite failure, a bearer token on a bot-only route, is 20002. Document next to each wrapper which token it is expected to carry.
Official reference: Discord Developer Docs - Opcodes and status codes. See all Discord error codes or the Discord limits and quotas.
Related codes
Error 20001 - quick answers
What does Discord error 20001 mean?
The route you called exists, but Discord only serves it to user accounts or OAuth2 bearer tokens, and you sent a Bot token. The token is valid; it is just the wrong kind of credential for this endpoint. Some features belong to a person rather than an application: a user's own settings and relationships, and data that requires the user's consent through OAuth2. A bot token cannot stand in for that user.
How do I fix Discord error 20001?
1. Check the endpoint's documentation for which token types it accepts 2. If the data needs user consent, implement the OAuth2 code grant and call the endpoint with the Bearer prefix and the user's access token 3. Remove any code paths that rely on user-account behavior 4. Make your HTTP helper choose Bot or Bearer explicitly per call
Stop debugging Discord by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.