Hi @Anonym,
You could put the accesstoken in request header and use the api like following
http://test.sharepoint.com/sites/testsite/_api/web/GetFolderByServerRelativeUrl('/sites/testsite/library name')/Files/add(url='a.txt',overwrite=true)
For more detail steps you could refer to following artilce
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.