Sign up and contact support to get 100 free checks.Sign up free
AvatarLookup workflow illustration for Profile Picture Not Updating? Revalidate the Image Before Reanalysis
A visual overview of the workflow discussed in this AvatarLookup article.

Separate image retrieval from analysis so an unchanged URL, a new picture and a failed download lead to different actions.

When a profile picture appears stale, revalidate the image at its source before submitting another analysis. Keep the previous bytes on a valid 304 response, compare bytes after a successful download, and treat a failed fetch as a retrieval failure.

Find which copy of the picture is stale

A contact card shows yesterday's picture, yet your database says analysis ran this morning. Running analysis again may simply send the same old file. Start by identifying the copy that each part of the application used.

There are three separate objects: the image cached by the browser, the bytes stored by your downloader, and the analysis result attached to those bytes. Refreshing one does not automatically replace the others. A browser can display an old copy while the server has a newer one; a server can download a new picture while the UI continues to display an earlier analysis.

For one affected record, inspect the displayed image URL, your stored source URL, the most recent successful fetch time and the digest of the submitted file. Record an analysis timestamp separately. That comparison tells you whether to investigate display caching, source retrieval or the step that associates the result with the picture.

Revalidate against the image host

When the source provides an ETag, retain it with the cached response. After the cached representation needs revalidation, a conditional GET can send that value in If-None-Match. MDN documents that a matching representation can produce a 304 response; a nonmatching representation is transferred normally.

This trace illustrates your downloader talking to a permitted image host. The host and tag values are examples, not AvatarLookup response fields.

GET /pictures/contact.png HTTP/1.1
Host: images.example
If-None-Match: "picture-v1"

HTTP/1.1 304 Not Modified
ETag: "picture-v1"

The 304 has no replacement image body. Retain the cached representation associated with that validator and update its validation metadata. If your cached bytes have been deleted or do not belong to that request variant, you cannot reconstruct the picture from a 304; fetch a complete representation instead.

A later response might be 200 OK with ETag: "picture-v2" and an image body. Check the body before replacing your stored file. Validators concern HTTP representations; use a digest of the actual downloaded bytes when your next decision depends on byte identity. A weak validator can describe equivalent representations without promising identical bytes.

Choose reanalysis from the downloaded bytes

Keep your own content digest alongside the file, source URL and result. Calculate the digest after a successful download and validation. If your pipeline transforms the image, also identify the final uploaded bytes; changing a crop or conversion can change the analysis input even when the source download stays the same.

Retrieval outcome Stored image action Analysis action
Valid 304 with matching cached representation Retain file; update validation time Reuse the result under your result policy
200 with the same validated bytes Retain existing content association Avoid a duplicate submission
200 with different valid bytes Save new version and digest Submit if the workflow requires a current analysis
404, denied request or timeout Keep previous successful observation with its date Mark retrieval failure; do not create a no-avatar result
200 with invalid or unsupported content Reject replacement Resolve retrieval or conversion first

For example, a contact's source URL stays unchanged, but its bytes change from a portrait to a company logo. The new file deserves its own image observation. If a CDN returns the same logo again with refreshed headers, your byte comparison can avoid sending it a second time merely because a fetch occurred.

Serialize updates for the contact or check the version before committing them. Otherwise, an older download that finishes late can overwrite a newer picture or attach an older result to the newest image.

Handle missing validators and changing URLs

Some hosts supply no useful validators. In that case, a successful full download followed by a digest comparison can still answer whether your stored bytes changed. Choose a refresh interval that fits the contact workflow and the source's access conditions. Honor applicable cache directives, including restrictions on storage; a convenience cache is not a reason to disregard them.

A changed URL is a new retrieval target, not proof of different image content. Download it through your existing safe downloader and compare validated bytes. For expiring URLs, obtain a current authorized URL through the relevant source workflow. Adding random query parameters is not a universal freshness mechanism and may invalidate a signed address.

Keep freshness and history explicit in the interface. “Last retrieved yesterday; refresh failed today” tells an operator more than silently relabeling yesterday's result as current. A 404 can reflect an expired location or removed resource. It does not establish that the underlying account has no avatar.

Submit the selected picture, not a cache instruction

Once you have chosen a new valid file, our image profile analysis accepts a multipart upload to POST /api/v1/image/profile. The supported formats are JPEG, PNG, WebP and GIF, up to 2 MB. Keep X-API-Key on your server and send the file using the documented multipart contract.

The conditional GET belongs to your downloader's interaction with the image host. It is separate from the analysis POST. There is no need to assume that AvatarLookup shares your cache, honors the source's ETag or suppresses charges for repeat pictures. A completed result, including a nonhuman picture or unknown appearance attributes, can be billable.

Start with one stale contact card and trace its displayed URL, downloaded digest and submitted-file digest. Fix the first mismatch, then test unchanged bytes, changed bytes and a denied fetch. Those three cases establish whether your refresh flow updates the picture and its analysis together without erasing the last usable observation.

Learn More

Choose the product information that fits the next step in your workflow.

Sources