Mailboxes with Microsoft API Error “MailboxNotEnabledForRESTAPI” happens when there is no valid M365 Mailbox, then RestAPI is not supported. To fix the error, the tenant’s admin has to enable Rest API Access for those mailboxes.
Please use the Microsoft Document "https://docs.microsoft.com/en-US/exchange/troubleshoot/user-and-shared-mailboxes/rest-api-is-not-yet-supported-for-this-mailbox-error" for reference to know more information or contact Microsoft.