Hi @Pablo Glomby ,
The short answer is no. We cannot get the team IDs through SharePoint REST API or CSOM API.
Microsoft Graph api can access data on many Microsoft clould apps (SharePoint, Teams, outlooks...): https://learn.microsoft.com/en-us/graph/overview?view=graph-rest-1.0#whats-in-microsoft-graph
However, SharePoint REST API or CSOM API can only access data stored in SharePoint, like sites, lists, listitems... It cannot get resources in other apps.
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.