This is an overview of how to move files with Microsoft Flow using the SharePoint - Send an HTTP request to SharePoint
action and SharePoint Online REST APIs.
These SharePoint Online REST APIs can be used outside of Flow, but you will need to handle authentication and provide an X-RequestDigest header with any POST requests (as with any SP REST POST request).
In the case of Flow's SharePoint - Send an HTTP request to SharePoint
action, authentication is handled for you and you do not need to provide the X-RequestDigest header.