@Shubham Tak Are you using Delegated permissions or Application permissions ? You may be getting this error if you are using a Delegated permissions as delegated permissions (using both personal and work accounts) are not supported for this API. Also, as Microsoft Teams APIs in Graph are protected API's, you need to get additional validation by using the form available here. Have you gone through this step ?
You may use /teams/allMessages API without any fees subject to Microsoft API Terms of Use however when GA you may require to pay additional fees based on your data consumed through the API. Please refer to documentation for details.