File Upload Overwrite Cache Issue


We are using the Files API to upload PDFs to attach to notes. Periodically we update the PDF and upload it again (with the overwrite flag set to true).

The upload/overwrite works fine but it seems the original PDF is cached on CDN for some period of time. I tested by:

  • Upload PDF Version 1.
  • View The PDF via the CDN URL (something like<some_id>/pdf_1.pdf)
  • Upload the modified PDF (with the same name as the original)
  • View the PDF at<some_id>/pdf_1.pdf again and it has not changed (even with browser cache cleared or even viewing it from another browser).
  • View the PDF with some random junk on the query_string:<some_id>/pdf_1.pdf?1111 and I now see the new version of the PDF

How long will the file be cached? Is there anyway to invalidate the cache when we upload a new version of the file?


… and the other thing I noticed is possibly another level of caching going on at:[some id]/file/[some id]/

I attached the recently updated file to a note, click on the attachment and am brought to the URL above. The version of the attachment I see there is even older that the one I see at<some_id>/pdf_1.pdf


Any thoughts on this one? Seems like the URL eventually clears the cache (hours?) but with the URL I’m still seeing a verison of the attachment that is over a day old.


Hi @homerlex,

While file replacement should happen relatively quickly, it may take up to a couple of hours for the cache to clear entirely (see below). I’m unsure what the behavior of the caching is; I’ll need to touch base with product on that.


Did something change recently? I don’t have the caching issue anymore. After I upload the new version of the file I can see it properly in the file-preview now.


Hi @homerlex,

While I didn’t hear back regarding that specific domain’s caching, it’s entirely possible that the team made changes. If you run into the same issue going forward, feel free to reach back out on this topic (or create a new one).