Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KevxxAlva/tiktok-bot-downloader/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/proxy-image fetches an image from a TikTok CDN URL on the server and forwards the binary to the browser with appropriate caching headers. The TikTokSaver frontend routes every image through this endpoint — including video cover thumbnails and all slideshow frames — so that images load reliably inside the application without being blocked by TikTok’s hotlink protections.
Endpoint
Why It Exists
TikTok’s CDN applies two restrictions that make it impractical to use raw CDN image URLs directly in browser<img> tags hosted on a third-party domain:
- Hotlink blocking — TikTok’s CDN may check the
OriginorRefererheader and refuse requests that do not originate from a TikTok page, resulting in broken images. - IP exposure — when the browser fetches a CDN URL directly, TikTok’s CDN logs the end-user’s IP address. Routing the request through the server prevents this, so only the server’s IP is visible to TikTok.
Parameters
The image URL to proxy, URL-encoded. Typical sources:
result.coverfrom aDownloadResultobject — the video thumbnail- An element of
result.images[]from aDownloadResultobject — a slideshow frame result.author.avatar— the creator’s profile picture
Behavior
The endpoint performs the following steps on every request:- Timeout guard — an
AbortControlleris created with a 10-second timeout. If the upstream server does not respond within 10 seconds, the request is aborted and a504is returned. - Upstream fetch — a plain
GETrequest is made to the providedurlwith no additional headers. - Content-Type forwarding — the
Content-Typeheader from the upstream response is forwarded directly to the client. If the upstream does not provide aContent-Type, it defaults toimage/jpeg. - Cache-Control — a
Cache-Control: public, max-age=31536000header is set, allowing browsers and CDN edges to cache the proxied image for up to one year. - Binary passthrough — the full response body is read into a
Bufferand sent to the client in one call.
Success Response
HTTP 200 — raw image binary with the following headers:| Header | Value |
|---|---|
Content-Type | Forwarded from upstream; defaults to image/jpeg |
Cache-Control | public, max-age=31536000 |
Error Responses
Returned when the
url query parameter is missing.Returned when the upstream fetch returns a non-OK status or when an unexpected runtime error occurs.
Returned when the upstream CDN does not respond within the 10-second
AbortController deadline.Frontend Usage
The TikTokSaver frontend constructs proxy image URLs inline inside<img src> attributes. The following patterns are taken directly from client/src/components/VideoResult.tsx:
Example
This endpoint does not validate or restrict the
url parameter beyond checking that it is present. It will attempt to proxy any HTTP or HTTPS image URL it receives. In a production environment, consider adding an allowlist of trusted CDN hostnames (e.g. *.tiktokcdn.com, *.tiktokcdn-us.com) to prevent the endpoint from being abused as an open image proxy.