Telegram error 400: Bad Request: wrong HTTP URL specified
Last verified against Telegram Bot API reference
Bad Request: wrong HTTP URL specifiedWhat error 400 means
Telegram rejected a URL you supplied as invalid before trying to use it. The Bot API server produces this sentence from two server-side errors, EXTERNAL_URL_INVALID and WC_CONVERT_URL_INVALID, both of which mean the URL is not acceptable as an external resource.
It appears when media is sent by URL (photos, documents, animations, inline query results with external thumbnails or content) and the string is not a usable public HTTP or HTTPS address. That covers obvious typos, but also addresses that look fine locally and mean nothing to Telegram, such as localhost, private IPs, internal hostnames and paths without a scheme.
Compare the sibling errors: a valid URL whose download fails produces a fetch failure instead; if the download works but the content is wrong, wrong type of the web page content. This one stops at the URL itself.
What it looks like
{"ok":false,"error_code":400,"description":"Bad Request: wrong HTTP URL specified"}Why it happens
- The URL points at
localhost, a private IP or an internal hostname. - The scheme is missing or unsupported (for example
ftp://or a bare path). - The URL contains unencoded spaces or characters that break parsing.
- A template produced an empty or partial URL.
How to fix Telegram error 400
- 1Log the exact URL sent and open it from a machine outside your network.
- 2Use an absolute
https://URL on a public domain. - 3Percent-encode spaces and special characters in paths and query strings.
- 4For files that are not publicly hosted, upload them via multipart/form-data instead.
How to stop it recurring
Validate media URLs before calling the API: absolute, public host, encoded. Build them from a configured public base URL rather than the request host, which is often internal behind a proxy. For files under your control, prefer direct uploads and then reuse the returned file_id.
Official reference: Telegram Bot API reference. See all Telegram error codes or the Telegram limits and quotas.
Related codes
- 400: Bad Request: failed to get HTTP URL contentBad Request: failed to get HTTP URL content
- 400: Bad Request: wrong type of the web page contentBad Request: wrong type of the web page content
- 400: Bad Request: wrong file identifier/HTTP URL specifiedBad Request: wrong file identifier/HTTP URL specified
Error 400 - quick answers
What does Telegram error 400 mean?
Telegram rejected a URL you supplied as invalid before trying to use it. The Bot API server produces this sentence from two server-side errors, EXTERNAL_URL_INVALID and WC_CONVERT_URL_INVALID , both of which mean the URL is not acceptable as an external resource.
How do I fix Telegram error 400?
1. Log the exact URL sent and open it from a machine outside your network. 2. Use an absolute https:// URL on a public domain. 3. Percent-encode spaces and special characters in paths and query strings. 4. For files that are not publicly hosted, upload them via multipart/form-data instead.
Should I retry after error 400?
No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.
Stop debugging Telegram by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.