How to deal with expiring images of TikTok and Instagram

Last updated:

Why do images expire

Thumbnails for TikTok and Instagram come with expiration signatures. This means the image URLs provided by these platforms are temporary and stop working after a certain period — commonly within a few days.

Because Iframely uses time-based caching, expired thumbnails may occasionally appear as stale or broken images.

What you can do

The best way to avoid broken images is to fetch and store the images on your servers or CDN as soon as you get them. This way, even if the original URL expires, you’ll have a working copy.

If you still encounter stale or broken images, you can trigger Iframely to refresh the data by repeating the API call with the &refresh=true parameter. Note that Iframely will invalidate and reload the data, but this can only be done once every 10 minutes to stay within platform rate limits.

Sometimes, refreshing may not work immediately because the provider (e.g. Instagram) responds with errors like "An unexpected error has occurred. Please retry your request later." This is a temporary issue on the provider's end, and the data will update when they resolve it.

Why avoid hot-linking

Hot-linking directly to TikTok or Instagram URLs is unreliable. Platforms often block these requests or let them expire, leaving you with broken images. Fetching and serving the images yourself ensures better reliability and performance.

See why Iframely recommends against hot-linking in general for more details.