AI Brief Practical fixes, setup guides and tool comparisons
Troubleshooting

Telegram Bot API in n8n: 401 "Unauthorized" vs 404 "Not Found" (Wrong Bot Token)

Telegram Bot API 401 Unauthorized vs 404 Not Found with your bot token: what each meant in ten tests with made-up tokens, plus an n8n checklist.

If a Telegram call from n8n (or curl) fails with 401 Unauthorized or 404 Not Found and you suspect the bot token, the two codes meant different things in my tests. 404 appeared when the token did not even have the shape of a bot token in the URL. 401 appeared when the shape was right but Telegram did not accept the token. I tried ten variations with made-up tokens to see where the line is.

The two responses

HTTPResponse bodyWhat it meant in my tests
401{"ok":false,"error_code":401,"description":"Unauthorized"}The URL looked like bot<digits>:<text>, but the token was not accepted
404{"ok":false,"error_code":404,"description":"Not Found"}The URL did not match the bot token shape at all

What I tested

On 2026-10-21 I sent the read-only getMe request to the Telegram Bot API with made-up tokens. I used no real bot token. The URL format https://api.telegram.org/bot<token>/METHOD_NAME comes from the Telegram Bot API documentation.

What I put in the URLResult
Digits, a colon, then 35 letters and digits401
Digits, a colon, then only ABC (a very short secret part)401
Digits only, no colon404
Letters only, no digits or colon404
Nothing after bot404
The token without the bot prefix404
A space after the token (%20)404
A space before the token (bot%20)404
bot written twice (botbot...)404
A well-shaped token with a method that does not exist401
  • Every 401 came from a token shaped like digits, a colon and some text. The length of the part after the colon did not matter in my two examples.
  • Every 404 came from a URL that did not have that shape. That includes a token with a space before or after it, which is easy to get when you paste a token into a credential field.
  • A well-shaped token with a method that does not exist still returned 401, so the token check came before the method lookup in this test.

The documentation says nothing about what 401 or 404 mean, and it says the error_code value may change in the future. Treat the table above as what I observed on one day, not as a guarantee.

A short checklist for n8n

  1. 404: look at the token itself. Copy the whole token from the bot creation message, including the numbers before the colon, with no spaces or line breaks at either end. Do not add bot yourself if the tool already adds it, because writing it twice gave me a 404.
  2. 401: the token has the right shape but is not accepted. Check that you copied the latest token and that it belongs to the bot you mean.
  3. Test the token outside n8n with a request like the one below, and compare the result with the table.
curl https://api.telegram.org/botYOUR_BOT_TOKEN/getMe

I did not run that command with a real token, so I cannot show you the successful response. Treat the token like a password: anyone who has it can control your bot, so keep it in the n8n credential and out of workflow files, chat messages and forum posts.

Related guides: approving actions with Telegram Send and Wait and the Korean write-up of my comment reply workflow.

What I did not test

  • I did not use a real bot token, so I did not test a revoked token or any request that needs a valid token, such as chat not found or sending a message.
  • I used curl. I did not look at how n8n displays these errors or how its Telegram credential builds the URL.
  • I tested only the getMe method and one day of behavior.

Source: Telegram Bot API documentation. The results above come from my own requests on 2026-10-21.

Updated: Oct 21, 2026