There’s not an official API for renaming yet. Uploads mostly uses the Micropub API, and I don’t think renaming is part of the spec. You can specify a filename during the upload, though.
If you need this now, you could copy the HTTP request the Micro.blog web app uses. It might change in the future, but probably not.
POST /account/uploads/<site ID>/info/<upload ID>
filename=newfilename.jpg
That won’t work in JavaScript web apps, though, because of cross-site restrictions.
If there’s a proposal for extending Micropub to support renaming uploads in the future, we’ll support it.
Sorry, just realized the upload ID isn’t exposed in the Micropub media endpoint, so perhaps this isn’t as useful as I thought. I’ll ask around and see if anyone has already thought about this for Micropub.
Just resurrecting this after a year BTW - I noticed that you can rename uploads on top of existing uploads but the old one isn’t automatically deleted. Is that expected?