Hi @Millennium Falcon
When a new SharePoint object is created, by default, Permission inheritance occurs. All SharePoint objects will be created within the context of a hierarchical tree. Unless the inheritance structure is broken, all SharePoint objects inherit permissions from its parent in the hierarchy.
Permission inheritance enables user to make the assignment of permission just once, and have that permission trickle down to all sites, lists, libraries, folders and items that inherit permissions from its parent. However as part of security management there are scenarios where we need to implement unique permissions to a particular site or list. We will need break the inheritance using the BreakRoleInheritance method of REST API.
Please try to use following api first
/_api/web/GetFolderByServerRelativeUrl('<pathToFolder>')/ListItemAllFields/breakroleinheritance(true)
Then you can use the api to add roleassignment
Here is a similar issue with yours. Please make a reference
https://sharepoint.stackexchange.com/questions/113317/manage-file-permissions-using-rest-api/113322#113322
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.