Replace a file at the same link
Upload with your own ID so a new version of a file keeps the same link.
When you upload with your own ID, the link depends only on the storage and that ID. Upload again with the same ID and the same link serves the new file, so pages that show it need no change.
1. Upload the first version with an ID made of letters and digits:
curl -H "x-token: YOUR_TOKEN" -F file=@sea.png "https://files.example.com/upload/photos/?id=homepagebanner"{"id":"homepagebanner","name":"sea.png","size":3577,"type":"image/png","width":800,"height":600,"ext":"png","url":"/files/photos/homepagebanner-14s.png"}2. Later, upload the new version with the same ID:
curl -H "x-token: YOUR_TOKEN" -F file=@sunset.png "https://files.example.com/upload/photos/?id=homepagebanner"{"id":"homepagebanner","name":"sunset.png","size":2795,"type":"image/png","width":640,"height":480,"ext":"png","url":"/files/photos/homepagebanner-14s.png"}The url is the same, and it now serves sunset.png.
Browsers may keep the old version in their cache for a while. If visitors must see the change at once, add a version to the link in your page, for example homepagebanner-14s.png?v=2.