platforms · /tiktok/

TikTok profile picture API

Get any TikTok profile picture from one image URL: avatarsapi.com/tiktok/<handle>. No TikTok API key, no scraping code.

Put a TikTok Handle in the URL and the response is the profile picture as image bytes, ready for an <img src>. avatarapi fetches it from TikTok, checks it is a real image, and caches it at the edge.

<img src="https://avatarsapi.com/tiktok/tiktok" alt="">

What goes in the URL

https://avatarsapi.com/tiktok/<handle>

The username from tiktok.com/@<username>, with or without the @.

Percent-encode the Handle if it contains a /, a space, or other reserved characters.

Options

{ "version": 1, "data": { "url": "https://…", "source": "tiktok", "kind": "username" } }

Starter Projects can also set ?ttl=1h..28d for the cache lifetime (default 7 days).

When there is no picture

If the account does not exist or has no profile picture, the response is a 404 with a JSON body whose code is ENOTFOUND. That makes onerror a reliable fallback:

<img
  src="https://avatarsapi.com/tiktok/tiktok"
  onerror="this.onerror=null; this.src='/default-avatar.svg'"
  alt="">

EUPSTREAM (502) means TikTok itself failed or changed; it is usually transient. All codes are in the error table.

Related