- Symptom
- Downloaded file is a few KB of HTML from slack.comPDF or image will not open after downloadHTTP 200 with content-type text/html for url_private_download
- Cause
- Private file URLs need an Authorization header with a bearer token that has files:read. Without it Slack answers with its login page and a 200 status, and the SDK WebClient does not wrap these URLs.
- Fix
- Fetch url_private_download with a plain HTTP client and an Authorization: Bearer header using a token that has files:read. Check the response content-type before saving.
- Apply
r = requests.get(f["url_private_download"], headers={"Authorization": f"Bearer {bot_token}"}, timeout=30) assert not r.headers["content-type"].startswith("text/html")- Affected
- Slack Web API file objects, all versions as of 2026-10
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders