Hi @Daniele Zorzi ,
Per my test, If we try to restore the deleted file in the standard way (go in the recycle bin manually and restore the file). SharePoint would rename the exsiting file (the new file somone put in the library) instead of the deleted file. Then restore it.
When using the rest api to restore the file, you would get the error: "A file with this name <filname> already exists in <folder>. To restore the file, rename the existing file and try again."
So, if we are using REST API to restore deleted files, you have to check and rename the existing file(new file) first, then restore it.
If an Answer is helpful, please click "Accept Answer" and upvote it.
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.