How to get a Discord bot token
The token is what your bot logs in with, and it lives on the Bot page of the Developer Portal. Here's where to click, why Discord only shows it once, and what to do if it leaks or stops working.
Every Discord bot logs in with a token, and you get it from the Bot page of your application in the Developer Portal. It takes about two minutes, and Discord only shows the token once.
What a bot token is
A bot token is the password your bot logs in with. Whatever runs your bot, a hosting service like BotGhost or your own code, sends the token to Discord, and Discord lets it act as that bot in every server it has joined.
- It's a long string of letters and numbers with two dots in it.
- It belongs to one bot. Each bot you make has its own.
- Anyone who has it can control the bot, so it gets the same care as a password.
1Open the Developer Portal
Go to the Discord Developer Portal and log in with your normal Discord account. You'll land on Applications, the list of apps you own. On a phone it works in the browser too, though a computer is easier.
- 1Click New Application
Already have a bot? Click it in the list and skip to step 3.
2Create an application
- Press New Application.
- Type a name. This is your bot's name too, and you can change it later.
- Tick the box to agree to Discord's terms and press Create.
- 1Type the name
- 2Tick this box
- 3Click Create
Every new application comes with a bot user already made, so there's no separate "add bot" step any more.
3Reset the token on the Bot page
- Click Bot in the menu on the left.
- Under Token, press Reset Token.
- Confirm with Yes, do it!
- 1Open Bot
- 2Click Reset Token
"Reset" sounds alarming on a new bot, but the first press is how you get a token at all. On a bot that's already running, it logs the bot out until you give it the new token.
If Discord asks for a code
With two-factor authentication on, Discord asks for the code from your authenticator app (or your password) before it shows the token. Type it in and the token appears.
Copy it straight away
Press Copy under the token. Discord shows a token only when it's made: reload the page or go somewhere else and it's hidden for good. If that happens, press Reset Token again and copy the new one.
Have the next tab ready. Open the place you'll paste the token before you press Reset Token, so it goes straight from Discord to there.
4Use the token
In BotGhost
BotGhost runs your bot for you, so the token is the only thing it needs from Discord. Sign in to the BotGhost dashboard and follow the setup: it opens the Developer Portal for you and walks through the same steps with pictures. On the last step, paste the token. BotGhost checks it with Discord and your bot comes online.
- 1Six short steps
- 2What to press on Discord
Changed the token later? Paste the new one in your bot's Settings in the dashboard. The full walkthrough, from the token to your first command, is in how to make a Discord bot without coding.
In your own code
Libraries like discord.js and discord.py take the token when the bot logs in. Keep it in an environment variable or a .env file, and add that file to .gitignore so it never ends up in a repo.
Keep it secret
- Don't paste it in a Discord chat, a forum post, or a support ticket. Nobody helping you needs it.
- Blur it out of screenshots and videos.
- Keep it out of code you share or upload.
- Give it only to the service that runs your bot.
If it leaks
Press Reset Token on the Bot page straight away. The leaked token stops working the moment you do, so whoever has it loses the bot. Then put the new token wherever your bot runs. Discord also resets tokens it finds posted in public, like on a public GitHub repo, and tells you when it does. That's often why a working bot suddenly logs out.
A bot token is not your account token
Some pages and browser extensions offer to fetch your user token, the one that logs in your own Discord account. That's a different thing. Never paste it anywhere: it gives full control of your account, and running your account as a bot breaks Discord's rules. A bot only ever needs the token from the Bot page.
Nobody legitimate asks for your account token. If a site, a server, or a "giveaway" asks you to paste a token or run code in your browser's console, close it.
The switches under the token
Further down the Bot page are three Privileged Gateway Intents: Presence, Server Members, and Message Content. They let a bot see who's online, who's in the server, and what messages say. Code you write yourself needs the ones it uses switched on, or those events never arrive.
With BotGhost you can leave them alone: it turns on the ones your bot needs when you connect the token.
When the token does not work
There is no Copy button
The token was made earlier and is hidden now. Press Reset Token to get a new one you can copy. If you can't see Reset Token at all on an app that belongs to a team, ask the team's owner or an admin.
Invalid token
- Copy it again with the Copy button instead of selecting the text, so no letter or space goes missing.
- Check it's from the Bot page, not the client secret on the OAuth2 page or the Application ID.
- Reset again if you pressed Reset Token twice; only the newest one works.
Bot already in use
BotGhost says this when the bot is already connected to another BotGhost account, usually one you made by signing in a different way. Link the two accounts to bring your bots together, or make a new application for a fresh bot.
Requires OAuth2 Code Grant
If this switch on the Bot page is on, adding the bot to a server fails. Switch it off: almost no bot needs it.
Questions people ask
Where do I find my Discord bot token?
In the Discord Developer Portal: open your application, go to Bot, and press Reset Token. Discord shows the new token once, so copy it straight away.
Why can't I see my bot token any more?
Discord only shows a token when it's made. After you leave the page it stays hidden, and the only way to get a working one is Reset Token, which also stops the old one working.
Does resetting the token break my bot?
It logs the bot out everywhere that uses the old token. Paste the new token into wherever your bot runs (BotGhost's Settings, or your code's config) and it comes back online.
Is it safe to give a bot token to a website?
Only to a service you trust to run your bot, because whoever has the token controls the bot. Never paste it into a chat, a public repo, a screenshot, or a site that only promises to "check" it.
Can I get a bot token without coding?
Yes. Getting the token is all clicks in the Developer Portal, and BotGhost uses it to run your bot with no code at all.
Is the bot token the same as the client secret?
No. The client secret on the OAuth2 page is for apps that log people in with Discord. A bot logs in with its token from the Bot page.
How many tokens can a bot have?
One at a time. Each reset makes a new token and the previous one stops working.