How to upload private files using API


I have successfully uploaded files and added them to the correct record, although I notice that the files stay public because the API returns the public_url.


Anyone knows how can I use the API to upload files but restrict them to logged in users only?