Why Discord Webhook Avatar Caching Persists for Days After Update
🔍 WiseChecker

Why Discord Webhook Avatar Caching Persists for Days After Update

You updated the avatar of your Discord webhook, but the old image still shows in messages and embeds. This caching behavior can last from several hours to multiple days. Discord uses aggressive caching to reduce server load and improve performance. This article explains why the cache does not refresh immediately and provides methods to force an update.

Key Takeaways: Discord Webhook Avatar Caching

  • CDN Cache TTL (Time to Live): Discord’s content delivery network caches webhook avatars for 24 to 48 hours by default.
  • Unique Avatar URL with Query String: Appending a random string to the avatar URL forces Discord to fetch a fresh copy.
  • Discord API Avatar Update: Using the webhook ID and token with the Modify Webhook endpoint updates the avatar but does not clear the CDN cache.

ADVERTISEMENT

Why Discord Caches Webhook Avatars

Discord stores webhook avatars on its content delivery network (CDN). The CDN serves the same image to all users for a set period called the TTL (Time to Live). This reduces the number of requests to the origin server and speeds up image delivery. When you update a webhook avatar through the Discord API or developer portal, the change is saved on Discord’s backend. However, the CDN cache still holds the old version until the TTL expires. The default TTL for webhook avatars is between 24 and 48 hours, but it can extend longer if the image is rarely requested.

Another factor is the avatar URL itself. Discord generates a hash based on the avatar image data and the webhook ID. If the new avatar produces a different hash, the CDN sees it as a new resource and serves the old one until the new URL is requested. But if the hash remains identical due to identical image data, the cache is not invalidated at all. This behavior is by design to keep Discord fast and reliable.

How the Avatar URL Works

The avatar URL format is: https://cdn.discordapp.com/avatars/{webhook_id}/{avatar_hash}.{extension}. The avatar_hash is a 32-character hexadecimal string generated from the image data. When you upload a new avatar, Discord generates a new hash. But the CDN caches the old URL and hash pair. Until the cache TTL expires, requests to that URL return the old image.

Steps to Force Webhook Avatar Cache Refresh

You cannot clear Discord’s CDN cache directly. But you can bypass the cache by using a unique query string appended to the avatar URL. This method works for custom bots and scripts that display the webhook avatar.

  1. Obtain the Current Webhook Avatar URL
    Use the Discord API to fetch the webhook object. Send a GET request to https://discord.com/api/webhooks/{webhook.id}/{webhook.token}. The response includes the avatar field with the hash. The full CDN URL is https://cdn.discordapp.com/avatars/{webhook.id}/{avatar}.png.
  2. Append a Unique Query String
    Add a random query parameter to the URL, such as ?v=123456 or ?t=current_timestamp. For example: https://cdn.discordapp.com/avatars/{webhook.id}/{avatar}.png?v=1712345678. This forces the browser or Discord client to treat it as a new URL and fetch the latest version from the CDN.
  3. Update the Avatar Again via API
    If the query string method does not work, upload a slightly different avatar image. Use the Modify Webhook endpoint with a new image. This generates a new hash and CDN URL. The old cache entry becomes orphaned and the new image appears after a few minutes. Send a PATCH request to https://discord.com/api/webhooks/{webhook.id}/{webhook.token} with a JSON body containing "avatar": "data:image/png;base64,...".
  4. Wait for Natural Cache Expiration
    If you cannot modify the webhook or URL, wait 24 to 48 hours. The CDN cache expires automatically. After that, all users see the updated avatar.

ADVERTISEMENT

If Discord Still Shows the Old Avatar

Even after following the steps above, some users may still see the old avatar due to local browser or app caching. Below are common issues and their fixes.

Old Avatar Shows in Discord Desktop App

The Discord desktop app caches avatars locally. Clear the app cache by pressing Ctrl + Shift + I to open Developer Tools. Go to the Application tab, select Clear Storage, and click Clear site data. Then restart Discord. This forces the app to fetch the avatar from the CDN again.

Old Avatar Shows in Browser

Your browser caches images aggressively. Open Developer Tools with F12, go to the Network tab, and check the Disable cache box. Reload the page. Alternatively, clear your browser cache entirely from Settings > Privacy and Security > Clear browsing data.

Webhook Avatar Does Not Update in Embeds

Discord embeds cache the webhook avatar at the time the embed is generated. If you sent a message with the webhook before updating the avatar, the embed shows the old image. Delete the old message and resend it. New embeds use the current avatar from the CDN.

Webhook Avatar Update Methods: API vs Developer Portal

Item Discord API (Modify Webhook) Discord Developer Portal
Update speed Instant on backend, CDN delay remains Instant on backend, CDN delay remains
Avatar hash change Yes, if image data differs Yes, if image data differs
Cache bypass method Append query string to URL in code Not applicable, no code access
Best for Developers with bot scripts Manual updates via web interface

After reading this article, you understand why Discord webhook avatar caching persists for days and how to force a refresh. For immediate results, append a unique query string to the avatar URL or re-upload a slightly different image. If you manage multiple webhooks, consider building a script that automatically appends a timestamp to avatar URLs to avoid future caching delays.

ADVERTISEMENT