Analytics Teams call via api

Giuseppe Minervino 0 Reputation points
2025-01-24T16:01:06.62+00:00

url = "https://api.interfaces.records.teams.microsoft.com/Teams.VoiceAnalytics/getanalytics"

headers = {
    "Authorization": f"Bearer {access_token}",
    "Content-Type": "application/json"
}
params = {
    'startDate': "2025-01-01",  #start_date,  # Data di inizio
    'endDate': "2025-01-31",      # Data di fine
    #'metrics': 'PSTNTotalMinutes,TotalCallCount',  # Misure da includere
    #'dimensions': 'DocumentId,ConferenceId,DialogId,UserStartTimeUTC,EndTime,Duration,AutoAttendantChainStartTime,AutoAttendantIdentity,AutoAttendantDirectorySearchMethod,AutoAttendantTransferAction,AutoAttendantCallResult,AutoAttendantCallFlow,AutoAttendantCallerActionCounts,AutoAttendantChainDurationInSecs,AutoAttendantChainIndex,AutoAttendantCount,PSTNConnectivityType'  # Dimensioni da includere
    #'metrics': ",".join(Measurements.keys()),  # Chiavi originali delle metriche,
    #'dimensions': ",".join(Dimensions.keys())  # Chiavi originali delle dimensioni
}



I run this call after getting the token with scope

scopes = ["https://graph.microsoft.com/.default"]

but it always comes back to me "HTTPError: 403 Client Error: Forbidden for url: https://api.interfaces.records.teams.microsoft.com/Teams.VoiceAnalytics/getanalytics"

Why ?

Microsoft Teams Microsoft Teams for business Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2025-01-25T16:10:32.6066667+00:00

    The scope needs to match the resource, you cannot just reuse the Graph's scopes. And given that this is an undocumented/unsupported endpoint, you're pretty much on your own here.

    Hint: you can try with https://api.interfaces.records.teams.microsoft.com/.default


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.