Discord Webhook Token Invalid: Rotation Steps
In this article
If you're getting a "token invalid" error from a Discord webhook, the fix is to rotate (regenerate) the webhook URL. This happens when Discord rotates webhook tokens for security, or when the URL was copied incorrectly. Below are the exact steps to create a fresh webhook URL and update your integrations.
What You'll Need
- Access to the Discord server where the webhook was created (you need "Manage Webhooks" permission, which is on by default for server administrators).
- The name of the channel the webhook posts to.
- If you're updating a bot or app, you'll need to edit its configuration file or settings where the old webhook URL is stored.
Step-by-Step
- Open Discord and go to your server. Log in on the desktop app, browser client, or mobile app — the steps are the same. If you're on mobile, tap the server name at the top to open the drop-down menu.
- Open Server Settings. Click the server name (top-left on desktop) and select Server Settings from the menu. On mobile, tap the three dots next to the server name and choose Settings.
- Navigate to Integrations. In the left sidebar, click Integrations. If you don't see it, your server may not have the feature enabled — but it's available for all servers by default. If you still don't see it, check that you have the "Manage Server" permission.
- Find your webhook. Under the "Webhooks" section, you'll see a list of all webhooks for that server. Click the one that's giving you the "token invalid" error.
- Copy the new webhook URL. On the webhook's page, you'll see a field labeled Webhook URL. Click the Copy button next to it. This URL contains a new token — Discord automatically rotates the token when you view this page, so the old URL becomes invalid immediately.
- Update your external app or script. Go to the place where you originally used the webhook URL (e.g., a GitHub action, a game server plugin, a Discord bot's config, or a custom script). Replace the old URL with the new one you just copied. Save the changes.
- Test the new URL. Send a test message using the new URL. If you're using a bot or script, trigger it manually. If you're using a simple tool like Postman or curl, send a POST request with the new URL. For example, in a terminal:
curl -X POST -H "Content-Type: application/json" -d '{"content":"test"}' YOUR_NEW_WEBHOOK_URL. If you get a 204 response, it worked.
Common Mistakes
- Copying the old URL again. If you copy the URL from a saved chat message or an old config file, it will still have the old token. Always copy from the Discord Integrations page directly.
- Not saving changes in the external app. After copying the new URL, you must update it everywhere it was used. If you only test with a new URL but forget to update your bot's config, the bot will still fail.
- Editing the wrong webhook. If you have multiple webhooks on the same server, make sure you're editing the one that matches the channel and name you intended. Check the channel name under the webhook's name.
- Deleting the webhook instead of rotating. Deleting the webhook and creating a new one works, but it changes the webhook ID as well as the token. This can break integrations that rely on the ID (e.g., some logging bots). Rotating (copying the URL) keeps the same ID.
Tips
- Rotate tokens regularly. If you suspect a webhook URL has been leaked (e.g., posted publicly), rotate it immediately by copying the URL again — this invalidates the old one.
- Use a dedicated channel for webhooks. Create a private channel that only admins can see, and set the webhook there. This reduces the risk of someone grabbing the URL from message history.
- Keep a note of the webhook name. When you have multiple webhooks, naming them clearly (e.g., "GitHub Deploy", "Server Alerts") helps you identify the right one.
- If you're coding, store the URL in an environment variable. This way, you only change it in one place, and you avoid hardcoding it into your codebase.
Troubleshooting
If you've copied the new URL and it still says "token invalid":
- Double-check the URL. Make sure you didn't accidentally copy a truncated version. The full URL should look like:
https://discord.com/api/webhooks/1234567890/abcdefg...— it has a long random string at the end. - Check if the webhook was deleted. If someone with admin permissions deleted the webhook, copying the URL from an old message won't work. Go to Integrations and see if the webhook still exists. If not, create a new one.
- Verify you have permission. If you can't see the Integrations option, you might not have "Manage Webhooks" permission. Ask a server admin to help.
- Test with a simple tool. Use a service like
discord.com/api/webhookstester or a simple curl command to isolate whether the issue is with your app or the URL itself. If curl works but your app doesn't, the problem is in your app's code or config. - Check for rate limiting. If you've made many requests with an invalid token, Discord may temporarily block your IP. Wait a few minutes and try again.
- If nothing works, create a brand new webhook. Go to Integrations > Webhooks > New Webhook, set a name and channel, and copy that URL. This gives you a completely fresh ID and token.
Frequently Asked Questions
Why did my webhook token become invalid?
Discord automatically rotates webhook tokens when you view the webhook's page in Server Settings. Also, if a webhook is deleted and recreated, the token changes. Tokens can also be invalidated if Discord detects a security issue.
Can I reuse an old webhook URL after rotation?
No. Once you copy a new URL from the Integrations page, the old token is immediately invalidated. You must update all usages.
Does rotating the webhook change the webhook ID?
No. Rotating by copying the URL keeps the same webhook ID. Only the token part changes. If you delete and recreate the webhook, the ID changes.
Can I rotate a webhook without accessing the server?
No. You need "Manage Webhooks" permission on the server. If you don't have it, ask a server admin to do it for you.
Will rotating a webhook affect my bot's existing messages?
No. Messages already sent by the webhook remain in the channel. Rotation only affects future requests.
How often should I rotate webhook tokens?
There's no official schedule. Rotate whenever you suspect the URL has been exposed, or as part of routine security hygiene (e.g., every few months).